diff --git a/www/app/(app)/transcripts/[transcriptId]/_components/TranscriptWithGutter.tsx b/www/app/(app)/transcripts/[transcriptId]/_components/TranscriptWithGutter.tsx new file mode 100644 index 00000000..d287062d --- /dev/null +++ b/www/app/(app)/transcripts/[transcriptId]/_components/TranscriptWithGutter.tsx @@ -0,0 +1,106 @@ +import { Box, Text, IconButton } from "@chakra-ui/react"; +import { ChevronUp } from "lucide-react"; +import { Topic } from "../../webSocketTypes"; +import { getTopicColor } from "../../../../lib/topicColors"; +import { TOPICS_SCROLL_DIV_ID } from "./constants"; + +interface TranscriptWithGutterProps { + topics: Topic[]; + getSpeakerName: (speakerNumber: number) => string | undefined; + onGutterClick: (topicId: string) => void; +} + +export function TranscriptWithGutter({ + topics, + getSpeakerName, + onGutterClick, +}: TranscriptWithGutterProps) { + const scrollToTopics = () => { + // Scroll to the topic list at the top + const topicList = document.getElementById(TOPICS_SCROLL_DIV_ID); + if (topicList) { + topicList.scrollIntoView({ + behavior: "smooth", + block: "start", + }); + } + }; + + return ( + + {topics.map((topic, topicIndex) => { + const color = getTopicColor(topicIndex); + + return ( + + {/* Topic Header with Up Button */} + + {topic.title} + + + + + + {/* Segments container with single gutter */} + + {/* Single continuous gutter for entire topic */} + onGutterClick(topic.id)} + /> + + {/* Segments */} + {topic.segments?.map((segment, segmentIndex) => ( + + {/* Segment Content */} + + + {getSpeakerName(segment.speaker) || + `Speaker ${segment.speaker}`} + : + {" "} + {segment.text} + + + ))} + + + ); + })} + + ); +} diff --git a/www/app/(app)/transcripts/[transcriptId]/_components/constants.ts b/www/app/(app)/transcripts/[transcriptId]/_components/constants.ts new file mode 100644 index 00000000..dc4f4c37 --- /dev/null +++ b/www/app/(app)/transcripts/[transcriptId]/_components/constants.ts @@ -0,0 +1 @@ +export const TOPICS_SCROLL_DIV_ID = "topics-scroll-div";