refactor: moving to components

This commit is contained in:
2025-07-18 15:28:34 +01:00
parent 1a9731c4bb
commit 5130691ab9
5 changed files with 52 additions and 41 deletions

View File

@@ -0,0 +1,31 @@
import { ImageComponent } from "@components/image";
import { ConcreteItemModal } from "@components/item-modal/ItemModal";
import { useSearchImageContext } from "@contexts/SearchImageContext";
import { useParams } from "@solidjs/router";
import { Component, For, Show } from "solid-js";
export const Entity: Component = () => {
const params = useParams<{ entityId: string }>();
const { images } = useSearchImageContext();
const entity = () => images().find((i) => i.data.ID === params.entityId);
return (
<div>
<Show
when={entity()}
fallback={<>Sorry, this entity could not be found</>}
>
{(e) => (
<div>
<ConcreteItemModal item={e()} />
<For each={e().data.Images}>
{(imageId) => <ImageComponent ID={imageId} />}
</For>
</div>
)}
</Show>
</div>
);
};

View File

@@ -3,3 +3,4 @@ export * from "./gallery";
export * from "./image";
export * from "./settings";
export * from "./login";
export * from "./entity";