Skip to content

Commit 17c2e5e

Browse files
authored
Merge pull request #66 from pvdthings/web-thing-details
Web: (Fixes) Thing Details - Iteration 1
2 parents 1ef611e + bd460a5 commit 17c2e5e

File tree

4 files changed

+20
-25
lines changed

4 files changed

+20
-25
lines changed

apps/web/src/lib/components/Drawer/Contents.svelte

Lines changed: 0 additions & 3 deletions
This file was deleted.

apps/web/src/lib/components/Drawer/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

apps/web/src/lib/components/Shell/Shell.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525

2626
<div class="drawer drawer-end">
2727
<input id="drawer-toggle" type="checkbox" class="drawer-toggle" />
28-
<div class="flex flex-col w-screen h-screen overflow-hidden drawer-content">
28+
<div class="flex flex-col h-dvh w-screen overflow-hidden drawer-content">
2929
<label bind:this={drawerToggle} for="drawer-toggle" />
3030
<slot />
3131
</div>
3232
<div class="drawer-side z-50">
3333
<label for="drawer-toggle" aria-label="close sidebar" class="drawer-overlay"></label>
34-
<div class="bg-base-200 text-base-content h-screen">
34+
<div class="bg-base-200 text-base-content flex flex-col h-dvh w-screen overflow-hidden md:w-80 lg:w-96 relative">
3535
<svelte:component this={drawerContent} {...drawerContentProps} />
3636
</div>
3737
</div>

apps/web/src/lib/components/things/Details/DetailsView.svelte

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,30 @@
22
import AbsoluteCenter from '$lib/components/AbsoluteCenter.svelte';
33
import { things } from '$lib/stores/things';
44
import LoadingSpinner from '$lib/components/LoadingSpinner.svelte';
5-
import Contents from '$lib/components/Drawer';
65
import Details from './Details.svelte';
6+
import { locale } from '$lib/language/translate';
77
88
export let id: string;
99
1010
$: details = things.details(id);
1111
$: loading = $details.loading;
1212
$: thing = $details.value;
13+
$: thingName = $locale === 'en' ? thing?.name : thing?.spanishName ?? thing?.name;
1314
</script>
1415

15-
<Contents>
16-
{#if loading}
17-
<AbsoluteCenter>
18-
<LoadingSpinner />
19-
</AbsoluteCenter>
20-
{:else}
21-
<Details
22-
id={thing.id}
23-
name={thing.name}
24-
image={thing.image}
25-
categories={thing.categories}
26-
stock={thing.stock}
27-
available={thing.available}
28-
availableDate={thing.availableDate}
29-
items={thing.items}
30-
/>
31-
{/if}
32-
</Contents>
16+
{#if loading}
17+
<AbsoluteCenter>
18+
<LoadingSpinner />
19+
</AbsoluteCenter>
20+
{:else}
21+
<Details
22+
id={thing.id}
23+
name={thingName}
24+
image={thing.image}
25+
categories={thing.categories}
26+
stock={thing.stock}
27+
available={thing.available}
28+
availableDate={thing.availableDate}
29+
items={thing.items}
30+
/>
31+
{/if}

0 commit comments

Comments
 (0)