{#if status === 'available'}
{/if}
diff --git a/apps/web/src/lib/components/things/Details/Item/ItemDetails.svelte b/apps/web/src/lib/components/things/Details/Item/ItemDetails.svelte
new file mode 100644
index 0000000..d362513
--- /dev/null
+++ b/apps/web/src/lib/components/things/Details/Item/ItemDetails.svelte
@@ -0,0 +1,62 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/apps/web/src/lib/components/things/Details/Item/ItemDetailsView.svelte b/apps/web/src/lib/components/things/Details/Item/ItemDetailsView.svelte
new file mode 100644
index 0000000..41dcdd4
--- /dev/null
+++ b/apps/web/src/lib/components/things/Details/Item/ItemDetailsView.svelte
@@ -0,0 +1,30 @@
+
+
+{#if loading}
+
+
+
+{:else}
+
+{/if}
diff --git a/apps/web/src/lib/components/things/Details/Item/index.ts b/apps/web/src/lib/components/things/Details/Item/index.ts
new file mode 100644
index 0000000..6d37c88
--- /dev/null
+++ b/apps/web/src/lib/components/things/Details/Item/index.ts
@@ -0,0 +1 @@
+export { default as ItemDetailsView } from "./ItemDetailsView.svelte";
\ No newline at end of file
diff --git a/apps/web/src/lib/components/things/ThingCardView.svelte b/apps/web/src/lib/components/things/ThingCardView.svelte
index c846a3e..2675839 100644
--- a/apps/web/src/lib/components/things/ThingCardView.svelte
+++ b/apps/web/src/lib/components/things/ThingCardView.svelte
@@ -4,18 +4,16 @@
import type { Thing } from '$lib/models/Thing';
import ThingCard from './ThingCard.svelte';
import { vibrate } from '$lib/utils/haptics';
- import { getShellContext } from '../Shell/ShellContext';
import Details from './Details';
+ import { push } from '$lib/components/Shell/Drawer';
export let thing: Thing;
$: bookmarked = $bookmarks.find((t) => t === thing.id) !== undefined;
$: thingName = $locale === 'en' ? thing.name : thing.spanishName ?? thing.name;
- const { drawer } = getShellContext();
-
const openThingDetails = () => {
- drawer.open(Details, { id: thing.id });
+ push(Details, { id: thing.id });
vibrate();
};
diff --git a/apps/web/src/lib/language/translations.ts b/apps/web/src/lib/language/translations.ts
index 9cc4866..ebd7f83 100644
--- a/apps/web/src/lib/language/translations.ts
+++ b/apps/web/src/lib/language/translations.ts
@@ -1,5 +1,6 @@
export default {
en: {
+ "Attachments": "Attachments",
"Button.Home": "Home",
"Button.WishList": "Wish List",
"Name": "Name",
@@ -7,6 +8,8 @@ export default {
"Categories": "Categories",
"Inventory": "Inventory",
"Input.Search": "Search...",
+ "Brand": "Brand",
+ "None": "None",
"No Results": "No Results",
"No Brand": "No Brand",
"Donate": "Donate",
@@ -49,6 +52,7 @@ export default {
"Due Back Disclaimer": "We cannot guarantee that the item will be returned by the expected due date. Please check with the Lead Librarian during open hours."
},
es: {
+ "Attachments": "Archivos adjuntos",
"Button.Home": "Inicio",
"Button.Donate": "Done",
"Button.WishList": "Donaciones",
@@ -57,7 +61,9 @@ export default {
"Categories": "CategorÃas",
"Inventory": "Inventario",
"Input.Search": "Buscar...",
+ "None": "Nada",
"No Results": "No hay resultados",
+ "Brand": "Marca",
"No Brand": "No Marca",
"Donate": "Donar",
"How to Borrow": "Como pedir prestado",
diff --git a/apps/web/src/lib/models/ItemDetails.ts b/apps/web/src/lib/models/ItemDetails.ts
new file mode 100644
index 0000000..84fd77e
--- /dev/null
+++ b/apps/web/src/lib/models/ItemDetails.ts
@@ -0,0 +1,14 @@
+export type ItemDetailsModel = {
+ id: string;
+ image?: string;
+ name: string;
+ spanishName?: string;
+ number: number;
+ available: boolean;
+ availableDate?: string;
+ brand?: string;
+ condition?: string;
+ hidden: boolean;
+ manuals: string[];
+ status: 'available'|'checkedOut';
+};
\ No newline at end of file
diff --git a/apps/web/src/lib/stores/items.ts b/apps/web/src/lib/stores/items.ts
new file mode 100644
index 0000000..3efbb6b
--- /dev/null
+++ b/apps/web/src/lib/stores/items.ts
@@ -0,0 +1,42 @@
+import type { ItemDetailsModel } from "$lib/models/ItemDetails";
+import { derived, get, readable, writable, type Readable } from "svelte/store";
+import type { Async } from "./types";
+
+function createItemsRepository() {
+ const items = writable(new Map());
+ const subscribe = items.subscribe;
+ const unsubscribe = items.subscribe(_ => {});
+
+ const details = (id: string): Readable
> => {
+ const itemsValue = get(items);
+
+ if (itemsValue.has(id)) {
+ return readable({
+ loading: false,
+ value: itemsValue[id]
+ });
+ }
+
+ const result = writable({
+ loading: true,
+ value: undefined
+ });
+
+ fetch(`/api/items/${id}`).then((r) => r.json()).then((model) => {
+ result.update((r) => ({
+ loading: false,
+ value: model
+ }));
+ });
+
+ return derived(result, (r) => r);
+ };
+
+ return {
+ subscribe,
+ unsubscribe,
+ details
+ };
+}
+
+export const items = createItemsRepository();
\ No newline at end of file
diff --git a/apps/web/src/lib/stores/things.ts b/apps/web/src/lib/stores/things.ts
index 4a4a526..6967f72 100644
--- a/apps/web/src/lib/stores/things.ts
+++ b/apps/web/src/lib/stores/things.ts
@@ -1,10 +1,6 @@
import type { ThingDetailsModel } from "$lib/models/ThingDetails";
import { derived, get, readable, writable, type Readable } from "svelte/store";
-
-type Async = {
- loading: boolean;
- value: T;
-};
+import type { Async } from "./types";
function createThingsRepository() {
const things = writable(new Map());
diff --git a/apps/web/src/lib/stores/types.ts b/apps/web/src/lib/stores/types.ts
new file mode 100644
index 0000000..bb9bc51
--- /dev/null
+++ b/apps/web/src/lib/stores/types.ts
@@ -0,0 +1,4 @@
+export type Async = {
+ loading: boolean;
+ value: T;
+};
\ No newline at end of file
diff --git a/apps/web/src/routes/+layout.svelte b/apps/web/src/routes/+layout.svelte
index a41afce..8315988 100644
--- a/apps/web/src/routes/+layout.svelte
+++ b/apps/web/src/routes/+layout.svelte
@@ -1,6 +1,7 @@