Fraser commited on
Commit
e7b0a32
·
1 Parent(s): f12c994

another try

Browse files
src/App.svelte CHANGED
@@ -1,6 +1,7 @@
1
  <script lang="ts">
2
  import { onMount } from 'svelte';
3
  import { authStore } from './lib/stores/auth';
 
4
  import AppHeader from './lib/components/Layout/AppHeader.svelte';
5
  import TabBar, { type TabId } from './lib/components/Layout/TabBar.svelte';
6
  import Scanner from './lib/components/Pages/Scanner.svelte';
@@ -30,6 +31,16 @@
30
  // Auth state from store
31
  const auth = $derived(authStore);
32
 
 
 
 
 
 
 
 
 
 
 
33
  onMount(async () => {
34
  // Load HF libraries
35
  const script1 = document.createElement('script');
@@ -110,9 +121,11 @@
110
  </script>
111
 
112
  <div class="app">
113
- <AppHeader {hfAuth} currentTab={tabNames[activeTab]} />
 
 
114
 
115
- <main class="app-content">
116
  {#if activeTab === 'scanner'}
117
  <Scanner
118
  {fluxClient}
@@ -126,7 +139,9 @@
126
  {/if}
127
  </main>
128
 
129
- <TabBar {activeTab} onTabChange={handleTabChange} />
 
 
130
  </div>
131
 
132
  <style>
@@ -146,6 +161,10 @@
146
  padding-bottom: calc(70px + env(safe-area-inset-bottom, 0));
147
  }
148
 
 
 
 
 
149
  /* Ensure content scrolls properly on iOS */
150
  :global(.app-content > *) {
151
  height: 100%;
 
1
  <script lang="ts">
2
  import { onMount } from 'svelte';
3
  import { authStore } from './lib/stores/auth';
4
+ import { uiStore } from './lib/stores/ui';
5
  import AppHeader from './lib/components/Layout/AppHeader.svelte';
6
  import TabBar, { type TabId } from './lib/components/Layout/TabBar.svelte';
7
  import Scanner from './lib/components/Pages/Scanner.svelte';
 
31
  // Auth state from store
32
  const auth = $derived(authStore);
33
 
34
+ // UI state
35
+ let isDetailPageOpen = $state(false);
36
+
37
+ $effect(() => {
38
+ const unsubscribe = uiStore.subscribe(state => {
39
+ isDetailPageOpen = state.isDetailPageOpen;
40
+ });
41
+ return unsubscribe;
42
+ });
43
+
44
  onMount(async () => {
45
  // Load HF libraries
46
  const script1 = document.createElement('script');
 
121
  </script>
122
 
123
  <div class="app">
124
+ {#if !isDetailPageOpen}
125
+ <AppHeader {hfAuth} currentTab={tabNames[activeTab]} />
126
+ {/if}
127
 
128
+ <main class="app-content" class:detail-open={isDetailPageOpen}>
129
  {#if activeTab === 'scanner'}
130
  <Scanner
131
  {fluxClient}
 
139
  {/if}
140
  </main>
141
 
142
+ {#if !isDetailPageOpen}
143
+ <TabBar {activeTab} onTabChange={handleTabChange} />
144
+ {/if}
145
  </div>
146
 
147
  <style>
 
161
  padding-bottom: calc(70px + env(safe-area-inset-bottom, 0));
162
  }
163
 
164
+ .app-content.detail-open {
165
+ padding-bottom: 0;
166
+ }
167
+
168
  /* Ensure content scrolls properly on iOS */
169
  :global(.app-content > *) {
170
  height: 100%;
src/lib/components/Piclets/PicletDetail.svelte CHANGED
@@ -1,6 +1,8 @@
1
  <script lang="ts">
 
2
  import type { PicletInstance } from '$lib/db/schema';
3
  import { deletePicletInstance } from '$lib/db/piclets';
 
4
 
5
  interface Props {
6
  instance: PicletInstance;
@@ -13,6 +15,13 @@
13
  let selectedTab = $state<'about' | 'stats' | 'actions'>('about');
14
  let expandedMoves = $state(new Set<number>());
15
 
 
 
 
 
 
 
 
16
  async function handleDelete() {
17
  if (!instance.id) return;
18
 
@@ -46,8 +55,7 @@
46
  }
47
  </script>
48
 
49
- <div class="detail-backdrop">
50
- <div class="detail-page">
51
  <div class="navigation-bar">
52
  <button class="back-btn" onclick={onClose}>
53
  <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
@@ -224,32 +232,19 @@
224
  {/if}
225
  </div>
226
  </div>
227
- </div>
228
  </div>
229
 
230
  <style>
231
- .detail-backdrop {
232
- position: fixed;
233
- top: 0;
234
- left: 0;
235
- right: 0;
236
- bottom: 0;
237
- z-index: 9998;
238
- background: rgba(0, 0, 0, 0.5);
239
- }
240
-
241
  .detail-page {
242
- position: absolute;
243
  top: 0;
244
  left: 0;
245
  right: 0;
246
  bottom: 0;
247
  background: #f2f2f7;
248
- z-index: 9999;
249
  display: flex;
250
  flex-direction: column;
251
- transform: translateZ(0);
252
- -webkit-transform: translateZ(0);
253
  }
254
 
255
  /* Navigation Bar */
 
1
  <script lang="ts">
2
+ import { onMount } from 'svelte';
3
  import type { PicletInstance } from '$lib/db/schema';
4
  import { deletePicletInstance } from '$lib/db/piclets';
5
+ import { uiStore } from '$lib/stores/ui';
6
 
7
  interface Props {
8
  instance: PicletInstance;
 
15
  let selectedTab = $state<'about' | 'stats' | 'actions'>('about');
16
  let expandedMoves = $state(new Set<number>());
17
 
18
+ onMount(() => {
19
+ uiStore.openDetailPage();
20
+ return () => {
21
+ uiStore.closeDetailPage();
22
+ };
23
+ });
24
+
25
  async function handleDelete() {
26
  if (!instance.id) return;
27
 
 
55
  }
56
  </script>
57
 
58
+ <div class="detail-page">
 
59
  <div class="navigation-bar">
60
  <button class="back-btn" onclick={onClose}>
61
  <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
 
232
  {/if}
233
  </div>
234
  </div>
 
235
  </div>
236
 
237
  <style>
 
 
 
 
 
 
 
 
 
 
238
  .detail-page {
239
+ position: fixed;
240
  top: 0;
241
  left: 0;
242
  right: 0;
243
  bottom: 0;
244
  background: #f2f2f7;
245
+ z-index: 1000;
246
  display: flex;
247
  flex-direction: column;
 
 
248
  }
249
 
250
  /* Navigation Bar */
src/lib/stores/ui.ts ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { writable } from 'svelte/store';
2
+
3
+ interface UIState {
4
+ isDetailPageOpen: boolean;
5
+ }
6
+
7
+ function createUIStore() {
8
+ const { subscribe, set, update } = writable<UIState>({
9
+ isDetailPageOpen: false
10
+ });
11
+
12
+ return {
13
+ subscribe,
14
+ openDetailPage: () => update(state => ({ ...state, isDetailPageOpen: true })),
15
+ closeDetailPage: () => update(state => ({ ...state, isDetailPageOpen: false }))
16
+ };
17
+ }
18
+
19
+ export const uiStore = createUIStore();