diff --git a/aimenet-web/app/cards/page.tsx b/aimenet-web/app/cards/page.tsx new file mode 100644 index 0000000..b09a022 --- /dev/null +++ b/aimenet-web/app/cards/page.tsx @@ -0,0 +1,85 @@ +"use client"; + +import React from "react"; +import {Separator} from "@/components/ui/separator"; +import {Footer} from "@/components/footer"; +import {Button} from "@/components/ui/button"; +import {CreditCard, Plus, ServerCog, Trash} from "lucide-react"; +import {useRouter} from "next/navigation"; +import {useLiveQuery} from "dexie-react-hooks"; +import {AimeCard, db} from "@/lib/database"; +import {LoadingIndicator} from "@/components/loading-indicator"; +import {CardCreationDialog} from "@/components/card-creation-form"; +import { + ContextMenu, + ContextMenuContent, + ContextMenuItem, + ContextMenuTrigger +} from "@/components/ui/context-menu"; +import {AimeCardEntry} from "@/components/aime-card"; + +function CardAddButton() { + return ( + + + + ); +} + +function CardList(props: { cards: AimeCard[] | undefined }) { + if (!props.cards) { + return (); + } + + if (!props.cards.length) { + return (<> + +
+ + No cards found +
+ ); + } + + return (<> + + + {props.cards.map(s => + + + + + + db.cards.delete(s.id)}> + Remove + + + )} + ); +} + +export default function CardManagerPage() { + const router = useRouter(); + const cards = useLiveQuery(() => db.cards.toArray()); + + return ( +
+
+

Cards

+ +
+ + +
+ +
+ +
+
+ ); +} \ No newline at end of file diff --git a/aimenet-web/components/aime-card.tsx b/aimenet-web/components/aime-card.tsx new file mode 100644 index 0000000..6969fff --- /dev/null +++ b/aimenet-web/components/aime-card.tsx @@ -0,0 +1,21 @@ +import {CreditCard} from "lucide-react"; +import {Card} from "@/components/ui/card"; +import React from "react"; +import {AimeCard} from "@/lib/database"; + +export function AimeCardEntry(props: { card: AimeCard, children?: Readonly }) { + return ( + +
+
+

{props.card.name}

+
+ + {props.card.id.match(/.{1,4}/g)?.join(" ")} +
+
+ {props.children} +
+
+ ); +} \ No newline at end of file