|
138 | 138 | <Skeleton height="h-6" /> |
139 | 139 | <Skeleton height="h-4" /> |
140 | 140 | </div> |
141 | | - {:else if !selectedPet} |
| 141 | + {:else if !selectedPet && currentView !== 'memories'} |
142 | 142 | <EmptyState |
143 | 143 | icon="file-text" |
144 | 144 | title="No pet selected" |
145 | 145 | description="Select a pet from the left panel to view details, add journal entries, and see AI insights." |
146 | 146 | actionText="Add a Pet" |
147 | 147 | onAction={() => { |
148 | | - console.log('Add a Pet clicked'); |
| 148 | + uiHelpers.openCreatePetForm(); |
149 | 149 | }} |
150 | 150 | /> |
151 | 151 | {:else} |
|
167 | 167 | </div> |
168 | 168 | </div> |
169 | 169 |
|
170 | | - <div class="flex space-x-2"> |
171 | | - <button |
172 | | - on:click={() => uiHelpers.setView('dashboard')} |
173 | | - class="nav-button px-3 py-1 rounded-md text-sm" |
174 | | - class:active={currentView === 'dashboard'} |
175 | | - disabled={isArchived(selectedPet)} |
176 | | - > |
177 | | - Dashboard |
178 | | - </button> |
179 | | - <button |
180 | | - on:click={() => uiHelpers.setView('journal')} |
181 | | - class="nav-button px-3 py-1 rounded-md text-sm" |
182 | | - class:active={currentView === 'journal'} |
183 | | - disabled={isArchived(selectedPet)} |
184 | | - > |
185 | | - New Entry |
186 | | - </button> |
187 | | - <button |
188 | | - on:click={() => uiHelpers.setView('history')} |
189 | | - class="nav-button px-3 py-1 rounded-md text-sm" |
190 | | - class:active={currentView === 'history'} |
191 | | - disabled={isArchived(selectedPet)} |
192 | | - > |
193 | | - History |
194 | | - </button> |
195 | | - </div> |
| 170 | + {#if currentView === 'memories'} |
| 171 | + <div class="flex space-x-2"> |
| 172 | + <button |
| 173 | + on:click={() => { |
| 174 | + // return to dashboard; select first active pet if available |
| 175 | + const firstActive = (pets || []).find((p) => !p.archived) || null; |
| 176 | + if (firstActive) { |
| 177 | + selectedPetHelpers.select(firstActive.id); |
| 178 | + } else { |
| 179 | + selectedPetHelpers.clear(); |
| 180 | + } |
| 181 | + uiHelpers.setView('dashboard'); |
| 182 | + }} |
| 183 | + class="nav-button px-3 py-1 rounded-md text-sm" |
| 184 | + > |
| 185 | + Back to Dashboard |
| 186 | + </button> |
| 187 | + </div> |
| 188 | + {/if} |
196 | 189 | </div> |
197 | 190 | </div> |
198 | 191 |
|
|
223 | 216 | <div class="flex items-center justify-between"> |
224 | 217 | <div> |
225 | 218 | <div class="text-base font-semibold" style="color: var(--petalytics-text);">Memories</div> |
226 | | - <div class="text-xs" style="color: var(--petalytics-subtle);">All archived pets</div> |
| 219 | + <div class="text-xs" style="color: var(--petalytics-subtle);">Archived memories</div> |
227 | 220 | </div> |
228 | 221 | <div class="text-xs px-2 py-1 rounded" style="background: var(--petalytics-surface); color: var(--petalytics-subtle);"> |
229 | 222 | {archivedPetsList().length} pets |
|
261 | 254 | {/each} |
262 | 255 | {/if} |
263 | 256 | </div> |
264 | | - {:else if currentView === 'dashboard'} |
| 257 | + {:else if currentView === 'dashboard' && selectedPet} |
265 | 258 | <!-- Dashboard View --> |
266 | 259 | <div class="dashboard-grid space-y-4"> |
267 | 260 | <!-- Stats Cards --> |
|
381 | 374 | </div> |
382 | 375 | </div> |
383 | 376 | </div> |
384 | | - {:else if currentView === 'journal'} |
| 377 | + {:else if currentView === 'journal' && selectedPet} |
385 | 378 | <!-- Journal Entry Form --> |
386 | 379 | <div class="journal-form max-w-2xl mx-auto"> |
387 | 380 | <div class="form-card p-6 rounded-lg" style="background: var(--petalytics-surface);"> |
|
479 | 472 | </div> |
480 | 473 | </div> |
481 | 474 | </div> |
482 | | - {:else if currentView === 'history'} |
| 475 | + {:else if currentView === 'history' && selectedPet} |
483 | 476 | <!-- History View --> |
484 | 477 | <div class="history-view max-w-4xl mx-auto"> |
485 | 478 | <h3 class="text-xl font-semibold mb-4" style="color: var(--petalytics-text);"> |
|
551 | 544 | transition: all 0.2s; |
552 | 545 | } |
553 | 546 |
|
554 | | - .nav-button.active { |
555 | | - background: var(--petalytics-accent); |
556 | | - color: var(--petalytics-bg); |
557 | | - } |
558 | | -
|
559 | | - .nav-button:hover:not(.active) { |
| 547 | + .nav-button:hover { |
560 | 548 | opacity: 0.8; |
| 549 | + background: var(--petalytics-highlight-low); |
561 | 550 | } |
562 | 551 | </style> |
0 commit comments