{item.description}
{item.cost_mana} ⚡ · остаток {item.stock}
diff --git a/frontend/src/components/admin/AdminStoreManager.tsx b/frontend/src/components/admin/AdminStoreManager.tsx new file mode 100644 index 0000000..ae40271 --- /dev/null +++ b/frontend/src/components/admin/AdminStoreManager.tsx @@ -0,0 +1,237 @@ +'use client'; + +import { FormEvent, useMemo, useState } from 'react'; +import { useRouter } from 'next/navigation'; + +import { apiFetch } from '../../lib/api'; + +export type StoreItem = { + id: number; + name: string; + description: string; + cost_mana: number; + stock: number; + image_url: string | null; +}; + +interface Props { + token: string; + items: StoreItem[]; +} + +interface FormState { + name: string; + description: string; + cost_mana: number; + stock: number; + image_url: string; +} + +const emptyForm: FormState = { + name: '', + description: '', + cost_mana: 0, + stock: 0, + image_url: '', +}; + +export function AdminStoreManager({ token, items }: Props) { + const router = useRouter(); + const [selectedId, setSelectedId] = useState+ Управляйте призами: загружайте изображения, задавайте стоимость в мане и поддерживайте актуальный остаток. +
+ ++ {status} +
+ )} + {error && ( ++ {error} +
+ )} +