diff --git a/app/[type]/[slug]/edit/client.tsx b/app/[type]/[slug]/edit/client.tsx index c22cd0e..2074562 100644 --- a/app/[type]/[slug]/edit/client.tsx +++ b/app/[type]/[slug]/edit/client.tsx @@ -44,6 +44,10 @@ export default function EditPageClient({ page, pageType, initialBlocks = [] }: P }); } + const handleChange = (data: EditorData) => { + dataRef.current = data; + }; + return (
@@ -62,9 +66,7 @@ export default function EditPageClient({ page, pageType, initialBlocks = [] }: P page={page} type={pageType} initialBlocks={initialBlocks} - onChange={(data) => { - dataRef.current = data; - }} + onChange={handleChange} />
); diff --git a/app/account/citizenship/has-citizenship.tsx b/app/account/citizenship/has-citizenship.tsx index 26d4028..337bf72 100644 --- a/app/account/citizenship/has-citizenship.tsx +++ b/app/account/citizenship/has-citizenship.tsx @@ -27,7 +27,7 @@ export async function HasCitizenship({ userId }: { userId: string }) { Citizenship record unavailable - We couldn't verify your active citizenship record. Contact the competent authority. + We couldn't verify your active citizenship record. Contact the competent authority. ); diff --git a/app/account/citizenship/review/application-card.tsx b/app/account/citizenship/review/application-card.tsx index 76095d7..ec8122a 100644 --- a/app/account/citizenship/review/application-card.tsx +++ b/app/account/citizenship/review/application-card.tsx @@ -12,7 +12,6 @@ import { approveApplication, rejectApplication } from "@/lib/citizenship/actions import { CitizenshipApplicationWithWarning } from "@/lib/citizenship/types"; import { formatDate } from "@/lib/utils"; import { TriangleAlertIcon } from "lucide-react"; -import Image from "next/image"; import { useState } from "react"; import { toast } from "sonner"; @@ -79,7 +78,7 @@ export default function ApplicationCard({ application, onClose }: { application: Name mismatch - The name on this application differs from the applicant's Kotosoft ID. Verify before approving. + The name on this application differs from the applicant's Kotosoft ID. Verify before approving. )} { application.previousCitizenship && ( diff --git a/components/editor.tsx b/components/editor.tsx index 113fdff..0d272a7 100644 --- a/components/editor.tsx +++ b/components/editor.tsx @@ -11,13 +11,11 @@ import { Globe2Icon, PlusIcon, Trash2Icon, XIcon, ChevronDownIcon, ChevronUpIcon import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from "./ui/select"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu"; import { cn } from "@/lib/utils"; -import { Input } from "./ui/input"; import { Separator } from "./ui/separator"; import { Alert } from "./ui/alert"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"; import { uploadPageImage, getImagePreviewUrl } from "@/lib/pages/actions"; import { ImageUploader } from "@/components/image-uploader"; -import { Spinner } from "@/components/ui/spinner"; export type EditorData = { title: string; @@ -319,13 +317,13 @@ function BlockInput({ block, onChange, previewUrls, onPreviewReady }: { block: B onChange({ type: "PARAGRAPH", text: e.target.value })} /> ); case "HEADING": - const level = (block.content as any).level; + const level = (block.content as { type: "HEADING"; text: string; level: 1 | 2 | 3 }).level; return (
@@ -339,12 +337,12 @@ function BlockInput({ block, onChange, previewUrls, onPreviewReady }: { block: B } )} placeholder="Heading" - value={(block.content as any).text ?? ""} - onChange={(e) => onChange({ type: "HEADING", text: e.target.value, level: (block.content as any).level ?? 2 })} + value={(block.content as { type: "HEADING"; text: string; level: 1 | 2 | 3 }).text ?? ""} + onChange={(e) => onChange({ type: "HEADING", text: e.target.value, level: (block.content as { type: "HEADING"; text: string; level: 1 | 2 | 3 }).level ?? 2 })} /> onChange({ type: "QUOTE", text: (block.content as any).text, author: e.target.value })} + value={(block.content as { type: "QUOTE"; text: string; author?: string }).author ?? ""} + onChange={(e) => onChange({ type: "QUOTE", text: (block.content as { type: "QUOTE"; text: string; author?: string }).text, author: e.target.value })} />
); @@ -383,14 +381,14 @@ function BlockInput({ block, onChange, previewUrls, onPreviewReady }: { block: B onChange({ type: "CALLOUT", title: e.target.value, text: (block.content as any).text ?? "" })} + value={(block.content as { type: "CALLOUT"; title: string; text: string }).title ?? ""} + onChange={(e) => onChange({ type: "CALLOUT", title: e.target.value, text: (block.content as { type: "CALLOUT"; title: string; text: string }).text ?? "" })} /> onChange({ type: "CALLOUT", title: (block.content as any).title ?? "", text: e.target.value })} + value={(block.content as { type: "CALLOUT"; title: string; text: string }).text ?? ""} + onChange={(e) => onChange({ type: "CALLOUT", title: (block.content as { type: "CALLOUT"; title: string; text: string }).title ?? "", text: e.target.value })} /> ); @@ -409,10 +407,10 @@ function BlockInput({ block, onChange, previewUrls, onPreviewReady }: { block: B return ; case "LIST": - return onChange(c)} />; + return onChange(c)} />; case "TABLE": - return onChange(c)} />; + return onChange(c)} />; case "LINK": return ( @@ -422,12 +420,12 @@ function BlockInput({ block, onChange, previewUrls, onPreviewReady }: { block: B onChange({ type: "LINK", label: e.target.value, - href: (block.content as any).href ?? "", + href: (block.content as { type: "LINK"; label: string; href: string }).href ?? "", }) } /> @@ -435,11 +433,11 @@ function BlockInput({ block, onChange, previewUrls, onPreviewReady }: { block: B onChange({ type: "LINK", - label: (block.content as any).label ?? "", + label: (block.content as { type: "LINK"; label: string; href: string }).label ?? "", href: e.target.value, }) } @@ -453,7 +451,7 @@ function BlockInput({ block, onChange, previewUrls, onPreviewReady }: { block: B } } -function ListEditor({ content, onChange }: { content: { type: "LIST"; style: "BULLET" | "ORDERED"; items: string[] }; onChange: (c: any) => void }) { +function ListEditor({ content, onChange }: { content: { type: "LIST"; style: "BULLET" | "ORDERED"; items: string[] }; onChange: (c: { type: "LIST"; style: "BULLET" | "ORDERED"; items: string[] }) => void }) { const items = content.items ?? [""]; function updateItem(index: number, value: string) { @@ -531,7 +529,7 @@ function ListEditor({ content, onChange }: { content: { type: "LIST"; style: "BU ); } -function TableEditor({ content, onChange }: { content: { type: "TABLE"; headers: string[]; rows: string[][] }; onChange: (c: any) => void }) { +function TableEditor({ content, onChange }: { content: { type: "TABLE"; headers: string[]; rows: string[][] }; onChange: (c: { type: "TABLE"; headers: string[]; rows: string[][] }) => void }) { const headers = content.headers ?? ["Column 1"]; const rows = content.rows ?? []; diff --git a/components/footer.tsx b/components/footer.tsx index 7fcc89b..5efe341 100644 --- a/components/footer.tsx +++ b/components/footer.tsx @@ -1,5 +1,4 @@ import Image from "next/image"; -import { Button } from "./ui/button"; import Link from "next/link"; export default function Footer() { diff --git a/lib/citizenship/actions.ts b/lib/citizenship/actions.ts index ebbf8a4..2e6685b 100644 --- a/lib/citizenship/actions.ts +++ b/lib/citizenship/actions.ts @@ -51,7 +51,7 @@ export const submitCitizenshipApplication = formAction(citizenshipApplicationSch if (!eligibility.eligible) throw new AppError(eligibility.reason!); const isEuResidentYes = data.isEuResident === "yes"; - const { profile, signature, isEuResident, ...applicationData } = data; + const { profile, signature, ...applicationData } = data; let regionName: string | null = null; if (isEuResidentYes) { diff --git a/lib/user.ts b/lib/user.ts index 117de46..ff2ed5e 100644 --- a/lib/user.ts +++ b/lib/user.ts @@ -1,7 +1,5 @@ import { getSessionUserId } from "@/lib/auth/session"; import { findUserById, findUsersByIds } from "@/lib/user/repository"; -import { fetchKotosoftUser } from "./kotosoft/client"; -import { cookies } from "next/headers"; export async function getCurrentUser() { const userId = await getSessionUserId();