Skip to content

feat(quests): swap a quest for Cores - #7467

Open
capJavert wants to merge 1 commit into
mainfrom
quest-refresh
Open

capJavert wants to merge 1 commit into
mainfrom
quest-refresh

Conversation

@capJavert

@capJavert capJavert commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Lets users swap a daily or weekly quest for a different one by paying Cores.

  • Sidebar (CompactQuestRow): on hover or keyboard focus, the rewards line is replaced by a Swap button. It only shows when the quest has a refreshCost.
  • Quest dropdown (QuestCard via QuestSection): a Swap button on cards with a refreshCost.
  • QuestRefreshModal (LazyModal.QuestRefresh, a drawer on mobile): Cores confirmation with "Swap for ◆ N" and CoresBalanceNote.
    • Without enough Cores, the button reads "Buy Cores ◆ N" and goes to /cores with origin=quest refresh.
    • The actions sit in the modal body so they also show in the mobile drawer.
  • useRefreshQuest hook:
    • runs the refreshQuest mutation and writes the returned quests into the dashboard cache;
    • lowers the cached Cores balance by the price and invalidates transactions;
    • handles transaction errors through useTransactionError.
  • useOpenQuestRefresh hook: logs and opens the modal.
  • GraphQL:
    • daily and weekly quests select refreshCost;
    • claim and refresh share one payload selection (QUEST_ACTION_PAYLOAD_FIELDS).
  • Log events:
    • names: open quest refresh, cancel quest refresh, refresh quest (with newQuestId) and refresh quest error;
    • target_id is quest sidebar or quest dropdown;
    • extra holds questId, questType, userQuestId, rotationId and cost.
  • Origin.QuestRefresh for the Cores page.

Depends on

dailydotdev/daily-api#4672 must be deployed first. These queries select refreshCost and call refreshQuest, which don't exist before it.

🤖 Generated with Claude Code

Preview domain

https://quest-refresh.preview.app.daily.dev

Daily and weekly quests with a refreshCost get a Swap action: in the
sidebar it replaces the rewards line on hover, and in the quest dropdown
it is a button on the card. Both open a Cores confirmation (a drawer on
mobile) that swaps the quest, or sends users without enough Cores to the
Cores page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
daily-webapp Ready Ready Preview Nov 20, 2026 3:54pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
storybook Ignored Ignored Nov 20, 2026 3:54pm UTC

Request Review

@capJavert capJavert left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blockers, 3 non-blocking. I checked the API side together with daily-api#4672: when questRefresh isn't set in remote config (or is 0), refreshCost comes back null. Every entry point here (CompactQuestRow, QuestCard, QuestRefreshModal, useRefreshQuest) requires a number, so no Swap UI renders. Deploy order as stated: the API first, because these queries select refreshCost.

Reviewed by AI.

variant={ButtonVariant.Tertiary}
icon={<RefreshIcon />}
onClick={() => onRefresh?.(quest)}
className="relative z-1 -my-1 !hidden group-focus-within/quest:!flex group-hover/quest:!flex"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: this Swap only appears on hover or focus-within. On touch devices (tablet sidebar, the streak widget) nothing hovers, and the row is a stretched link, so the button can't be reached. Worse, on iOS a tap that changes content on :hover gets swallowed: the first tap reveals Swap, and it takes a second tap to open the quest (same failure as #6893). Please gate the reveal behind the mouse: variant and decide what touch gets: always show Swap, or leave it to the quest dropdown.

Reviewed by AI.

onUnlock,
onRefresh,
}: CompactQuestRowProps): ReactElement => {
const canRefresh = typeof quest.refreshCost === 'number' && !!onRefresh;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: hiding Swap when refreshCost is null or missing is the whole kill switch for this feature, because it's how the UI stays off until questRefresh is set in the API remote config. Please add a spec (here and/or QuestCard) that renders a quest with refreshCost: null and with the field absent, and asserts there's no Swap button. That keeps a later refactor from showing the UI while the config is off.

Reviewed by AI.

});
}
},
onError: async (error: ApiErrorResult, { quest }) => {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: on a non-balance error (swapping turned off in remote config after the dashboard loaded, "No other quests available", quest no longer in progress), the toast shows and the modal closes, but the cached dashboard still holds the old refreshCost. Swap stays visible and fails again on every try until the next refetch. Please invalidate the QuestDashboard query here.

Reviewed by AI.

This branch was successfully deployed

1 active deployment
Preview – daily-webapp — 474d671d Deployed Nov 20, 2026 by vercel[bot]
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.

1 participant