Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion app/analyze/[videoId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { Topic, TranscriptSegment, VideoInfo, Citation, PlaybackCommand, Note, N
import { normalizeWhitespace } from "@/lib/quote-matcher";
import { hydrateTopicsWithTranscript, normalizeTranscript } from "@/lib/topic-utils";
import { SelectionActionPayload, EXPLAIN_SELECTION_EVENT } from "@/components/selection-actions";
import { fetchNotes, saveNote } from "@/lib/notes-client";
import { fetchNotes, saveNote, deleteNote } from "@/lib/notes-client";
import { EditingNote } from "@/components/notes-panel";
import { useModePreference } from "@/lib/hooks/use-mode-preference";
import { useTranslation } from "@/lib/hooks/use-translation";
Expand Down Expand Up @@ -1821,6 +1821,17 @@ export default function AnalyzePage() {
}
}, [videoId, videoDbId, user, promptSignInForNotes]);

const handleDeleteNote = useCallback(async (noteId: string) => {
try {
await deleteNote(noteId);
setNotes((prev) => prev.filter((n) => n.id !== noteId));
toast.success("Note deleted");
} catch (error) {
console.error("Failed to delete note", error);
toast.error("Failed to delete note");
}
}, []);

const handleTakeNoteFromSelection = useCallback((payload: SelectionActionPayload) => {
if (!user) {
promptSignInForNotes();
Expand Down Expand Up @@ -2104,6 +2115,7 @@ export default function AnalyzePage() {
onSaveEditingNote={handleSaveEditingNote}
onCancelEditing={handleCancelEditing}
onAddNote={handleAddNote}
onDeleteNote={handleDeleteNote}
isAuthenticated={!!user}
onRequestSignIn={handleAuthRequired}
selectedLanguage={selectedLanguage}
Expand Down
5 changes: 4 additions & 1 deletion components/right-column-tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ interface RightColumnTabsProps {
isLoading?: boolean;
};
onAddNote?: () => void;
onDeleteNote?: (noteId: string) => Promise<void>;
}

export interface RightColumnTabsHandle {
Expand Down Expand Up @@ -94,7 +95,8 @@ export const RightColumnTabs = forwardRef<RightColumnTabsHandle, RightColumnTabs
currentSourceLanguage,
onRequestExport,
exportButtonState,
onAddNote
onAddNote,
onDeleteNote
}, ref) => {
const [activeTab, setActiveTab] = useState<"transcript" | "chat" | "notes">("transcript");
const showTranslationSelector = translationSelectorEnabled;
Expand Down Expand Up @@ -243,6 +245,7 @@ export const RightColumnTabs = forwardRef<RightColumnTabsHandle, RightColumnTabs
currentTime={currentTime}
onTimestampClick={onTimestampClick}
onAddNote={onAddNote}
onDeleteNote={onDeleteNote}
/>
</TooltipProvider>
</div>
Expand Down
Loading