feat: redesign collection UI with WanderLog-inspired card style
- CollectionCard: hero image with gradient overlay, title/date on image in white, glass pill status badges, compact stats footer, removes 'Open Details' button (entire card is clickable) - collections page: clean white bg, underline tabs, 'New Collection' button in header, responsive grid starts at md breakpoint - Fix empty dropdown for viewonly type, remove debug console.log, add aria-label to card container
This commit is contained in:
@@ -1,8 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { createEventDispatcher } from 'svelte';
|
import { createEventDispatcher } from 'svelte';
|
||||||
|
|
||||||
import Launch from '~icons/mdi/launch';
|
|
||||||
|
|
||||||
import FileDocumentEdit from '~icons/mdi/file-document-edit';
|
import FileDocumentEdit from '~icons/mdi/file-document-edit';
|
||||||
import ArchiveArrowDown from '~icons/mdi/archive-arrow-down';
|
import ArchiveArrowDown from '~icons/mdi/archive-arrow-down';
|
||||||
import ArchiveArrowUp from '~icons/mdi/archive-arrow-up';
|
import ArchiveArrowUp from '~icons/mdi/archive-arrow-up';
|
||||||
@@ -25,7 +23,6 @@
|
|||||||
import Eye from '~icons/mdi/eye';
|
import Eye from '~icons/mdi/eye';
|
||||||
import EyeOff from '~icons/mdi/eye-off';
|
import EyeOff from '~icons/mdi/eye-off';
|
||||||
import Check from '~icons/mdi/check';
|
import Check from '~icons/mdi/check';
|
||||||
import MapMarker from '~icons/mdi/map-marker-multiple';
|
|
||||||
import LinkIcon from '~icons/mdi/link';
|
import LinkIcon from '~icons/mdi/link';
|
||||||
import DownloadIcon from '~icons/mdi/download';
|
import DownloadIcon from '~icons/mdi/download';
|
||||||
import ContentCopy from '~icons/mdi/content-copy';
|
import ContentCopy from '~icons/mdi/content-copy';
|
||||||
@@ -98,7 +95,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function archiveCollection(is_archived: boolean) {
|
async function archiveCollection(is_archived: boolean) {
|
||||||
console.log(JSON.stringify({ is_archived: is_archived }));
|
|
||||||
let res = await fetch(`/api/collections/${collection.id}/`, {
|
let res = await fetch(`/api/collections/${collection.id}/`, {
|
||||||
method: 'PATCH',
|
method: 'PATCH',
|
||||||
headers: {
|
headers: {
|
||||||
@@ -146,6 +142,43 @@
|
|||||||
$: locationLength =
|
$: locationLength =
|
||||||
'location_count' in collection ? collection.location_count : collection.locations.length;
|
'location_count' in collection ? collection.location_count : collection.locations.length;
|
||||||
|
|
||||||
|
function formatCollectionDate(dateString: string) {
|
||||||
|
return new Date(dateString).toLocaleDateString('en-GB', {
|
||||||
|
timeZone: 'UTC',
|
||||||
|
month: 'short',
|
||||||
|
day: 'numeric',
|
||||||
|
year: 'numeric'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$: dateRangeString =
|
||||||
|
collection.start_date && collection.end_date
|
||||||
|
? `${formatCollectionDate(collection.start_date)} – ${formatCollectionDate(collection.end_date)}`
|
||||||
|
: collection.start_date
|
||||||
|
? formatCollectionDate(collection.start_date)
|
||||||
|
: collection.end_date
|
||||||
|
? formatCollectionDate(collection.end_date)
|
||||||
|
: '';
|
||||||
|
|
||||||
|
$: days =
|
||||||
|
collection.start_date && collection.end_date
|
||||||
|
? Math.floor(
|
||||||
|
(new Date(collection.end_date).getTime() - new Date(collection.start_date).getTime()) /
|
||||||
|
(1000 * 60 * 60 * 24)
|
||||||
|
) + 1
|
||||||
|
: null;
|
||||||
|
|
||||||
|
function goToCollection() {
|
||||||
|
goto(`/collections/${collection.id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleCardKeydown(event: KeyboardEvent) {
|
||||||
|
if (event.key === 'Enter' || event.key === ' ') {
|
||||||
|
event.preventDefault();
|
||||||
|
goToCollection();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function deleteCollection() {
|
async function deleteCollection() {
|
||||||
let res = await fetch(`/api/collections/${collection.id}`, {
|
let res = await fetch(`/api/collections/${collection.id}`, {
|
||||||
method: 'DELETE'
|
method: 'DELETE'
|
||||||
@@ -177,55 +210,70 @@
|
|||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="card w-full max-w-md bg-base-300 shadow hover:shadow-md transition-all duration-200 border border-base-300 group"
|
class="bg-base-100 rounded-2xl shadow hover:shadow-xl transition-all overflow-hidden w-full cursor-pointer group"
|
||||||
|
role="link"
|
||||||
|
aria-label={collection.name}
|
||||||
|
tabindex="0"
|
||||||
|
on:click={goToCollection}
|
||||||
|
on:keydown={handleCardKeydown}
|
||||||
>
|
>
|
||||||
<!-- Image Carousel -->
|
<div class="relative h-56 overflow-hidden card-carousel-tall">
|
||||||
<div class="relative overflow-hidden rounded-t-2xl">
|
|
||||||
<CardCarousel images={location_images} name={collection.name} icon="📚" />
|
<CardCarousel images={location_images} name={collection.name} icon="📚" />
|
||||||
|
<div
|
||||||
|
class="absolute inset-0 bg-gradient-to-t from-black/70 via-black/20 to-transparent pointer-events-none z-10"
|
||||||
|
></div>
|
||||||
|
|
||||||
<!-- Status Badge Overlay -->
|
<div class="absolute top-3 left-3 z-20 flex gap-1.5">
|
||||||
<div class="absolute top-2 left-4 flex items-center gap-2">
|
|
||||||
{#if collection.status === 'folder'}
|
{#if collection.status === 'folder'}
|
||||||
<div class="badge badge-sm badge-neutral shadow-sm">
|
<div
|
||||||
|
class="flex items-center gap-1 bg-black/40 backdrop-blur-sm text-white rounded-full px-2.5 py-1 text-xs font-medium"
|
||||||
|
>
|
||||||
📁 {$t('adventures.folder')}
|
📁 {$t('adventures.folder')}
|
||||||
</div>
|
</div>
|
||||||
{:else if collection.status === 'upcoming'}
|
{:else if collection.status === 'upcoming'}
|
||||||
<div class="badge badge-sm badge-info shadow-sm">
|
<div
|
||||||
|
class="flex items-center gap-1 bg-black/40 backdrop-blur-sm text-white rounded-full px-2.5 py-1 text-xs font-medium"
|
||||||
|
>
|
||||||
🚀 {$t('adventures.upcoming')}
|
🚀 {$t('adventures.upcoming')}
|
||||||
</div>
|
</div>
|
||||||
{#if collection.days_until_start !== null}
|
{#if collection.days_until_start !== null}
|
||||||
<div class="badge badge-sm badge-accent shadow-sm">
|
<div
|
||||||
|
class="flex items-center gap-1 bg-black/40 backdrop-blur-sm text-white rounded-full px-2.5 py-1 text-xs font-medium"
|
||||||
|
>
|
||||||
⏳ {collection.days_until_start}
|
⏳ {collection.days_until_start}
|
||||||
{collection.days_until_start === 1 ? $t('adventures.day') : $t('adventures.days')}
|
{collection.days_until_start === 1 ? $t('adventures.day') : $t('adventures.days')}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
{:else if collection.status === 'in_progress'}
|
{:else if collection.status === 'in_progress'}
|
||||||
<div class="badge badge-sm badge-success shadow-sm">
|
<div
|
||||||
|
class="flex items-center gap-1 bg-black/40 backdrop-blur-sm text-white rounded-full px-2.5 py-1 text-xs font-medium"
|
||||||
|
>
|
||||||
🎯 {$t('adventures.in_progress')}
|
🎯 {$t('adventures.in_progress')}
|
||||||
</div>
|
</div>
|
||||||
{:else if collection.status === 'completed'}
|
{:else if collection.status === 'completed'}
|
||||||
<div class="badge badge-sm badge-primary shadow-sm">
|
<div
|
||||||
<Check class="w-4 h-4" />
|
class="flex items-center gap-1 bg-black/40 backdrop-blur-sm text-white rounded-full px-2.5 py-1 text-xs font-medium"
|
||||||
|
>
|
||||||
|
<Check class="w-3.5 h-3.5" />
|
||||||
{$t('adventures.completed')}
|
{$t('adventures.completed')}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
{#if collection.is_archived}
|
{#if collection.is_archived}
|
||||||
<div class="badge badge-sm badge-warning shadow-sm">
|
<div
|
||||||
|
class="flex items-center gap-1 bg-black/40 backdrop-blur-sm text-white rounded-full px-2.5 py-1 text-xs font-medium"
|
||||||
|
>
|
||||||
{$t('adventures.archived')}
|
{$t('adventures.archived')}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Privacy Indicator -->
|
<div class="absolute top-3 right-3 z-20 flex items-center gap-1.5">
|
||||||
<div class="absolute top-2 right-4">
|
|
||||||
<div
|
<div
|
||||||
class="tooltip tooltip-left"
|
class="tooltip tooltip-left"
|
||||||
data-tip={collection.is_public ? $t('adventures.public') : $t('adventures.private')}
|
data-tip={collection.is_public ? $t('adventures.public') : $t('adventures.private')}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="badge badge-sm {collection.is_public
|
class="flex items-center justify-center bg-black/40 backdrop-blur-sm text-white rounded-full w-7 h-7"
|
||||||
? 'badge-secondary'
|
|
||||||
: 'badge-ghost'} shadow-lg"
|
|
||||||
aria-label={collection.is_public ? $t('adventures.public') : $t('adventures.private')}
|
aria-label={collection.is_public ? $t('adventures.public') : $t('adventures.private')}
|
||||||
>
|
>
|
||||||
{#if collection.is_public}
|
{#if collection.is_public}
|
||||||
@@ -235,112 +283,22 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Content -->
|
{#if user && user.uuid == collection.user && type != 'link' && type != 'viewonly'}
|
||||||
<div class="card-body p-4 space-y-3">
|
|
||||||
<!-- Title -->
|
|
||||||
<a
|
|
||||||
href="/collections/{collection.id}"
|
|
||||||
class="hover:text-primary transition-colors duration-200 line-clamp-2 text-lg font-semibold"
|
|
||||||
>{collection.name}</a
|
|
||||||
>
|
|
||||||
|
|
||||||
<!-- Stats -->
|
|
||||||
<div class="flex flex-wrap items-center gap-2 text-sm text-base-content/70">
|
|
||||||
<!-- Location Count -->
|
|
||||||
<div class="flex items-center gap-1">
|
|
||||||
<MapMarker class="w-4 h-4 text-primary" />
|
|
||||||
<span>
|
|
||||||
{locationLength}
|
|
||||||
{locationLength === 1 ? $t('locations.location') : $t('locations.locations')}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Date Range & Duration -->
|
|
||||||
{#if collection.start_date && collection.end_date}
|
|
||||||
<span class="text-base-content/60 px-1">•</span>
|
|
||||||
<div class="flex items-center gap-1">
|
|
||||||
<span>
|
|
||||||
{Math.floor(
|
|
||||||
(new Date(collection.end_date).getTime() -
|
|
||||||
new Date(collection.start_date).getTime()) /
|
|
||||||
(1000 * 60 * 60 * 24)
|
|
||||||
) + 1}
|
|
||||||
{Math.floor(
|
|
||||||
(new Date(collection.end_date).getTime() -
|
|
||||||
new Date(collection.start_date).getTime()) /
|
|
||||||
(1000 * 60 * 60 * 24)
|
|
||||||
) +
|
|
||||||
1 ===
|
|
||||||
1
|
|
||||||
? $t('adventures.day')
|
|
||||||
: $t('adventures.days')}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Date Range (if exists) -->
|
|
||||||
{#if collection.start_date && collection.end_date}
|
|
||||||
<div class="text-xs text-base-content/60">
|
|
||||||
{new Date(collection.start_date).toLocaleDateString('en-GB', {
|
|
||||||
timeZone: 'UTC',
|
|
||||||
month: 'short',
|
|
||||||
day: 'numeric',
|
|
||||||
year: 'numeric'
|
|
||||||
})} – {new Date(collection.end_date).toLocaleDateString('en-GB', {
|
|
||||||
timeZone: 'UTC',
|
|
||||||
month: 'short',
|
|
||||||
day: 'numeric',
|
|
||||||
year: 'numeric'
|
|
||||||
})}
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<!-- Actions -->
|
|
||||||
<div class="pt-4 border-t border-base-300">
|
|
||||||
{#if type == 'link'}
|
|
||||||
{#if linkedCollectionList && linkedCollectionList
|
|
||||||
.map(String)
|
|
||||||
.includes(String(collection.id))}
|
|
||||||
<button
|
|
||||||
class="btn btn-error btn-block"
|
|
||||||
on:click={() => dispatch('unlink', collection.id)}
|
|
||||||
>
|
|
||||||
<Minus class="w-4 h-4" />
|
|
||||||
{$t('adventures.remove_from_collection')}
|
|
||||||
</button>
|
|
||||||
{:else}
|
|
||||||
<button
|
|
||||||
class="btn btn-primary btn-block"
|
|
||||||
on:click={() => dispatch('link', collection.id)}
|
|
||||||
>
|
|
||||||
<Plus class="w-4 h-4" />
|
|
||||||
{$t('adventures.add_to_collection')}
|
|
||||||
</button>
|
|
||||||
{/if}
|
|
||||||
{:else}
|
|
||||||
<div class="flex justify-between items-center">
|
|
||||||
<button
|
|
||||||
class="btn btn-neutral btn-sm flex-1 mr-2"
|
|
||||||
on:click={() => goto(`/collections/${collection.id}`)}
|
|
||||||
>
|
|
||||||
<Launch class="w-4 h-4" />
|
|
||||||
{$t('adventures.open_details')}
|
|
||||||
</button>
|
|
||||||
{#if user && user.uuid == collection.user}
|
|
||||||
<div class="dropdown dropdown-end">
|
<div class="dropdown dropdown-end">
|
||||||
<button type="button" class="btn btn-square btn-sm btn-base-300">
|
<button
|
||||||
<DotsHorizontal class="w-5 h-5" />
|
type="button"
|
||||||
|
class="btn btn-ghost bg-black/40 backdrop-blur-sm text-white rounded-full w-7 h-7 p-0 min-h-0 border-0 hover:bg-black/55"
|
||||||
|
on:click|stopPropagation
|
||||||
|
>
|
||||||
|
<DotsHorizontal class="w-4 h-4" />
|
||||||
</button>
|
</button>
|
||||||
<ul
|
<ul
|
||||||
class="dropdown-content menu bg-base-100 rounded-box z-[1] w-64 p-2 shadow-xl border border-base-300"
|
class="dropdown-content menu bg-base-100 rounded-box z-[1] w-64 p-2 shadow-xl border border-base-300 mt-1"
|
||||||
>
|
>
|
||||||
{#if type != 'viewonly'}
|
{#if type != 'viewonly'}
|
||||||
<li>
|
<li>
|
||||||
<button class="flex items-center gap-2" on:click={editAdventure}>
|
<button class="flex items-center gap-2" on:click|stopPropagation={editAdventure}>
|
||||||
<FileDocumentEdit class="w-4 h-4" />
|
<FileDocumentEdit class="w-4 h-4" />
|
||||||
{$t('adventures.edit_collection')}
|
{$t('adventures.edit_collection')}
|
||||||
</button>
|
</button>
|
||||||
@@ -348,7 +306,7 @@
|
|||||||
<li>
|
<li>
|
||||||
<button
|
<button
|
||||||
class="flex items-center gap-2"
|
class="flex items-center gap-2"
|
||||||
on:click={() => (isShareModalOpen = true)}
|
on:click|stopPropagation={() => (isShareModalOpen = true)}
|
||||||
>
|
>
|
||||||
<ShareVariant class="w-4 h-4" />
|
<ShareVariant class="w-4 h-4" />
|
||||||
{$t('adventures.share')}
|
{$t('adventures.share')}
|
||||||
@@ -356,7 +314,7 @@
|
|||||||
</li>
|
</li>
|
||||||
{#if collection.is_public}
|
{#if collection.is_public}
|
||||||
<li>
|
<li>
|
||||||
<button on:click={copyLink} class="flex items-center gap-2">
|
<button on:click|stopPropagation={copyLink} class="flex items-center gap-2">
|
||||||
{#if copied}
|
{#if copied}
|
||||||
<Check class="w-4 h-4 text-success" />
|
<Check class="w-4 h-4 text-success" />
|
||||||
<span>{$t('adventures.link_copied')}</span>
|
<span>{$t('adventures.link_copied')}</span>
|
||||||
@@ -371,7 +329,7 @@
|
|||||||
<li>
|
<li>
|
||||||
<button
|
<button
|
||||||
class="flex items-center gap-2"
|
class="flex items-center gap-2"
|
||||||
on:click={() => archiveCollection(false)}
|
on:click|stopPropagation={() => archiveCollection(false)}
|
||||||
>
|
>
|
||||||
<ArchiveArrowUp class="w-4 h-4" />
|
<ArchiveArrowUp class="w-4 h-4" />
|
||||||
{$t('adventures.unarchive')}
|
{$t('adventures.unarchive')}
|
||||||
@@ -381,7 +339,7 @@
|
|||||||
<li>
|
<li>
|
||||||
<button
|
<button
|
||||||
class="flex items-center gap-2"
|
class="flex items-center gap-2"
|
||||||
on:click={() => archiveCollection(true)}
|
on:click|stopPropagation={() => archiveCollection(true)}
|
||||||
>
|
>
|
||||||
<ArchiveArrowDown class="w-4 h-4" />
|
<ArchiveArrowDown class="w-4 h-4" />
|
||||||
{$t('adventures.archive')}
|
{$t('adventures.archive')}
|
||||||
@@ -389,7 +347,10 @@
|
|||||||
</li>
|
</li>
|
||||||
{/if}
|
{/if}
|
||||||
<li>
|
<li>
|
||||||
<button class="flex items-center gap-2" on:click={exportCollectionZip}>
|
<button
|
||||||
|
class="flex items-center gap-2"
|
||||||
|
on:click|stopPropagation={exportCollectionZip}
|
||||||
|
>
|
||||||
<DownloadIcon class="w-4 h-4" />
|
<DownloadIcon class="w-4 h-4" />
|
||||||
{$t('adventures.export_zip')}
|
{$t('adventures.export_zip')}
|
||||||
</button>
|
</button>
|
||||||
@@ -397,7 +358,7 @@
|
|||||||
<li>
|
<li>
|
||||||
<button
|
<button
|
||||||
class="flex items-center gap-2"
|
class="flex items-center gap-2"
|
||||||
on:click={duplicateCollection}
|
on:click|stopPropagation={duplicateCollection}
|
||||||
disabled={isDuplicating}
|
disabled={isDuplicating}
|
||||||
>
|
>
|
||||||
<ContentCopy class="w-4 h-4" />
|
<ContentCopy class="w-4 h-4" />
|
||||||
@@ -410,39 +371,31 @@
|
|||||||
id="delete_collection"
|
id="delete_collection"
|
||||||
data-umami-event="Delete Collection"
|
data-umami-event="Delete Collection"
|
||||||
class="text-error flex items-center gap-2"
|
class="text-error flex items-center gap-2"
|
||||||
on:click={() => (isWarningModalOpen = true)}
|
on:click|stopPropagation={() => (isWarningModalOpen = true)}
|
||||||
>
|
>
|
||||||
<TrashCan class="w-4 h-4" />
|
<TrashCan class="w-4 h-4" />
|
||||||
{$t('adventures.delete')}
|
{$t('adventures.delete')}
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
{/if}
|
{/if}
|
||||||
{#if type == 'viewonly'}
|
|
||||||
<li>
|
|
||||||
<button
|
|
||||||
class="flex items-center gap-2"
|
|
||||||
on:click={() => goto(`/collections/${collection.id}`)}
|
|
||||||
>
|
|
||||||
<Launch class="w-4 h-4" />
|
|
||||||
{$t('adventures.open_details')}
|
|
||||||
</button>
|
|
||||||
</li>
|
|
||||||
{/if}
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
{:else if user && collection.shared_with && collection.shared_with.includes(user.uuid)}
|
{:else if user && collection.shared_with && collection.shared_with.includes(user.uuid) && type != 'link'}
|
||||||
<!-- dropdown with leave button -->
|
|
||||||
<div class="dropdown dropdown-end">
|
<div class="dropdown dropdown-end">
|
||||||
<button type="button" class="btn btn-square btn-sm btn-base-300">
|
<button
|
||||||
<DotsHorizontal class="w-5 h-5" />
|
type="button"
|
||||||
|
class="btn btn-ghost bg-black/40 backdrop-blur-sm text-white rounded-full w-7 h-7 p-0 min-h-0 border-0 hover:bg-black/55"
|
||||||
|
on:click|stopPropagation
|
||||||
|
>
|
||||||
|
<DotsHorizontal class="w-4 h-4" />
|
||||||
</button>
|
</button>
|
||||||
<ul
|
<ul
|
||||||
class="dropdown-content menu bg-base-100 rounded-box z-[1] w-64 p-2 shadow-xl border border-base-300"
|
class="dropdown-content menu bg-base-100 rounded-box z-[1] w-64 p-2 shadow-xl border border-base-300 mt-1"
|
||||||
>
|
>
|
||||||
<li>
|
<li>
|
||||||
<button
|
<button
|
||||||
class="text-error flex items-center gap-2"
|
class="text-error flex items-center gap-2"
|
||||||
on:click={() => dispatch('leave', collection.id)}
|
on:click|stopPropagation={() => dispatch('leave', collection.id)}
|
||||||
>
|
>
|
||||||
<ExitRun class="w-4 h-4" />
|
<ExitRun class="w-4 h-4" />
|
||||||
{$t('adventures.leave_collection')}
|
{$t('adventures.leave_collection')}
|
||||||
@@ -452,8 +405,49 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="absolute bottom-0 left-0 right-0 p-4 z-20 pointer-events-none">
|
||||||
|
<h3 class="text-white font-bold text-base leading-snug line-clamp-2 drop-shadow-sm">
|
||||||
|
{collection.name}
|
||||||
|
</h3>
|
||||||
|
{#if collection.start_date || collection.end_date}
|
||||||
|
<p class="text-white/75 text-xs mt-0.5 drop-shadow-sm">{dateRangeString}</p>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{#if type == 'link'}
|
||||||
|
<div class="absolute bottom-3 right-3 z-20">
|
||||||
|
{#if linkedCollectionList && linkedCollectionList
|
||||||
|
.map(String)
|
||||||
|
.includes(String(collection.id))}
|
||||||
|
<button
|
||||||
|
class="btn btn-xs border-0 bg-black/40 backdrop-blur-sm text-white rounded-full px-3 hover:bg-black/55"
|
||||||
|
on:click|stopPropagation={() => dispatch('unlink', collection.id)}
|
||||||
|
>
|
||||||
|
<Minus class="w-3.5 h-3.5" />
|
||||||
|
{$t('adventures.remove_from_collection')}
|
||||||
|
</button>
|
||||||
|
{:else}
|
||||||
|
<button
|
||||||
|
class="btn btn-xs border-0 bg-black/40 backdrop-blur-sm text-white rounded-full px-3 hover:bg-black/55"
|
||||||
|
on:click|stopPropagation={() => dispatch('link', collection.id)}
|
||||||
|
>
|
||||||
|
<Plus class="w-3.5 h-3.5" />
|
||||||
|
{$t('adventures.add_to_collection')}
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="px-4 py-3 flex items-center gap-3 text-sm text-base-content/60">
|
||||||
|
<span
|
||||||
|
>{locationLength}
|
||||||
|
{locationLength !== 1 ? $t('locations.locations') : $t('locations.location')}</span
|
||||||
|
>
|
||||||
|
{#if days}
|
||||||
|
<span>· {days} {days !== 1 ? $t('adventures.days') : $t('adventures.day')}</span>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -465,4 +459,12 @@
|
|||||||
-webkit-box-orient: vertical;
|
-webkit-box-orient: vertical;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.card-carousel-tall :global(figure),
|
||||||
|
.card-carousel-tall :global(.carousel),
|
||||||
|
.card-carousel-tall :global(.carousel-item),
|
||||||
|
.card-carousel-tall :global(img),
|
||||||
|
.card-carousel-tall :global(figure > div) {
|
||||||
|
height: 14rem;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -3,9 +3,7 @@
|
|||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
import { page } from '$app/stores';
|
import { page } from '$app/stores';
|
||||||
import CollectionCard from '$lib/components/cards/CollectionCard.svelte';
|
import CollectionCard from '$lib/components/cards/CollectionCard.svelte';
|
||||||
import CollectionLink from '$lib/components/CollectionLink.svelte';
|
|
||||||
import CollectionModal from '$lib/components/CollectionModal.svelte';
|
import CollectionModal from '$lib/components/CollectionModal.svelte';
|
||||||
import NotFound from '$lib/components/NotFound.svelte';
|
|
||||||
import type { Collection, CollectionInvite, SlimCollection } from '$lib/types';
|
import type { Collection, CollectionInvite, SlimCollection } from '$lib/types';
|
||||||
import { t } from 'svelte-i18n';
|
import { t } from 'svelte-i18n';
|
||||||
|
|
||||||
@@ -22,7 +20,6 @@
|
|||||||
import DeleteWarning from '$lib/components/DeleteWarning.svelte';
|
import DeleteWarning from '$lib/components/DeleteWarning.svelte';
|
||||||
|
|
||||||
export let data: any;
|
export let data: any;
|
||||||
console.log('Collections page data:', data);
|
|
||||||
|
|
||||||
let collections: SlimCollection[] = data.props.adventures || [];
|
let collections: SlimCollection[] = data.props.adventures || [];
|
||||||
let sharedCollections: SlimCollection[] = data.props.sharedCollections || [];
|
let sharedCollections: SlimCollection[] = data.props.sharedCollections || [];
|
||||||
@@ -377,85 +374,74 @@
|
|||||||
</dialog>
|
</dialog>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<div class="min-h-screen bg-gradient-to-br from-base-200 via-base-100 to-base-200">
|
<div class="min-h-screen bg-base-100">
|
||||||
<div class="drawer lg:drawer-open">
|
<div class="drawer lg:drawer-open">
|
||||||
<input id="my-drawer" type="checkbox" class="drawer-toggle" bind:checked={sidebarOpen} />
|
<input id="my-drawer" type="checkbox" class="drawer-toggle" bind:checked={sidebarOpen} />
|
||||||
|
|
||||||
<div class="drawer-content">
|
<div class="drawer-content">
|
||||||
<!-- Header Section -->
|
<!-- Header Section -->
|
||||||
<div class="sticky top-0 z-40 bg-base-100/80 backdrop-blur-lg border-b border-base-300">
|
<div class="sticky top-0 z-40 bg-base-100/95 backdrop-blur-md border-b border-base-200">
|
||||||
<div class="container mx-auto px-6 py-4">
|
<div class="container mx-auto px-6 py-4">
|
||||||
<div class="flex items-center justify-between">
|
<div class="flex items-center justify-between gap-3">
|
||||||
<div class="flex items-center gap-4">
|
<div class="flex items-center gap-3">
|
||||||
<button class="btn btn-ghost btn-square lg:hidden" on:click={toggleSidebar}>
|
<button class="btn btn-ghost btn-square lg:hidden" on:click={toggleSidebar}>
|
||||||
<Filter class="w-5 h-5" />
|
<Filter class="w-5 h-5" />
|
||||||
</button>
|
</button>
|
||||||
<div class="flex items-center gap-3">
|
<h1 class="text-2xl font-bold">Collections</h1>
|
||||||
<div class="p-2 bg-primary/10 rounded-xl">
|
|
||||||
<CollectionIcon class="w-8 h-8 text-primary" />
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h1 class="text-3xl font-bold bg-clip-text text-primary">
|
|
||||||
{activeView === 'invites'
|
|
||||||
? $t('invites.title')
|
|
||||||
: $t(`adventures.my_collections`)}
|
|
||||||
</h1>
|
|
||||||
<p class="text-sm text-base-content/60">
|
|
||||||
{currentCount}
|
|
||||||
{activeView === 'owned'
|
|
||||||
? $t('navbar.collections')
|
|
||||||
: activeView === 'shared'
|
|
||||||
? $t('collection.shared_collections')
|
|
||||||
: activeView === 'archived'
|
|
||||||
? $t('adventures.archived_collections')
|
|
||||||
: $t('invites.pending_invites')}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- View Toggle -->
|
|
||||||
<div class="tabs tabs-boxed bg-base-200">
|
|
||||||
<button
|
<button
|
||||||
class="tab gap-2 {activeView === 'owned' ? 'tab-active' : ''}"
|
class="btn btn-primary btn-sm gap-2"
|
||||||
|
on:click={() => {
|
||||||
|
collectionToEdit = null;
|
||||||
|
isShowingCollectionModal = true;
|
||||||
|
newType = 'visited';
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Plus class="w-4 h-4" />
|
||||||
|
{$t('collection.create')}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex border-b border-base-200 mt-4 overflow-x-auto">
|
||||||
|
<button
|
||||||
|
class="tab px-4 py-2 text-sm font-medium border-b-2 transition-colors whitespace-nowrap {activeView ===
|
||||||
|
'owned'
|
||||||
|
? 'border-primary text-primary'
|
||||||
|
: 'border-transparent text-base-content/60 hover:text-base-content'}"
|
||||||
on:click={() => switchView('owned')}
|
on:click={() => switchView('owned')}
|
||||||
>
|
>
|
||||||
<CollectionIcon class="w-4 h-4" />
|
<CollectionIcon class="w-4 h-4" />
|
||||||
<span class="hidden sm:inline">{$t('adventures.my_collections')}</span>
|
<span class="hidden sm:inline">{$t('adventures.my_collections')}</span>
|
||||||
<div
|
<div class="badge badge-sm badge-ghost">{collections.length}</div>
|
||||||
class="badge badge-sm {activeView === 'owned' ? 'badge-primary' : 'badge-ghost'}"
|
|
||||||
>
|
|
||||||
{collections.length}
|
|
||||||
</div>
|
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
class="tab gap-2 {activeView === 'shared' ? 'tab-active' : ''}"
|
class="tab px-4 py-2 text-sm font-medium border-b-2 transition-colors whitespace-nowrap {activeView ===
|
||||||
|
'shared'
|
||||||
|
? 'border-primary text-primary'
|
||||||
|
: 'border-transparent text-base-content/60 hover:text-base-content'}"
|
||||||
on:click={() => switchView('shared')}
|
on:click={() => switchView('shared')}
|
||||||
>
|
>
|
||||||
<Share class="w-4 h-4" />
|
<Share class="w-4 h-4" />
|
||||||
<span class="hidden sm:inline">{$t('share.shared')}</span>
|
<span class="hidden sm:inline">{$t('share.shared')}</span>
|
||||||
<div
|
<div class="badge badge-sm badge-ghost">{sharedCollections.length}</div>
|
||||||
class="badge badge-sm {activeView === 'shared' ? 'badge-primary' : 'badge-ghost'}"
|
|
||||||
>
|
|
||||||
{sharedCollections.length}
|
|
||||||
</div>
|
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
class="tab gap-2 {activeView === 'archived' ? 'tab-active' : ''}"
|
class="tab px-4 py-2 text-sm font-medium border-b-2 transition-colors whitespace-nowrap {activeView ===
|
||||||
|
'archived'
|
||||||
|
? 'border-primary text-primary'
|
||||||
|
: 'border-transparent text-base-content/60 hover:text-base-content'}"
|
||||||
on:click={() => switchView('archived')}
|
on:click={() => switchView('archived')}
|
||||||
>
|
>
|
||||||
<Archive class="w-4 h-4" />
|
<Archive class="w-4 h-4" />
|
||||||
<span class="hidden sm:inline">{$t('adventures.archived')}</span>
|
<span class="hidden sm:inline">{$t('adventures.archived')}</span>
|
||||||
<div
|
<div class="badge badge-sm badge-ghost">{archivedCollections.length}</div>
|
||||||
class="badge badge-sm {activeView === 'archived'
|
|
||||||
? 'badge-primary'
|
|
||||||
: 'badge-ghost'}"
|
|
||||||
>
|
|
||||||
{archivedCollections.length}
|
|
||||||
</div>
|
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
class="tab gap-2 {activeView === 'invites' ? 'tab-active' : ''}"
|
class="tab px-4 py-2 text-sm font-medium border-b-2 transition-colors whitespace-nowrap {activeView ===
|
||||||
|
'invites'
|
||||||
|
? 'border-primary text-primary'
|
||||||
|
: 'border-transparent text-base-content/60 hover:text-base-content'}"
|
||||||
on:click={() => switchView('invites')}
|
on:click={() => switchView('invites')}
|
||||||
>
|
>
|
||||||
<div class="indicator">
|
<div class="indicator">
|
||||||
@@ -465,20 +451,13 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<span class="hidden sm:inline">{$t('invites.title')}</span>
|
<span class="hidden sm:inline">{$t('invites.title')}</span>
|
||||||
<div
|
<div class="badge badge-sm {invites.length > 0 ? 'badge-error' : 'badge-ghost'}">
|
||||||
class="badge badge-sm {activeView === 'invites'
|
|
||||||
? 'badge-primary'
|
|
||||||
: invites.length > 0
|
|
||||||
? 'badge-error'
|
|
||||||
: 'badge-ghost'}"
|
|
||||||
>
|
|
||||||
{invites.length}
|
{invites.length}
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Main Content -->
|
<!-- Main Content -->
|
||||||
<div class="container mx-auto px-6 py-8">
|
<div class="container mx-auto px-6 py-8">
|
||||||
@@ -588,9 +567,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
<!-- Collections Grid -->
|
<!-- Collections Grid -->
|
||||||
<div
|
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-5">
|
||||||
class="grid grid-cols-1 sm:grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-6"
|
|
||||||
>
|
|
||||||
{#each currentCollections as collection (collection.id)}
|
{#each currentCollections as collection (collection.id)}
|
||||||
<CollectionCard
|
<CollectionCard
|
||||||
type=""
|
type=""
|
||||||
|
|||||||
Reference in New Issue
Block a user