feat(categories): kategori ağacı, varsayılan Türkçe set ve yönetim ekranı
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { z } from "zod";
|
||||
import { tr } from "../../i18n/tr";
|
||||
import { ICON_KEYS, SWATCHES } from "../appearance";
|
||||
|
||||
export const CATEGORY_KINDS = ["expense", "income"] as const;
|
||||
export type CategoryKind = (typeof CATEGORY_KINDS)[number];
|
||||
|
||||
export const categoryFormSchema = z.object({
|
||||
kind: z.enum(CATEGORY_KINDS),
|
||||
name: z.string().trim().min(1, tr.common.required).max(80, tr.validation.nameMax),
|
||||
parentId: z
|
||||
.string()
|
||||
.regex(/^([a-f0-9]{24})?$/i)
|
||||
.transform((s) => (s === "" ? null : s)),
|
||||
icon: z.enum(ICON_KEYS),
|
||||
color: z.enum(SWATCHES),
|
||||
});
|
||||
|
||||
export type CategoryFormInput = z.input<typeof categoryFormSchema>;
|
||||
export type CategoryForm = z.output<typeof categoryFormSchema>;
|
||||
Reference in New Issue
Block a user