Added more todos

This commit is contained in:
Tim Howitz 2025-05-30 13:34:09 +01:00
parent 88f89ad12d
commit 183a53b178
2 changed files with 21 additions and 17 deletions

View File

@ -34,6 +34,8 @@ const store = createStore<StoreModel>({
}), }),
}); });
// todo fix user persisting on reload
function UserFetcher() { function UserFetcher() {
const setUser = useStoreActions((actions) => actions.setUser); const setUser = useStoreActions((actions) => actions.setUser);
const { data, error } = useSWR("/api/user", fetcher); const { data, error } = useSWR("/api/user", fetcher);

View File

@ -16,7 +16,7 @@ interface SidebarProps {
setHoveredEventId: Dispatch<SetStateAction<string>>; setHoveredEventId: Dispatch<SetStateAction<string>>;
button1Name: string; button1Name: string;
button2Name: string; button2Name: string;
onButton2Click?: () => void; onButton2Click?: () => void;
} }
function MagnitudeNumber({ magnitude }: { magnitude: number }) { function MagnitudeNumber({ magnitude }: { magnitude: number }) {
@ -37,6 +37,8 @@ function MagnitudeNumber({ magnitude }: { magnitude: number }) {
); );
} }
// todo change sidebar event highlighting on selection
export default function Sidebar({ export default function Sidebar({
logTitle, logTitle,
logSubtitle, logSubtitle,
@ -48,7 +50,7 @@ export default function Sidebar({
setHoveredEventId, setHoveredEventId,
button1Name, button1Name,
button2Name, button2Name,
onButton2Click, onButton2Click,
}: SidebarProps) { }: SidebarProps) {
const eventsContainerRef = useRef<HTMLDivElement>(null); const eventsContainerRef = useRef<HTMLDivElement>(null);
@ -70,21 +72,21 @@ export default function Sidebar({
<div className="px-6 pb-8 border-b border-neutral-200"> <div className="px-6 pb-8 border-b border-neutral-200">
<h2 className="text-2xl font-bold text-neutral-800 mb-2">{logTitle}</h2> <h2 className="text-2xl font-bold text-neutral-800 mb-2">{logTitle}</h2>
<p className="text-sm text-neutral-600 leading-relaxed">{logSubtitle}</p> <p className="text-sm text-neutral-600 leading-relaxed">{logSubtitle}</p>
<Link href="/"> <Link href="/">
<button className="mt-4 w-full bg-blue-600 hover:bg-blue-700 text-white py-2 px-4 rounded-lg transition-colors duration-200 font-medium"> <button className="mt-4 w-full bg-blue-600 hover:bg-blue-700 text-white py-2 px-4 rounded-lg transition-colors duration-200 font-medium">
{button1Name} {button1Name}
</button> </button>
</Link> </Link>
{/* "Search Earthquakes" should NOT be wrapped in a Link! */} {/* "Search Earthquakes" should NOT be wrapped in a Link! */}
<button <button
className="mt-4 w-full bg-blue-600 hover:bg-blue-700 text-white py-2 px-4 rounded-lg transition-colors duration-200 font-medium" className="mt-4 w-full bg-blue-600 hover:bg-blue-700 text-white py-2 px-4 rounded-lg transition-colors duration-200 font-medium"
onClick={onButton2Click} onClick={onButton2Click}
type="button" type="button"
> >
{button2Name} {button2Name}
</button> </button>
</div> </div>
<div className="px-6 pt-6"> <div className="px-6 pt-6">
<h2 className="text-xl font-bold text-neutral-800 mb-4">{recentsTitle}</h2> <h2 className="text-xl font-bold text-neutral-800 mb-4">{recentsTitle}</h2>
</div> </div>