diff --git a/web/src/pages/FaceLibrary.tsx b/web/src/pages/FaceLibrary.tsx index 419692a0b..4a0dfa20e 100644 --- a/web/src/pages/FaceLibrary.tsx +++ b/web/src/pages/FaceLibrary.tsx @@ -1,12 +1,19 @@ import { baseUrl } from "@/api/baseUrl"; import Chip from "@/components/indicators/Chip"; +import { Button } from "@/components/ui/button"; +import { Form, FormControl, FormField, FormItem } from "@/components/ui/form"; +import { Input } from "@/components/ui/input"; import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area"; import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group"; import useOptimisticState from "@/hooks/use-optimistic-state"; +import { zodResolver } from "@hookform/resolvers/zod"; import { useEffect, useMemo, useRef, useState } from "react"; import { isDesktop } from "react-device-detect"; +import { useForm } from "react-hook-form"; +import { FaPlus } from "react-icons/fa"; import { LuTrash } from "react-icons/lu"; import useSWR from "swr"; +import { z } from "zod"; export default function FaceLibrary() { const [page, setPage] = useState(); @@ -34,6 +41,24 @@ export default function FaceLibrary() { // eslint-disable-next-line react-hooks/exhaustive-deps }, [faces]); + /** + * + */ + + const formSchema = z.object({ + image: z + .instanceof(File, { message: "Please select an image file." }) + .refine((file) => file.size < 1000000, "Image size is too large."), + }); + + const form = useForm>({ + resolver: zodResolver(formSchema), + mode: "onChange", + }); + return (
@@ -65,6 +90,21 @@ export default function FaceLibrary() {
+
+ + ( + + + + + + )} + /> + +
{pageToggle && (