-
Notifications
You must be signed in to change notification settings - Fork 11
Feat: raffle badge click reopens details popup #443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -143,6 +143,9 @@ function DashboardContent({ | |
| const [showWorkspaceSettings, setShowWorkspaceSettings] = useState(false); | ||
| const [showWorkspaceShare, setShowWorkspaceShare] = useState(false); | ||
|
|
||
| // Manual open state for the raffle popup (re-opened via the share-count badge). | ||
| const [showRafflePopup, setShowRafflePopup] = useState(false); | ||
|
|
||
| const showSignInPrompt = | ||
| !!session?.user?.isAnonymous && | ||
| !isLoadingWorkspace && | ||
|
|
@@ -289,6 +292,8 @@ function DashboardContent({ | |
| currentWorkspaceId={currentWorkspaceId} | ||
| isLoadingWorkspace={isLoadingWorkspace} | ||
| onOpenFullShare={() => setShowWorkspaceShare(true)} | ||
| manuallyOpen={showRafflePopup} | ||
| onManuallyClose={() => setShowRafflePopup(false)} | ||
| /> | ||
| <DashboardLayout | ||
| currentWorkspaceId={currentWorkspaceId} | ||
|
|
@@ -353,6 +358,7 @@ function DashboardContent({ | |
| } | ||
| googleLoginHint={session?.user?.email ?? null} | ||
| isWorkspaceOwner={isWorkspaceOwner} | ||
| onShowRaffleDetails={() => setShowRafflePopup(true)} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Custom agent: Flag AI Slop and Fabricated Changes A new raffle-popup reopen behavior was added without regression-style test coverage, which Rule 1 explicitly flags for behavior changes. Prompt for AI agents |
||
| /> | ||
| ) : undefined | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -23,6 +23,10 @@ interface RafflePopupProps { | |||||||||||||||||
| currentWorkspaceId: string | null; | ||||||||||||||||||
| isLoadingWorkspace: boolean; | ||||||||||||||||||
| onOpenFullShare?: () => void; | ||||||||||||||||||
| /** Force the popup open regardless of dismissal state (e.g. user clicked the share-count badge). */ | ||||||||||||||||||
| manuallyOpen?: boolean; | ||||||||||||||||||
| /** Called when a manually-opened popup is closed; parent should clear its manual-open state. */ | ||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P3: Custom agent: Flag AI Slop and Fabricated Changes The new comment claims Prompt for AI agents
Suggested change
|
||||||||||||||||||
| onManuallyClose?: () => void; | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| const FEATURE_KEY = "midterms-raffle-2026-04"; | ||||||||||||||||||
|
|
@@ -33,6 +37,8 @@ export function RafflePopup({ | |||||||||||||||||
| currentWorkspaceId, | ||||||||||||||||||
| isLoadingWorkspace, | ||||||||||||||||||
| onOpenFullShare, | ||||||||||||||||||
| manuallyOpen = false, | ||||||||||||||||||
| onManuallyClose, | ||||||||||||||||||
| }: RafflePopupProps) { | ||||||||||||||||||
| const { data: session } = useSession(); | ||||||||||||||||||
| const { isNew, dismiss } = useNewFeature({ | ||||||||||||||||||
|
|
@@ -46,16 +52,17 @@ export function RafflePopup({ | |||||||||||||||||
| const [isLoadingShareLink, setIsLoadingShareLink] = useState(false); | ||||||||||||||||||
| const [copied, setCopied] = useState(false); | ||||||||||||||||||
|
|
||||||||||||||||||
| const canRender = | ||||||||||||||||||
| const canShowPopup = | ||||||||||||||||||
| !!currentWorkspaceId && | ||||||||||||||||||
| !isLoadingWorkspace && | ||||||||||||||||||
| !!workspace && | ||||||||||||||||||
| session?.user?.isAnonymous !== true && | ||||||||||||||||||
| workspace?.userId === session?.user?.id && | ||||||||||||||||||
| isNew; | ||||||||||||||||||
| workspace?.userId === session?.user?.id; | ||||||||||||||||||
|
|
||||||||||||||||||
| const isOpen = canShowPopup && (isNew || manuallyOpen); | ||||||||||||||||||
|
|
||||||||||||||||||
| useEffect(() => { | ||||||||||||||||||
| if (!canRender || !workspace) return; | ||||||||||||||||||
| if (!isOpen || !workspace) return; | ||||||||||||||||||
|
|
||||||||||||||||||
| const controller = new AbortController(); | ||||||||||||||||||
| setIsLoadingShareLink(true); | ||||||||||||||||||
|
|
@@ -81,12 +88,17 @@ export function RafflePopup({ | |||||||||||||||||
| return () => { | ||||||||||||||||||
| controller.abort(); | ||||||||||||||||||
| }; | ||||||||||||||||||
| }, [canRender, workspace]); | ||||||||||||||||||
| }, [isOpen, workspace]); | ||||||||||||||||||
|
|
||||||||||||||||||
| if (!canRender || !workspace) { | ||||||||||||||||||
| if (!canShowPopup || !workspace) { | ||||||||||||||||||
| return null; | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| const handleClose = () => { | ||||||||||||||||||
| if (isNew) dismiss(); | ||||||||||||||||||
| onManuallyClose?.(); | ||||||||||||||||||
| }; | ||||||||||||||||||
|
Comment on lines
+97
to
+100
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||
|
|
||||||||||||||||||
| const deepCopyUrl = `${typeof window !== "undefined" ? window.location.origin : ""}/share-copy/${workspace.id}`; | ||||||||||||||||||
| const activeUrl = linkMode === "collaborate" ? shareLinkUrl : deepCopyUrl; | ||||||||||||||||||
| const isActiveLoading = linkMode === "collaborate" && isLoadingShareLink; | ||||||||||||||||||
|
|
@@ -106,9 +118,9 @@ export function RafflePopup({ | |||||||||||||||||
|
|
||||||||||||||||||
| return ( | ||||||||||||||||||
| <Dialog | ||||||||||||||||||
| open={isNew} | ||||||||||||||||||
| open={isOpen} | ||||||||||||||||||
| onOpenChange={(next) => { | ||||||||||||||||||
| if (!next) dismiss(); | ||||||||||||||||||
| if (!next) handleClose(); | ||||||||||||||||||
| }} | ||||||||||||||||||
| > | ||||||||||||||||||
| <DialogContent className="sm:max-w-md" overlayClassName="bg-black/70"> | ||||||||||||||||||
|
|
@@ -199,7 +211,7 @@ export function RafflePopup({ | |||||||||||||||||
| type="button" | ||||||||||||||||||
| variant="outline" | ||||||||||||||||||
| onClick={() => { | ||||||||||||||||||
| dismiss(); | ||||||||||||||||||
| handleClose(); | ||||||||||||||||||
| onOpenFullShare(); | ||||||||||||||||||
| }} | ||||||||||||||||||
| > | ||||||||||||||||||
|
|
@@ -209,7 +221,7 @@ export function RafflePopup({ | |||||||||||||||||
| ) : ( | ||||||||||||||||||
| <span /> | ||||||||||||||||||
| )} | ||||||||||||||||||
| <Button type="button" onClick={dismiss}> | ||||||||||||||||||
| <Button type="button" onClick={handleClose}> | ||||||||||||||||||
| Got it | ||||||||||||||||||
| </Button> | ||||||||||||||||||
| </DialogFooter> | ||||||||||||||||||
|
|
||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -255,6 +255,8 @@ interface WorkspaceHeaderProps { | |||||||||||||||||||||||||||
| // Workspace actions | ||||||||||||||||||||||||||||
| onOpenSettings?: () => void; | ||||||||||||||||||||||||||||
| onOpenShare?: () => void; | ||||||||||||||||||||||||||||
| /** Open the raffle details popup (reopens the "Win a $50 Amazon gift card" dialog). */ | ||||||||||||||||||||||||||||
| onShowRaffleDetails?: () => void; | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| /** Item shown in the fullscreen workspace viewer (`openMode === "single"`) — breadcrumbs + header actions */ | ||||||||||||||||||||||||||||
| activeOpenWorkspaceItem?: Item | null; | ||||||||||||||||||||||||||||
|
|
@@ -286,6 +288,7 @@ export function WorkspaceHeader({ | |||||||||||||||||||||||||||
| onRenameFolder, | ||||||||||||||||||||||||||||
| onOpenSettings, | ||||||||||||||||||||||||||||
| onOpenShare, | ||||||||||||||||||||||||||||
| onShowRaffleDetails, | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| activeOpenWorkspaceItem = null, | ||||||||||||||||||||||||||||
| onCloseActiveItem, | ||||||||||||||||||||||||||||
|
|
@@ -1240,10 +1243,10 @@ export function WorkspaceHeader({ | |||||||||||||||||||||||||||
| Feedback | ||||||||||||||||||||||||||||
| </button> | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| {isWorkspaceOwner && currentWorkspaceId && onOpenShare && ( | ||||||||||||||||||||||||||||
| {isWorkspaceOwner && currentWorkspaceId && ( | ||||||||||||||||||||||||||||
| <ShareCountBadge | ||||||||||||||||||||||||||||
| workspaceId={currentWorkspaceId} | ||||||||||||||||||||||||||||
| onClick={onOpenShare} | ||||||||||||||||||||||||||||
| onClick={onShowRaffleDetails} | ||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||
|
Comment on lines
+1246
to
1251
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The condition was previously
Suggested change
|
||||||||||||||||||||||||||||
| {onOpenShare && ( | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: Reset
showRafflePopupon workspace change; otherwise manual-open state can leak across workspaces and reopen the raffle popup unintentionally.Prompt for AI agents