From 902bc6c7cca10760c832f798d9e6186518d92026 Mon Sep 17 00:00:00 2001 From: Sara Date: Fri, 22 Sep 2023 17:51:33 +0200 Subject: [PATCH] visual fixes, remove error --- www/app/layout.tsx | 2 +- www/app/styles/globals.scss | 5 ++-- www/app/transcripts/[transcriptId]/page.tsx | 1 + www/app/transcripts/new/page.tsx | 1 + www/app/transcripts/scrollToBottom.tsx | 2 +- www/app/transcripts/topicList.tsx | 33 +++++++++++++-------- 6 files changed, 26 insertions(+), 18 deletions(-) diff --git a/www/app/layout.tsx b/www/app/layout.tsx index 168ef820..de423da8 100644 --- a/www/app/layout.tsx +++ b/www/app/layout.tsx @@ -53,7 +53,7 @@ export const metadata: Metadata = { maximumScale: 1, }, - robots: { index: false, follow: false, noarchive: true, noimageindex: true } + robots: { index: false, follow: false, noarchive: true, noimageindex: true }, }; export default function RootLayout({ children }) { diff --git a/www/app/styles/globals.scss b/www/app/styles/globals.scss index 0acacc90..fcaea4b6 100644 --- a/www/app/styles/globals.scss +++ b/www/app/styles/globals.scss @@ -10,7 +10,7 @@ body { background: white; - scrollbar-color: rgb(96 165 250) transparent; + scrollbar-color: rgb(132, 186, 251) transparent; scrollbar-width: thin; } @@ -26,12 +26,11 @@ body { } ::-webkit-scrollbar { - visibility: visible; width: 5px; opacity: 0.7; } ::-webkit-scrollbar-thumb { border-radius: 10px; - background-color: rgb(96 165 250); + background-color: rgb(132, 186, 251); } diff --git a/www/app/transcripts/[transcriptId]/page.tsx b/www/app/transcripts/[transcriptId]/page.tsx index 967eab12..17cee689 100644 --- a/www/app/transcripts/[transcriptId]/page.tsx +++ b/www/app/transcripts/[transcriptId]/page.tsx @@ -52,6 +52,7 @@ export default function TranscriptDetails(details: TranscriptDetails) {
diff --git a/www/app/transcripts/new/page.tsx b/www/app/transcripts/new/page.tsx index 15ce5ca9..07a0b8b9 100644 --- a/www/app/transcripts/new/page.tsx +++ b/www/app/transcripts/new/page.tsx @@ -65,6 +65,7 @@ const TranscriptCreate = () => {
{!hasRecorded ? ( diff --git a/www/app/transcripts/scrollToBottom.tsx b/www/app/transcripts/scrollToBottom.tsx index 5fa09039..8088709c 100644 --- a/www/app/transcripts/scrollToBottom.tsx +++ b/www/app/transcripts/scrollToBottom.tsx @@ -9,7 +9,7 @@ type ScrollToBottomProps = { export default function ScrollToBottom(props: ScrollToBottomProps) { return (
{ diff --git a/www/app/transcripts/topicList.tsx b/www/app/transcripts/topicList.tsx index ec78da9e..65a76276 100644 --- a/www/app/transcripts/topicList.tsx +++ b/www/app/transcripts/topicList.tsx @@ -14,22 +14,25 @@ type TopicListProps = { Topic | null, React.Dispatch>, ]; + autoscroll: boolean; }; -export function TopicList({ topics, useActiveTopic }: TopicListProps) { +export function TopicList({ + topics, + useActiveTopic, + autoscroll, +}: TopicListProps) { const [activeTopic, setActiveTopic] = useActiveTopic; const [autoscrollEnabled, setAutoscrollEnabled] = useState(true); useEffect(() => { - if (autoscrollEnabled) scrollToBottom(); - }, [topics]); + if (autoscroll && autoscrollEnabled) scrollToBottom(); + }, [topics.length]); const scrollToBottom = () => { const topicsDiv = document.getElementById("topics-div"); - if (!topicsDiv) - console.error("Could not find topics div to scroll to bottom"); - else topicsDiv.scrollTop = topicsDiv.scrollHeight; + if (topicsDiv) topicsDiv.scrollTop = topicsDiv.scrollHeight; }; // scroll top is not rounded, heights are, so exact match won't work. @@ -50,19 +53,23 @@ export function TopicList({ topics, useActiveTopic }: TopicListProps) { }; useEffect(() => { - const topicsDiv = document.getElementById("topics-div"); + if (autoscroll) { + const topicsDiv = document.getElementById("topics-div"); - topicsDiv && toggleScroll(topicsDiv); - }, [activeTopic]); + topicsDiv && toggleScroll(topicsDiv); + } + }, [activeTopic, autoscroll]); return (
{topics.length > 0 ? ( <> - + {autoscroll && ( + + )}