ui:use the default styling on homepage and find detail page

This commit is contained in:
2025-11-22 20:07:06 +01:00
parent 5285a15335
commit 2ac826cbf9

View File

@@ -9,6 +9,7 @@
let { data }: { data: PageData } = $props();
let currentMediaIndex = $state(0);
let isPanelVisible = $state(true);
function nextMedia() {
if (!data.find?.media) return;
@@ -58,6 +59,10 @@
}
}
function togglePanel() {
isPanelVisible = !isPanelVisible;
}
// Create the map find format
let mapFinds = $derived(
data.find
@@ -132,6 +137,7 @@
</svelte:head>
<div class="public-find-page">
<!-- Fullscreen map -->
<div class="map-section">
<Map
autoCenter={true}
@@ -141,10 +147,13 @@
/>
</div>
<div class="find-details">
<!-- Details panel container -->
<div class="panel-container">
<!-- Details panel -->
<div class="find-details-panel" class:hidden={!isPanelVisible}>
{#if data.find}
<div class="details-content">
<div class="details-header">
<div class="panel-content">
<div class="panel-header">
<div class="user-section">
<ProfilePicture
username={data.find.username}
@@ -166,7 +175,7 @@
</div>
</div>
<div class="details-body">
<div class="panel-body">
{#if data.find.media && data.find.media.length > 0}
<div class="media-container">
<div class="media-viewer">
@@ -305,23 +314,41 @@
<div class="error-state">
<h1>Find not found</h1>
<p>This find does not exist or is private.</p>
<a href="/" class="back-button">Back to Home</a>
</div>
{/if}
</div>
<!-- Toggle button -->
<button
class="panel-toggle"
class:collapsed={!isPanelVisible}
onclick={togglePanel}
aria-label="Toggle find details"
>
<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
{#if isPanelVisible}
<path d="M15 18l-6-6 6-6" stroke="currentColor" stroke-width="2" stroke-linecap="round" />
{:else}
<path d="M9 18l6-6-6-6" stroke="currentColor" stroke-width="2" stroke-linecap="round" />
{/if}
</svg>
</button>
</div>
</div>
<style>
.public-find-page {
display: flex;
flex-direction: row;
width: 100vw;
height: 100vh;
overflow: hidden;
position: relative;
}
.map-section {
flex: 1;
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
z-index: 0;
overflow: hidden;
}
@@ -330,29 +357,78 @@
border-radius: 0;
}
.find-details {
width: 45%;
max-width: 650px;
min-width: 400px;
height: 100vh;
background: rgba(255, 255, 255, 0.95);
backdrop-filter: blur(10px);
box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
overflow-y: auto;
display: flex;
flex-direction: column;
.map-section :global(.maplibregl-map) {
border-radius: 0 !important;
box-shadow: none !important;
}
.details-content {
.panel-container {
display: flex;
flex-direction: row;
margin-left: 20px;
gap: 12px;
}
.panel-toggle {
width: 48px;
height: 48px;
background: rgba(255, 255, 255, 0.95);
backdrop-filter: blur(10px);
border: none;
border-radius: 12px;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
z-index: 60;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.3s ease;
}
.panel-toggle:hover {
background: rgba(255, 255, 255, 1);
box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
}
.panel-toggle svg {
color: #333;
}
.find-details-panel {
width: 40%;
max-width: 1000px;
min-width: 500px;
height: calc(100vh - 100px);
backdrop-filter: blur(10px);
border-radius: 12px;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
z-index: 50;
display: flex;
flex-direction: column;
overflow: hidden;
box-sizing: border-box;
transition:
transform 0.3s ease,
opacity 0.3s ease;
}
.find-details-panel.hidden {
display: none;
transform: translateX(-100%);
opacity: 0;
pointer-events: none;
}
.panel-content {
display: flex;
flex-direction: column;
height: 100%;
}
.details-header {
.panel-header {
padding: 1.5rem 2rem;
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
background: rgba(255, 255, 255, 0.8);
background: rgba(255, 255, 255, 0.5);
flex-shrink: 0;
}
@@ -368,6 +444,13 @@
flex-shrink: 0;
}
:global(.avatar-fallback) {
background: hsl(var(--primary));
color: white;
font-size: 1rem;
font-weight: 600;
}
.user-info {
flex: 1;
min-width: 0;
@@ -410,7 +493,7 @@
text-transform: capitalize;
}
.details-body {
.panel-body {
display: flex;
flex-direction: column;
overflow: auto;
@@ -427,7 +510,7 @@
.media-viewer {
position: relative;
width: 100%;
max-height: 450px;
max-height: 400px;
background: hsl(var(--muted));
overflow: hidden;
display: flex;
@@ -506,6 +589,7 @@
display: flex;
flex-direction: column;
gap: 1rem;
background: rgba(255, 255, 255, 0.5);
}
.description {
@@ -573,39 +657,81 @@
flex-direction: column;
flex: 1;
overflow: hidden;
background: rgba(255, 255, 255, 0.5);
}
.error-state {
padding: 2rem;
text-align: center;
background: rgba(255, 255, 255, 0.5);
}
.error-state h1 {
font-family: 'Washington', serif;
font-size: 2rem;
margin-bottom: 1rem;
color: hsl(var(--foreground));
}
@media (max-width: 1024px) {
.public-find-page {
flex-direction: column;
.error-state p {
color: hsl(var(--muted-foreground));
margin-bottom: 1.5rem;
}
.map-section {
height: 40vh;
.back-button {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 0.75rem 1.5rem;
background: hsl(var(--primary));
color: hsl(var(--primary-foreground));
border-radius: 8px;
font-size: 0.875rem;
font-weight: 500;
text-decoration: none;
transition: all 0.2s ease;
}
.find-details {
.back-button:hover {
background: hsl(var(--primary) / 0.9);
}
@media (max-width: 768px) {
.panel-container {
position: fixed;
bottom: 0;
left: 0;
right: 0;
display: flex;
flex-direction: column-reverse;
align-items: center;
margin: 0;
}
.panel-toggle.collapsed {
margin: 12px auto;
}
.panel-toggle svg {
transform: rotate(-90deg);
}
.find-details-panel {
width: 100%;
max-width: none;
max-width: 100vw;
min-width: 0;
height: 60vh;
}
border-radius: 20px 20px 0 0;
box-sizing: border-box;
}
@media (max-width: 640px) {
.details-header,
.content-section {
.find-details-panel.hidden {
display: none;
transform: translateX(-100%);
opacity: 0;
pointer-events: none;
}
.panel-header {
padding: 1rem 1.25rem;
}
@@ -617,5 +743,24 @@
width: 48px;
height: 48px;
}
.content-section {
padding: 1rem 1.25rem;
}
.map-section :global(.map-container) {
height: 100vh;
}
}
@media (max-width: 480px) {
.find-details-panel {
height: 60vh;
}
.panel-header,
.content-section {
padding: 1rem;
}
}
</style>