diff --git a/src/app/store/authStore.ts b/src/app/store/authStore.ts index c77273d..2227dd1 100644 --- a/src/app/store/authStore.ts +++ b/src/app/store/authStore.ts @@ -12,6 +12,7 @@ export interface AuthUser { phone?: string; role?: string; avatar?: string; + createdAt?: string; } interface AuthState { diff --git a/src/components/avatarUpload.tsx b/src/components/avatarUpload.tsx new file mode 100644 index 0000000..7ef341c --- /dev/null +++ b/src/components/avatarUpload.tsx @@ -0,0 +1,157 @@ +import { useRef, useState } from "react"; +import { useTranslation } from "react-i18next"; +import { Upload, X, Loader2 } from "lucide-react"; +import { cn } from "@/lib/utils"; +import { postFile, buildFileUrl } from "@/features/shared/api/sharedApi"; + +// ─── Types ──────────────────────────────────────────────────────────────────── + +interface AvatarUploadProps { + label?: string; + value?: string; + onChange?: (url: string) => void; + error?: string; + required?: boolean; + disabled?: boolean; +} + +// ─── FieldLabel ─────────────────────────────────────────────────────────────── + +function FieldLabel({ label, required }: { label?: string; required?: boolean }) { + if (!label) return null; + return ( + + ); +} + +// ─── ErrorMsg ───────────────────────────────────────────────────────────────── + +function ErrorMsg({ error }: { error?: string }) { + if (!error) return null; + return ( +
+ + {error} +
+ ); +} + +// ─── AvatarUpload ───────────────────────────────────────────────────────────── + +export function AvatarUpload({ label, value, onChange, error, required, disabled }: AvatarUploadProps) { + const { t } = useTranslation(); + const inputRef = useRefNetije tapylmady
) : ( diff --git a/src/components/infiniteSelect.tsx b/src/components/infiniteSelect.tsx index 9d69003..60a9893 100644 --- a/src/components/infiniteSelect.tsx +++ b/src/components/infiniteSelect.tsx @@ -170,7 +170,7 @@ export function InfiniteSelect({
-
- )
+ );
},
...components,
}}
{...props}
/>
- )
+ );
}
function CalendarDayButton({
@@ -185,12 +129,12 @@ function CalendarDayButton({
locale,
...props
}: React.ComponentProps