Skip to content

Explorer — redeem cart + skills/tools redeem & optimistic add - #571

Merged
Wieedze merged 9 commits into
devfrom
fix/explorer-redeem-cart-submit
Jul 1, 2026
Merged

Explorer — redeem cart + skills/tools redeem & optimistic add#571
Wieedze merged 9 commits into
devfrom
fix/explorer-redeem-cart-submit

Conversation

@Wieedze

@Wieedze Wieedze commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Explorer — redeem cart + skills/tools redeem & optimistic add

Fixes the redeem/cart flow on the profile Context Manager and brings the same
"delete = redeem" affordance to the Skills & Tools panel, plus optimistic UI.

Redeem cart

  • Redeem-only cart is signable — the Sign button was gated on
    totalDeposit <= 0, which treats a redeem (deposits nothing, recovers TRUST)
    as "nothing to do". Gate on !hasRedeem; stop showing a misleading 0 T.
  • Optimistic removal after a redeem instead of an invalidateQueries
    refetch that raced the indexer and re-persisted the stale row.
  • Honest no-op + curve scanredeemAtom only read Linear (1n) shares and
    returned a phantom "validated" (no wallet popup) when they were 0. Scan Linear
    then Progressive (2n) and redeem where the stake lives; a true 0-share case is
    reported as "Nothing to redeem".

Skills & Tools

  • Hover-to-redeem on each confirmed chip (owner only), mirroring the Context
    Manager — queues a redeem of the declaration's stake.
  • Optimistic add — a declared skill/tool surfaces the instant the create tx
    confirms, before the indexer catches up; scoped to the owner's cache.
  • Indexer-lag resilience — freshly-minted atoms stay type: "Unknown" with
    a null label until Intuition's Thing resolver catches up (which used to drop
    the skill from the panel). Resolve such atoms by their pinned IPFS Thing name.
  • Only show staked attributes — the query returned every
    [you → uses/is_skilled_in → X] triple regardless of stake, so a redeemed
    skill/tool reappeared on refetch. Filter to positions with shares > 0 so
    redeem is a permanent removal.

Config note (not in this diff)

Creating any new atom (skills/tools/circles) requires VITE_PIN_PROXY_URL in the
explorer env and the pin-proxy's PIN_ALLOWED_ORIGINS to include the caller
origin (e.g. http://localhost:5173 for dev) — otherwise pinThing 403s.

🤖 Generated with Claude Code

Wieedze and others added 9 commits July 1, 2026 09:29
… Add-to-Sofia

Explorer — coachmark onboarding tour (first Privy login), 11 steps over the
real UI: Explore, Circles → open a circle → what's inside, Compose + compile
actions, Cart, Profile → Scores/backers (view details + per-topic backers),
and the browser extension. Spotlight uses a box-shadow scrim (backdrop-filter
cutouts don't composite reliably here) with a clickable hole; steps advance on
real route/DOM interaction. Triggered by useExplorerOnboarding (localStorage
flag sofia:explorer-onboarding-done), portaled from App.tsx, with data-tour
anchors on nav items + circle cards.

Extension — right-click "Add to Sofia" while disconnected now opens the Sofia
side panel to connect: modal pre-checks wallet status (new ADD_TO_SOFIA_STATUS
message) and swaps its CTA to "Connect to Sofia", sending open_sidepanel
synchronously to preserve the user gesture.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ier spotlight, backers CTA

- Split Explore into nav + a "community feed" step that opens a wide hole over
  .page-content so the Explore page content is actually visible.
- Measure the spotlight target immediately + via MutationObserver (no more lag
  when a target — e.g. a circle hero — renders after navigation).
- Tighten the spotlight padding and make the /scores step insist on clicking a
  topic to reveal its backers.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ics)

Merge the Mark page's two pickers (verb + context) into one multi-select
combobox following the "Categorisation Sidepanel" design (option 2a):
closed field with removable chips, search, alphabetical checklist with
verbs (lucide icons) + topics (drill-down categories), footer count/clear.

- New CategorisationDropdown component + CSS; verb selection derived from
  the cart (multi-select) instead of a single active pick.
- Unify the tag look across the side panel: ink text + colored icon +
  tighter radius, driven by --verb-color. Chips reuse the DS .fc-verb-tag
  class; extension-scoped theme override keeps the explorer feeds intact.
- Verbs + topics sorted A->Z in the dropdown.
- Add verb icons to the cart basket rows (WeightBasketRow).
- Rename: "Actions on this page" -> "Tags on this page", Validate -> Save,
  placeholder -> "Add a tag"; retarget the onboarding tour accordingly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The Sign button was disabled for a redeem-only cart because
`totalDeposit <= 0` treats "zero deposit" as "nothing to do" — but a
redeem legitimately deposits nothing (it recovers TRUST). Gate that guard
on `!hasRedeem` and stop showing a misleading "0 T" amount.

After a successful redeem the cart invalidated the profile query, which
refetched ~1s post-tx while the indexer still reported the position — it
re-cached the stale row and re-persisted it, so the card reappeared on
reload. Replace the invalidate with an optimistic
`removeCertsFromProfileCache`: the tx passed, so drop the cert locally and
let staleTime reconcile once the indexer catches up.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Owner-only trash button on each confirmed skill/tool chip (mirrors the
Context Manager's UntaggedCertCard). Clicking queues a redeem of the
declaration triple's stake into the cart — same MultiVault.redeem flow as
URL certs, reusing useRedeemCert with the chip's on-chain termId.

Extend the optimistic post-redeem removal to the attributes cache
(removeAttributesFromCache, twin of removeCertsFromProfileCache) so a
redeemed chip vanishes on tx confirm and stays gone on reload instead of
racing the indexer. WeightModal filters both caches per redeemed termId;
the non-matching one is a no-op.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
redeemAtom read shares only on the Linear curve (1n) and returned
{success:true} with no tx when they were 0 — the UI then showed a phantom
"Transaction validated" with no wallet popup and optimistically dropped the
item. Scan Linear then Progressive (2n, the extension's regular-deposit
curve) and redeem whichever holds the shares; flag a genuine 0-share case
as noop so WeightModal reports "Nothing to redeem" instead of a fake success
and skips the cache drop.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Declaring a skill/tool now surfaces the chip the instant the create tx
confirms (addAttributesToCache, scoped to the owner's cache key) instead of
waiting on the indexer. userAttributes is excluded from the immediate
post-mint refresh so a pre-index refetch can't wipe the optimistic chip; the
scheduled refetches reconcile the real termId/count.

Freshly-minted atoms stay type "Unknown" with a null label until Intuition's
Thing resolver catches up, which previously dropped the skill from the panel
(getAttributeByLabel(null) → undefined). Resolve such atoms by their pinned
IPFS Thing name as a fallback, so the chip persists through the lag.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The userAttributes query returned every [you → uses/is_skilled_in → X]
triple the profile is the subject of, regardless of the owner's stake. Since
a triple lives on-chain forever, a redeemed skill/tool reappeared on the next
refetch — undoing the optimistic removal. Filter as_subject_triples to those
where the owner holds a position with shares > 0, so redeem is a permanent
removal and a freshly-staked declaration still shows.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Wieedze
Wieedze merged commit 8d84934 into dev Jul 1, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants