This commit is contained in:
Ivan Rezchikov
2026-07-11 21:40:18 +03:00
parent 6667cc55b2
commit e4844f741c
7 changed files with 30 additions and 34 deletions
+5 -3
View File
@@ -44,6 +44,10 @@ export default function EditPageClient({ page, pageType, initialBlocks = [] }: P
});
}
const handleChange = (data: EditorData) => {
dataRef.current = data;
};
return (
<div className="flex flex-col p-4 md:p-16 gap-6 md:gap-12 mb-4 md:mb-0">
<div className="flex flex-row items-center justify-between">
@@ -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}
/>
</div>
);
+1 -1
View File
@@ -27,7 +27,7 @@ export async function HasCitizenship({ userId }: { userId: string }) {
<TriangleAlertIcon />
<AlertTitle>Citizenship record unavailable</AlertTitle>
<AlertDescription>
We couldn't verify your active citizenship record. Contact the competent authority.
We couldn&apos;t verify your active citizenship record. Contact the competent authority.
</AlertDescription>
</Alert>
);
@@ -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:
<Alert className="mb-2" variant="warning">
<TriangleAlertIcon />
<AlertTitle>Name mismatch</AlertTitle>
<AlertDescription className="w-fit max-w-full">The name on this application differs from the applicant's Kotosoft ID. Verify before approving.</AlertDescription>
<AlertDescription className="w-fit max-w-full">The name on this application differs from the applicant&apos;s Kotosoft ID. Verify before approving.</AlertDescription>
</Alert>
)}
{ application.previousCitizenship && (
+22 -24
View File
@@ -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
<AutoResizeTextarea
className="w-full bg-transparent resize-none outline-none leading-relaxed placeholder:text-muted-foreground"
placeholder="Start writing..."
value={(block.content as any).text ?? ""}
value={(block.content as { type: "PARAGRAPH"; text: string }).text ?? ""}
onChange={(e) => 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 (
<div className="flex items-center gap-2">
@@ -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 })}
/>
<Select
value={String((block.content as any).level ?? 2)}
onValueChange={(v) => onChange({ type: "HEADING", text: (block.content as any).text ?? "", level: Number(v) as 1 | 2 | 3 })}
value={String((block.content as { type: "HEADING"; text: string; level: 1 | 2 | 3 }).level ?? 2)}
onValueChange={(v) => onChange({ type: "HEADING", text: (block.content as { type: "HEADING"; text: string; level: 1 | 2 | 3 }).text ?? "", level: Number(v) as 1 | 2 | 3 })}
>
<SelectTrigger className="w-16 h-7 opacity-0 group-hover:opacity-100 transition-opacity">
<SelectValue />
@@ -364,14 +362,14 @@ function BlockInput({ block, onChange, previewUrls, onPreviewReady }: { block: B
<AutoResizeTextarea
className="w-full bg-transparent resize-none outline-none leading-relaxed placeholder:text-muted-foreground"
placeholder="Quote text..."
value={(block.content as any).text ?? ""}
onChange={(e) => onChange({ type: "QUOTE", text: e.target.value, author: (block.content as any).author })}
value={(block.content as { type: "QUOTE"; text: string; author?: string }).text ?? ""}
onChange={(e) => onChange({ type: "QUOTE", text: e.target.value, author: (block.content as { type: "QUOTE"; text: string; author?: string }).author })}
/>
<input
className="w-full bg-transparent outline-none text-sm text-muted-foreground placeholder:text-muted-foreground/60"
placeholder="— Author"
value={(block.content as any).author ?? ""}
onChange={(e) => 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 })}
/>
</div>
);
@@ -383,14 +381,14 @@ function BlockInput({ block, onChange, previewUrls, onPreviewReady }: { block: B
<input
className="w-full bg-transparent outline-none text-sm font-medium placeholder:text-muted-foreground"
placeholder="Callout title"
value={(block.content as any).title ?? ""}
onChange={(e) => 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 ?? "" })}
/>
<AutoResizeTextarea
className="w-full bg-transparent resize-none outline-none text-sm leading-relaxed text-muted-foreground placeholder:text-muted-foreground/60"
placeholder="Callout text..."
value={(block.content as any).text ?? ""}
onChange={(e) => 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 })}
/>
</Alert>
);
@@ -409,10 +407,10 @@ function BlockInput({ block, onChange, previewUrls, onPreviewReady }: { block: B
return <Separator />;
case "LIST":
return <ListEditor content={block.content as any} onChange={(c) => onChange(c)} />;
return <ListEditor content={block.content as { type: "LIST"; style: "BULLET" | "ORDERED"; items: string[] }} onChange={(c) => onChange(c)} />;
case "TABLE":
return <TableEditor content={block.content as any} onChange={(c) => onChange(c)} />;
return <TableEditor content={block.content as { type: "TABLE"; headers: string[]; rows: string[][] }} onChange={(c) => onChange(c)} />;
case "LINK":
return (
@@ -422,12 +420,12 @@ function BlockInput({ block, onChange, previewUrls, onPreviewReady }: { block: B
<input
className="w-full bg-transparent outline-none text-sm"
placeholder="Link label"
value={(block.content as any).label ?? ""}
value={(block.content as { type: "LINK"; label: string; href: string }).label ?? ""}
onChange={(e) =>
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
<input
className="w-full bg-transparent outline-none text-sm text-muted-foreground"
placeholder="URL"
value={(block.content as any).href ?? ""}
value={(block.content as { type: "LINK"; label: string; href: string }).href ?? ""}
onChange={(e) =>
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 ?? [];
-1
View File
@@ -1,5 +1,4 @@
import Image from "next/image";
import { Button } from "./ui/button";
import Link from "next/link";
export default function Footer() {
+1 -1
View File
@@ -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) {
-2
View File
@@ -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();