mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 20:29:06 +00:00
save current topic and small styling
This commit is contained in:
@@ -23,9 +23,20 @@ export default function TopicHeader({
|
||||
|
||||
useEffect(() => {
|
||||
if (!topics.loading && !currentTopic) {
|
||||
const sessionTopic = window.localStorage.getItem(
|
||||
transcriptId + "correct",
|
||||
);
|
||||
console.log(sessionTopic, window.localStorage);
|
||||
if (sessionTopic && topics?.topics?.find((t) => t.id == sessionTopic)) {
|
||||
setCurrentTopic(topics?.topics?.find((t) => t.id == sessionTopic));
|
||||
console.log("he", sessionTopic, !!sessionTopic);
|
||||
} else {
|
||||
setCurrentTopic(topics?.topics?.at(0));
|
||||
console.log("hi");
|
||||
}
|
||||
}
|
||||
}, [topics.loading]);
|
||||
// console.log(currentTopic)
|
||||
|
||||
const number = topics.topics?.findIndex(
|
||||
(topic) => topic.id == currentTopic?.id,
|
||||
@@ -43,6 +54,13 @@ export default function TopicHeader({
|
||||
canGoNext && setCurrentTopic(topics.topics?.at(number + 1));
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
console.log(currentTopic?.id);
|
||||
|
||||
currentTopic?.id &&
|
||||
window.localStorage.setItem(transcriptId + "correct", currentTopic?.id);
|
||||
}, [currentTopic?.id]);
|
||||
|
||||
const keyHandler = (e) => {
|
||||
if (e.key == "ArrowLeft") {
|
||||
onPrev();
|
||||
|
||||
@@ -150,17 +150,18 @@ const topicWords = ({
|
||||
participants.response
|
||||
) {
|
||||
return (
|
||||
<div onMouseUp={onMouseUp} className="p-5 h-full w-full">
|
||||
<div onMouseUp={onMouseUp} className="p-5 h-full w-full overflow-scroll">
|
||||
{topicWithWords.response.wordsPerSpeaker.map(
|
||||
(speakerWithWords, index) => (
|
||||
<p key={index}>
|
||||
<p key={index} className="mb-2 last:mb-0">
|
||||
<span
|
||||
data-speaker={speakerWithWords.speaker}
|
||||
className={
|
||||
className={`
|
||||
font-semibold ${
|
||||
selectedText == speakerWithWords.speaker
|
||||
? "bg-yellow-200"
|
||||
: ""
|
||||
}
|
||||
}`}
|
||||
>
|
||||
{getSpeakerName(speakerWithWords.speaker)} :
|
||||
</span>
|
||||
|
||||
Reference in New Issue
Block a user