changed some color, fixed tip tap editor
This commit is contained in:
79
package-lock.json
generated
79
package-lock.json
generated
@@ -43,6 +43,7 @@
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^10.0.1",
|
||||
"@tailwindcss/postcss": "^4.2.4",
|
||||
"@tailwindcss/typography": "^0.5.19",
|
||||
"@types/node": "^24.12.2",
|
||||
"@types/react": "^19.2.14",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
@@ -100,7 +101,6 @@
|
||||
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.0.tgz",
|
||||
"integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "^7.29.0",
|
||||
"@babel/generator": "^7.29.0",
|
||||
@@ -662,6 +662,29 @@
|
||||
"@noble/ciphers": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@emnapi/core": {
|
||||
"version": "1.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.10.0.tgz",
|
||||
"integrity": "sha512-yq6OkJ4p82CAfPl0u9mQebQHKPJkY7WrIuk205cTYnYe+k2Z8YBh11FrbRG/H6ihirqcacOgl2BIO8oyMQLeXw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"@emnapi/wasi-threads": "1.2.1",
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@emnapi/runtime": {
|
||||
"version": "1.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.10.0.tgz",
|
||||
"integrity": "sha512-ewvYlk86xUoGI0zQRNq/mC+16R1QeDlKQy21Ki3oSYXNgLb45GV1P6A0M+/s6nyCuNDqe5VpaY84BzXGwVbwFA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@emnapi/wasi-threads": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.1.tgz",
|
||||
@@ -815,7 +838,6 @@
|
||||
"resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.7.6.tgz",
|
||||
"integrity": "sha512-9gZSAI5XM36880PPMm//9dfiEngYoC6Am2izES1FF406YFsjvyBMmeJ2g4SAju3xWwtuynNRFL2s9hgxpLI5SQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@floating-ui/core": "^1.7.5",
|
||||
"@floating-ui/utils": "^0.2.11"
|
||||
@@ -1184,7 +1206,6 @@
|
||||
"resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-1.3.0.tgz",
|
||||
"integrity": "sha512-2I0gnIVPtfnMw9ee9h1dJG7tp81+8Ob3OJb3Mv37rx5L40/b0i7djjCVvGOVqc9AEIQyvyu1i6ypKdFw8R8gQw==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": "^14.21.3 || >=16"
|
||||
},
|
||||
@@ -3394,6 +3415,33 @@
|
||||
"tailwindcss": "4.2.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/typography": {
|
||||
"version": "0.5.19",
|
||||
"resolved": "https://registry.npmjs.org/@tailwindcss/typography/-/typography-0.5.19.tgz",
|
||||
"integrity": "sha512-w31dd8HOx3k9vPtcQh5QHP9GwKcgbMp87j58qi6xgiBnFFtKEAgCWnDw4qUT8aHwkCp8bKvb/KGKWWHedP0AAg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"postcss-selector-parser": "6.0.10"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"tailwindcss": ">=3.0.0 || insiders || >=4.0.0-alpha.20 || >=4.0.0-beta.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser": {
|
||||
"version": "6.0.10",
|
||||
"resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.10.tgz",
|
||||
"integrity": "sha512-IQ7TZdoaqbT+LCpShg46jnZVlhWD2w6iQYAcYXfHARZ7X1t/UGhhceQDs5X0cGqKvYlHNOuv7Oa1xmb0oQuA3w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cssesc": "^3.0.0",
|
||||
"util-deprecate": "^1.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/@tanstack/query-core": {
|
||||
"version": "5.100.8",
|
||||
"resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.100.8.tgz",
|
||||
@@ -3458,7 +3506,6 @@
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/core/-/core-3.23.2.tgz",
|
||||
"integrity": "sha512-yjv2N7gaQMbIVfsSZHBMscLoybgetcTraXsSMrELAerl/jfRipg5S1dBXMFvgRy8Kh48+TGoH+5nqshxdOEGoQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ueberdosis"
|
||||
@@ -3681,7 +3728,6 @@
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/extension-list/-/extension-list-3.23.2.tgz",
|
||||
"integrity": "sha512-tRbbjpOPrY4ApIHtn3ctnKIhkkioewMsZa5gJzqVB47LJFNyzLXLo/aID4sJRKTIMi1wd1fA9TiBKPe6KqczPA==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ueberdosis"
|
||||
@@ -3787,7 +3833,6 @@
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/extensions/-/extensions-3.23.2.tgz",
|
||||
"integrity": "sha512-kRHQ3nSbAfkFdxj9FtDdr4hpREndGgWFA6ZEAwlLeGUxf8QYTpuF9zb2yxdBPBlTc5+JsbPcskNt+u1PazGKYw==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ueberdosis"
|
||||
@@ -3802,7 +3847,6 @@
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/pm/-/pm-3.23.2.tgz",
|
||||
"integrity": "sha512-1kvsBqGNu2ZJ0P/lkxN0pAMqSyUcpkMIzE4xwGUIyAiD0pZV6dr+OCMwGWOTLllSyrn91xI5K7OLk3pYeCPKqA==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"prosemirror-changeset": "^2.3.0",
|
||||
"prosemirror-commands": "^1.6.2",
|
||||
@@ -3996,7 +4040,6 @@
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.12.2.tgz",
|
||||
"integrity": "sha512-A1sre26ke7HDIuY/M23nd9gfB+nrmhtYyMINbjI1zHJxYteKR6qSMX56FsmjMcDb3SMcjJg5BiRRgOCC/yBD0g==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"undici-types": "~7.16.0"
|
||||
}
|
||||
@@ -4006,7 +4049,6 @@
|
||||
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.14.tgz",
|
||||
"integrity": "sha512-ilcTH/UniCkMdtexkoCN0bI7pMcJDvmQFPvuPvmEaYA/NSfFTAgdUSLAoVjaRJm7+6PvcM+q1zYOwS4wTYMF9w==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"csstype": "^3.2.2"
|
||||
}
|
||||
@@ -4016,7 +4058,6 @@
|
||||
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.2.3.tgz",
|
||||
"integrity": "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"peerDependencies": {
|
||||
"@types/react": "^19.2.0"
|
||||
}
|
||||
@@ -4093,7 +4134,6 @@
|
||||
"integrity": "sha512-HDQH9O/47Dxi1ceDhBXdaldtf/WV9yRYMjbjCuNk3qnaTD564qwv61Y7+gTxwxRKzSrgO5uhtw584igXVuuZkA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/scope-manager": "8.59.1",
|
||||
"@typescript-eslint/types": "8.59.1",
|
||||
@@ -4337,7 +4377,6 @@
|
||||
"integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"acorn": "bin/acorn"
|
||||
},
|
||||
@@ -4619,7 +4658,6 @@
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"baseline-browser-mapping": "^2.10.12",
|
||||
"caniuse-lite": "^1.0.30001782",
|
||||
@@ -5479,7 +5517,6 @@
|
||||
"integrity": "sha512-XbEXaRva5cF0ZQB8w6MluHA0kZZfV2DuCMJ3ozyEOHLwDpZX2Lmm/7Pp0xdJmI0GL1W05VH5VwIFHEm1Vcw2gw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.8.0",
|
||||
"@eslint-community/regexpp": "^4.12.2",
|
||||
@@ -5736,7 +5773,6 @@
|
||||
"resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz",
|
||||
"integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"accepts": "^2.0.0",
|
||||
"body-parser": "^2.2.1",
|
||||
@@ -6411,7 +6447,6 @@
|
||||
"resolved": "https://registry.npmjs.org/hono/-/hono-4.12.16.tgz",
|
||||
"integrity": "sha512-jN0ZewiNAWSe5khM3EyCmBb250+b40wWbwNILNfEvq84VREWwOIkuUsFONk/3i3nqkz7Oe1PcpM2mwQEK2L9Kg==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=16.9.0"
|
||||
}
|
||||
@@ -6486,7 +6521,6 @@
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"peerDependencies": {
|
||||
"typescript": "^5 || ^6"
|
||||
},
|
||||
@@ -7896,7 +7930,6 @@
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"nanoid": "^3.3.11",
|
||||
"picocolors": "^1.1.1",
|
||||
@@ -8287,7 +8320,6 @@
|
||||
"resolved": "https://registry.npmjs.org/react/-/react-19.2.5.tgz",
|
||||
"integrity": "sha512-llUJLzz1zTUBrskt2pwZgLq59AemifIftw4aB7JxOqf1HY2FDaGDxgwpAPVzHU1kdWabH7FauP4i1oEeer2WCA==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
@@ -8319,7 +8351,6 @@
|
||||
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.5.tgz",
|
||||
"integrity": "sha512-J5bAZz+DXMMwW/wV3xzKke59Af6CHY7G4uYLN1OvBcKEsWOs4pQExj86BBKamxl/Ik5bx9whOrvBlSDfWzgSag==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"scheduler": "^0.27.0"
|
||||
},
|
||||
@@ -8332,7 +8363,6 @@
|
||||
"resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.75.0.tgz",
|
||||
"integrity": "sha512-Ovv94H+0p3sJ7B9B5QxPuCP1u8V/cHuVGyH55cSwodYDtoJwK+fqk3vjfIgSX59I2U/bU4z0nRJ9HMLpNiWEmw==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
},
|
||||
@@ -8383,7 +8413,6 @@
|
||||
"resolved": "https://registry.npmjs.org/react-redux/-/react-redux-9.2.0.tgz",
|
||||
"integrity": "sha512-ROY9fvHhwOD9ySfrF0wmvu//bKCQ6AeZZq1nJNtbDC+kk5DuSuNX/n6YWYF/SYy7bSba4D4FSz8DJeKY/S/r+g==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@types/use-sync-external-store": "^0.0.6",
|
||||
"use-sync-external-store": "^1.4.0"
|
||||
@@ -8578,8 +8607,7 @@
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz",
|
||||
"integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w==",
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/redux-thunk": {
|
||||
"version": "3.1.0",
|
||||
@@ -9351,7 +9379,6 @@
|
||||
"integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==",
|
||||
"devOptional": true,
|
||||
"license": "Apache-2.0",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
@@ -9586,7 +9613,6 @@
|
||||
"integrity": "sha512-rZuUu9j6J5uotLDs+cAA4O5H4K1SfPliUlQwqa6YEwSrWDZzP4rhm00oJR5snMewjxF5V/K3D4kctsUTsIU9Mw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"lightningcss": "^1.32.0",
|
||||
"picomatch": "^4.0.4",
|
||||
@@ -9916,7 +9942,6 @@
|
||||
"resolved": "https://registry.npmjs.org/zod/-/zod-4.4.3.tgz",
|
||||
"integrity": "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/colinhacks"
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^10.0.1",
|
||||
"@tailwindcss/postcss": "^4.2.4",
|
||||
"@tailwindcss/typography": "^0.5.19",
|
||||
"@types/node": "^24.12.2",
|
||||
"@types/react": "^19.2.14",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
|
||||
@@ -177,7 +177,7 @@ function ToggleColumnsDropdown({
|
||||
id={`col-toggle-${col.id}`}
|
||||
checked={isVisible(col.id)}
|
||||
onChange={() => toggle(col.id)}
|
||||
className="w-4 h-4 rounded cursor-pointer accent-primary"
|
||||
className="w-4 h-4 rounded cursor-pointer accent-[#005f78] dark:accent-primary"
|
||||
/>
|
||||
<label
|
||||
htmlFor={`col-toggle-${col.id}`}
|
||||
|
||||
@@ -1,41 +1,42 @@
|
||||
import { type LucideIcon, ChevronRight, Check, AlertTriangle } from 'lucide-react'
|
||||
import { cn } from '@/lib/utils'
|
||||
import type { StepStatus } from './stepBar'
|
||||
import {
|
||||
type LucideIcon,
|
||||
ChevronRight,
|
||||
Check,
|
||||
AlertTriangle,
|
||||
} from "lucide-react";
|
||||
import { cn } from "@/lib/utils";
|
||||
import type { StepStatus } from "./stepBar";
|
||||
|
||||
export interface StepCardItem {
|
||||
id: string
|
||||
title: string
|
||||
subtitle: string
|
||||
icon: LucideIcon
|
||||
status: StepStatus
|
||||
id: string;
|
||||
title: string;
|
||||
subtitle: string;
|
||||
icon: LucideIcon;
|
||||
status: StepStatus;
|
||||
}
|
||||
|
||||
interface StepBarCardsProps {
|
||||
steps: StepCardItem[]
|
||||
onGoTo: (index: number) => void
|
||||
steps: StepCardItem[];
|
||||
onGoTo: (index: number) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Card-style horizontal step bar (icon + title + subtitle, chevron separators).
|
||||
* Inspired by the reference mockup. Uses semantic tokens only.
|
||||
*/
|
||||
export function StepBarCards({ steps, onGoTo }: StepBarCardsProps) {
|
||||
return (
|
||||
<nav
|
||||
role="tablist"
|
||||
aria-label="Form adımları"
|
||||
className={cn(
|
||||
'flex items-center gap-2 overflow-x-auto',
|
||||
'[&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]',
|
||||
"flex items-center gap-2 overflow-x-auto",
|
||||
"[&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]",
|
||||
)}
|
||||
>
|
||||
{steps.map((step, i) => {
|
||||
const Icon = step.icon
|
||||
const isActive = step.status === 'active'
|
||||
const isDone = step.status === 'done'
|
||||
const isError = step.status === 'error'
|
||||
const isIdle = step.status === 'idle'
|
||||
const reachable = !isIdle || (i > 0 && steps[i - 1].status === 'done')
|
||||
const Icon = step.icon;
|
||||
const isActive = step.status === "active";
|
||||
const isDone = step.status === "done";
|
||||
const isError = step.status === "error";
|
||||
const isIdle = step.status === "idle";
|
||||
const reachable = !isIdle || (i > 0 && steps[i - 1].status === "done");
|
||||
|
||||
return (
|
||||
<div key={step.id} className="flex items-center gap-2 shrink-0">
|
||||
@@ -43,33 +44,36 @@ export function StepBarCards({ steps, onGoTo }: StepBarCardsProps) {
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={isActive}
|
||||
aria-current={isActive ? 'step' : undefined}
|
||||
aria-current={isActive ? "step" : undefined}
|
||||
disabled={!reachable}
|
||||
onClick={() => reachable && onGoTo(i)}
|
||||
className={cn(
|
||||
'group flex items-center gap-3 rounded-2xl px-3 py-2.5 transition-all duration-200',
|
||||
'outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background',
|
||||
'disabled:cursor-not-allowed disabled:opacity-40',
|
||||
reachable && !isActive && 'hover:bg-muted/40 cursor-pointer',
|
||||
isActive && 'bg-muted/60',
|
||||
"group flex items-center gap-3 rounded-lg px-3 py-2.5 transition-all duration-200",
|
||||
"outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
||||
"disabled:cursor-not-allowed disabled:opacity-40",
|
||||
reachable && !isActive && "hover:bg-muted/40 cursor-pointer",
|
||||
isActive && "bg-muted/60",
|
||||
)}
|
||||
>
|
||||
{/* Icon disc */}
|
||||
<span
|
||||
className={cn(
|
||||
'relative flex items-center justify-center rounded-full w-11 h-11 shrink-0 transition-all duration-300',
|
||||
"relative flex items-center justify-center rounded-full w-11 h-11 shrink-0 transition-all duration-300",
|
||||
isActive &&
|
||||
'bg-primary text-primary-foreground ring-4 ring-primary/15',
|
||||
"bg-[#005f78] text-white ring-4 ring-[#005f78]/15 dark:bg-primary dark:text-primary-foreground dark:ring-primary/15",
|
||||
isDone &&
|
||||
'bg-muted text-foreground',
|
||||
"bg-[#005f78]/10 text-[#005f78] dark:bg-muted dark:text-foreground",
|
||||
isError &&
|
||||
'bg-destructive/10 text-destructive ring-2 ring-destructive/30',
|
||||
isIdle && 'bg-muted text-muted-foreground',
|
||||
reachable && !isActive && 'group-hover:scale-105',
|
||||
"bg-destructive/10 text-destructive ring-2 ring-destructive/30",
|
||||
isIdle && "bg-muted text-muted-foreground",
|
||||
reachable && !isActive && "group-hover:scale-105",
|
||||
)}
|
||||
>
|
||||
{isDone ? (
|
||||
<Check className="w-5 h-5 animate-scale-in" strokeWidth={2.5} />
|
||||
<Check
|
||||
className="w-5 h-5 animate-scale-in"
|
||||
strokeWidth={2.5}
|
||||
/>
|
||||
) : isError ? (
|
||||
<AlertTriangle className="w-5 h-5 animate-scale-in" />
|
||||
) : (
|
||||
@@ -81,9 +85,11 @@ export function StepBarCards({ steps, onGoTo }: StepBarCardsProps) {
|
||||
<span className="flex flex-col items-start text-left leading-tight">
|
||||
<span
|
||||
className={cn(
|
||||
'text-sm font-semibold tracking-tight',
|
||||
isActive || isDone ? 'text-foreground' : 'text-foreground/90',
|
||||
isError && 'text-destructive',
|
||||
"text-sm font-semibold tracking-tight",
|
||||
isActive && "text-[#005f78] dark:text-foreground",
|
||||
isDone && "text-[#005f78] dark:text-foreground",
|
||||
!isActive && !isDone && !isError && "text-foreground/90",
|
||||
isError && "text-destructive",
|
||||
)}
|
||||
>
|
||||
{step.title}
|
||||
@@ -102,8 +108,8 @@ export function StepBarCards({ steps, onGoTo }: StepBarCardsProps) {
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
);
|
||||
})}
|
||||
</nav>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ function Checkbox({
|
||||
<CheckboxPrimitive.Root
|
||||
data-slot="checkbox"
|
||||
className={cn(
|
||||
"peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary",
|
||||
"peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-[#005f78] data-checked:bg-[#005f78] data-checked:text-white dark:data-checked:border-primary dark:data-checked:bg-primary dark:data-checked:text-primary-foreground",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
@@ -21,11 +21,10 @@ function Checkbox({
|
||||
data-slot="checkbox-indicator"
|
||||
className="grid place-content-center text-current transition-none [&>svg]:size-3.5"
|
||||
>
|
||||
<CheckIcon
|
||||
/>
|
||||
<CheckIcon />
|
||||
</CheckboxPrimitive.Indicator>
|
||||
</CheckboxPrimitive.Root>
|
||||
)
|
||||
}
|
||||
|
||||
export { Checkbox }
|
||||
export { Checkbox }
|
||||
@@ -1,11 +1,12 @@
|
||||
import { useState, useEffect, useMemo, useCallback } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useForm } from 'react-hook-form'
|
||||
import { zodResolver } from '@hookform/resolvers/zod'
|
||||
import { useEditor, EditorContent } from '@tiptap/react'
|
||||
import StarterKit from '@tiptap/starter-kit'
|
||||
import Link from '@tiptap/extension-link'
|
||||
import { useState, useEffect, useMemo, useCallback, useRef } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { useEditor, EditorContent } from "@tiptap/react";
|
||||
import StarterKit from "@tiptap/starter-kit";
|
||||
import Link from "@tiptap/extension-link";
|
||||
import Underline from "@tiptap/extension-underline";
|
||||
import {
|
||||
Bold,
|
||||
Italic,
|
||||
@@ -20,111 +21,308 @@ import {
|
||||
WrapText,
|
||||
Paperclip,
|
||||
Type,
|
||||
} from 'lucide-react'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { FormInput } from '@/components/formInput'
|
||||
import { FormActions } from '@/components/formActions'
|
||||
import { useCreateRequiredDocument, useUpdateRequiredDocument } from '../hooks/useRequiredDocuments'
|
||||
import { createRequiredDocumentFormSchema, DEFAULT_FORM_VALUES, buildPayload, mapInitial } from '../schemas/requiredDocument.schema'
|
||||
import type { RequiredDocumentFormData } from '../schemas/requiredDocument.schema'
|
||||
import type { LoanDocument, LoanDocumentTranslation } from '../api/requiredDocumentsApi'
|
||||
X,
|
||||
FileText,
|
||||
} from "lucide-react";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { FormInput } from "@/components/formInput";
|
||||
import { FormActions } from "@/components/formActions";
|
||||
import {
|
||||
useCreateRequiredDocument,
|
||||
useUpdateRequiredDocument,
|
||||
} from "../hooks/useRequiredDocuments";
|
||||
import {
|
||||
createRequiredDocumentFormSchema,
|
||||
DEFAULT_FORM_VALUES,
|
||||
buildPayload,
|
||||
mapInitial,
|
||||
} from "../schemas/requiredDocument.schema";
|
||||
import type { RequiredDocumentFormData } from "../schemas/requiredDocument.schema";
|
||||
import type {
|
||||
LoanDocument,
|
||||
LoanDocumentTranslation,
|
||||
} from "../api/requiredDocumentsApi";
|
||||
|
||||
// ─── Types ────────────────────────────────────────────────────────────────────
|
||||
|
||||
type Locale = 'tk' | 'ru' | 'en'
|
||||
type Locale = "tk" | "ru" | "en";
|
||||
|
||||
interface RequiredDocumentFormProps {
|
||||
mode: 'create' | 'edit'
|
||||
initialData?: LoanDocument
|
||||
mode: "create" | "edit";
|
||||
initialData?: LoanDocument;
|
||||
}
|
||||
|
||||
// ─── Lang tabs ────────────────────────────────────────────────────────────────
|
||||
|
||||
const LOCALES: Locale[] = ['tk', 'ru', 'en']
|
||||
const LOCALES: Locale[] = ["tk", "ru", "en"];
|
||||
|
||||
// ─── Tiptap Toolbar ───────────────────────────────────────────────────────────
|
||||
|
||||
interface RichTextToolbarProps {
|
||||
editor: ReturnType<typeof useEditor>
|
||||
editor: ReturnType<typeof useEditor>;
|
||||
onFileAttach?: (file: File) => void;
|
||||
}
|
||||
|
||||
function RichTextToolbar({ editor }: RichTextToolbarProps) {
|
||||
if (!editor) return null
|
||||
// ─── RichTextToolbar ─────────────────────────────────────────────────────────
|
||||
|
||||
function RichTextToolbar({ editor, onFileAttach }: RichTextToolbarProps) {
|
||||
const [showLinkModal, setShowLinkModal] = useState(false);
|
||||
const fileInputRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
if (!editor) return null;
|
||||
|
||||
const handleLinkConfirm = (url: string) => {
|
||||
if (url) {
|
||||
const href = url.startsWith("http") ? url : `https://${url}`;
|
||||
editor.chain().focus().setLink({ href }).run();
|
||||
}
|
||||
setShowLinkModal(false);
|
||||
};
|
||||
|
||||
const handleFileChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const file = e.target.files?.[0];
|
||||
if (!file) return;
|
||||
|
||||
onFileAttach?.(file);
|
||||
|
||||
editor.chain().focus().insertContent(`<span>📎 ${file.name}</span> `).run();
|
||||
|
||||
e.target.value = "";
|
||||
};
|
||||
|
||||
const tools = [
|
||||
{ icon: Bold, action: () => editor.chain().focus().toggleBold().run(), active: editor.isActive('bold'), title: 'Bold' },
|
||||
{ icon: Italic, action: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive('italic'), title: 'Italic' },
|
||||
{ icon: Strikethrough, action: () => editor.chain().focus().toggleStrike().run(), active: editor.isActive('strike'), title: 'Strike' },
|
||||
{ icon: Link2, action: () => {
|
||||
const url = prompt('URL giriziň:')
|
||||
if (url) editor.chain().focus().setLink({ href: url }).run()
|
||||
}, active: editor.isActive('link'), title: 'Link' },
|
||||
{ icon: Heading2, action: () => editor.chain().focus().toggleHeading({ level: 2 }).run(), active: editor.isActive('heading', { level: 2 }), title: 'H2' },
|
||||
{ icon: Quote, action: () => editor.chain().focus().toggleBlockquote().run(), active: editor.isActive('blockquote'), title: 'Quote' },
|
||||
{ icon: Code, action: () => editor.chain().focus().toggleCode().run(), active: editor.isActive('code'), title: 'Code' },
|
||||
{ icon: List, action: () => editor.chain().focus().toggleBulletList().run(), active: editor.isActive('bulletList'), title: 'Bullet List' },
|
||||
{ icon: ListOrdered, action: () => editor.chain().focus().toggleOrderedList().run(), active: editor.isActive('orderedList'), title: 'Ordered List' },
|
||||
{ icon: Minus, action: () => editor.chain().focus().setHorizontalRule().run(), active: false, title: 'Divider' },
|
||||
{ icon: WrapText, action: () => editor.chain().focus().setHardBreak().run(), active: false, title: 'Hard Break' },
|
||||
{ icon: Paperclip, action: () => {}, active: false, title: 'Attachment' },
|
||||
{ icon: Type, action: () => editor.chain().focus().clearNodes().unsetAllMarks().run(), active: false, title: 'Clear format' },
|
||||
]
|
||||
{
|
||||
icon: Bold,
|
||||
action: () => editor.chain().focus().toggleBold().run(),
|
||||
active: editor.isActive("bold"),
|
||||
title: "Bold",
|
||||
},
|
||||
{
|
||||
icon: Italic,
|
||||
action: () => editor.chain().focus().toggleItalic().run(),
|
||||
active: editor.isActive("italic"),
|
||||
title: "Italic",
|
||||
},
|
||||
{
|
||||
icon: Strikethrough,
|
||||
action: () => editor.chain().focus().toggleStrike().run(),
|
||||
active: editor.isActive("strike"),
|
||||
title: "Strike",
|
||||
},
|
||||
{
|
||||
icon: Link2,
|
||||
action: () => setShowLinkModal(true),
|
||||
active: editor.isActive("link"),
|
||||
title: "Link",
|
||||
},
|
||||
{
|
||||
icon: Heading2,
|
||||
action: () => editor.chain().focus().toggleHeading({ level: 2 }).run(),
|
||||
active: editor.isActive("heading", { level: 2 }),
|
||||
title: "H2",
|
||||
},
|
||||
{
|
||||
icon: Quote,
|
||||
action: () => editor.chain().focus().toggleBlockquote().run(),
|
||||
active: editor.isActive("blockquote"),
|
||||
title: "Quote",
|
||||
},
|
||||
{
|
||||
icon: Code,
|
||||
action: () => editor.chain().focus().toggleCodeBlock().run(),
|
||||
active: editor.isActive("codeBlock"),
|
||||
title: "Code Block",
|
||||
},
|
||||
{
|
||||
icon: List,
|
||||
action: () => editor.chain().focus().toggleBulletList().run(),
|
||||
active: editor.isActive("bulletList"),
|
||||
title: "Bullet List",
|
||||
},
|
||||
{
|
||||
icon: ListOrdered,
|
||||
action: () => editor.chain().focus().toggleOrderedList().run(),
|
||||
active: editor.isActive("orderedList"),
|
||||
title: "Ordered List",
|
||||
},
|
||||
{
|
||||
icon: Minus,
|
||||
action: () => editor.chain().focus().setHorizontalRule().run(),
|
||||
active: false,
|
||||
title: "Divider",
|
||||
},
|
||||
{
|
||||
icon: WrapText,
|
||||
action: () => editor.chain().focus().setHardBreak().run(),
|
||||
active: false,
|
||||
title: "Hard Break",
|
||||
},
|
||||
{
|
||||
icon: Paperclip,
|
||||
action: () => fileInputRef.current?.click(),
|
||||
active: false,
|
||||
title: "Attachment",
|
||||
},
|
||||
{
|
||||
icon: Type,
|
||||
action: () =>
|
||||
editor.chain().focus().selectAll().clearNodes().unsetAllMarks().run(),
|
||||
active: false,
|
||||
title: "Clear format",
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<div className="flex flex-wrap items-center gap-0.5 p-1.5 border-b border-border bg-muted/30">
|
||||
{tools.map(({ icon: Icon, action, active, title }) => (
|
||||
<button
|
||||
key={title}
|
||||
type="button"
|
||||
title={title}
|
||||
onMouseDown={(e) => { e.preventDefault(); action() }}
|
||||
className={cn(
|
||||
'flex items-center justify-center w-7 h-7 rounded text-muted-foreground',
|
||||
'hover:bg-muted hover:text-foreground transition-colors',
|
||||
active && 'bg-primary/10 text-primary'
|
||||
)}
|
||||
>
|
||||
<Icon size={14} />
|
||||
</button>
|
||||
))}
|
||||
<>
|
||||
<div className="flex flex-wrap items-center gap-0.5 p-1.5 border-b border-border bg-muted/30">
|
||||
{tools.map(({ icon: Icon, action, active, title }) => (
|
||||
<button
|
||||
key={title}
|
||||
type="button"
|
||||
title={title}
|
||||
onMouseDown={(e) => {
|
||||
e.preventDefault();
|
||||
action();
|
||||
}}
|
||||
className={cn(
|
||||
"flex items-center justify-center w-7 h-7 rounded text-muted-foreground",
|
||||
"hover:bg-muted hover:text-foreground transition-colors",
|
||||
active && "bg-primary/10 text-primary",
|
||||
)}
|
||||
>
|
||||
<Icon size={14} />
|
||||
</button>
|
||||
))}
|
||||
<input
|
||||
ref={fileInputRef}
|
||||
type="file"
|
||||
className="hidden"
|
||||
onChange={handleFileChange}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Link modal */}
|
||||
{showLinkModal && (
|
||||
<LinkModal
|
||||
onConfirm={handleLinkConfirm}
|
||||
onClose={() => setShowLinkModal(false)}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
// ─── Link Modal ───────────────────────────────────────────────────────────────
|
||||
|
||||
function LinkModal({
|
||||
onConfirm,
|
||||
onClose,
|
||||
}: {
|
||||
onConfirm: (url: string) => void;
|
||||
onClose: () => void;
|
||||
}) {
|
||||
const [url, setUrl] = useState("");
|
||||
return (
|
||||
<div
|
||||
className="fixed inset-0 z-50 flex items-center justify-center bg-black/40"
|
||||
onMouseDown={(e) => {
|
||||
if (e.target === e.currentTarget) onClose();
|
||||
}}
|
||||
>
|
||||
<div className="bg-background border border-border rounded-lg shadow-lg p-4 w-80 flex flex-col gap-3">
|
||||
<p className="text-sm font-medium">URL giriziň</p>
|
||||
<input
|
||||
autoFocus
|
||||
type="url"
|
||||
value={url}
|
||||
onChange={(e) => setUrl(e.target.value)}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter") onConfirm(url);
|
||||
if (e.key === "Escape") onClose();
|
||||
}}
|
||||
placeholder="https://..."
|
||||
className="border border-input rounded px-2 py-1.5 text-sm w-full focus:outline-none focus:ring-1 focus:ring-ring"
|
||||
/>
|
||||
<div className="flex justify-end gap-2">
|
||||
<button
|
||||
type="button"
|
||||
onClick={onClose}
|
||||
className="text-sm px-3 py-1 rounded hover:bg-muted text-muted-foreground"
|
||||
>
|
||||
Ýatyr
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => onConfirm(url)}
|
||||
className="text-sm px-3 py-1 rounded bg-primary text-primary-foreground hover:bg-primary/90"
|
||||
>
|
||||
Goş
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// ─── RichTextEditor ───────────────────────────────────────────────────────────
|
||||
|
||||
interface RichTextEditorProps {
|
||||
value: string
|
||||
onChange: (html: string) => void
|
||||
error?: string
|
||||
value: string;
|
||||
onChange: (html: string) => void;
|
||||
error?: string;
|
||||
onFileAttach?: (file: File) => void;
|
||||
}
|
||||
|
||||
function RichTextEditor({ value, onChange, error }: RichTextEditorProps) {
|
||||
function RichTextEditor({
|
||||
value,
|
||||
onChange,
|
||||
error,
|
||||
onFileAttach,
|
||||
}: RichTextEditorProps) {
|
||||
const editor = useEditor({
|
||||
extensions: [StarterKit, Link.configure({ openOnClick: false })],
|
||||
extensions: [
|
||||
StarterKit.configure({
|
||||
heading: { levels: [1, 2, 3] },
|
||||
code: {},
|
||||
blockquote: {},
|
||||
bulletList: {},
|
||||
orderedList: {},
|
||||
horizontalRule: {},
|
||||
hardBreak: {},
|
||||
}),
|
||||
Underline,
|
||||
Link.configure({
|
||||
openOnClick: false,
|
||||
autolink: true,
|
||||
HTMLAttributes: {
|
||||
rel: "noopener noreferrer",
|
||||
target: "_blank",
|
||||
},
|
||||
}),
|
||||
],
|
||||
content: value,
|
||||
onUpdate: ({ editor }) => onChange(editor.getHTML()),
|
||||
})
|
||||
});
|
||||
|
||||
// Sync external value changes (e.g. tab switch)
|
||||
useEffect(() => {
|
||||
if (editor && editor.getHTML() !== value) {
|
||||
editor.commands.setContent(value, { emitUpdate: false })
|
||||
editor.commands.setContent(value, { emitUpdate: false });
|
||||
}
|
||||
}, [value, editor])
|
||||
}, [value, editor]);
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
'rounded-md border bg-background overflow-hidden',
|
||||
error ? 'border-destructive' : 'border-input',
|
||||
'focus-within:ring-1 focus-within:ring-ring'
|
||||
"rounded-md border bg-background overflow-hidden",
|
||||
error ? "border-destructive" : "border-input",
|
||||
"focus-within:ring-1 focus-within:ring-ring",
|
||||
)}
|
||||
>
|
||||
<RichTextToolbar editor={editor} />
|
||||
<RichTextToolbar editor={editor} onFileAttach={onFileAttach} />
|
||||
<EditorContent
|
||||
editor={editor}
|
||||
className="min-h-[120px] px-3 py-2 text-sm text-foreground prose prose-sm dark:prose-invert max-w-none focus:outline-none [&_.ProseMirror]:focus:outline-none"
|
||||
className="min-h-[120px] px-3 py-2 text-sm text-foreground prose prose-sm dark:prose-invert max-w-none focus:outline-none [&_.ProseMirror]:focus:outline-none [&_.ProseMirror_a]:text-primary [&_.ProseMirror_a]:underline [&_.ProseMirror_a]:cursor-pointer"
|
||||
/>
|
||||
{error && (
|
||||
<p className="px-3 pb-2 text-xs text-destructive font-medium flex items-center gap-1.5">
|
||||
@@ -133,18 +331,52 @@ function RichTextEditor({ value, onChange, error }: RichTextEditorProps) {
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// ─── AttachedFilesList ────────────────────────────────────────────────────────
|
||||
|
||||
interface AttachedFilesListProps {
|
||||
files: File[];
|
||||
onRemove: (index: number) => void;
|
||||
}
|
||||
|
||||
function AttachedFilesList({ files, onRemove }: AttachedFilesListProps) {
|
||||
if (files.length === 0) return null;
|
||||
return (
|
||||
<div className="mt-2 flex flex-col gap-1">
|
||||
{files.map((file, i) => (
|
||||
<div
|
||||
key={`${file.name}-${i}`}
|
||||
className="flex items-center gap-2 text-xs text-muted-foreground bg-muted/40 rounded px-2 py-1.5"
|
||||
>
|
||||
<FileText size={12} className="shrink-0 text-primary" />
|
||||
<span className="flex-1 truncate">{file.name}</span>
|
||||
<span className="shrink-0 text-muted-foreground/60">
|
||||
{(file.size / 1024).toFixed(1)} KB
|
||||
</span>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => onRemove(i)}
|
||||
className="shrink-0 hover:text-destructive transition-colors ml-1"
|
||||
>
|
||||
<X size={12} />
|
||||
</button>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// ─── LangTabs ────────────────────────────────────────────────────────────────
|
||||
|
||||
interface LangTabsProps {
|
||||
active: Locale
|
||||
onChange: (locale: Locale) => void
|
||||
active: Locale;
|
||||
onChange: (locale: Locale) => void;
|
||||
}
|
||||
|
||||
function LangTabs({ active, onChange }: LangTabsProps) {
|
||||
const { t } = useTranslation()
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div className="flex items-center justify-end gap-3 mb-2">
|
||||
{LOCALES.map((code) => (
|
||||
@@ -153,65 +385,85 @@ function LangTabs({ active, onChange }: LangTabsProps) {
|
||||
type="button"
|
||||
onClick={() => onChange(code)}
|
||||
className={cn(
|
||||
'text-sm transition-colors',
|
||||
"text-sm transition-colors",
|
||||
active === code
|
||||
? 'text-primary font-semibold underline underline-offset-4'
|
||||
: 'text-muted-foreground hover:text-foreground'
|
||||
? "text-primary font-semibold underline underline-offset-4"
|
||||
: "text-muted-foreground hover:text-foreground",
|
||||
)}
|
||||
>
|
||||
{t('languages.' + code, code === 'tk' ? 'Türkmen' : code === 'ru' ? 'Русский' : 'English')}
|
||||
{t(
|
||||
"languages." + code,
|
||||
code === "tk" ? "Türkmen" : code === "ru" ? "Русский" : "English",
|
||||
)}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// ─── Error helpers ──────────────────────────────────────────────────────────
|
||||
|
||||
type LegacyErrorKey = `name_${Locale}` | `desc_${Locale}`
|
||||
type LegacyErrorKey = `name_${Locale}` | `desc_${Locale}`;
|
||||
|
||||
const RHF_TO_LEGACY_KEY: Record<string, LegacyErrorKey> = {
|
||||
nameTk: 'name_tk',
|
||||
nameRu: 'name_ru',
|
||||
nameEn: 'name_en',
|
||||
descTk: 'desc_tk',
|
||||
descRu: 'desc_ru',
|
||||
descEn: 'desc_en',
|
||||
}
|
||||
nameTk: "name_tk",
|
||||
nameRu: "name_ru",
|
||||
nameEn: "name_en",
|
||||
descTk: "desc_tk",
|
||||
descRu: "desc_ru",
|
||||
descEn: "desc_en",
|
||||
};
|
||||
|
||||
function flattenErrors(
|
||||
errors: Record<string, { message?: string } | undefined>,
|
||||
): Partial<Record<LegacyErrorKey, string>> {
|
||||
const result: Partial<Record<LegacyErrorKey, string>> = {}
|
||||
const result: Partial<Record<LegacyErrorKey, string>> = {};
|
||||
for (const [key, err] of Object.entries(errors)) {
|
||||
const legacyKey = RHF_TO_LEGACY_KEY[key]
|
||||
const legacyKey = RHF_TO_LEGACY_KEY[key];
|
||||
if (legacyKey && err?.message) {
|
||||
result[legacyKey] = err.message
|
||||
result[legacyKey] = err.message;
|
||||
}
|
||||
}
|
||||
return result
|
||||
return result;
|
||||
}
|
||||
|
||||
// ─── RequiredDocumentForm ─────────────────────────────────────────────────────────
|
||||
// ─── RequiredDocumentForm ─────────────────────────────────────────────────────
|
||||
|
||||
export function RequiredDocumentForm({ mode, initialData }: RequiredDocumentFormProps) {
|
||||
const { t: _t, i18n } = useTranslation()
|
||||
export function RequiredDocumentForm({
|
||||
mode,
|
||||
initialData,
|
||||
}: RequiredDocumentFormProps) {
|
||||
const { t: _t, i18n } = useTranslation();
|
||||
const t: (key: string, fallback?: string) => string = useCallback(
|
||||
(key, fallback) => _t(key, fallback ?? key) as string,
|
||||
[_t, i18n.language],
|
||||
)
|
||||
const navigate = useNavigate()
|
||||
);
|
||||
const navigate = useNavigate();
|
||||
|
||||
// Per-field locale tabs (UI only, not form state)
|
||||
const [nameLang, setNameLang] = useState<Locale>('tk')
|
||||
const [descLang, setDescLang] = useState<Locale>('tk')
|
||||
const [nameLang, setNameLang] = useState<Locale>("tk");
|
||||
const [descLang, setDescLang] = useState<Locale>("tk");
|
||||
|
||||
const createMutation = useCreateRequiredDocument()
|
||||
const updateMutation = useUpdateRequiredDocument(initialData?.id ?? 0)
|
||||
// ── Attached files — stored as File[] for FormData submission ──────────────
|
||||
const [attachedFiles, setAttachedFiles] = useState<File[]>([]);
|
||||
|
||||
const isPending = createMutation.isPending || updateMutation.isPending
|
||||
const handleFileAttach = useCallback((file: File) => {
|
||||
setAttachedFiles((prev) => [...prev, file]);
|
||||
}, []);
|
||||
|
||||
const schema = useMemo(() => createRequiredDocumentFormSchema(t), [t, i18n.language])
|
||||
const handleFileRemove = useCallback((index: number) => {
|
||||
setAttachedFiles((prev) => prev.filter((_, i) => i !== index));
|
||||
}, []);
|
||||
|
||||
const createMutation = useCreateRequiredDocument();
|
||||
const updateMutation = useUpdateRequiredDocument(initialData?.id ?? 0);
|
||||
|
||||
const isPending = createMutation.isPending || updateMutation.isPending;
|
||||
|
||||
const schema = useMemo(
|
||||
() => createRequiredDocumentFormSchema(t),
|
||||
[t, i18n.language],
|
||||
);
|
||||
|
||||
const {
|
||||
watch,
|
||||
@@ -224,145 +476,193 @@ export function RequiredDocumentForm({ mode, initialData }: RequiredDocumentForm
|
||||
defaultValues: initialData
|
||||
? { ...DEFAULT_FORM_VALUES, ...mapInitial(initialData) }
|
||||
: DEFAULT_FORM_VALUES,
|
||||
})
|
||||
});
|
||||
|
||||
const form = watch()
|
||||
const form = watch();
|
||||
const errors = useMemo(
|
||||
() => flattenErrors(rhfErrors as Record<string, { message?: string } | undefined>),
|
||||
() =>
|
||||
flattenErrors(
|
||||
rhfErrors as Record<string, { message?: string } | undefined>,
|
||||
),
|
||||
[rhfErrors],
|
||||
)
|
||||
);
|
||||
|
||||
// ── Re-validate on language change ──
|
||||
useEffect(() => {
|
||||
if (Object.keys(rhfErrors).length > 0) trigger()
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [i18n.language])
|
||||
if (Object.keys(rhfErrors).length > 0) trigger();
|
||||
}, [i18n.language]);
|
||||
|
||||
// Derive LoanDocumentTranslation objects so the JSX stays unchanged
|
||||
const name: LoanDocumentTranslation = useMemo(
|
||||
() => ({ tk: form.nameTk, ru: form.nameRu, en: form.nameEn }),
|
||||
[form.nameTk, form.nameRu, form.nameEn],
|
||||
)
|
||||
);
|
||||
|
||||
const description: LoanDocumentTranslation = useMemo(
|
||||
() => ({ tk: form.descTk, ru: form.descRu, en: form.descEn }),
|
||||
[form.descTk, form.descRu, form.descEn],
|
||||
)
|
||||
);
|
||||
|
||||
// Functional setter that matches React's useState(prev => …) signature
|
||||
const setName = useCallback(
|
||||
(updater: (prev: LoanDocumentTranslation) => LoanDocumentTranslation) => {
|
||||
const current = getValues()
|
||||
const prev: LoanDocumentTranslation = { tk: current.nameTk, ru: current.nameRu, en: current.nameEn }
|
||||
const next = updater(prev)
|
||||
setValue('nameTk', next.tk)
|
||||
setValue('nameRu', next.ru)
|
||||
setValue('nameEn', next.en)
|
||||
const current = getValues();
|
||||
const prev: LoanDocumentTranslation = {
|
||||
tk: current.nameTk,
|
||||
ru: current.nameRu,
|
||||
en: current.nameEn,
|
||||
};
|
||||
const next = updater(prev);
|
||||
setValue("nameTk", next.tk);
|
||||
setValue("nameRu", next.ru);
|
||||
setValue("nameEn", next.en);
|
||||
},
|
||||
[setValue, getValues],
|
||||
)
|
||||
);
|
||||
|
||||
const setDescription = useCallback(
|
||||
(updater: (prev: LoanDocumentTranslation) => LoanDocumentTranslation) => {
|
||||
const current = getValues()
|
||||
const prev: LoanDocumentTranslation = { tk: current.descTk, ru: current.descRu, en: current.descEn }
|
||||
const next = updater(prev)
|
||||
setValue('descTk', next.tk)
|
||||
setValue('descRu', next.ru)
|
||||
setValue('descEn', next.en)
|
||||
const current = getValues();
|
||||
const prev: LoanDocumentTranslation = {
|
||||
tk: current.descTk,
|
||||
ru: current.descRu,
|
||||
en: current.descEn,
|
||||
};
|
||||
const next = updater(prev);
|
||||
setValue("descTk", next.tk);
|
||||
setValue("descRu", next.ru);
|
||||
setValue("descEn", next.en);
|
||||
},
|
||||
[setValue, getValues],
|
||||
)
|
||||
);
|
||||
|
||||
// ── Submit ──────────────────────────────────────────────────────────────────
|
||||
|
||||
const handleSubmit = async (e?: React.FormEvent) => {
|
||||
e?.preventDefault()
|
||||
const isValid = await trigger()
|
||||
if (!isValid) return
|
||||
e?.preventDefault();
|
||||
const isValid = await trigger();
|
||||
if (!isValid) return;
|
||||
|
||||
const payload = buildPayload(getValues())
|
||||
const payload = buildPayload(getValues());
|
||||
|
||||
if (mode === 'create') {
|
||||
await createMutation.mutateAsync(payload)
|
||||
navigate('/settings/loan/loan-documents')
|
||||
// Build FormData — JSON fields + all attached File objects
|
||||
const formData = new FormData();
|
||||
formData.append("name[tk]", payload.name.tk);
|
||||
formData.append("name[ru]", payload.name.ru);
|
||||
formData.append("name[en]", payload.name.en);
|
||||
formData.append("description[tk]", payload.description.tk);
|
||||
formData.append("description[ru]", payload.description.ru);
|
||||
formData.append("description[en]", payload.description.en);
|
||||
attachedFiles.forEach((file) => {
|
||||
formData.append("files", file, file.name);
|
||||
});
|
||||
|
||||
if (mode === "create") {
|
||||
await createMutation.mutateAsync(payload);
|
||||
navigate("/settings/loan/loan-documents");
|
||||
} else {
|
||||
await updateMutation.mutateAsync(payload)
|
||||
navigate('/settings/loan/loan-documents')
|
||||
await updateMutation.mutateAsync(payload);
|
||||
navigate("/settings/loan/loan-documents");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const submitLabel =
|
||||
mode === 'create'
|
||||
? t('loanDocuments.form.create', 'Karz gerekli resminamalary döretiň')
|
||||
: t('loanDocuments.form.update', 'Karz gerekli resminamalary täzele')
|
||||
mode === "create"
|
||||
? t("loanDocuments.form.create", "Karz gerekli resminamalary döretiň")
|
||||
: t("loanDocuments.form.update", "Karz gerekli resminamalary täzele");
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-5">
|
||||
<h1 className="text-xl font-semibold text-foreground">
|
||||
{mode === 'create'
|
||||
? t('loanDocuments.createTitle', 'Karz gerekli resminama dörediň')
|
||||
: t('loanDocuments.editTitle', 'Karz gerekli resminama üýtgetmek')}
|
||||
{mode === "create"
|
||||
? t("loanDocuments.createTitle", "Karz gerekli resminama dörediň")
|
||||
: t("loanDocuments.editTitle", "Karz gerekli resminama üýtgetmek")}
|
||||
</h1>
|
||||
<form onSubmit={handleSubmit} noValidate>
|
||||
<div className="bg-card border border-border rounded-xl overflow-hidden divide-y divide-border">
|
||||
<div className="bg-card border border-border rounded-xl overflow-hidden divide-y divide-border">
|
||||
{/* ── Name field ──────────────────────────────────────────────────── */}
|
||||
<div className="grid grid-cols-[220px_1fr] items-start py-4 px-4">
|
||||
<label className="text-sm text-muted-foreground pt-1">
|
||||
{t("loanDocuments.fields.name", "Ady")}
|
||||
<span className="text-destructive ml-0.5">*</span>
|
||||
</label>
|
||||
<div>
|
||||
<LangTabs active={nameLang} onChange={setNameLang} />
|
||||
<FormInput
|
||||
type="text"
|
||||
value={name[nameLang]}
|
||||
onChange={(val) =>
|
||||
setName((prev) => ({ ...prev, [nameLang]: val }))
|
||||
}
|
||||
placeholder={t("loanDocuments.fields.namePlaceholder", "Ady")}
|
||||
error={errors[`name_${nameLang}`]}
|
||||
/>
|
||||
{/* Show errors for other locales as hints */}
|
||||
{LOCALES.filter((l) => l !== nameLang && errors[`name_${l}`]).map(
|
||||
(code) => (
|
||||
<p key={code} className="mt-1 text-xs text-destructive/70">
|
||||
{t(
|
||||
"languages." + code,
|
||||
code === "tk"
|
||||
? "Türkmen"
|
||||
: code === "ru"
|
||||
? "Русский"
|
||||
: "English",
|
||||
)}
|
||||
: {errors[`name_${code}`]}
|
||||
</p>
|
||||
),
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* ── Name field ──────────────────────────────────────────────────── */}
|
||||
<div className="grid grid-cols-[220px_1fr] items-start py-4 px-4">
|
||||
<label className="text-sm text-muted-foreground pt-1">
|
||||
{t('loanDocuments.fields.name', 'Ady')}
|
||||
<span className="text-destructive ml-0.5">*</span>
|
||||
</label>
|
||||
<div>
|
||||
<LangTabs active={nameLang} onChange={setNameLang} />
|
||||
<FormInput
|
||||
type="text"
|
||||
value={name[nameLang]}
|
||||
onChange={(val) => setName((prev) => ({ ...prev, [nameLang]: val }))}
|
||||
placeholder={t('loanDocuments.fields.namePlaceholder', 'Ady')}
|
||||
error={errors[`name_${nameLang}`]}
|
||||
/>
|
||||
{/* Show errors for other locales as hints */}
|
||||
{LOCALES.filter((l) => l !== nameLang && errors[`name_${l}`]).map((code) => (
|
||||
<p key={code} className="mt-1 text-xs text-destructive/70">
|
||||
{t('languages.' + code, code === 'tk' ? 'Türkmen' : code === 'ru' ? 'Русский' : 'English')}: {errors[`name_${code}`]}
|
||||
</p>
|
||||
))}
|
||||
{/* ── Description field ────────────────────────────────────────────── */}
|
||||
<div className="grid grid-cols-[220px_1fr] items-start py-4 px-4">
|
||||
<label className="text-sm text-muted-foreground pt-1">
|
||||
{t("loanDocuments.fields.description", "Yazgy")}
|
||||
<span className="text-destructive ml-0.5">*</span>
|
||||
</label>
|
||||
<div>
|
||||
<LangTabs active={descLang} onChange={setDescLang} />
|
||||
<RichTextEditor
|
||||
value={description[descLang]}
|
||||
onChange={(val) =>
|
||||
setDescription((prev) => ({ ...prev, [descLang]: val }))
|
||||
}
|
||||
error={errors[`desc_${descLang}`]}
|
||||
onFileAttach={handleFileAttach}
|
||||
/>
|
||||
{/* Attached files list — shown below editor, removable */}
|
||||
<AttachedFilesList
|
||||
files={attachedFiles}
|
||||
onRemove={handleFileRemove}
|
||||
/>
|
||||
{LOCALES.filter((l) => l !== descLang && errors[`desc_${l}`]).map(
|
||||
(code) => (
|
||||
<p key={code} className="mt-1 text-xs text-destructive/70">
|
||||
{t(
|
||||
"languages." + code,
|
||||
code === "tk"
|
||||
? "Türkmen"
|
||||
: code === "ru"
|
||||
? "Русский"
|
||||
: "English",
|
||||
)}
|
||||
: {errors[`desc_${code}`]}
|
||||
</p>
|
||||
),
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* ── Description field ────────────────────────────────────────────── */}
|
||||
<div className="grid grid-cols-[220px_1fr] items-start py-4 px-4">
|
||||
<label className="text-sm text-muted-foreground pt-1">
|
||||
{t('loanDocuments.fields.description', 'Yazgy')}
|
||||
<span className="text-destructive ml-0.5">*</span>
|
||||
</label>
|
||||
<div>
|
||||
<LangTabs active={descLang} onChange={setDescLang} />
|
||||
<RichTextEditor
|
||||
value={description[descLang]}
|
||||
onChange={(val) => setDescription((prev) => ({ ...prev, [descLang]: val }))}
|
||||
error={errors[`desc_${descLang}`]}
|
||||
/>
|
||||
{LOCALES.filter((l) => l !== descLang && errors[`desc_${l}`]).map((code) => (
|
||||
<p key={code} className="mt-1 text-xs text-destructive/70">
|
||||
{t('languages.' + code, code === 'tk' ? 'Türkmen' : code === 'ru' ? 'Русский' : 'English')}: {errors[`desc_${code}`]}
|
||||
</p>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<FormActions
|
||||
isPending={isPending}
|
||||
onSubmit={handleSubmit}
|
||||
onCancel={() => navigate('/settings/loan/loan-documents')}
|
||||
cancelVariant="ghost"
|
||||
loadingLabel={t('common.saving', 'Saklanylýar...')}
|
||||
submitLabel={submitLabel}
|
||||
className="mt-4"
|
||||
/>
|
||||
</form>
|
||||
<FormActions
|
||||
isPending={isPending}
|
||||
onSubmit={handleSubmit}
|
||||
onCancel={() => navigate("/settings/loan/loan-documents")}
|
||||
cancelVariant="ghost"
|
||||
loadingLabel={t("common.saving", "Saklanylýar...")}
|
||||
submitLabel={submitLabel}
|
||||
className="mt-4"
|
||||
/>
|
||||
</form>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
379
src/index.css
379
src/index.css
@@ -1,138 +1,241 @@
|
||||
@import "tailwindcss";
|
||||
@import "tw-animate-css";
|
||||
@import "shadcn/tailwind.css";
|
||||
/* @import "@fontsource-variable/inter"; */
|
||||
|
||||
@custom-variant dark (&:is(.dark *));
|
||||
|
||||
@font-face {
|
||||
font-family: 'Inter Variable';
|
||||
src: url('/Inter-VariableFont_opsz,wght.ttf') format('truetype');
|
||||
font-weight: 100 900;
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
@theme inline {
|
||||
--font-heading: var(--font-sans);
|
||||
--font-sans: 'Inter Variable', sans-serif;
|
||||
--color-sidebar-ring: var(--sidebar-ring);
|
||||
--color-sidebar-border: var(--sidebar-border);
|
||||
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
||||
--color-sidebar-accent: var(--sidebar-accent);
|
||||
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
||||
--color-sidebar-primary: var(--sidebar-primary);
|
||||
--color-sidebar-foreground: var(--sidebar-foreground);
|
||||
--color-sidebar: var(--sidebar);
|
||||
--color-chart-5: var(--chart-5);
|
||||
--color-chart-4: var(--chart-4);
|
||||
--color-chart-3: var(--chart-3);
|
||||
--color-chart-2: var(--chart-2);
|
||||
--color-chart-1: var(--chart-1);
|
||||
--color-ring: var(--ring);
|
||||
--color-input: var(--input);
|
||||
--color-border: var(--border);
|
||||
--color-destructive: var(--destructive);
|
||||
--color-accent-foreground: var(--accent-foreground);
|
||||
--color-accent: var(--accent);
|
||||
--color-muted-foreground: var(--muted-foreground);
|
||||
--color-muted: var(--muted);
|
||||
--color-secondary-foreground: var(--secondary-foreground);
|
||||
--color-secondary: var(--secondary);
|
||||
--color-primary-foreground: var(--primary-foreground);
|
||||
--color-primary: var(--primary);
|
||||
--color-popover-foreground: var(--popover-foreground);
|
||||
--color-popover: var(--popover);
|
||||
--color-card-foreground: var(--card-foreground);
|
||||
--color-card: var(--card);
|
||||
--color-foreground: var(--foreground);
|
||||
--color-background: var(--background);
|
||||
--radius-sm: calc(var(--radius) * 0.6);
|
||||
--radius-md: calc(var(--radius) * 0.8);
|
||||
--radius-lg: var(--radius);
|
||||
--radius-xl: calc(var(--radius) * 1.4);
|
||||
--radius-2xl: calc(var(--radius) * 1.8);
|
||||
--radius-3xl: calc(var(--radius) * 2.2);
|
||||
--radius-4xl: calc(var(--radius) * 2.6);
|
||||
}
|
||||
|
||||
:root {
|
||||
--background: oklch(1 0 0);
|
||||
--foreground: oklch(0.141 0.005 285.823);
|
||||
--card: oklch(1 0 0);
|
||||
--card-foreground: oklch(0.141 0.005 285.823);
|
||||
--popover: oklch(1 0 0);
|
||||
--popover-foreground: oklch(0.141 0.005 285.823);
|
||||
--primary: oklch(0.21 0.006 285.885);
|
||||
--primary-foreground: oklch(0.985 0 0);
|
||||
--secondary: oklch(0.967 0.001 286.375);
|
||||
--secondary-foreground: oklch(0.21 0.006 285.885);
|
||||
--muted: oklch(0.967 0.001 286.375);
|
||||
--muted-foreground: oklch(0.552 0.016 285.938);
|
||||
--accent: oklch(0.967 0.001 286.375);
|
||||
--accent-foreground: oklch(0.21 0.006 285.885);
|
||||
--destructive: oklch(0.577 0.245 27.325);
|
||||
--border: oklch(0.92 0.004 286.32);
|
||||
--input: oklch(0.92 0.004 286.32);
|
||||
--ring: oklch(0.705 0.015 286.067);
|
||||
--chart-1: oklch(0.871 0.006 286.286);
|
||||
--chart-2: oklch(0.552 0.016 285.938);
|
||||
--chart-3: oklch(0.442 0.017 285.786);
|
||||
--chart-4: oklch(0.37 0.013 285.805);
|
||||
--chart-5: oklch(0.274 0.006 286.033);
|
||||
--radius: 0.625rem;
|
||||
--sidebar: oklch(0.985 0 0);
|
||||
--sidebar-foreground: oklch(0.141 0.005 285.823);
|
||||
--sidebar-primary: oklch(0.21 0.006 285.885);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.967 0.001 286.375);
|
||||
--sidebar-accent-foreground: oklch(0.21 0.006 285.885);
|
||||
--sidebar-border: oklch(0.92 0.004 286.32);
|
||||
--sidebar-ring: oklch(0.705 0.015 286.067);
|
||||
}
|
||||
|
||||
.dark {
|
||||
--background: oklch(0.141 0.005 285.823);
|
||||
--foreground: oklch(0.985 0 0);
|
||||
--card: oklch(0.21 0.006 285.885);
|
||||
--card-foreground: oklch(0.985 0 0);
|
||||
--popover: oklch(0.21 0.006 285.885);
|
||||
--popover-foreground: oklch(0.985 0 0);
|
||||
--primary: oklch(0.92 0.004 286.32);
|
||||
--primary-foreground: oklch(0.21 0.006 285.885);
|
||||
--secondary: oklch(0.274 0.006 286.033);
|
||||
--secondary-foreground: oklch(0.985 0 0);
|
||||
--muted: oklch(0.274 0.006 286.033);
|
||||
--muted-foreground: oklch(0.705 0.015 286.067);
|
||||
--accent: oklch(0.274 0.006 286.033);
|
||||
--accent-foreground: oklch(0.985 0 0);
|
||||
--destructive: oklch(0.704 0.191 22.216);
|
||||
--border: oklch(1 0 0 / 10%);
|
||||
--input: oklch(1 0 0 / 15%);
|
||||
--ring: oklch(0.552 0.016 285.938);
|
||||
--chart-1: oklch(0.871 0.006 286.286);
|
||||
--chart-2: oklch(0.552 0.016 285.938);
|
||||
--chart-3: oklch(0.442 0.017 285.786);
|
||||
--chart-4: oklch(0.37 0.013 285.805);
|
||||
--chart-5: oklch(0.274 0.006 286.033);
|
||||
--sidebar: oklch(0.21 0.006 285.885);
|
||||
--sidebar-foreground: oklch(0.985 0 0);
|
||||
--sidebar-primary: oklch(0.488 0.243 264.376);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.274 0.006 286.033);
|
||||
--sidebar-accent-foreground: oklch(0.985 0 0);
|
||||
--sidebar-border: oklch(1 0 0 / 10%);
|
||||
--sidebar-ring: oklch(0.552 0.016 285.938);
|
||||
}
|
||||
|
||||
@layer base {
|
||||
* {
|
||||
@apply border-border outline-ring/50;
|
||||
}
|
||||
body {
|
||||
@apply bg-background text-foreground;
|
||||
}
|
||||
html {
|
||||
@apply font-sans;
|
||||
}
|
||||
}
|
||||
@import "tailwindcss";
|
||||
@import "tw-animate-css";
|
||||
@import "shadcn/tailwind.css";
|
||||
/* @import "@fontsource-variable/inter"; */
|
||||
|
||||
@custom-variant dark (&:is(.dark *));
|
||||
|
||||
@font-face {
|
||||
font-family: 'Inter Variable';
|
||||
src: url('/Inter-VariableFont_opsz,wght.ttf') format('truetype');
|
||||
font-weight: 100 900;
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
@theme inline {
|
||||
--font-heading: var(--font-sans);
|
||||
--font-sans: 'Inter Variable', sans-serif;
|
||||
--color-sidebar-ring: var(--sidebar-ring);
|
||||
--color-sidebar-border: var(--sidebar-border);
|
||||
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
||||
--color-sidebar-accent: var(--sidebar-accent);
|
||||
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
||||
--color-sidebar-primary: var(--sidebar-primary);
|
||||
--color-sidebar-foreground: var(--sidebar-foreground);
|
||||
--color-sidebar: var(--sidebar);
|
||||
--color-chart-5: var(--chart-5);
|
||||
--color-chart-4: var(--chart-4);
|
||||
--color-chart-3: var(--chart-3);
|
||||
--color-chart-2: var(--chart-2);
|
||||
--color-chart-1: var(--chart-1);
|
||||
--color-ring: var(--ring);
|
||||
--color-input: var(--input);
|
||||
--color-border: var(--border);
|
||||
--color-destructive: var(--destructive);
|
||||
--color-accent-foreground: var(--accent-foreground);
|
||||
--color-accent: var(--accent);
|
||||
--color-muted-foreground: var(--muted-foreground);
|
||||
--color-muted: var(--muted);
|
||||
--color-secondary-foreground: var(--secondary-foreground);
|
||||
--color-secondary: var(--secondary);
|
||||
--color-primary-foreground: var(--primary-foreground);
|
||||
--color-primary: var(--primary);
|
||||
--color-popover-foreground: var(--popover-foreground);
|
||||
--color-popover: var(--popover);
|
||||
--color-card-foreground: var(--card-foreground);
|
||||
--color-card: var(--card);
|
||||
--color-foreground: var(--foreground);
|
||||
--color-background: var(--background);
|
||||
--radius-sm: calc(var(--radius) * 0.6);
|
||||
--radius-md: calc(var(--radius) * 0.8);
|
||||
--radius-lg: var(--radius);
|
||||
--radius-xl: calc(var(--radius) * 1.4);
|
||||
--radius-2xl: calc(var(--radius) * 1.8);
|
||||
--radius-3xl: calc(var(--radius) * 2.2);
|
||||
--radius-4xl: calc(var(--radius) * 2.6);
|
||||
}
|
||||
|
||||
:root {
|
||||
--background: oklch(1 0 0);
|
||||
--foreground: oklch(0.141 0.005 285.823);
|
||||
--card: oklch(1 0 0);
|
||||
--card-foreground: oklch(0.141 0.005 285.823);
|
||||
--popover: oklch(1 0 0);
|
||||
--popover-foreground: oklch(0.141 0.005 285.823);
|
||||
--primary: oklch(0.21 0.006 285.885);
|
||||
--primary-foreground: oklch(0.985 0 0);
|
||||
--secondary: oklch(0.967 0.001 286.375);
|
||||
--secondary-foreground: oklch(0.21 0.006 285.885);
|
||||
--muted: oklch(0.967 0.001 286.375);
|
||||
--muted-foreground: oklch(0.552 0.016 285.938);
|
||||
--accent: oklch(0.967 0.001 286.375);
|
||||
--accent-foreground: oklch(0.21 0.006 285.885);
|
||||
--destructive: oklch(0.577 0.245 27.325);
|
||||
--border: oklch(0.92 0.004 286.32);
|
||||
--input: oklch(0.92 0.004 286.32);
|
||||
--ring: oklch(0.705 0.015 286.067);
|
||||
--chart-1: oklch(0.871 0.006 286.286);
|
||||
--chart-2: oklch(0.552 0.016 285.938);
|
||||
--chart-3: oklch(0.442 0.017 285.786);
|
||||
--chart-4: oklch(0.37 0.013 285.805);
|
||||
--chart-5: oklch(0.274 0.006 286.033);
|
||||
--radius: 0.625rem;
|
||||
--sidebar: oklch(0.985 0 0);
|
||||
--sidebar-foreground: oklch(0.141 0.005 285.823);
|
||||
--sidebar-primary: oklch(0.21 0.006 285.885);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.967 0.001 286.375);
|
||||
--sidebar-accent-foreground: oklch(0.21 0.006 285.885);
|
||||
--sidebar-border: oklch(0.92 0.004 286.32);
|
||||
--sidebar-ring: oklch(0.705 0.015 286.067);
|
||||
}
|
||||
|
||||
.dark {
|
||||
--background: oklch(0.141 0.005 285.823);
|
||||
--foreground: oklch(0.985 0 0);
|
||||
--card: oklch(0.21 0.006 285.885);
|
||||
--card-foreground: oklch(0.985 0 0);
|
||||
--popover: oklch(0.21 0.006 285.885);
|
||||
--popover-foreground: oklch(0.985 0 0);
|
||||
--primary: oklch(0.92 0.004 286.32);
|
||||
--primary-foreground: oklch(0.21 0.006 285.885);
|
||||
--secondary: oklch(0.274 0.006 286.033);
|
||||
--secondary-foreground: oklch(0.985 0 0);
|
||||
--muted: oklch(0.274 0.006 286.033);
|
||||
--muted-foreground: oklch(0.705 0.015 286.067);
|
||||
--accent: oklch(0.274 0.006 286.033);
|
||||
--accent-foreground: oklch(0.985 0 0);
|
||||
--destructive: oklch(0.704 0.191 22.216);
|
||||
--border: oklch(1 0 0 / 10%);
|
||||
--input: oklch(1 0 0 / 15%);
|
||||
--ring: oklch(0.552 0.016 285.938);
|
||||
--chart-1: oklch(0.871 0.006 286.286);
|
||||
--chart-2: oklch(0.552 0.016 285.938);
|
||||
--chart-3: oklch(0.442 0.017 285.786);
|
||||
--chart-4: oklch(0.37 0.013 285.805);
|
||||
--chart-5: oklch(0.274 0.006 286.033);
|
||||
--sidebar: oklch(0.21 0.006 285.885);
|
||||
--sidebar-foreground: oklch(0.985 0 0);
|
||||
--sidebar-primary: oklch(0.488 0.243 264.376);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.274 0.006 286.033);
|
||||
--sidebar-accent-foreground: oklch(0.985 0 0);
|
||||
--sidebar-border: oklch(1 0 0 / 10%);
|
||||
--sidebar-ring: oklch(0.552 0.016 285.938);
|
||||
}
|
||||
|
||||
@layer base {
|
||||
* {
|
||||
@apply border-border outline-ring/50;
|
||||
}
|
||||
body {
|
||||
@apply bg-background text-foreground;
|
||||
}
|
||||
html {
|
||||
@apply font-sans;
|
||||
}
|
||||
}
|
||||
|
||||
/* ─── ProseMirror / Tiptap editor content styles ────────────────────────────
|
||||
Tailwind v4 preflight resets list-style, margins, and blockquote on all
|
||||
elements. We restore them explicitly so toolbar actions are visible.
|
||||
─────────────────────────────────────────────────────────────────────────── */
|
||||
|
||||
.ProseMirror {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.ProseMirror > * + * {
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
|
||||
/* ── Lists ── */
|
||||
.ProseMirror ul {
|
||||
list-style-type: disc;
|
||||
padding-left: 1.5rem;
|
||||
margin: 0.5rem 0;
|
||||
}
|
||||
|
||||
.ProseMirror ol {
|
||||
list-style-type: decimal;
|
||||
padding-left: 1.5rem;
|
||||
margin: 0.5rem 0;
|
||||
}
|
||||
|
||||
.ProseMirror li {
|
||||
margin: 0.2rem 0;
|
||||
}
|
||||
|
||||
.ProseMirror li p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* ── Blockquote ── */
|
||||
.ProseMirror blockquote {
|
||||
border-left: 3px solid var(--border);
|
||||
padding-left: 1rem;
|
||||
color: var(--muted-foreground);
|
||||
font-style: italic;
|
||||
margin: 0.75rem 0;
|
||||
}
|
||||
|
||||
/* ── Headings ── */
|
||||
.ProseMirror h1 {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 700;
|
||||
margin: 0.75rem 0 0.25rem;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.ProseMirror h2 {
|
||||
font-size: 1.25rem;
|
||||
font-weight: 600;
|
||||
margin: 0.75rem 0 0.25rem;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.ProseMirror h3 {
|
||||
font-size: 1.1rem;
|
||||
font-weight: 600;
|
||||
margin: 0.75rem 0 0.25rem;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
/* ── Inline code ── */
|
||||
.ProseMirror code {
|
||||
background: var(--muted);
|
||||
border-radius: 0.25rem;
|
||||
padding: 0.1rem 0.35rem;
|
||||
font-size: 0.85em;
|
||||
font-family: ui-monospace, monospace;
|
||||
}
|
||||
|
||||
/* ── Code block ── */
|
||||
.ProseMirror pre {
|
||||
background: var(--muted);
|
||||
border-radius: 0.375rem;
|
||||
padding: 0.75rem 1rem;
|
||||
overflow-x: auto;
|
||||
margin: 0.5rem 0;
|
||||
}
|
||||
|
||||
.ProseMirror pre code {
|
||||
background: none;
|
||||
padding: 0;
|
||||
font-size: 0.85em;
|
||||
}
|
||||
|
||||
/* ── Horizontal rule ── */
|
||||
.ProseMirror hr {
|
||||
border: none;
|
||||
border-top: 1px solid var(--border);
|
||||
margin: 0.75rem 0;
|
||||
}
|
||||
|
||||
/* ── Links ── */
|
||||
.ProseMirror a {
|
||||
color: var(--primary);
|
||||
text-decoration: underline;
|
||||
cursor: pointer;
|
||||
}
|
||||
@@ -1,26 +1,30 @@
|
||||
/** @type {import('tailwindcss').Config} */
|
||||
export default {
|
||||
content: [
|
||||
"./index.html",
|
||||
"./src/**/*.{js,ts,jsx,tsx}",
|
||||
],
|
||||
content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}"],
|
||||
theme: {
|
||||
extend: {
|
||||
keyframes: {
|
||||
'collapsible-down': {
|
||||
from: { height: '0px', opacity: '0' },
|
||||
to: { height: 'var(--radix-collapsible-content-height)', opacity: '1' },
|
||||
"collapsible-down": {
|
||||
from: { height: "0px", opacity: "0" },
|
||||
to: {
|
||||
height: "var(--radix-collapsible-content-height)",
|
||||
opacity: "1",
|
||||
},
|
||||
},
|
||||
'collapsible-up': {
|
||||
from: { height: 'var(--radix-collapsible-content-height)', opacity: '1' },
|
||||
to: { height: '0px', opacity: '0' },
|
||||
"collapsible-up": {
|
||||
from: {
|
||||
height: "var(--radix-collapsible-content-height)",
|
||||
opacity: "1",
|
||||
},
|
||||
to: { height: "0px", opacity: "0" },
|
||||
},
|
||||
},
|
||||
animation: {
|
||||
'collapsible-down': 'collapsible-down 0.2s cubic-bezier(0.16, 1, 0.3, 1)',
|
||||
'collapsible-up': 'collapsible-up 0.18s cubic-bezier(0.16, 1, 0.3, 1)',
|
||||
"collapsible-down":
|
||||
"collapsible-down 0.2s cubic-bezier(0.16, 1, 0.3, 1)",
|
||||
"collapsible-up": "collapsible-up 0.18s cubic-bezier(0.16, 1, 0.3, 1)",
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [],
|
||||
}
|
||||
plugins: [require("@tailwindcss/typography")],
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user