visual fixes, remove error

This commit is contained in:
Sara
2023-09-22 17:51:33 +02:00
parent 2cc98314d2
commit 902bc6c7cc
6 changed files with 26 additions and 18 deletions

View File

@@ -53,7 +53,7 @@ export const metadata: Metadata = {
maximumScale: 1, 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 }) { export default function RootLayout({ children }) {

View File

@@ -10,7 +10,7 @@
body { body {
background: white; background: white;
scrollbar-color: rgb(96 165 250) transparent; scrollbar-color: rgb(132, 186, 251) transparent;
scrollbar-width: thin; scrollbar-width: thin;
} }
@@ -26,12 +26,11 @@ body {
} }
::-webkit-scrollbar { ::-webkit-scrollbar {
visibility: visible;
width: 5px; width: 5px;
opacity: 0.7; opacity: 0.7;
} }
::-webkit-scrollbar-thumb { ::-webkit-scrollbar-thumb {
border-radius: 10px; border-radius: 10px;
background-color: rgb(96 165 250); background-color: rgb(132, 186, 251);
} }

View File

@@ -52,6 +52,7 @@ export default function TranscriptDetails(details: TranscriptDetails) {
<TopicList <TopicList
topics={topics?.topics || []} topics={topics?.topics || []}
useActiveTopic={useActiveTopic} useActiveTopic={useActiveTopic}
autoscroll={false}
/> />
<section className="relative w-full h-auto max-h-full bg-blue-400/20 rounded-lg md:rounded-xl px-2 md:px-4 flex flex-col justify-center align-center"> <section className="relative w-full h-auto max-h-full bg-blue-400/20 rounded-lg md:rounded-xl px-2 md:px-4 flex flex-col justify-center align-center">
<div className="py-2 h-full"> <div className="py-2 h-full">

View File

@@ -65,6 +65,7 @@ const TranscriptCreate = () => {
<TopicList <TopicList
topics={webSockets.topics} topics={webSockets.topics}
useActiveTopic={useActiveTopic} useActiveTopic={useActiveTopic}
autoscroll={true}
/> />
<section className="w-full h-full bg-blue-400/20 rounded-lg md:rounded-xl px-2 md:px-4 flex flex-col justify-center align-center"> <section className="w-full h-full bg-blue-400/20 rounded-lg md:rounded-xl px-2 md:px-4 flex flex-col justify-center align-center">
{!hasRecorded ? ( {!hasRecorded ? (

View File

@@ -9,7 +9,7 @@ type ScrollToBottomProps = {
export default function ScrollToBottom(props: ScrollToBottomProps) { export default function ScrollToBottom(props: ScrollToBottomProps) {
return ( return (
<div <div
className={`absolute bottom-0 right-0 ${ className={`absolute bottom-0 right-[0.15rem] md:right-[0.65rem] ${
props.visible ? "flex" : "hidden" props.visible ? "flex" : "hidden"
} text-2xl cursor-pointer opacity-70 hover:opacity-100 transition-opacity duration-200 text-blue-400`} } text-2xl cursor-pointer opacity-70 hover:opacity-100 transition-opacity duration-200 text-blue-400`}
onClick={() => { onClick={() => {

View File

@@ -14,22 +14,25 @@ type TopicListProps = {
Topic | null, Topic | null,
React.Dispatch<React.SetStateAction<Topic | null>>, React.Dispatch<React.SetStateAction<Topic | null>>,
]; ];
autoscroll: boolean;
}; };
export function TopicList({ topics, useActiveTopic }: TopicListProps) { export function TopicList({
topics,
useActiveTopic,
autoscroll,
}: TopicListProps) {
const [activeTopic, setActiveTopic] = useActiveTopic; const [activeTopic, setActiveTopic] = useActiveTopic;
const [autoscrollEnabled, setAutoscrollEnabled] = useState<boolean>(true); const [autoscrollEnabled, setAutoscrollEnabled] = useState<boolean>(true);
useEffect(() => { useEffect(() => {
if (autoscrollEnabled) scrollToBottom(); if (autoscroll && autoscrollEnabled) scrollToBottom();
}, [topics]); }, [topics.length]);
const scrollToBottom = () => { const scrollToBottom = () => {
const topicsDiv = document.getElementById("topics-div"); const topicsDiv = document.getElementById("topics-div");
if (!topicsDiv) if (topicsDiv) topicsDiv.scrollTop = topicsDiv.scrollHeight;
console.error("Could not find topics div to scroll to bottom");
else topicsDiv.scrollTop = topicsDiv.scrollHeight;
}; };
// scroll top is not rounded, heights are, so exact match won't work. // scroll top is not rounded, heights are, so exact match won't work.
@@ -50,19 +53,23 @@ export function TopicList({ topics, useActiveTopic }: TopicListProps) {
}; };
useEffect(() => { useEffect(() => {
const topicsDiv = document.getElementById("topics-div"); if (autoscroll) {
const topicsDiv = document.getElementById("topics-div");
topicsDiv && toggleScroll(topicsDiv); topicsDiv && toggleScroll(topicsDiv);
}, [activeTopic]); }
}, [activeTopic, autoscroll]);
return ( return (
<section className="relative w-full h-full bg-blue-400/20 rounded-lg md:rounded-xl px-2 md:px-4 flex flex-col justify-center align-center"> <section className="relative w-full h-full bg-blue-400/20 rounded-lg md:rounded-xl px-2 md:px-4 flex flex-col justify-center align-center">
{topics.length > 0 ? ( {topics.length > 0 ? (
<> <>
<ScrollToBottom {autoscroll && (
visible={!autoscrollEnabled} <ScrollToBottom
handleScrollBottom={scrollToBottom} visible={!autoscrollEnabled}
/> handleScrollBottom={scrollToBottom}
/>
)}
<div <div
id="topics-div" id="topics-div"