diff --git a/backend/models/user.go b/backend/models/user.go index 2d402c8..ee42467 100644 --- a/backend/models/user.go +++ b/backend/models/user.go @@ -256,7 +256,7 @@ func (m UserModel) GetUserImages(ctx context.Context, userId uuid.UUID) ([]UserI type ListsWithImages struct { model.Lists - Scheme struct { + Schema struct { model.Schemas SchemaItems []model.SchemaItems diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 36c6138..dce764c 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -9,6 +9,7 @@ import { Entity, SearchPage, AllImages, + List, } from "./pages"; import { SearchImageContextProvider } from "@contexts/SearchImageContext"; import { WithNotifications } from "@contexts/Notifications"; @@ -34,6 +35,7 @@ export const App = () => { + diff --git a/frontend/src/contexts/SearchImageContext.tsx b/frontend/src/contexts/SearchImageContext.tsx index 3b96589..c39edcd 100644 --- a/frontend/src/contexts/SearchImageContext.tsx +++ b/frontend/src/contexts/SearchImageContext.tsx @@ -11,6 +11,7 @@ import { CategoryUnion, getUserImages, JustTheImageWhatAreTheseNames, + List, UserImage, } from "../network"; import { groupPropertiesWithImage } from "../utils/groupPropertiesWithImage"; diff --git a/frontend/src/network/index.ts b/frontend/src/network/index.ts index 04c17e8..5d88b05 100644 --- a/frontend/src/network/index.ts +++ b/frontend/src/network/index.ts @@ -182,10 +182,34 @@ const listValidator = strictObject({ ID: pipe(string(), uuid()), ImageID: pipe(string(), uuid()), ListID: pipe(string(), uuid()), + Items: array( + strictObject({ + ID: pipe(string(), uuid()), + ImageID: pipe(string(), uuid()), + SchemaItemID: pipe(string(), uuid()), + Value: string(), + }), + ), }), ), + + Schema: strictObject({ + ID: pipe(string(), uuid()), + ListID: pipe(string(), uuid()), + SchemaItems: array( + strictObject({ + ID: pipe(string(), uuid()), + SchemaID: pipe(string(), uuid()), + Item: string(), + Value: nullable(string()), + Description: string(), + }), + ), + }), }); +export type List = InferOutput; + const imageRequestValidator = strictObject({ UserImages: array(userImageValidator), ImageProperties: array(dataTypeValidator), diff --git a/frontend/src/pages/front/gallery.tsx b/frontend/src/pages/front/gallery.tsx index db26ff6..36908dc 100644 --- a/frontend/src/pages/front/gallery.tsx +++ b/frontend/src/pages/front/gallery.tsx @@ -60,7 +60,7 @@ export const Categories: Component = () => { {(list) => ( { + const { listId } = useParams(); + + const { lists } = useSearchImageContext(); + + const list = () => lists().find((l) => l.ID === listId); + + return ( + + {(l) => ( + + + + + + {(item) => } + + + + + + {(image) => ( + + + + {(item) => } + + + )} + + +
Image{item.Item}
+ + {item.Value}
+ )} +
+ ); +};