diff --git a/backend/src/routes/cards.ts b/backend/src/routes/cards.ts index e40cc2b0..d61ed003 100644 --- a/backend/src/routes/cards.ts +++ b/backend/src/routes/cards.ts @@ -39,6 +39,7 @@ interface DueCardPreview { id: string; question: string; next_review: string; + card_file: string; } /** @@ -113,6 +114,7 @@ cardRoutes.get("/due", async (c) => { id: card.metadata.id, question: card.content.question, next_review: card.metadata.next_review, + card_file: `${vault.metadataPath}/cards/${card.metadata.id}.md`, })); const response: DueCardsResponse = { diff --git a/frontend/src/components/home/SpacedRepetitionWidget.tsx b/frontend/src/components/home/SpacedRepetitionWidget.tsx index 276c2220..560647e8 100644 --- a/frontend/src/components/home/SpacedRepetitionWidget.tsx +++ b/frontend/src/components/home/SpacedRepetitionWidget.tsx @@ -268,14 +268,25 @@ export function SpacedRepetitionWidget({ ); /** - * Handle Open action: navigate to source file in Recall tab. + * Handle Open Source action: navigate to source file in Recall tab. + * Used in revealed phase to view the original note. */ - const handleOpenCard = useCallback(() => { + const handleOpenSource = useCallback(() => { if (!state.cardDetail?.source_file) return; setCurrentPath(state.cardDetail.source_file); setMode("browse"); }, [state.cardDetail?.source_file, setCurrentPath, setMode]); + /** + * Handle Open Card action: navigate to card file in Recall tab. + * Used in question phase to edit the card (e.g., fix the question). + */ + const handleOpenCard = useCallback(() => { + if (!state.currentCard?.card_file) return; + setCurrentPath(state.currentCard.card_file); + setMode("browse"); + }, [state.currentCard?.card_file, setCurrentPath, setMode]); + /** * Handle keyboard shortcuts for assessment (1/2/3/4 keys). * Must be defined after handleAssessment to avoid reference error. @@ -417,6 +428,17 @@ export function SpacedRepetitionWidget({ > Forget + {state.currentCard?.card_file && ( + + )}