format and fix

This commit is contained in:
2026-02-24 23:01:11 +01:00
parent 1bb9241116
commit 81a6daaa75
17 changed files with 133 additions and 59 deletions

View File

@@ -2,8 +2,6 @@ import { useCallback, useMemo, useState } from "react";
import { createFileRoute } from "@tanstack/react-router";
import { useSuspenseQuery } from "@tanstack/react-query";
import { timelineQueryOptions } from "@/functions/get-timeline";
import GroupFormDrawer from "@/components/group-form-drawer";
import ItemFormDrawer from "@/components/item-form-drawer";
import { FlutterView } from "@/components/flutter-view";
export const Route = createFileRoute("/timeline/$timelineId")({
@@ -44,11 +42,16 @@ function RouteComponent() {
[timeline, selectedItemId]
);
const [flutterHeight, setFlutterHeight] = useState<number | undefined>();
const handleEvent = useCallback(
(event: { type: string; payload?: Record<string, unknown> }) => {
switch (event.type) {
case "content_height":
setFlutterHeight(event.payload?.height as number);
break;
case "item_selected":
setSelectedItemId((event.payload?.itemId as string) ?? null);
// setSelectedItemId((event.payload?.itemId as string) ?? null);
break;
case "item_deselected":
setSelectedItemId(null);
@@ -59,13 +62,16 @@ function RouteComponent() {
);
return (
<div className="flex h-screen flex-col px-4 py-6">
<h1 className="text-3xl font-serif font-bold mb-6">{timeline.title}</h1>
<div className="flex flex-col">
<h1 className="text-3xl font-serif font-bold mb-6 mx-4">
{timeline.title}
</h1>
<FlutterView
state={flutterState}
onEvent={handleEvent}
className="min-h-0 flex-1 rounded-lg overflow-hidden"
className="overflow-hidden"
height={flutterHeight}
/>
</div>
);