Refactor code
This commit is contained in:
@ -67,6 +67,7 @@ function BrandSvg({ icon }: { icon: SimpleIcon }) {
|
||||
className="h-5 w-5 fill-current"
|
||||
aria-hidden="true"
|
||||
focusable="false"
|
||||
// biome-ignore lint: lint/security/noDangerouslySetInnerHtml
|
||||
dangerouslySetInnerHTML={{ __html: icon.svg }}
|
||||
/>
|
||||
);
|
||||
|
||||
@ -26,6 +26,7 @@ export default function RawCloseButton({ targetHref }: RawCloseButtonProps) {
|
||||
onClick={() => router.push(targetHref)}
|
||||
className="absolute top-4 right-4 z-50 rounded-md bg-background/80 p-2 hover:bg-background/60 transition"
|
||||
title="Close full view (ESC)"
|
||||
type="button"
|
||||
>
|
||||
<X className="w-6 h-6" />
|
||||
</button>
|
||||
|
||||
@ -25,7 +25,6 @@ type Tag = {
|
||||
slug: string;
|
||||
sortIndex: number;
|
||||
parentId: string | null;
|
||||
// these may exist, but we do NOT rely on them:
|
||||
parent?: { id: string; name: string; slug: string; sortIndex: number } | null;
|
||||
children?: { id: string; name: string; slug: string; sortIndex: number; parentId: string | null }[];
|
||||
};
|
||||
@ -65,7 +64,6 @@ export default function TagFilterDialog({
|
||||
|
||||
const byId = useMemo(() => new Map(tags.map((t) => [t.id, t])), [tags]);
|
||||
|
||||
// Build children mapping from the flat list: parentId -> Tag[]
|
||||
const childrenByParentId = useMemo(() => {
|
||||
const map = new Map<string, Tag[]>();
|
||||
for (const t of tags) {
|
||||
@ -74,7 +72,6 @@ export default function TagFilterDialog({
|
||||
arr.push(t);
|
||||
map.set(t.parentId, arr);
|
||||
}
|
||||
// sort each child list
|
||||
for (const [k, arr] of map) {
|
||||
map.set(k, arr.slice().sort(sortTags));
|
||||
}
|
||||
@ -101,7 +98,6 @@ export default function TagFilterDialog({
|
||||
const s = new Set(prev);
|
||||
if (next) {
|
||||
s.add(parent.slug);
|
||||
// when selecting parent, remove child selections (redundant)
|
||||
for (const c of children) s.delete(c.slug);
|
||||
} else {
|
||||
s.delete(parent.slug);
|
||||
@ -188,9 +184,6 @@ export default function TagFilterDialog({
|
||||
/>
|
||||
<div className="min-w-0">
|
||||
<div className="truncate font-medium">{p.name}</div>
|
||||
{/* <div className="text-xs text-muted-foreground">
|
||||
{children.length ? "Parent tag" : "Tag"}
|
||||
</div> */}
|
||||
</div>
|
||||
</Label>
|
||||
|
||||
@ -231,11 +224,6 @@ export default function TagFilterDialog({
|
||||
|
||||
{orphanChildren.length ? (
|
||||
<div className="rounded-lg border p-4">
|
||||
{/* <div className="mb-2 font-medium">Other tags</div> */}
|
||||
{/* <div className="mb-3 text-xs text-muted-foreground">
|
||||
These tags are not currently assigned to a visible parent.
|
||||
</div> */}
|
||||
|
||||
<div className="grid grid-cols-1 gap-2 sm:grid-cols-2">
|
||||
{orphanChildren.map((t) => {
|
||||
const checked = selectedSet.has(t.slug);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
|
||||
import { CommissionExtra, CommissionOption, CommissionType, CommissionTypeExtra, CommissionTypeOption } from "@/generated/prisma/client"
|
||||
import type { CommissionExtra, CommissionOption, CommissionType, CommissionTypeExtra, CommissionTypeOption } from "@/generated/prisma/client"
|
||||
|
||||
type CommissionTypeWithItems = CommissionType & {
|
||||
options: (CommissionTypeOption & {
|
||||
|
||||
@ -12,7 +12,7 @@ import {
|
||||
} from "@/components/ui/form";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import {
|
||||
import type {
|
||||
CommissionCustomInput,
|
||||
CommissionExtra,
|
||||
CommissionOption,
|
||||
@ -28,7 +28,7 @@ import Link from "next/link";
|
||||
import { useMemo, useState } from "react";
|
||||
import { useForm, useWatch } from "react-hook-form";
|
||||
import { toast } from "sonner";
|
||||
import * as z from "zod/v4";
|
||||
import type * as z from "zod/v4";
|
||||
import { FileDropzone } from "./FileDropzone";
|
||||
|
||||
type CommissionTypeWithRelations = CommissionType & {
|
||||
|
||||
@ -1,11 +1,8 @@
|
||||
import { prisma } from "@/lib/prisma";
|
||||
import { cn } from "@/lib/utils";
|
||||
// import { Fraunces } from "next/font/google";
|
||||
import localFont from 'next/font/local';
|
||||
import Image from "next/image";
|
||||
|
||||
// const pacifico = Fraunces({ weight: "700", subsets: ["latin"] });
|
||||
|
||||
const myFont = localFont({
|
||||
src: './Echotopia-Regular.woff2',
|
||||
})
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import { ThemeProvider as NextThemesProvider } from "next-themes"
|
||||
import * as React from "react"
|
||||
import type * as React from "react"
|
||||
|
||||
export function ThemeProvider({
|
||||
children,
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
"use client"
|
||||
|
||||
import * as React from "react"
|
||||
import * as AccordionPrimitive from "@radix-ui/react-accordion"
|
||||
import { ChevronDownIcon } from "lucide-react"
|
||||
import * as React from "react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
@ -63,4 +63,5 @@ function AccordionContent({
|
||||
)
|
||||
}
|
||||
|
||||
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
|
||||
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user