Compare commits
11 Commits
f198c05063
...
feature/st
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
500ad347ee | ||
|
|
4c219abab4 | ||
|
|
6cee6095ed | ||
|
|
8422c6e34f | ||
|
|
cdf3643622 | ||
|
|
aadc80b7a8 | ||
|
|
9be793e2dd | ||
|
|
cb0e5602c8 | ||
|
|
326b52b858 | ||
|
|
0848418453 | ||
|
|
6b13522d6d |
13
.claude/launch.json
Normal file
13
.claude/launch.json
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"version": "0.0.1",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Map-Jurnal",
|
||||||
|
"cwd": "/Users/haerikim/Desktop/SP Map Journal/Map-Jurnal",
|
||||||
|
"runtimeExecutable": "npm",
|
||||||
|
"runtimeArgs": ["run", "dev"],
|
||||||
|
"port": 5173,
|
||||||
|
"autoPort": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
6
.env
Normal file
6
.env
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
VITE_FIREBASE_API_KEY=AIzaSyC_hZf9TpIIb4H7y7umUeYtFKD-guN_iR0
|
||||||
|
VITE_FIREBASE_AUTH_DOMAIN=map-jurnal.firebaseapp.com
|
||||||
|
VITE_FIREBASE_PROJECT_ID=map-jurnal
|
||||||
|
VITE_FIREBASE_STORAGE_BUCKET=map-jurnal.firebasestorage.app
|
||||||
|
VITE_FIREBASE_MESSAGING_SENDER_ID=922587077950
|
||||||
|
VITE_FIREBASE_APP_ID=1:922587077950:web:9f140f84468e306152606f
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>map-journal</title>
|
<title>Journi</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
|||||||
1844
package-lock.json
generated
1844
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
11
package.json
11
package.json
@@ -9,8 +9,15 @@
|
|||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@sveltejs/vite-plugin-svelte": "^7.1.2",
|
"@sveltejs/vite-plugin-svelte": "^5.0.3",
|
||||||
"svelte": "^5.55.5",
|
"svelte": "^5.55.5",
|
||||||
"vite": "^8.0.12"
|
"vite": "^6.3.5"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"d3": "^7.9.0",
|
||||||
|
"flag-icons": "^7.5.0",
|
||||||
|
"html-to-image": "^1.11.13",
|
||||||
|
"topojson-client": "^3.1.0",
|
||||||
|
"world-atlas": "^2.0.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,48 @@
|
|||||||
<script>
|
<script>
|
||||||
import TimelineView from './lib/TimelineView.svelte';
|
import Layout from './lib/layout/Layout.svelte';
|
||||||
|
import WorldMap from './lib/world-map/WorldMap.svelte';
|
||||||
|
import StatsPanel from './lib/world-map/StatsPanel.svelte';
|
||||||
|
import TimelineView from './lib/timeline/TimelineView.svelte';
|
||||||
|
|
||||||
|
let screen = $state('worldmap');
|
||||||
|
let inDetail = $state(false);
|
||||||
|
let pendingCountry = $state('');
|
||||||
|
|
||||||
|
function handleCountryClick(name) {
|
||||||
|
pendingCountry = name;
|
||||||
|
screen = 'timeline';
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<main>
|
<Layout {screen} onNavigate={(s) => (screen = s)} hideTopBar={inDetail}>
|
||||||
<TimelineView />
|
{#if screen === 'worldmap'}
|
||||||
</main>
|
<div class="worldmap-page">
|
||||||
|
<div class="map-area">
|
||||||
|
<WorldMap onCountryClick={handleCountryClick} />
|
||||||
|
</div>
|
||||||
|
<StatsPanel />
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
|
<TimelineView
|
||||||
|
onDetailChange={(v) => (inDetail = v)}
|
||||||
|
{pendingCountry}
|
||||||
|
onNewEntryClear={() => (pendingCountry = '')}
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
|
</Layout>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
main {
|
.worldmap-page {
|
||||||
min-height: 100svh;
|
flex: 1;
|
||||||
background: var(--bg);
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
min-width: 0;
|
||||||
|
height: 100%;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.map-area {
|
||||||
|
flex: 1;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
357
src/app.css
357
src/app.css
@@ -1,296 +1,95 @@
|
|||||||
|
@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,300;12..96,400;12..96,500&display=swap');
|
||||||
|
|
||||||
|
/* ── Color tokens ─────────────────────────────────────────── */
|
||||||
:root {
|
:root {
|
||||||
--text: #6b6375;
|
--accent: #7c3aed; /* indigo-600 */
|
||||||
--text-h: #08060d;
|
--accent-dark: #5b21b6;
|
||||||
--bg: #fff;
|
--accent-light: #a78bfa;
|
||||||
--border: #e5e4e7;
|
--accent-bg: rgba(124, 58, 237, 0.07);
|
||||||
--code-bg: #f4f3ec;
|
--accent-border: rgba(124, 58, 237, 0.2);
|
||||||
--accent: #aa3bff;
|
|
||||||
--accent-bg: rgba(170, 59, 255, 0.1);
|
|
||||||
--accent-border: rgba(170, 59, 255, 0.5);
|
|
||||||
--social-bg: rgba(244, 243, 236, 0.5);
|
|
||||||
--shadow:
|
|
||||||
rgba(0, 0, 0, 0.1) 0 10px 15px -3px, rgba(0, 0, 0, 0.05) 0 4px 6px -2px;
|
|
||||||
|
|
||||||
--sans: system-ui, 'Segoe UI', Roboto, sans-serif;
|
--lavender: #a78bfa;
|
||||||
--heading: system-ui, 'Segoe UI', Roboto, sans-serif;
|
--lavender-bg: rgba(167, 139, 250, 0.1);
|
||||||
--mono: ui-monospace, Consolas, monospace;
|
|
||||||
|
|
||||||
font: 18px/145% var(--sans);
|
/* Light-first neutrals */
|
||||||
letter-spacing: 0.18px;
|
--text: #52525b; /* zinc-600 */
|
||||||
color-scheme: light dark;
|
--text-h: #18181b; /* zinc-900 */
|
||||||
|
--text-sub: #a1a1aa; /* zinc-400 */
|
||||||
|
--bg: #ffffff; /* white */
|
||||||
|
--bg-raised: #fafafa; /* off-white */
|
||||||
|
--bg-subtle: #f4f4f5; /* zinc-100 */
|
||||||
|
--border: #e4e4e7; /* zinc-200 */
|
||||||
|
--border-bright: #d4d4d8; /* zinc-300 */
|
||||||
|
--shadow: 0 4px 24px rgba(0,0,0,0.08);
|
||||||
|
|
||||||
|
/* Typography */
|
||||||
|
--sans: 'Bricolage Grotesque', system-ui, sans-serif;
|
||||||
|
--heading: 'Bricolage Grotesque', system-ui, sans-serif;
|
||||||
|
--mono: ui-monospace, Consolas, monospace;
|
||||||
|
|
||||||
|
/* Type scale */
|
||||||
|
--text-xs: 11px;
|
||||||
|
--text-sm: 13px;
|
||||||
|
--text-base: 14px;
|
||||||
|
--text-md: 16px;
|
||||||
|
--text-lg: 20px;
|
||||||
|
--text-xl: 28px;
|
||||||
|
--text-2xl: 40px;
|
||||||
|
|
||||||
|
font-family: var(--sans);
|
||||||
|
font-size: var(--text-base);
|
||||||
|
line-height: 1.6;
|
||||||
|
font-weight: 300;
|
||||||
|
letter-spacing: 0.01em;
|
||||||
color: var(--text);
|
color: var(--text);
|
||||||
background: var(--bg);
|
background: var(--bg);
|
||||||
font-synthesis: none;
|
font-synthesis: none;
|
||||||
text-rendering: optimizeLegibility;
|
text-rendering: optimizeLegibility;
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
|
||||||
@media (max-width: 1024px) {
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark) {
|
/* ── Reset ────────────────────────────────────────────────── */
|
||||||
:root {
|
*, *::before, *::after {
|
||||||
--text: #9ca3af;
|
|
||||||
--text-h: #f3f4f6;
|
|
||||||
--bg: #16171d;
|
|
||||||
--border: #2e303a;
|
|
||||||
--code-bg: #1f2028;
|
|
||||||
--accent: #c084fc;
|
|
||||||
--accent-bg: rgba(192, 132, 252, 0.15);
|
|
||||||
--accent-border: rgba(192, 132, 252, 0.5);
|
|
||||||
--social-bg: rgba(47, 48, 58, 0.5);
|
|
||||||
--shadow:
|
|
||||||
rgba(0, 0, 0, 0.4) 0 10px 15px -3px, rgba(0, 0, 0, 0.25) 0 4px 6px -2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#social .button-icon {
|
|
||||||
filter: invert(1) brightness(2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1,
|
|
||||||
h2 {
|
|
||||||
font-family: var(--heading);
|
|
||||||
font-weight: 500;
|
|
||||||
color: var(--text-h);
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
font-size: 56px;
|
|
||||||
letter-spacing: -1.68px;
|
|
||||||
margin: 32px 0;
|
|
||||||
@media (max-width: 1024px) {
|
|
||||||
font-size: 36px;
|
|
||||||
margin: 20px 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
h2 {
|
|
||||||
font-size: 24px;
|
|
||||||
line-height: 118%;
|
|
||||||
letter-spacing: -0.24px;
|
|
||||||
margin: 0 0 8px;
|
|
||||||
@media (max-width: 1024px) {
|
|
||||||
font-size: 20px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
p {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
code,
|
|
||||||
.counter {
|
|
||||||
font-family: var(--mono);
|
|
||||||
display: inline-flex;
|
|
||||||
border-radius: 4px;
|
|
||||||
color: var(--text-h);
|
|
||||||
}
|
|
||||||
|
|
||||||
code {
|
|
||||||
font-size: 15px;
|
|
||||||
line-height: 135%;
|
|
||||||
padding: 4px 8px;
|
|
||||||
background: var(--code-bg);
|
|
||||||
}
|
|
||||||
|
|
||||||
.counter {
|
|
||||||
font-size: 16px;
|
|
||||||
padding: 5px 10px;
|
|
||||||
border-radius: 5px;
|
|
||||||
color: var(--accent);
|
|
||||||
background: var(--accent-bg);
|
|
||||||
border: 2px solid transparent;
|
|
||||||
transition: border-color 0.3s;
|
|
||||||
margin-bottom: 24px;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
border-color: var(--accent-border);
|
|
||||||
}
|
|
||||||
&:focus-visible {
|
|
||||||
outline: 2px solid var(--accent);
|
|
||||||
outline-offset: 2px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.hero {
|
|
||||||
position: relative;
|
|
||||||
|
|
||||||
.base,
|
|
||||||
.framework,
|
|
||||||
.vite {
|
|
||||||
inset-inline: 0;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.base {
|
|
||||||
width: 170px;
|
|
||||||
position: relative;
|
|
||||||
z-index: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.framework,
|
|
||||||
.vite {
|
|
||||||
position: absolute;
|
|
||||||
}
|
|
||||||
|
|
||||||
.framework {
|
|
||||||
z-index: 1;
|
|
||||||
top: 34px;
|
|
||||||
height: 28px;
|
|
||||||
transform: perspective(2000px) rotateZ(300deg) rotateX(44deg) rotateY(39deg)
|
|
||||||
scale(1.4);
|
|
||||||
}
|
|
||||||
|
|
||||||
.vite {
|
|
||||||
z-index: 0;
|
|
||||||
top: 107px;
|
|
||||||
height: 26px;
|
|
||||||
width: auto;
|
|
||||||
transform: perspective(2000px) rotateZ(300deg) rotateX(40deg) rotateY(39deg)
|
|
||||||
scale(0.8);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#app {
|
|
||||||
width: 1126px;
|
|
||||||
max-width: 100%;
|
|
||||||
margin: 0 auto;
|
|
||||||
text-align: center;
|
|
||||||
border-inline: 1px solid var(--border);
|
|
||||||
min-height: 100svh;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
margin: 0;
|
||||||
|
|
||||||
#center {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 25px;
|
|
||||||
place-content: center;
|
|
||||||
place-items: center;
|
|
||||||
flex-grow: 1;
|
|
||||||
|
|
||||||
@media (max-width: 1024px) {
|
|
||||||
padding: 32px 20px 24px;
|
|
||||||
gap: 18px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#next-steps {
|
|
||||||
display: flex;
|
|
||||||
border-top: 1px solid var(--border);
|
|
||||||
text-align: left;
|
|
||||||
|
|
||||||
& > div {
|
|
||||||
flex: 1 1 0;
|
|
||||||
padding: 32px;
|
|
||||||
@media (max-width: 1024px) {
|
|
||||||
padding: 24px 20px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon {
|
|
||||||
margin-bottom: 16px;
|
|
||||||
width: 22px;
|
|
||||||
height: 22px;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 1024px) {
|
|
||||||
flex-direction: column;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#docs {
|
|
||||||
border-right: 1px solid var(--border);
|
|
||||||
|
|
||||||
@media (max-width: 1024px) {
|
|
||||||
border-right: none;
|
|
||||||
border-bottom: 1px solid var(--border);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#next-steps ul {
|
|
||||||
list-style: none;
|
|
||||||
padding: 0;
|
padding: 0;
|
||||||
display: flex;
|
|
||||||
gap: 8px;
|
|
||||||
margin: 32px 0 0;
|
|
||||||
|
|
||||||
.logo {
|
|
||||||
height: 18px;
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
color: var(--text-h);
|
|
||||||
font-size: 16px;
|
|
||||||
border-radius: 6px;
|
|
||||||
background: var(--social-bg);
|
|
||||||
display: flex;
|
|
||||||
padding: 6px 12px;
|
|
||||||
align-items: center;
|
|
||||||
gap: 8px;
|
|
||||||
text-decoration: none;
|
|
||||||
transition: box-shadow 0.3s;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
box-shadow: var(--shadow);
|
|
||||||
}
|
|
||||||
.button-icon {
|
|
||||||
height: 18px;
|
|
||||||
width: 18px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 1024px) {
|
|
||||||
margin-top: 20px;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
justify-content: center;
|
|
||||||
|
|
||||||
li {
|
|
||||||
flex: 1 1 calc(50% - 8px);
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
width: 100%;
|
|
||||||
justify-content: center;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#spacer {
|
html, body, #app {
|
||||||
height: 88px;
|
|
||||||
border-top: 1px solid var(--border);
|
|
||||||
@media (max-width: 1024px) {
|
|
||||||
height: 48px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.ticks {
|
|
||||||
position: relative;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
&::before,
|
overflow: hidden;
|
||||||
&::after {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
top: -4.5px;
|
|
||||||
border: 5px solid transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
&::before {
|
|
||||||
left: 0;
|
|
||||||
border-left-color: var(--border);
|
|
||||||
}
|
|
||||||
&::after {
|
|
||||||
right: 0;
|
|
||||||
border-right-color: var(--border);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ── Text hierarchy ───────────────────────────────────────── */
|
||||||
|
h1 {
|
||||||
|
font-size: var(--text-2xl);
|
||||||
|
font-weight: 400;
|
||||||
|
line-height: 1.1;
|
||||||
|
letter-spacing: -1px;
|
||||||
|
color: var(--text-h);
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
font-size: var(--text-xl);
|
||||||
|
font-weight: 400;
|
||||||
|
line-height: 1.15;
|
||||||
|
letter-spacing: -0.5px;
|
||||||
|
color: var(--text-h);
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
font-size: var(--text-lg);
|
||||||
|
font-weight: 300;
|
||||||
|
line-height: 1.3;
|
||||||
|
color: var(--text-h);
|
||||||
|
}
|
||||||
|
|
||||||
|
h4, h5, h6 {
|
||||||
|
font-size: var(--text-md);
|
||||||
|
font-weight: 300;
|
||||||
|
color: var(--text-h);
|
||||||
|
}
|
||||||
|
|
||||||
|
p { margin: 0; color: var(--text); }
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
<script>
|
|
||||||
let count = $state(0)
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<button type="button" class="counter" onclick={() => count++}>Count is {count}</button>
|
|
||||||
@@ -1,313 +0,0 @@
|
|||||||
<script>
|
|
||||||
/** @type {{ entry: import('./stores/journalStore.js').JournalEntry, onBack: () => void }} */
|
|
||||||
let { entry, onBack } = $props();
|
|
||||||
|
|
||||||
let photoIdx = $state(0);
|
|
||||||
|
|
||||||
function formatDate(/** @type {string} */ iso) {
|
|
||||||
return new Date(iso).toLocaleDateString('en-US', {
|
|
||||||
year: 'numeric', month: 'long', day: 'numeric',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function prev() {
|
|
||||||
photoIdx = (photoIdx - 1 + entry.photos.length) % entry.photos.length;
|
|
||||||
}
|
|
||||||
function next() {
|
|
||||||
photoIdx = (photoIdx + 1) % entry.photos.length;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<article class="detail-page">
|
|
||||||
|
|
||||||
<button class="back-btn" onclick={onBack} aria-label="Back to timeline">
|
|
||||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true">
|
|
||||||
<path d="M10 3L5 8l5 5" stroke="currentColor" stroke-width="1.8"
|
|
||||||
stroke-linecap="round" stroke-linejoin="round"/>
|
|
||||||
</svg>
|
|
||||||
Back
|
|
||||||
</button>
|
|
||||||
|
|
||||||
{#if entry.photos.length > 0}
|
|
||||||
<div class="hero-gallery">
|
|
||||||
<img
|
|
||||||
class="hero-img"
|
|
||||||
src={entry.photos[photoIdx]}
|
|
||||||
alt="{entry.title} — photo {photoIdx + 1}"
|
|
||||||
loading="lazy"
|
|
||||||
/>
|
|
||||||
{#if entry.photos.length > 1}
|
|
||||||
<button class="arr left" onclick={prev} aria-label="Previous photo">‹</button>
|
|
||||||
<button class="arr right" onclick={next} aria-label="Next photo">›</button>
|
|
||||||
<div class="thumb-strip">
|
|
||||||
{#each entry.photos as photo, i}
|
|
||||||
<button
|
|
||||||
class="thumb"
|
|
||||||
class:active={i === photoIdx}
|
|
||||||
onclick={() => (photoIdx = i)}
|
|
||||||
aria-label="Photo {i + 1}"
|
|
||||||
>
|
|
||||||
<img src={photo} alt="" />
|
|
||||||
</button>
|
|
||||||
{/each}
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
<span class="photo-counter">{photoIdx + 1} / {entry.photos.length}</span>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<div class="detail-content">
|
|
||||||
<div class="meta-row">
|
|
||||||
<span class="badge loc-badge">📍 {entry.location.city}, {entry.location.country}</span>
|
|
||||||
<span class="badge trip-badge trip-badge--{entry.tripType}">
|
|
||||||
{entry.tripType === 'solo' ? '🧍 Solo' : '👥 With Friends'}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h1 class="detail-title">{entry.title}</h1>
|
|
||||||
|
|
||||||
<div class="stats-row">
|
|
||||||
<div class="stat">
|
|
||||||
<span class="stat-label">Date</span>
|
|
||||||
<time class="stat-value" datetime={entry.date}>{formatDate(entry.date)}</time>
|
|
||||||
</div>
|
|
||||||
<div class="stat-divider"></div>
|
|
||||||
<div class="stat">
|
|
||||||
<span class="stat-label">Duration</span>
|
|
||||||
<span class="stat-value">{entry.days} {entry.days === 1 ? 'day' : 'days'}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<hr class="section-divider" />
|
|
||||||
<p class="detail-memo">{entry.memo}</p>
|
|
||||||
<hr class="section-divider" />
|
|
||||||
|
|
||||||
<div class="song-row">
|
|
||||||
<div class="song-icon-wrap" aria-hidden="true">
|
|
||||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none">
|
|
||||||
<path d="M9 18V5l12-2v13" stroke="currentColor" stroke-width="2"
|
|
||||||
stroke-linecap="round" stroke-linejoin="round"/>
|
|
||||||
<circle cx="6" cy="18" r="3" stroke="currentColor" stroke-width="2"/>
|
|
||||||
<circle cx="18" cy="16" r="3" stroke="currentColor" stroke-width="2"/>
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
<div class="song-text">
|
|
||||||
<span class="song-label">Soundtrack</span>
|
|
||||||
<span class="song-name">{entry.song.title}</span>
|
|
||||||
<span class="song-artist">{entry.song.artist}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</article>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.detail-page {
|
|
||||||
max-width: 680px;
|
|
||||||
margin: 0 auto;
|
|
||||||
padding: 32px 24px 80px;
|
|
||||||
font-family: var(--sans, system-ui, sans-serif);
|
|
||||||
}
|
|
||||||
|
|
||||||
.back-btn {
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 6px;
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: 500;
|
|
||||||
color: var(--text, #6b6375);
|
|
||||||
background: none;
|
|
||||||
border: none;
|
|
||||||
cursor: pointer;
|
|
||||||
padding: 6px 0;
|
|
||||||
margin-bottom: 28px;
|
|
||||||
transition: color 0.15s;
|
|
||||||
}
|
|
||||||
.back-btn:hover { color: var(--accent, #aa3bff); }
|
|
||||||
|
|
||||||
.hero-gallery {
|
|
||||||
position: relative;
|
|
||||||
border-radius: 16px;
|
|
||||||
overflow: hidden;
|
|
||||||
background: #000;
|
|
||||||
margin-bottom: 28px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hero-img {
|
|
||||||
width: 100%;
|
|
||||||
height: 380px;
|
|
||||||
object-fit: cover;
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.arr {
|
|
||||||
position: absolute;
|
|
||||||
top: 50%;
|
|
||||||
transform: translateY(-50%);
|
|
||||||
background: rgba(0,0,0,0.45);
|
|
||||||
color: #fff;
|
|
||||||
border: none;
|
|
||||||
width: 40px;
|
|
||||||
height: 40px;
|
|
||||||
border-radius: 50%;
|
|
||||||
font-size: 24px;
|
|
||||||
cursor: pointer;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
transition: background 0.15s;
|
|
||||||
z-index: 2;
|
|
||||||
}
|
|
||||||
.arr:hover { background: rgba(0,0,0,0.7); }
|
|
||||||
.arr.left { left: 14px; }
|
|
||||||
.arr.right { right: 14px; }
|
|
||||||
|
|
||||||
.photo-counter {
|
|
||||||
position: absolute;
|
|
||||||
top: 14px;
|
|
||||||
right: 14px;
|
|
||||||
font-size: 12px;
|
|
||||||
font-weight: 500;
|
|
||||||
color: #fff;
|
|
||||||
background: rgba(0,0,0,0.45);
|
|
||||||
padding: 3px 10px;
|
|
||||||
border-radius: 20px;
|
|
||||||
z-index: 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.thumb-strip {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 12px;
|
|
||||||
left: 50%;
|
|
||||||
transform: translateX(-50%);
|
|
||||||
display: flex;
|
|
||||||
gap: 8px;
|
|
||||||
z-index: 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.thumb {
|
|
||||||
width: 52px;
|
|
||||||
height: 36px;
|
|
||||||
border-radius: 6px;
|
|
||||||
overflow: hidden;
|
|
||||||
border: 2px solid transparent;
|
|
||||||
padding: 0;
|
|
||||||
cursor: pointer;
|
|
||||||
opacity: 0.65;
|
|
||||||
background: none;
|
|
||||||
transition: border-color 0.15s, opacity 0.15s;
|
|
||||||
}
|
|
||||||
.thumb.active { border-color: #fff; opacity: 1; }
|
|
||||||
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
|
|
||||||
|
|
||||||
.detail-content { text-align: left; }
|
|
||||||
|
|
||||||
.meta-row {
|
|
||||||
display: flex;
|
|
||||||
gap: 8px;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
margin-bottom: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.badge {
|
|
||||||
font-size: 12px;
|
|
||||||
font-weight: 500;
|
|
||||||
padding: 4px 10px;
|
|
||||||
border-radius: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.loc-badge {
|
|
||||||
background: var(--accent-bg, rgba(170,59,255,0.08));
|
|
||||||
color: var(--accent, #aa3bff);
|
|
||||||
}
|
|
||||||
|
|
||||||
.trip-badge--solo { background: rgba(245,158,11,0.12); color: #b45309; }
|
|
||||||
.trip-badge--friends { background: rgba(59,130,246,0.12); color: #1d4ed8; }
|
|
||||||
|
|
||||||
.detail-title {
|
|
||||||
font-size: 28px;
|
|
||||||
font-weight: 700;
|
|
||||||
color: var(--text-h, #08060d);
|
|
||||||
margin: 0 0 20px;
|
|
||||||
letter-spacing: -0.6px;
|
|
||||||
line-height: 1.2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.stats-row {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 20px;
|
|
||||||
margin-bottom: 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.stat { display: flex; flex-direction: column; gap: 2px; }
|
|
||||||
|
|
||||||
.stat-label {
|
|
||||||
font-size: 11px;
|
|
||||||
letter-spacing: 1.5px;
|
|
||||||
text-transform: uppercase;
|
|
||||||
color: var(--text, #6b6375);
|
|
||||||
}
|
|
||||||
|
|
||||||
.stat-value {
|
|
||||||
font-size: 15px;
|
|
||||||
font-weight: 600;
|
|
||||||
color: var(--text-h, #08060d);
|
|
||||||
}
|
|
||||||
|
|
||||||
.stat-divider {
|
|
||||||
width: 1px;
|
|
||||||
height: 32px;
|
|
||||||
background: var(--border, #e5e4e7);
|
|
||||||
}
|
|
||||||
|
|
||||||
.section-divider {
|
|
||||||
border: none;
|
|
||||||
border-top: 1px solid var(--border, #e5e4e7);
|
|
||||||
margin: 24px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.detail-memo {
|
|
||||||
font-size: 16px;
|
|
||||||
line-height: 1.75;
|
|
||||||
color: var(--text, #6b6375);
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.song-row { display: flex; align-items: center; gap: 14px; }
|
|
||||||
|
|
||||||
.song-icon-wrap {
|
|
||||||
width: 44px;
|
|
||||||
height: 44px;
|
|
||||||
border-radius: 50%;
|
|
||||||
background: var(--accent-bg, rgba(170,59,255,0.08));
|
|
||||||
color: var(--accent, #aa3bff);
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.song-text { display: flex; flex-direction: column; gap: 2px; }
|
|
||||||
|
|
||||||
.song-label {
|
|
||||||
font-size: 11px;
|
|
||||||
letter-spacing: 1.5px;
|
|
||||||
text-transform: uppercase;
|
|
||||||
color: var(--text, #6b6375);
|
|
||||||
}
|
|
||||||
|
|
||||||
.song-name {
|
|
||||||
font-size: 15px;
|
|
||||||
font-weight: 600;
|
|
||||||
color: var(--text-h, #08060d);
|
|
||||||
}
|
|
||||||
|
|
||||||
.song-artist { font-size: 13px; color: var(--text, #6b6375); }
|
|
||||||
|
|
||||||
@media (max-width: 600px) {
|
|
||||||
.detail-page { padding: 24px 16px 60px; }
|
|
||||||
.hero-img { height: 260px; }
|
|
||||||
.detail-title { font-size: 22px; }
|
|
||||||
.thumb { width: 40px; height: 28px; }
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,349 +0,0 @@
|
|||||||
<script>
|
|
||||||
import { get } from 'svelte/store';
|
|
||||||
import { journals } from './stores/journalStore.js';
|
|
||||||
import JournalDetail from './JournalDetail.svelte';
|
|
||||||
|
|
||||||
/** @type {import('./stores/journalStore.js').JournalEntry|null} */
|
|
||||||
let selected = $state(null);
|
|
||||||
|
|
||||||
/** @type {Record<string, number>} */
|
|
||||||
let photoIdx = $state({});
|
|
||||||
|
|
||||||
// Store subscription
|
|
||||||
let entries = $state(get(journals));
|
|
||||||
$effect(() => {
|
|
||||||
const unsub = journals.subscribe((v) => { entries = v; });
|
|
||||||
return unsub;
|
|
||||||
});
|
|
||||||
|
|
||||||
const sortOptions = [
|
|
||||||
{ value: 'date-desc', label: 'Newest First' },
|
|
||||||
{ value: 'date-asc', label: 'Oldest First' },
|
|
||||||
{ value: 'country-asc', label: 'Country A → Z' },
|
|
||||||
{ value: 'country-desc', label: 'Country Z → A' },
|
|
||||||
];
|
|
||||||
|
|
||||||
let sortKey = $state('date-desc');
|
|
||||||
|
|
||||||
// Explicit $effect so sortKey changes always trigger a re-sort
|
|
||||||
let sortedEntries = $state(/** @type {typeof entries} */([]));
|
|
||||||
$effect(() => {
|
|
||||||
const key = sortKey;
|
|
||||||
sortedEntries = [...entries].sort((a, b) => {
|
|
||||||
if (key === 'date-asc') return a.date.localeCompare(b.date);
|
|
||||||
if (key === 'date-desc') return b.date.localeCompare(a.date);
|
|
||||||
if (key === 'country-asc') return a.location.country.localeCompare(b.location.country) || b.date.localeCompare(a.date);
|
|
||||||
if (key === 'country-desc') return b.location.country.localeCompare(a.location.country) || b.date.localeCompare(a.date);
|
|
||||||
return 0;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
function formatDate(/** @type {string} */ iso) {
|
|
||||||
return new Date(iso).toLocaleDateString('en-US', {
|
|
||||||
year: 'numeric', month: 'short', day: 'numeric',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function stepPhoto(/** @type {string} */ id, /** @type {number} */ total, /** @type {1|-1} */ dir, /** @type {Event} */ e) {
|
|
||||||
e.stopPropagation();
|
|
||||||
const cur = photoIdx[id] ?? 0;
|
|
||||||
photoIdx = { ...photoIdx, [id]: (cur + dir + total) % total };
|
|
||||||
}
|
|
||||||
|
|
||||||
function setPhoto(/** @type {string} */ id, /** @type {number} */ i, /** @type {Event} */ e) {
|
|
||||||
e.stopPropagation();
|
|
||||||
photoIdx = { ...photoIdx, [id]: i };
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
{#if selected}
|
|
||||||
<JournalDetail entry={selected} onBack={() => (selected = null)} />
|
|
||||||
{:else}
|
|
||||||
<section class="timeline-view">
|
|
||||||
|
|
||||||
<header class="toolbar">
|
|
||||||
<div class="title-block">
|
|
||||||
<p class="eyebrow">Travel Journal</p>
|
|
||||||
<h1 class="page-title">My Journey</h1>
|
|
||||||
</div>
|
|
||||||
<div class="sort-control">
|
|
||||||
<label for="sort-select">Sort</label>
|
|
||||||
<select id="sort-select" onchange={(e) => (sortKey = e.currentTarget.value)}>
|
|
||||||
{#each sortOptions as opt}
|
|
||||||
<option value={opt.value} selected={opt.value === sortKey}>{opt.label}</option>
|
|
||||||
{/each}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
{#if sortedEntries.length === 0}
|
|
||||||
<p class="empty">No journal entries yet.</p>
|
|
||||||
{:else}
|
|
||||||
<ol class="v-list">
|
|
||||||
{#each sortedEntries as entry (entry.id)}
|
|
||||||
{@const idx = photoIdx[entry.id] ?? 0}
|
|
||||||
<li class="v-item">
|
|
||||||
<div class="v-dot" aria-hidden="true"></div>
|
|
||||||
<div class="v-entry-wrap">
|
|
||||||
<div class="above-card">
|
|
||||||
<time class="above-date" datetime={entry.date}>{formatDate(entry.date)}</time>
|
|
||||||
<span class="above-sep">·</span>
|
|
||||||
<span class="above-loc">{entry.location.city}, {entry.location.country}</span>
|
|
||||||
<span class="above-sep">·</span>
|
|
||||||
<span class="above-days">{entry.days} {entry.days === 1 ? 'day' : 'days'}</span>
|
|
||||||
</div>
|
|
||||||
<div class="entry-card" role="button" tabindex="0"
|
|
||||||
onclick={() => (selected = entry)}
|
|
||||||
onkeydown={(e) => e.key === 'Enter' && (selected = entry)}>
|
|
||||||
|
|
||||||
{#if entry.photos.length > 0}
|
|
||||||
<div class="gallery">
|
|
||||||
<img class="gallery-main" src={entry.photos[idx]}
|
|
||||||
alt="{entry.title} photo {idx + 1}" loading="lazy" />
|
|
||||||
{#if entry.photos.length > 1}
|
|
||||||
<button class="gallery-arrow left"
|
|
||||||
onclick={(e) => stepPhoto(entry.id, entry.photos.length, -1, e)}
|
|
||||||
aria-label="Previous photo">‹</button>
|
|
||||||
<button class="gallery-arrow right"
|
|
||||||
onclick={(e) => stepPhoto(entry.id, entry.photos.length, 1, e)}
|
|
||||||
aria-label="Next photo">›</button>
|
|
||||||
<div class="gallery-dots">
|
|
||||||
{#each entry.photos as _, i}
|
|
||||||
<button class="gallery-pip" class:active={i === idx}
|
|
||||||
onclick={(e) => setPhoto(entry.id, i, e)}
|
|
||||||
aria-label="Photo {i + 1}"></button>
|
|
||||||
{/each}
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<div class="entry-body">
|
|
||||||
<h2 class="entry-title">{entry.title}</h2>
|
|
||||||
{#if entry.memo}
|
|
||||||
<p class="entry-memo">{entry.memo}</p>
|
|
||||||
{/if}
|
|
||||||
<div class="entry-song">
|
|
||||||
<svg class="song-icon" width="13" height="13" viewBox="0 0 24 24" fill="none">
|
|
||||||
<path d="M9 18V5l12-2v13" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
||||||
<circle cx="6" cy="18" r="3" stroke="currentColor" stroke-width="2"/>
|
|
||||||
<circle cx="18" cy="16" r="3" stroke="currentColor" stroke-width="2"/>
|
|
||||||
</svg>
|
|
||||||
<span class="song-title">{entry.song.title}</span>
|
|
||||||
<span class="song-sep">·</span>
|
|
||||||
<span class="song-artist">{entry.song.artist}</span>
|
|
||||||
<span class="trip-badge trip-badge--{entry.tripType}">
|
|
||||||
{entry.tripType === 'solo' ? 'Solo' : 'With Friends'}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
{/each}
|
|
||||||
</ol>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<footer class="page-footer">
|
|
||||||
{sortedEntries.length} {sortedEntries.length === 1 ? 'entry' : 'entries'}
|
|
||||||
</footer>
|
|
||||||
</section>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.timeline-view {
|
|
||||||
max-width: 600px;
|
|
||||||
margin: 0 auto;
|
|
||||||
padding: 48px 24px 64px;
|
|
||||||
font-family: var(--sans, system-ui, sans-serif);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Toolbar */
|
|
||||||
.toolbar {
|
|
||||||
display: flex;
|
|
||||||
align-items: flex-end;
|
|
||||||
justify-content: space-between;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
gap: 20px;
|
|
||||||
margin-bottom: 48px;
|
|
||||||
padding-bottom: 24px;
|
|
||||||
border-bottom: 1px solid var(--border, #e5e4e7);
|
|
||||||
}
|
|
||||||
|
|
||||||
.eyebrow {
|
|
||||||
font-size: 11px;
|
|
||||||
letter-spacing: 3px;
|
|
||||||
text-transform: uppercase;
|
|
||||||
color: var(--accent, #aa3bff);
|
|
||||||
margin: 0 0 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.page-title {
|
|
||||||
font-size: 32px;
|
|
||||||
font-weight: 700;
|
|
||||||
color: var(--text-h, #08060d);
|
|
||||||
margin: 0;
|
|
||||||
letter-spacing: -0.8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sort-control { display: flex; align-items: center; gap: 8px; }
|
|
||||||
.sort-control label { font-size: 13px; color: var(--text, #6b6375); }
|
|
||||||
|
|
||||||
select {
|
|
||||||
font-size: 13px;
|
|
||||||
padding: 7px 28px 7px 10px;
|
|
||||||
border: 1px solid var(--border, #e5e4e7);
|
|
||||||
border-radius: 8px;
|
|
||||||
background: var(--bg, #fff);
|
|
||||||
color: var(--text-h, #08060d);
|
|
||||||
cursor: pointer;
|
|
||||||
appearance: none;
|
|
||||||
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b6375' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-position: right 10px center;
|
|
||||||
}
|
|
||||||
select:focus { outline: 2px solid var(--accent, #aa3bff); outline-offset: 2px; }
|
|
||||||
|
|
||||||
/* Above-card */
|
|
||||||
.above-card {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 6px;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
}
|
|
||||||
.above-date { font-size: 12px; font-weight: 500; color: var(--text-h, #08060d); }
|
|
||||||
.above-loc, .above-days { font-size: 12px; color: var(--text, #6b6375); }
|
|
||||||
.above-sep { font-size: 11px; color: var(--border, #c8c6cc); user-select: none; }
|
|
||||||
|
|
||||||
/* Card */
|
|
||||||
.entry-card {
|
|
||||||
display: block;
|
|
||||||
width: 100%;
|
|
||||||
box-sizing: border-box;
|
|
||||||
border: 1px solid var(--border, #e5e4e7);
|
|
||||||
border-radius: 14px;
|
|
||||||
overflow: hidden;
|
|
||||||
background: var(--bg, #fff);
|
|
||||||
cursor: pointer;
|
|
||||||
transition: box-shadow 0.2s, transform 0.15s;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
.entry-card:hover {
|
|
||||||
box-shadow: 0 6px 24px rgba(0,0,0,0.1);
|
|
||||||
transform: translateY(-2px);
|
|
||||||
}
|
|
||||||
|
|
||||||
.entry-body { padding: 14px 18px 18px; }
|
|
||||||
|
|
||||||
.entry-song .trip-badge { margin-left: auto; flex-shrink: 0; }
|
|
||||||
|
|
||||||
.trip-badge {
|
|
||||||
display: inline-block;
|
|
||||||
font-size: 11px;
|
|
||||||
font-weight: 500;
|
|
||||||
padding: 2px 8px;
|
|
||||||
border-radius: 20px;
|
|
||||||
}
|
|
||||||
.trip-badge--solo { background: rgba(245,158,11,0.12); color: #b45309; }
|
|
||||||
.trip-badge--friends { background: rgba(59,130,246,0.12); color: #1d4ed8; }
|
|
||||||
|
|
||||||
.entry-title {
|
|
||||||
font-size: 16px;
|
|
||||||
font-weight: 600;
|
|
||||||
color: var(--text-h, #08060d);
|
|
||||||
margin: 0 0 6px;
|
|
||||||
letter-spacing: -0.2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.entry-memo {
|
|
||||||
font-size: 13px;
|
|
||||||
line-height: 1.6;
|
|
||||||
color: var(--text, #6b6375);
|
|
||||||
margin: 0 0 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.entry-song {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 5px;
|
|
||||||
font-size: 12px;
|
|
||||||
color: var(--text, #6b6375);
|
|
||||||
padding-top: 10px;
|
|
||||||
border-top: 1px solid var(--border, #e5e4e7);
|
|
||||||
}
|
|
||||||
.song-icon { flex-shrink: 0; color: var(--accent, #aa3bff); }
|
|
||||||
.song-title { font-weight: 500; color: var(--text-h, #08060d); }
|
|
||||||
.song-sep { opacity: 0.35; }
|
|
||||||
|
|
||||||
/* Gallery */
|
|
||||||
.gallery { position: relative; overflow: hidden; background: #000; }
|
|
||||||
.gallery-main { width: 100%; height: 220px; object-fit: cover; display: block; }
|
|
||||||
|
|
||||||
.gallery-arrow {
|
|
||||||
position: absolute; top: 50%; transform: translateY(-50%);
|
|
||||||
background: rgba(0,0,0,0.45); color: #fff;
|
|
||||||
border: none; width: 32px; height: 32px; border-radius: 50%;
|
|
||||||
font-size: 20px; cursor: pointer;
|
|
||||||
display: flex; align-items: center; justify-content: center;
|
|
||||||
transition: background 0.15s; z-index: 2;
|
|
||||||
}
|
|
||||||
.gallery-arrow:hover { background: rgba(0,0,0,0.7); }
|
|
||||||
.gallery-arrow.left { left: 10px; }
|
|
||||||
.gallery-arrow.right { right: 10px; }
|
|
||||||
|
|
||||||
.gallery-dots {
|
|
||||||
position: absolute; bottom: 8px; left: 50%;
|
|
||||||
transform: translateX(-50%);
|
|
||||||
display: flex; gap: 5px; z-index: 2;
|
|
||||||
}
|
|
||||||
.gallery-pip {
|
|
||||||
width: 6px; height: 6px; border-radius: 50%;
|
|
||||||
border: none; background: rgba(255,255,255,0.5);
|
|
||||||
cursor: pointer; padding: 0;
|
|
||||||
transition: background 0.15s, transform 0.15s;
|
|
||||||
}
|
|
||||||
.gallery-pip.active { background: #fff; transform: scale(1.3); }
|
|
||||||
|
|
||||||
/* Vertical timeline */
|
|
||||||
.v-list { list-style: none; padding: 0; margin: 0; position: relative; }
|
|
||||||
.v-list::before {
|
|
||||||
content: '';
|
|
||||||
position: absolute; left: 10px; top: 6px; bottom: 6px;
|
|
||||||
width: 2px; background: var(--border, #e5e4e7); border-radius: 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.v-item { display: flex; gap: 24px; align-items: flex-start; padding-bottom: 36px; }
|
|
||||||
.v-item:last-child { padding-bottom: 0; }
|
|
||||||
|
|
||||||
.v-dot {
|
|
||||||
flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
|
|
||||||
background: var(--accent, #aa3bff);
|
|
||||||
border: 3px solid var(--bg, #fff);
|
|
||||||
box-shadow: 0 0 0 2px var(--accent, #aa3bff);
|
|
||||||
margin-top: 28px; z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.v-entry-wrap { flex: 1; display: flex; flex-direction: column; }
|
|
||||||
|
|
||||||
/* Footer */
|
|
||||||
.page-footer {
|
|
||||||
margin-top: 40px;
|
|
||||||
text-align: center;
|
|
||||||
font-size: 13px;
|
|
||||||
color: var(--text, #6b6375);
|
|
||||||
padding-top: 24px;
|
|
||||||
border-top: 1px solid var(--border, #e5e4e7);
|
|
||||||
}
|
|
||||||
|
|
||||||
.empty { text-align: center; color: var(--text, #6b6375); padding: 80px 0; }
|
|
||||||
|
|
||||||
@media (max-width: 600px) {
|
|
||||||
.timeline-view { padding: 32px 16px 48px; }
|
|
||||||
.page-title { font-size: 26px; }
|
|
||||||
.v-list::before { left: 8px; }
|
|
||||||
.v-dot { width: 18px; height: 18px; }
|
|
||||||
.v-item { gap: 16px; }
|
|
||||||
.gallery-main { height: 180px; }
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
25
src/lib/layout/Footer.svelte
Normal file
25
src/lib/layout/Footer.svelte
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<script>
|
||||||
|
import { getSelected, getTotalCount } from './selection.svelte.js';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<footer class="footer">
|
||||||
|
<span>{getSelected().size} / {getTotalCount()} countries visited</span>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.footer {
|
||||||
|
height: 40px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-family: var(--sans);
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 300;
|
||||||
|
color: var(--text-sub);
|
||||||
|
border-top: 1px solid var(--border);
|
||||||
|
background: var(--bg);
|
||||||
|
flex-shrink: 0;
|
||||||
|
letter-spacing: 0.06em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
36
src/lib/layout/Layout.svelte
Normal file
36
src/lib/layout/Layout.svelte
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<script>
|
||||||
|
import TopBar from './TopBar.svelte';
|
||||||
|
|
||||||
|
let { screen, onNavigate, hideTopBar = false, children } = $props();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="layout" class:no-topbar={hideTopBar}>
|
||||||
|
{#if !hideTopBar}
|
||||||
|
<TopBar {screen} {onNavigate} />
|
||||||
|
{/if}
|
||||||
|
<main class="main">
|
||||||
|
{@render children()}
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.layout {
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
display: grid;
|
||||||
|
grid-template-rows: auto 1fr;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.layout.no-topbar {
|
||||||
|
grid-template-rows: 1fr;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main {
|
||||||
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
73
src/lib/layout/TopBar.svelte
Normal file
73
src/lib/layout/TopBar.svelte
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
<script>
|
||||||
|
let { screen, onNavigate } = $props();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<nav class="topbar">
|
||||||
|
<div class="logo-area">
|
||||||
|
<span class="logo">Journi</span>
|
||||||
|
</div>
|
||||||
|
<div class="nav-links">
|
||||||
|
<button class="nav-btn" class:active={screen === 'worldmap'} onclick={() => onNavigate('worldmap')}>Map</button>
|
||||||
|
<button class="nav-btn" class:active={screen === 'timeline'} onclick={() => onNavigate('timeline')}>Journal</button>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.topbar {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 0 32px;
|
||||||
|
height: 52px;
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
background: var(--bg);
|
||||||
|
flex-shrink: 0;
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo-area {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo {
|
||||||
|
font-family: var(--heading);
|
||||||
|
font-size: 22px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--text-h);
|
||||||
|
letter-spacing: -0.5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-links {
|
||||||
|
display: flex;
|
||||||
|
gap: 2px;
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
background: var(--bg-subtle);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-btn {
|
||||||
|
font-family: var(--sans);
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 300;
|
||||||
|
padding: 4px 18px;
|
||||||
|
border-radius: 6px;
|
||||||
|
border: none;
|
||||||
|
background: none;
|
||||||
|
color: var(--text);
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background 0.15s, color 0.15s;
|
||||||
|
letter-spacing: 0.01em;
|
||||||
|
}
|
||||||
|
.nav-btn:hover { color: var(--text-h); }
|
||||||
|
.nav-btn.active {
|
||||||
|
background: #7c3aed;
|
||||||
|
color: #fff;
|
||||||
|
box-shadow: 0 1px 4px rgba(124,58,237,0.25);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
28
src/lib/layout/selection.svelte.js
Normal file
28
src/lib/layout/selection.svelte.js
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
let selected = $state(new Set());
|
||||||
|
let totalCountries = $state(0);
|
||||||
|
|
||||||
|
export function toggle(id) {
|
||||||
|
const next = new Set(selected);
|
||||||
|
if (next.has(id)) {
|
||||||
|
next.delete(id);
|
||||||
|
} else {
|
||||||
|
next.add(id);
|
||||||
|
}
|
||||||
|
selected = next;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function clearAll() {
|
||||||
|
selected = new Set();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getSelected() {
|
||||||
|
return selected;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setTotalCount(n) {
|
||||||
|
totalCountries = n;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getTotalCount() {
|
||||||
|
return totalCountries;
|
||||||
|
}
|
||||||
167
src/lib/shared/PhotoGallery.svelte
Normal file
167
src/lib/shared/PhotoGallery.svelte
Normal file
@@ -0,0 +1,167 @@
|
|||||||
|
<script>
|
||||||
|
/**
|
||||||
|
* Reusable photo gallery with prev/next arrows and indicator.
|
||||||
|
* @type {{
|
||||||
|
* photos: string[],
|
||||||
|
* height?: string,
|
||||||
|
* thumbs?: boolean,
|
||||||
|
* counter?: boolean,
|
||||||
|
* onStep?: (e: Event) => void,
|
||||||
|
* }}
|
||||||
|
*/
|
||||||
|
let { photos, height = '220px', thumbs = false, counter = false } = $props();
|
||||||
|
|
||||||
|
let idx = $state(0);
|
||||||
|
|
||||||
|
function prev(e) {
|
||||||
|
e?.stopPropagation();
|
||||||
|
idx = (idx - 1 + photos.length) % photos.length;
|
||||||
|
}
|
||||||
|
function next(e) {
|
||||||
|
e?.stopPropagation();
|
||||||
|
idx = (idx + 1) % photos.length;
|
||||||
|
}
|
||||||
|
function go(i, e) {
|
||||||
|
e?.stopPropagation();
|
||||||
|
idx = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset when photos change (e.g. navigating to a different entry)
|
||||||
|
$effect(() => {
|
||||||
|
photos;
|
||||||
|
idx = 0;
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if photos.length > 0}
|
||||||
|
<div class="gallery" style="--gallery-height: {height}">
|
||||||
|
<img class="gallery-img" src={photos[idx]} alt="photo {idx + 1}" loading="lazy" />
|
||||||
|
|
||||||
|
{#if photos.length > 1}
|
||||||
|
<button class="arr left" onclick={prev} aria-label="Previous photo">‹</button>
|
||||||
|
<button class="arr right" onclick={next} aria-label="Next photo">›</button>
|
||||||
|
|
||||||
|
{#if thumbs}
|
||||||
|
<div class="thumb-strip">
|
||||||
|
{#each photos as photo, i}
|
||||||
|
<button class="thumb" class:active={i === idx} onclick={(e) => go(i, e)} aria-label="Photo {i + 1}">
|
||||||
|
<img src={photo} alt="" />
|
||||||
|
</button>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
|
<div class="dots">
|
||||||
|
{#each photos as _, i}
|
||||||
|
<button class="pip" class:active={i === idx} onclick={(e) => go(i, e)} aria-label="Photo {i + 1}"></button>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#if counter}
|
||||||
|
<span class="counter">{idx + 1} / {photos.length}</span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.gallery {
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
background: #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gallery-img {
|
||||||
|
width: 100%;
|
||||||
|
height: var(--gallery-height);
|
||||||
|
object-fit: cover;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.arr {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
background: rgba(0,0,0,0.45);
|
||||||
|
color: #fff;
|
||||||
|
border: none;
|
||||||
|
border-radius: 50%;
|
||||||
|
font-size: 22px;
|
||||||
|
cursor: pointer;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
transition: background 0.15s;
|
||||||
|
z-index: 2;
|
||||||
|
width: 36px;
|
||||||
|
height: 36px;
|
||||||
|
}
|
||||||
|
.arr:hover { background: rgba(0,0,0,0.7); }
|
||||||
|
.arr.left { left: 10px; }
|
||||||
|
.arr.right { right: 10px; }
|
||||||
|
|
||||||
|
/* Dot indicators (timeline cards) */
|
||||||
|
.dots {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 8px;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
display: flex;
|
||||||
|
gap: 5px;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
.pip {
|
||||||
|
width: 6px;
|
||||||
|
height: 6px;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: none;
|
||||||
|
background: rgba(255,255,255,0.5);
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 0;
|
||||||
|
transition: background 0.15s, transform 0.15s;
|
||||||
|
}
|
||||||
|
.pip.active { background: #fff; transform: scale(1.3); }
|
||||||
|
|
||||||
|
/* Thumbnail strip (detail page) */
|
||||||
|
.thumb-strip {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 12px;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
.thumb {
|
||||||
|
width: 52px;
|
||||||
|
height: 36px;
|
||||||
|
border-radius: 6px;
|
||||||
|
overflow: hidden;
|
||||||
|
border: 2px solid transparent;
|
||||||
|
padding: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
opacity: 0.65;
|
||||||
|
background: none;
|
||||||
|
transition: border-color 0.15s, opacity 0.15s;
|
||||||
|
}
|
||||||
|
.thumb.active { border-color: #fff; opacity: 1; }
|
||||||
|
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
|
||||||
|
|
||||||
|
/* Photo counter badge */
|
||||||
|
.counter {
|
||||||
|
position: absolute;
|
||||||
|
top: 14px;
|
||||||
|
right: 14px;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 300;
|
||||||
|
color: #fff;
|
||||||
|
background: rgba(0,0,0,0.45);
|
||||||
|
padding: 3px 10px;
|
||||||
|
border-radius: 20px;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 600px) {
|
||||||
|
.thumb { width: 40px; height: 28px; }
|
||||||
|
}
|
||||||
|
</style>
|
||||||
128
src/lib/shared/SearchInput.svelte
Normal file
128
src/lib/shared/SearchInput.svelte
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
<script>
|
||||||
|
/**
|
||||||
|
* Searchable combobox input.
|
||||||
|
* @type {{ id?: string, value: string, options: string[], placeholder?: string, required?: boolean, onchange?: (v: string) => void }}
|
||||||
|
*/
|
||||||
|
let { id, value = $bindable(), options, placeholder = '', required = false, onselect } = $props();
|
||||||
|
|
||||||
|
let query = $state(value);
|
||||||
|
let open = $state(false);
|
||||||
|
let focused = $state(-1);
|
||||||
|
|
||||||
|
let filtered = $derived(
|
||||||
|
query.trim() === ''
|
||||||
|
? options
|
||||||
|
: options.filter(o => o.toLowerCase().includes(query.toLowerCase()))
|
||||||
|
);
|
||||||
|
|
||||||
|
function select(opt) {
|
||||||
|
query = opt;
|
||||||
|
value = opt;
|
||||||
|
open = false;
|
||||||
|
focused = -1;
|
||||||
|
onselect?.(opt);
|
||||||
|
}
|
||||||
|
|
||||||
|
function onInput(e) {
|
||||||
|
query = e.currentTarget.value;
|
||||||
|
value = query;
|
||||||
|
open = true;
|
||||||
|
focused = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
function onKeydown(e) {
|
||||||
|
if (!open) { if (e.key === 'ArrowDown') { open = true; } return; }
|
||||||
|
if (e.key === 'ArrowDown') { e.preventDefault(); focused = Math.min(focused + 1, filtered.length - 1); }
|
||||||
|
else if (e.key === 'ArrowUp') { e.preventDefault(); focused = Math.max(focused - 1, 0); }
|
||||||
|
else if (e.key === 'Enter') { e.preventDefault(); if (focused >= 0) { select(filtered[focused]); } else if (query.trim()) { select(query.trim()); } }
|
||||||
|
else if (e.key === 'Escape') { open = false; focused = -1; }
|
||||||
|
}
|
||||||
|
|
||||||
|
function onBlur() {
|
||||||
|
setTimeout(() => { open = false; focused = -1; }, 150);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Keep query in sync if value is changed externally
|
||||||
|
$effect(() => { query = value; });
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="combo">
|
||||||
|
<input
|
||||||
|
{id}
|
||||||
|
{required}
|
||||||
|
{placeholder}
|
||||||
|
class="combo-input"
|
||||||
|
type="text"
|
||||||
|
autocomplete="off"
|
||||||
|
value={query}
|
||||||
|
oninput={onInput}
|
||||||
|
onkeydown={onKeydown}
|
||||||
|
onfocus={() => open = true}
|
||||||
|
onblur={onBlur}
|
||||||
|
/>
|
||||||
|
{#if open && filtered.length > 0}
|
||||||
|
<ul class="dropdown" role="listbox">
|
||||||
|
{#each filtered as opt, i}
|
||||||
|
<li
|
||||||
|
class="option"
|
||||||
|
class:highlighted={i === focused}
|
||||||
|
role="option"
|
||||||
|
aria-selected={opt === value}
|
||||||
|
onmousedown={() => select(opt)}
|
||||||
|
>{opt}</li>
|
||||||
|
{/each}
|
||||||
|
</ul>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.combo {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.combo-input {
|
||||||
|
font-family: var(--sans);
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 300;
|
||||||
|
color: var(--text-h);
|
||||||
|
background: var(--bg-subtle);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 8px 12px;
|
||||||
|
outline: none;
|
||||||
|
transition: border-color 0.15s;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.combo-input:focus { border-color: var(--accent-border); }
|
||||||
|
|
||||||
|
.dropdown {
|
||||||
|
position: absolute;
|
||||||
|
top: calc(100% + 4px);
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
background: var(--bg);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 4px 16px rgba(0,0,0,0.1);
|
||||||
|
list-style: none;
|
||||||
|
max-height: 200px;
|
||||||
|
overflow-y: auto;
|
||||||
|
z-index: 50;
|
||||||
|
padding: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.option {
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 300;
|
||||||
|
color: var(--text);
|
||||||
|
padding: 7px 10px;
|
||||||
|
border-radius: 6px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background 0.1s, color 0.1s;
|
||||||
|
}
|
||||||
|
.option:hover, .option.highlighted {
|
||||||
|
background: var(--accent-bg);
|
||||||
|
color: var(--accent);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
25
src/lib/shared/countries.js
Normal file
25
src/lib/shared/countries.js
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
export const countryCodeMap = {
|
||||||
|
'Argentina': 'AR', 'Australia': 'AU', 'Austria': 'AT',
|
||||||
|
'Belgium': 'BE', 'Brazil': 'BR',
|
||||||
|
'Canada': 'CA', 'Chile': 'CL', 'China': 'CN', 'Croatia': 'HR',
|
||||||
|
'Czech Republic': 'CZ', 'Denmark': 'DK', 'Egypt': 'EG',
|
||||||
|
'Finland': 'FI', 'France': 'FR', 'Germany': 'DE', 'Greece': 'GR',
|
||||||
|
'Hungary': 'HU', 'India': 'IN', 'Indonesia': 'ID', 'Italy': 'IT',
|
||||||
|
'Japan': 'JP', 'Kenya': 'KE',
|
||||||
|
'Malaysia': 'MY', 'Mexico': 'MX', 'Morocco': 'MA',
|
||||||
|
'Netherlands': 'NL', 'New Zealand': 'NZ', 'Norway': 'NO',
|
||||||
|
'Peru': 'PE', 'Poland': 'PL', 'Portugal': 'PT',
|
||||||
|
'Singapore': 'SG', 'South Africa': 'ZA', 'South Korea': 'KR',
|
||||||
|
'Spain': 'ES', 'Sweden': 'SE', 'Switzerland': 'CH',
|
||||||
|
'Taiwan': 'TW', 'Thailand': 'TH', 'Turkey': 'TR',
|
||||||
|
'UK': 'GB', 'USA': 'US', 'Vietnam': 'VN',
|
||||||
|
};
|
||||||
|
|
||||||
|
export const countryNames = Object.keys(countryCodeMap).sort();
|
||||||
|
|
||||||
|
/** @param {string} country */
|
||||||
|
export function flagEmoji(country) {
|
||||||
|
const code = countryCodeMap[country];
|
||||||
|
if (!code) return '';
|
||||||
|
return [...code].map(c => String.fromCodePoint(0x1F1E6 - 65 + c.charCodeAt(0))).join('');
|
||||||
|
}
|
||||||
@@ -5,10 +5,10 @@ import { writable } from 'svelte/store';
|
|||||||
* id: string,
|
* id: string,
|
||||||
* title: string,
|
* title: string,
|
||||||
* date: string,
|
* date: string,
|
||||||
* location: { country: string, city: string },
|
* location: { country: string, cities: string[] },
|
||||||
* photos: string[],
|
* photos: string[],
|
||||||
* song: { title: string, artist: string },
|
* transport: 'flight' | 'train' | 'bus' | 'car' | 'ship' | 'walk',
|
||||||
* tripType: 'solo' | 'friends',
|
* tripType: 'solo' | 'friends' | 'family',
|
||||||
* days: number,
|
* days: number,
|
||||||
* memo: string
|
* memo: string
|
||||||
* }} JournalEntry
|
* }} JournalEntry
|
||||||
@@ -20,13 +20,13 @@ const mockEntries = [
|
|||||||
id: '1',
|
id: '1',
|
||||||
title: 'First Day in Tokyo',
|
title: 'First Day in Tokyo',
|
||||||
date: '2024-03-15',
|
date: '2024-03-15',
|
||||||
location: { country: 'Japan', city: 'Tokyo' },
|
location: { country: 'Japan', cities: ['Tokyo'] },
|
||||||
photos: [
|
photos: [
|
||||||
'https://images.unsplash.com/photo-1540959733332-eab4deabeeaf?w=600&q=80',
|
'https://images.unsplash.com/photo-1540959733332-eab4deabeeaf?w=600&q=80',
|
||||||
'https://images.unsplash.com/photo-1513407030348-c983a97b98d8?w=600&q=80',
|
'https://images.unsplash.com/photo-1513407030348-c983a97b98d8?w=600&q=80',
|
||||||
'https://images.unsplash.com/photo-1490806843957-31f4c9a91c65?w=600&q=80',
|
'https://images.unsplash.com/photo-1490806843957-31f4c9a91c65?w=600&q=80',
|
||||||
],
|
],
|
||||||
song: { title: 'Tokyo', artist: 'Imagine Dragons' },
|
transport: 'flight',
|
||||||
tripType: 'solo',
|
tripType: 'solo',
|
||||||
days: 5,
|
days: 5,
|
||||||
memo: 'Got completely lost in Shinjuku — stumbled into a tiny ramen shop with no English menu. The chashu just melted. Worth every wrong turn.',
|
memo: 'Got completely lost in Shinjuku — stumbled into a tiny ramen shop with no English menu. The chashu just melted. Worth every wrong turn.',
|
||||||
@@ -35,12 +35,12 @@ const mockEntries = [
|
|||||||
id: '2',
|
id: '2',
|
||||||
title: 'Arashiyama Bamboo Grove',
|
title: 'Arashiyama Bamboo Grove',
|
||||||
date: '2024-03-18',
|
date: '2024-03-18',
|
||||||
location: { country: 'Japan', city: 'Kyoto' },
|
location: { country: 'Japan', cities: ['Kyoto'] },
|
||||||
photos: [
|
photos: [
|
||||||
'https://images.unsplash.com/photo-1528360983277-13d401cdc186?w=600&q=80',
|
'https://images.unsplash.com/photo-1528360983277-13d401cdc186?w=600&q=80',
|
||||||
'https://images.unsplash.com/photo-1545569341-9eb8b30979d9?w=600&q=80',
|
'https://images.unsplash.com/photo-1545569341-9eb8b30979d9?w=600&q=80',
|
||||||
],
|
],
|
||||||
song: { title: 'Spirited Away Suite', artist: 'Joe Hisaishi' },
|
transport: 'train',
|
||||||
tripType: 'friends',
|
tripType: 'friends',
|
||||||
days: 3,
|
days: 3,
|
||||||
memo: 'Arrived at 6am before the crowds. Just me and the wind moving through the bamboo. One of those moments you keep coming back to.',
|
memo: 'Arrived at 6am before the crowds. Just me and the wind moving through the bamboo. One of those moments you keep coming back to.',
|
||||||
@@ -49,13 +49,13 @@ const mockEntries = [
|
|||||||
id: '3',
|
id: '3',
|
||||||
title: 'Sunset on Montmartre',
|
title: 'Sunset on Montmartre',
|
||||||
date: '2024-06-02',
|
date: '2024-06-02',
|
||||||
location: { country: 'France', city: 'Paris' },
|
location: { country: 'France', cities: ['Paris'] },
|
||||||
photos: [
|
photos: [
|
||||||
'https://images.unsplash.com/photo-1502602898657-3e91760cbb34?w=600&q=80',
|
'https://images.unsplash.com/photo-1502602898657-3e91760cbb34?w=600&q=80',
|
||||||
'https://images.unsplash.com/photo-1499856871958-5b9627545d1a?w=600&q=80',
|
'https://images.unsplash.com/photo-1499856871958-5b9627545d1a?w=600&q=80',
|
||||||
'https://images.unsplash.com/photo-1511739001486-6bfe10ce785f?w=600&q=80',
|
'https://images.unsplash.com/photo-1511739001486-6bfe10ce785f?w=600&q=80',
|
||||||
],
|
],
|
||||||
song: { title: 'La Vie en Rose', artist: 'Édith Piaf' },
|
transport: 'flight',
|
||||||
tripType: 'solo',
|
tripType: 'solo',
|
||||||
days: 7,
|
days: 7,
|
||||||
memo: 'Watched the whole city turn orange from the steps of Sacré-Cœur. A street musician was playing La Vie en Rose. Cliché, perfect.',
|
memo: 'Watched the whole city turn orange from the steps of Sacré-Cœur. A street musician was playing La Vie en Rose. Cliché, perfect.',
|
||||||
@@ -64,12 +64,12 @@ const mockEntries = [
|
|||||||
id: '4',
|
id: '4',
|
||||||
title: 'Inside La Sagrada Família',
|
title: 'Inside La Sagrada Família',
|
||||||
date: '2024-06-10',
|
date: '2024-06-10',
|
||||||
location: { country: 'Spain', city: 'Barcelona' },
|
location: { country: 'Spain', cities: ['Barcelona'] },
|
||||||
photos: [
|
photos: [
|
||||||
'https://images.unsplash.com/photo-1523531294919-4bcd7c65e216?w=600&q=80',
|
'https://images.unsplash.com/photo-1523531294919-4bcd7c65e216?w=600&q=80',
|
||||||
'https://images.unsplash.com/photo-1583422409516-2895a77efded?w=600&q=80',
|
'https://images.unsplash.com/photo-1583422409516-2895a77efded?w=600&q=80',
|
||||||
],
|
],
|
||||||
song: { title: 'Spain', artist: 'Chick Corea' },
|
transport: 'flight',
|
||||||
tripType: 'friends',
|
tripType: 'friends',
|
||||||
days: 4,
|
days: 4,
|
||||||
memo: 'Nothing prepares you for the light inside. The stained glass turns the whole nave into a kaleidoscope. Gaudí was building a forest.',
|
memo: 'Nothing prepares you for the light inside. The stained glass turns the whole nave into a kaleidoscope. Gaudí was building a forest.',
|
||||||
@@ -78,13 +78,13 @@ const mockEntries = [
|
|||||||
id: '5',
|
id: '5',
|
||||||
title: 'Central Park in Fall',
|
title: 'Central Park in Fall',
|
||||||
date: '2023-10-20',
|
date: '2023-10-20',
|
||||||
location: { country: 'USA', city: 'New York' },
|
location: { country: 'USA', cities: ['New York'] },
|
||||||
photos: [
|
photos: [
|
||||||
'https://images.unsplash.com/photo-1534430480872-3498386e7856?w=600&q=80',
|
'https://images.unsplash.com/photo-1534430480872-3498386e7856?w=600&q=80',
|
||||||
'https://images.unsplash.com/photo-1485871981521-5b1fd3805345?w=600&q=80',
|
'https://images.unsplash.com/photo-1485871981521-5b1fd3805345?w=600&q=80',
|
||||||
'https://images.unsplash.com/photo-1522083165195-3424ed129620?w=600&q=80',
|
'https://images.unsplash.com/photo-1522083165195-3424ed129620?w=600&q=80',
|
||||||
],
|
],
|
||||||
song: { title: 'New York, New York', artist: 'Frank Sinatra' },
|
transport: 'car',
|
||||||
tripType: 'friends',
|
tripType: 'friends',
|
||||||
days: 6,
|
days: 6,
|
||||||
memo: 'Peak foliage. Joggers, picnics, a guy playing saxophone near Bethesda Fountain. Hard to believe a city this big wraps around this much quiet.',
|
memo: 'Peak foliage. Joggers, picnics, a guy playing saxophone near Bethesda Fountain. Hard to believe a city this big wraps around this much quiet.',
|
||||||
@@ -93,12 +93,12 @@ const mockEntries = [
|
|||||||
id: '6',
|
id: '6',
|
||||||
title: 'Wat Pho Reclining Buddha',
|
title: 'Wat Pho Reclining Buddha',
|
||||||
date: '2024-01-08',
|
date: '2024-01-08',
|
||||||
location: { country: 'Thailand', city: 'Bangkok' },
|
location: { country: 'Thailand', cities: ['Bangkok'] },
|
||||||
photos: [
|
photos: [
|
||||||
'https://images.unsplash.com/photo-1563492065599-3520f775eeed?w=600&q=80',
|
'https://images.unsplash.com/photo-1563492065599-3520f775eeed?w=600&q=80',
|
||||||
'https://images.unsplash.com/photo-1552465011-b4e21bf6e79a?w=600&q=80',
|
'https://images.unsplash.com/photo-1552465011-b4e21bf6e79a?w=600&q=80',
|
||||||
],
|
],
|
||||||
song: { title: 'Elephant', artist: 'Tame Impala' },
|
transport: 'ship',
|
||||||
tripType: 'solo',
|
tripType: 'solo',
|
||||||
days: 2,
|
days: 2,
|
||||||
memo: 'Stood in front of the 45m golden Buddha for a long time. The mother-of-pearl inlay on the soles of the feet is impossibly detailed.',
|
memo: 'Stood in front of the 45m golden Buddha for a long time. The mother-of-pearl inlay on the soles of the feet is impossibly detailed.',
|
||||||
@@ -116,3 +116,8 @@ export function addJournal(entry) {
|
|||||||
export function removeJournal(id) {
|
export function removeJournal(id) {
|
||||||
journals.update((entries) => entries.filter((e) => e.id !== id));
|
journals.update((entries) => entries.filter((e) => e.id !== id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @param {JournalEntry} updated */
|
||||||
|
export function updateJournal(updated) {
|
||||||
|
journals.update((entries) => entries.map((e) => e.id === updated.id ? updated : e));
|
||||||
|
}
|
||||||
|
|||||||
88
src/lib/timeline/DeleteConfirm.svelte
Normal file
88
src/lib/timeline/DeleteConfirm.svelte
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
<script>
|
||||||
|
let { entry, onConfirm, onCancel } = $props();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="overlay" role="dialog" aria-modal="true">
|
||||||
|
<div class="dialog">
|
||||||
|
<h2 class="title">Delete entry?</h2>
|
||||||
|
<p class="body">
|
||||||
|
<strong>{entry.location.cities.join(', ')}, {entry.location.country}</strong> — {entry.date.slice(0, 4)} will be permanently removed.
|
||||||
|
</p>
|
||||||
|
<div class="actions">
|
||||||
|
<button class="btn btn-cancel" onclick={onCancel}>Cancel</button>
|
||||||
|
<button class="btn btn-delete" onclick={onConfirm}>Delete</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.overlay {
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
background: rgba(0,0,0,0.4);
|
||||||
|
z-index: 200;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog {
|
||||||
|
background: var(--bg);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 14px;
|
||||||
|
padding: 28px 32px;
|
||||||
|
width: 360px;
|
||||||
|
box-shadow: 0 8px 32px rgba(0,0,0,0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
font-size: 17px;
|
||||||
|
font-weight: 400;
|
||||||
|
color: var(--text-h);
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.body {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 300;
|
||||||
|
color: var(--text);
|
||||||
|
line-height: 1.6;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.actions {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
font-family: var(--sans);
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 300;
|
||||||
|
padding: 8px 18px;
|
||||||
|
border-radius: 8px;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background 0.15s, color 0.15s, border-color 0.15s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-cancel {
|
||||||
|
background: var(--bg);
|
||||||
|
color: var(--text);
|
||||||
|
}
|
||||||
|
.btn-cancel:hover {
|
||||||
|
background: var(--bg-subtle);
|
||||||
|
color: var(--text-h);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-delete {
|
||||||
|
background: #dc2626;
|
||||||
|
color: #fff;
|
||||||
|
border-color: #dc2626;
|
||||||
|
}
|
||||||
|
.btn-delete:hover {
|
||||||
|
background: #b91c1c;
|
||||||
|
border-color: #b91c1c;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
421
src/lib/timeline/EditForm.svelte
Normal file
421
src/lib/timeline/EditForm.svelte
Normal file
@@ -0,0 +1,421 @@
|
|||||||
|
<script>
|
||||||
|
import { get } from 'svelte/store';
|
||||||
|
import { journals, addJournal, updateJournal } from '../stores/journalStore.js';
|
||||||
|
import { countryNames } from '../shared/countries.js';
|
||||||
|
import SearchInput from '../shared/SearchInput.svelte';
|
||||||
|
import PhotoEditor from './PhotoEditor.svelte';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* entry = null → "new entry" mode
|
||||||
|
* entry = {...} → "edit" mode
|
||||||
|
* @type {{ entry?: import('../stores/journalStore.js').JournalEntry | null, initialCountry?: string, onBack: () => void }}
|
||||||
|
*/
|
||||||
|
let { entry = null, initialCountry = '', onBack } = $props();
|
||||||
|
|
||||||
|
let isNew = !entry;
|
||||||
|
|
||||||
|
let cities = $state([...(entry?.location.cities ?? [])]);
|
||||||
|
let cityInput = $state('');
|
||||||
|
let country = $state(entry?.location.country ?? initialCountry);
|
||||||
|
let date = $state(entry?.date ?? new Date().toISOString().slice(0, 10));
|
||||||
|
let days = $state(String(entry?.days ?? 1));
|
||||||
|
let tripType = $state(entry?.tripType ?? 'solo');
|
||||||
|
let photos = $state([...(entry?.photos ?? [])]);
|
||||||
|
let memo = $state(entry?.memo ?? '');
|
||||||
|
let transport = $state(entry?.transport ?? 'flight');
|
||||||
|
|
||||||
|
const transportOptions = [
|
||||||
|
{ value: 'flight', label: '✈ Flight' },
|
||||||
|
{ value: 'train', label: '🚂 Train' },
|
||||||
|
{ value: 'bus', label: '🚌 Bus' },
|
||||||
|
{ value: 'car', label: '🚗 Car' },
|
||||||
|
{ value: 'ship', label: '🚢 Ship' },
|
||||||
|
{ value: 'walk', label: '🚶 Walk' },
|
||||||
|
];
|
||||||
|
|
||||||
|
const MEMO_MAX = 100;
|
||||||
|
let wordCount = $derived(memo.trim() === '' ? 0 : memo.trim().split(/\s+/).length);
|
||||||
|
let memoOverLimit = $derived(wordCount > MEMO_MAX);
|
||||||
|
|
||||||
|
function onMemoInput(e) {
|
||||||
|
const raw = e.currentTarget.value;
|
||||||
|
const words = raw.trim() === '' ? [] : raw.trim().split(/\s+/);
|
||||||
|
if (words.length > MEMO_MAX) {
|
||||||
|
// keep first 100 words, preserve trailing space if user is mid-word
|
||||||
|
memo = words.slice(0, MEMO_MAX).join(' ');
|
||||||
|
e.currentTarget.value = memo;
|
||||||
|
} else {
|
||||||
|
memo = raw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let cityOptions = $derived(
|
||||||
|
[...new Set(get(journals).flatMap(e => e.location.cities))].sort()
|
||||||
|
);
|
||||||
|
|
||||||
|
function addCity(val) {
|
||||||
|
const trimmed = (val ?? cityInput).trim();
|
||||||
|
if (trimmed && !cities.includes(trimmed)) {
|
||||||
|
cities = [...cities, trimmed];
|
||||||
|
}
|
||||||
|
cityInput = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeCity(c) {
|
||||||
|
cities = cities.filter(x => x !== c);
|
||||||
|
}
|
||||||
|
|
||||||
|
function save() {
|
||||||
|
if (isNew) {
|
||||||
|
addJournal({
|
||||||
|
title: `${cities.join(', ')}, ${country}`,
|
||||||
|
date,
|
||||||
|
days: Number(days),
|
||||||
|
tripType,
|
||||||
|
memo,
|
||||||
|
photos,
|
||||||
|
transport,
|
||||||
|
location: { cities, country },
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
updateJournal({
|
||||||
|
...entry,
|
||||||
|
date,
|
||||||
|
days: Number(days),
|
||||||
|
tripType,
|
||||||
|
transport,
|
||||||
|
memo,
|
||||||
|
photos,
|
||||||
|
location: { cities, country },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
onBack();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="edit-layout">
|
||||||
|
|
||||||
|
<header class="edit-topbar">
|
||||||
|
<div class="topbar-left">
|
||||||
|
<button class="topbar-btn" onclick={onBack}>
|
||||||
|
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<path d="M19 12H5M12 5l-7 7 7 7"/>
|
||||||
|
</svg>
|
||||||
|
Back
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<span class="topbar-title">{isNew ? 'New entry' : 'Edit'}</span>
|
||||||
|
<div class="topbar-right">
|
||||||
|
<button class="topbar-btn topbar-btn--save" onclick={save}>Save changes</button>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="edit-scroll">
|
||||||
|
<form class="form" onsubmit={(e) => { e.preventDefault(); save(); }}>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="field">
|
||||||
|
<label class="label" for="edit-country">Country <span class="req">*</span></label>
|
||||||
|
<SearchInput id="edit-country" bind:value={country} options={countryNames} required />
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label class="label" for="edit-city">Cities <span class="req">*</span></label>
|
||||||
|
<div class="city-input-row">
|
||||||
|
<SearchInput id="edit-city" bind:value={cityInput} options={cityOptions} onselect={addCity} />
|
||||||
|
</div>
|
||||||
|
{#if cities.length > 0}
|
||||||
|
<div class="city-tags">
|
||||||
|
{#each cities as c}
|
||||||
|
<span class="city-tag">
|
||||||
|
{c}
|
||||||
|
<button type="button" class="city-tag-remove" onclick={() => removeCity(c)}>×</button>
|
||||||
|
</span>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="field">
|
||||||
|
<label class="label" for="edit-date">Date <span class="req">*</span></label>
|
||||||
|
<input id="edit-date" class="input" type="date" bind:value={date} required />
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label class="label" for="edit-days">Days <span class="req">*</span></label>
|
||||||
|
<input id="edit-days" class="input" type="number" min="1" bind:value={days} required />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label class="label">Trip type</label>
|
||||||
|
<div class="toggle-row">
|
||||||
|
<label class="toggle-opt" class:active={tripType === 'solo'}>
|
||||||
|
<input type="radio" name="tripType" value="solo" bind:group={tripType} /> Solo
|
||||||
|
</label>
|
||||||
|
<label class="toggle-opt" class:active={tripType === 'friends'}>
|
||||||
|
<input type="radio" name="tripType" value="friends" bind:group={tripType} /> With friends
|
||||||
|
</label>
|
||||||
|
<label class="toggle-opt" class:active={tripType === 'family'}>
|
||||||
|
<input type="radio" name="tripType" value="family" bind:group={tripType} /> With family
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label class="label">How did you get there?</label>
|
||||||
|
<div class="transport-grid">
|
||||||
|
{#each transportOptions as opt}
|
||||||
|
<label class="transport-opt" class:active={transport === opt.value}>
|
||||||
|
<input type="radio" name="transport" value={opt.value} bind:group={transport} />
|
||||||
|
{opt.label}
|
||||||
|
</label>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<PhotoEditor {photos} onchange={(p) => (photos = p)} />
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<div class="label-row">
|
||||||
|
<label class="label" for="edit-memo">How was it?</label>
|
||||||
|
<span class="char-count" class:over={memoOverLimit}>{wordCount} / {MEMO_MAX} words</span>
|
||||||
|
</div>
|
||||||
|
<textarea id="edit-memo" class="input textarea" class:input-over={memoOverLimit} rows="4" value={memo} oninput={onMemoInput}></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.edit-layout {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
background: var(--bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.edit-topbar {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 0 20px;
|
||||||
|
height: 52px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
background: var(--bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.topbar-left, .topbar-right {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
min-width: 120px;
|
||||||
|
}
|
||||||
|
.topbar-right { justify-content: flex-end; }
|
||||||
|
|
||||||
|
.topbar-title {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 400;
|
||||||
|
color: var(--text-h);
|
||||||
|
}
|
||||||
|
|
||||||
|
.topbar-btn {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
font-family: var(--sans);
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 300;
|
||||||
|
color: var(--text);
|
||||||
|
background: none;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 6px 12px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background 0.15s, color 0.15s, border-color 0.15s;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.topbar-btn:hover {
|
||||||
|
background: var(--bg-subtle);
|
||||||
|
border-color: var(--border);
|
||||||
|
color: var(--text-h);
|
||||||
|
}
|
||||||
|
.topbar-btn--save {
|
||||||
|
background: var(--accent);
|
||||||
|
color: #fff;
|
||||||
|
border-color: var(--accent);
|
||||||
|
}
|
||||||
|
.topbar-btn--save:hover {
|
||||||
|
background: var(--accent-dark);
|
||||||
|
border-color: var(--accent-dark);
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.edit-scroll {
|
||||||
|
flex: 1;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 18px;
|
||||||
|
max-width: 560px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 36px 48px 80px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
gap: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.field {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 400;
|
||||||
|
letter-spacing: 0.08em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
color: var(--text-sub);
|
||||||
|
}
|
||||||
|
|
||||||
|
.char-count {
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 300;
|
||||||
|
color: var(--text-sub);
|
||||||
|
transition: color 0.15s;
|
||||||
|
}
|
||||||
|
.char-count.over { color: #dc2626; }
|
||||||
|
.input-over { border-color: #fca5a5; }
|
||||||
|
|
||||||
|
.req {
|
||||||
|
color: var(--accent);
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input {
|
||||||
|
font-family: var(--sans);
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 300;
|
||||||
|
color: var(--text-h);
|
||||||
|
background: var(--bg-subtle);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 8px 12px;
|
||||||
|
outline: none;
|
||||||
|
transition: border-color 0.15s;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.input:focus { border-color: var(--accent-border); }
|
||||||
|
|
||||||
|
.textarea {
|
||||||
|
resize: vertical;
|
||||||
|
line-height: 1.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toggle-row {
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toggle-opt {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 300;
|
||||||
|
color: var(--text);
|
||||||
|
padding: 7px 14px;
|
||||||
|
border-radius: 8px;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
cursor: pointer;
|
||||||
|
transition: border-color 0.15s, background 0.15s, color 0.15s;
|
||||||
|
background: var(--bg-subtle);
|
||||||
|
}
|
||||||
|
.toggle-opt input { display: none; }
|
||||||
|
.toggle-opt.active {
|
||||||
|
border-color: var(--accent-border);
|
||||||
|
background: var(--accent-bg);
|
||||||
|
color: var(--accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.transport-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(3, 1fr);
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
.transport-opt {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 6px;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 300;
|
||||||
|
color: var(--text);
|
||||||
|
padding: 8px 10px;
|
||||||
|
border-radius: 8px;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
cursor: pointer;
|
||||||
|
transition: border-color 0.15s, background 0.15s, color 0.15s;
|
||||||
|
background: var(--bg-subtle);
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.transport-opt input { display: none; }
|
||||||
|
.transport-opt.active {
|
||||||
|
border-color: var(--accent-border);
|
||||||
|
background: var(--accent-bg);
|
||||||
|
color: var(--accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.city-input-row {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.city-tags {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 6px;
|
||||||
|
margin-top: 4px;
|
||||||
|
}
|
||||||
|
.city-tag {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 300;
|
||||||
|
color: var(--accent);
|
||||||
|
background: var(--accent-bg);
|
||||||
|
border: 1px solid var(--accent-border);
|
||||||
|
border-radius: 20px;
|
||||||
|
padding: 3px 10px 3px 12px;
|
||||||
|
}
|
||||||
|
.city-tag-remove {
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
color: var(--accent);
|
||||||
|
font-size: 15px;
|
||||||
|
line-height: 1;
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 0;
|
||||||
|
opacity: 0.6;
|
||||||
|
transition: opacity 0.15s;
|
||||||
|
}
|
||||||
|
.city-tag-remove:hover { opacity: 1; }
|
||||||
|
|
||||||
|
</style>
|
||||||
352
src/lib/timeline/JournalDetail.svelte
Normal file
352
src/lib/timeline/JournalDetail.svelte
Normal file
@@ -0,0 +1,352 @@
|
|||||||
|
<script>
|
||||||
|
import { removeJournal } from '../stores/journalStore.js';
|
||||||
|
import { flagEmoji } from '../shared/countries.js';
|
||||||
|
import DeleteConfirm from './DeleteConfirm.svelte';
|
||||||
|
|
||||||
|
/** @type {{ entry: import('../stores/journalStore.js').JournalEntry, onBack: () => void, onEdit: () => void }} */
|
||||||
|
let { entry, onBack, onEdit } = $props();
|
||||||
|
|
||||||
|
let showDeleteConfirm = $state(false);
|
||||||
|
|
||||||
|
function handleDelete() {
|
||||||
|
removeJournal(entry.id);
|
||||||
|
onBack();
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatDate(iso) {
|
||||||
|
return new Date(iso).toLocaleDateString('en-US', {
|
||||||
|
weekday: 'long', year: 'numeric', month: 'long', day: 'numeric',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
let lightboxSrc = $state(null);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if showDeleteConfirm}
|
||||||
|
<DeleteConfirm {entry} onConfirm={handleDelete} onCancel={() => showDeleteConfirm = false} />
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<!-- Lightbox -->
|
||||||
|
{#if lightboxSrc}
|
||||||
|
<div class="lightbox" onclick={() => lightboxSrc = null} role="button" tabindex="0"
|
||||||
|
onkeydown={(e) => e.key === 'Escape' && (lightboxSrc = null)}>
|
||||||
|
<img src={lightboxSrc} alt="" />
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<div class="detail-layout">
|
||||||
|
|
||||||
|
<!-- ── Full-width top bar ── -->
|
||||||
|
<header class="detail-topbar">
|
||||||
|
<div class="topbar-left">
|
||||||
|
<button class="topbar-btn" onclick={onBack}>
|
||||||
|
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<path d="M19 12H5M12 5l-7 7 7 7"/>
|
||||||
|
</svg>
|
||||||
|
Back
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<div class="topbar-divider"></div>
|
||||||
|
|
||||||
|
<span class="topbar-flag">{flagEmoji(entry.location.country)}</span>
|
||||||
|
<div class="topbar-place">
|
||||||
|
<span class="topbar-city">{entry.location.cities.join(', ')}</span>
|
||||||
|
<span class="topbar-country">{entry.location.country}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="topbar-right">
|
||||||
|
<button class="topbar-btn" title="Edit entry" onclick={onEdit}>
|
||||||
|
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/>
|
||||||
|
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/>
|
||||||
|
</svg>
|
||||||
|
Edit
|
||||||
|
</button>
|
||||||
|
<button class="topbar-btn topbar-btn--danger" title="Delete entry" onclick={() => showDeleteConfirm = true}>
|
||||||
|
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<path d="M3 6h18M8 6V4h8v2M19 6l-1 14H6L5 6"/>
|
||||||
|
</svg>
|
||||||
|
Delete
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<!-- ── Body: photo left + Q&A right ── -->
|
||||||
|
<div class="detail-body">
|
||||||
|
|
||||||
|
<!-- Left: photos -->
|
||||||
|
<div class="photo-col">
|
||||||
|
<div class="photo-scroll">
|
||||||
|
{#if entry.photos.length === 0}
|
||||||
|
<div class="no-photos">No photos</div>
|
||||||
|
{:else}
|
||||||
|
<div class="photo-grid">
|
||||||
|
{#each entry.photos as photo, i}
|
||||||
|
<div class="photo-cell" class:cell-wide={i === 0 && entry.photos.length > 1}>
|
||||||
|
<img src={photo} alt=""
|
||||||
|
onclick={() => lightboxSrc = photo}
|
||||||
|
onerror={(e) => e.currentTarget.parentElement.classList.add('cell-broken')} />
|
||||||
|
</div>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Right: Q&A -->
|
||||||
|
<div class="info-col">
|
||||||
|
<div class="info-inner">
|
||||||
|
<div class="qa-list">
|
||||||
|
|
||||||
|
<div class="qa-item">
|
||||||
|
<p class="question">When did you go?</p>
|
||||||
|
<p class="answer">{formatDate(entry.date)}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="qa-item">
|
||||||
|
<p class="question">How long did you stay?</p>
|
||||||
|
<p class="answer">{entry.days} {entry.days === 1 ? 'day' : 'days'}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="qa-item">
|
||||||
|
<p class="question">Who did you go with?</p>
|
||||||
|
<p class="answer">
|
||||||
|
{#if entry.tripType === 'solo'}
|
||||||
|
Just me — solo trip
|
||||||
|
{:else if entry.tripType === 'family'}
|
||||||
|
With family
|
||||||
|
{:else}
|
||||||
|
With friends
|
||||||
|
{/if}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="qa-item">
|
||||||
|
<p class="question">How was it?</p>
|
||||||
|
<p class="answer memo">{entry.memo}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
/* ── Outer layout: column (topbar + body) ── */
|
||||||
|
.detail-layout {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Full-width top bar ── */
|
||||||
|
.detail-topbar {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 0 20px;
|
||||||
|
height: 52px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
background: var(--bg);
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.topbar-left {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
.topbar-right {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topbar-divider {
|
||||||
|
width: 1px;
|
||||||
|
height: 20px;
|
||||||
|
background: var(--border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.topbar-flag { font-size: 20px; line-height: 1; }
|
||||||
|
|
||||||
|
.topbar-place {
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
.topbar-city {
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 300;
|
||||||
|
color: var(--text-sub);
|
||||||
|
}
|
||||||
|
.topbar-country {
|
||||||
|
font-size: 17px;
|
||||||
|
font-weight: 400;
|
||||||
|
color: var(--text-h);
|
||||||
|
letter-spacing: -0.3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topbar-btn {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
font-family: var(--sans);
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 300;
|
||||||
|
color: var(--text);
|
||||||
|
background: none;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 6px 12px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background 0.15s, color 0.15s, border-color 0.15s;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.topbar-btn:hover {
|
||||||
|
background: var(--bg-subtle);
|
||||||
|
border-color: var(--border);
|
||||||
|
color: var(--text-h);
|
||||||
|
}
|
||||||
|
.topbar-btn--danger:hover { color: #dc2626; background: #fff1f1; border-color: #fca5a5; }
|
||||||
|
|
||||||
|
/* ── Body row ── */
|
||||||
|
.detail-body {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Left: photos ── */
|
||||||
|
.photo-col {
|
||||||
|
flex: 1;
|
||||||
|
overflow: hidden;
|
||||||
|
background: #f0f0f0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.photo-scroll {
|
||||||
|
flex: 1;
|
||||||
|
overflow-y: auto;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.photo-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
gap: 4px;
|
||||||
|
grid-auto-rows: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.photo-cell {
|
||||||
|
overflow: hidden;
|
||||||
|
background: var(--bg-subtle);
|
||||||
|
border-radius: 4px;
|
||||||
|
cursor: zoom-in;
|
||||||
|
}
|
||||||
|
.photo-cell.cell-wide {
|
||||||
|
grid-column: 1 / -1;
|
||||||
|
grid-row: span 2;
|
||||||
|
}
|
||||||
|
.photo-cell img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
display: block;
|
||||||
|
transition: transform 0.2s ease;
|
||||||
|
}
|
||||||
|
.photo-cell:hover img { transform: scale(1.03); }
|
||||||
|
.photo-cell.cell-broken {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: var(--text-sub);
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.no-photos {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
height: 100%;
|
||||||
|
color: var(--text-sub);
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Right: Q&A ── */
|
||||||
|
.info-col {
|
||||||
|
width: 440px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
overflow-y: auto;
|
||||||
|
border-left: 1px solid var(--border);
|
||||||
|
background: var(--bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-inner {
|
||||||
|
padding: 36px 32px 80px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.qa-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.qa-item {
|
||||||
|
padding: 20px 0;
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
}
|
||||||
|
.qa-item:first-child { padding-top: 0; }
|
||||||
|
.qa-item:last-child { border-bottom: none; }
|
||||||
|
|
||||||
|
.question {
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 400;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.1em;
|
||||||
|
color: var(--accent);
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.answer {
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 300;
|
||||||
|
color: var(--text-h);
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
.answer.memo {
|
||||||
|
font-size: 14px;
|
||||||
|
color: var(--text);
|
||||||
|
line-height: 1.75;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Lightbox ── */
|
||||||
|
.lightbox {
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
background: rgba(0,0,0,0.9);
|
||||||
|
z-index: 100;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
cursor: zoom-out;
|
||||||
|
}
|
||||||
|
.lightbox img {
|
||||||
|
max-width: 90vw;
|
||||||
|
max-height: 90vh;
|
||||||
|
object-fit: contain;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Responsive ── */
|
||||||
|
@media (max-width: 700px) {
|
||||||
|
.detail-body { flex-direction: column; overflow-y: auto; }
|
||||||
|
.photo-col { height: 260px; flex: none; }
|
||||||
|
.info-col { width: 100%; border-left: none; border-top: 1px solid var(--border); }
|
||||||
|
}
|
||||||
|
</style>
|
||||||
198
src/lib/timeline/JournalSummary.svelte
Normal file
198
src/lib/timeline/JournalSummary.svelte
Normal file
@@ -0,0 +1,198 @@
|
|||||||
|
<script>
|
||||||
|
/** @type {{ entries: import('../stores/journalStore.js').JournalEntry[] }} */
|
||||||
|
let { entries } = $props();
|
||||||
|
|
||||||
|
let stats = $derived.by(() => {
|
||||||
|
if (entries.length === 0) return null;
|
||||||
|
|
||||||
|
const totalDays = entries.reduce((s, e) => s + e.days, 0);
|
||||||
|
const countries = [...new Set(entries.map(e => e.location.country))];
|
||||||
|
const cities = [...new Set(entries.flatMap(e => e.location.cities))];
|
||||||
|
|
||||||
|
const years = entries.map(e => new Date(e.date).getFullYear());
|
||||||
|
const minYear = Math.min(...years);
|
||||||
|
const maxYear = Math.max(...years);
|
||||||
|
const yearRange = minYear === maxYear ? `${minYear}` : `${minYear} – ${maxYear}`;
|
||||||
|
|
||||||
|
return { totalDays, countries, cities, yearRange, tripCount: entries.length };
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if stats}
|
||||||
|
<div class="passport">
|
||||||
|
<!-- diagonal pattern -->
|
||||||
|
|
||||||
|
<div class="passport-body">
|
||||||
|
<!-- Left -->
|
||||||
|
<div class="passport-left">
|
||||||
|
<div class="passport-header">
|
||||||
|
<svg viewBox="0 0 32 32" fill="none" class="globe">
|
||||||
|
<circle cx="16" cy="16" r="13" stroke="currentColor" stroke-width="1.3"/>
|
||||||
|
<ellipse cx="16" cy="16" rx="5.5" ry="13" stroke="currentColor" stroke-width="1.3"/>
|
||||||
|
<line x1="3" y1="16" x2="29" y2="16" stroke="currentColor" stroke-width="1.3"/>
|
||||||
|
<line x1="5" y1="9" x2="27" y2="9" stroke="currentColor" stroke-width="1.3"/>
|
||||||
|
<line x1="5" y1="23" x2="27" y2="23" stroke="currentColor" stroke-width="1.3"/>
|
||||||
|
</svg>
|
||||||
|
<span class="issuer">TRAVEL JOURNAL</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p class="type">PASSPORT</p>
|
||||||
|
<p class="years">{stats.yearRange}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="vdivider"></div>
|
||||||
|
|
||||||
|
<!-- Right -->
|
||||||
|
<div class="passport-right">
|
||||||
|
<div class="field">
|
||||||
|
<span class="field-label">TRIPS</span>
|
||||||
|
<span class="field-value">{stats.tripCount}</span>
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<span class="field-label">COUNTRIES</span>
|
||||||
|
<span class="field-value">{stats.countries.length}</span>
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<span class="field-label">DAYS</span>
|
||||||
|
<span class="field-value">{stats.totalDays}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- MRZ -->
|
||||||
|
<div class="mrz">
|
||||||
|
<span>P<JNL{String(stats.tripCount).padStart(2,'0')}<<<<<<<<<<<<<<<<<<<<<<<<<<<</span>
|
||||||
|
<span>{stats.yearRange.replace(' – ','').replace(/\s/g,'')}{'<'.repeat(12)}{String(stats.totalDays).padStart(4,'0')}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.passport {
|
||||||
|
background: #1e1b4b;
|
||||||
|
border-radius: 14px;
|
||||||
|
overflow: hidden;
|
||||||
|
color: #e0e7ff;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.passport::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
background: repeating-linear-gradient(
|
||||||
|
135deg,
|
||||||
|
transparent 0px, transparent 20px,
|
||||||
|
rgba(255,255,255,0.025) 20px, rgba(255,255,255,0.025) 21px
|
||||||
|
);
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Body: left + divider + right in a row */
|
||||||
|
.passport-body {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: stretch;
|
||||||
|
padding: 20px;
|
||||||
|
gap: 0;
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Left column */
|
||||||
|
.passport-left {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 16px;
|
||||||
|
padding-right: 20px;
|
||||||
|
}
|
||||||
|
.passport-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
.globe {
|
||||||
|
width: 26px;
|
||||||
|
height: 26px;
|
||||||
|
color: #a5b4fc;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
.issuer {
|
||||||
|
font-size: 9px;
|
||||||
|
font-weight: 500;
|
||||||
|
letter-spacing: 0.18em;
|
||||||
|
color: #a5b4fc;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
.type {
|
||||||
|
font-size: 10px;
|
||||||
|
font-weight: 500;
|
||||||
|
letter-spacing: 0.22em;
|
||||||
|
color: #818cf8;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
.years {
|
||||||
|
font-size: 26px;
|
||||||
|
font-weight: 400;
|
||||||
|
color: #fff;
|
||||||
|
letter-spacing: -0.8px;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Divider */
|
||||||
|
.vdivider {
|
||||||
|
width: 1px;
|
||||||
|
background: rgba(255,255,255,0.12);
|
||||||
|
flex-shrink: 0;
|
||||||
|
align-self: stretch;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Right column */
|
||||||
|
.passport-right {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 10px;
|
||||||
|
padding-left: 20px;
|
||||||
|
}
|
||||||
|
.field {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 2px;
|
||||||
|
}
|
||||||
|
.field-label {
|
||||||
|
font-size: 8px;
|
||||||
|
font-weight: 500;
|
||||||
|
letter-spacing: 0.18em;
|
||||||
|
color: #818cf8;
|
||||||
|
}
|
||||||
|
.field-value {
|
||||||
|
font-size: 22px;
|
||||||
|
font-weight: 400;
|
||||||
|
color: #fff;
|
||||||
|
letter-spacing: -0.5px;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* MRZ strip */
|
||||||
|
.mrz {
|
||||||
|
border-top: 1px solid rgba(255,255,255,0.1);
|
||||||
|
padding: 9px 20px;
|
||||||
|
background: rgba(0,0,0,0.18);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 2px;
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
.mrz span {
|
||||||
|
font-family: var(--mono);
|
||||||
|
font-size: 8px;
|
||||||
|
color: #6366f1;
|
||||||
|
letter-spacing: 0.06em;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
183
src/lib/timeline/PhotoEditor.svelte
Normal file
183
src/lib/timeline/PhotoEditor.svelte
Normal file
@@ -0,0 +1,183 @@
|
|||||||
|
<script>
|
||||||
|
/** @type {{ photos: string[], onchange: (photos: string[]) => void }} */
|
||||||
|
let { photos, onchange } = $props();
|
||||||
|
|
||||||
|
let fileInput;
|
||||||
|
|
||||||
|
function remove(index) {
|
||||||
|
const next = photos.filter((_, i) => i !== index);
|
||||||
|
onchange(next);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function addFiles(e) {
|
||||||
|
const files = Array.from(e.currentTarget.files ?? []);
|
||||||
|
if (!files.length) return;
|
||||||
|
|
||||||
|
const dataUrls = await Promise.all(files.map(fileToDataUrl));
|
||||||
|
onchange([...photos, ...dataUrls]);
|
||||||
|
|
||||||
|
// reset so the same file can be picked again
|
||||||
|
e.currentTarget.value = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @param {File} file */
|
||||||
|
function fileToDataUrl(file) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
const reader = new FileReader();
|
||||||
|
reader.onload = (e) => resolve(/** @type {string} */ (e.target.result));
|
||||||
|
reader.readAsDataURL(file);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="photo-editor">
|
||||||
|
<div class="label-row">
|
||||||
|
<span class="label">Photos</span>
|
||||||
|
<input bind:this={fileInput} type="file" accept="image/*" multiple onchange={addFiles} hidden />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if photos.length === 0}
|
||||||
|
<button type="button" class="empty-zone" onclick={() => fileInput.click()}>
|
||||||
|
<svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.2">
|
||||||
|
<rect x="3" y="3" width="18" height="18" rx="3"/>
|
||||||
|
<circle cx="8.5" cy="8.5" r="1.5"/>
|
||||||
|
<path d="M21 15l-5-5L5 21"/>
|
||||||
|
</svg>
|
||||||
|
<span>Click to add photos</span>
|
||||||
|
</button>
|
||||||
|
{:else}
|
||||||
|
<div class="grid">
|
||||||
|
{#each photos as src, i (src + i)}
|
||||||
|
<div class="cell">
|
||||||
|
<img {src} alt="photo {i + 1}" />
|
||||||
|
<button type="button" class="remove-btn" onclick={() => remove(i)} aria-label="Remove photo">
|
||||||
|
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round">
|
||||||
|
<path d="M18 6L6 18M6 6l12 12"/>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{/each}
|
||||||
|
|
||||||
|
<button type="button" class="add-cell" onclick={() => fileInput.click()}>
|
||||||
|
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round">
|
||||||
|
<path d="M12 5v14M5 12h14"/>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.photo-editor {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 400;
|
||||||
|
letter-spacing: 0.08em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
color: var(--text-sub);
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.add-btn {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 5px;
|
||||||
|
font-family: var(--sans);
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 300;
|
||||||
|
color: var(--accent);
|
||||||
|
background: var(--accent-bg);
|
||||||
|
border: 1px solid var(--accent-border);
|
||||||
|
border-radius: 6px;
|
||||||
|
padding: 4px 10px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background 0.15s;
|
||||||
|
}
|
||||||
|
.add-btn:hover { background: rgba(124,58,237,0.12); }
|
||||||
|
|
||||||
|
.empty-zone {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 10px;
|
||||||
|
height: 120px;
|
||||||
|
border: 1.5px dashed var(--border-bright);
|
||||||
|
border-radius: 10px;
|
||||||
|
color: var(--text-sub);
|
||||||
|
font-family: var(--sans);
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 300;
|
||||||
|
cursor: pointer;
|
||||||
|
background: var(--bg-subtle);
|
||||||
|
transition: border-color 0.15s, color 0.15s;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.empty-zone:hover { border-color: var(--accent-border); color: var(--accent); }
|
||||||
|
|
||||||
|
.grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(3, 1fr);
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cell {
|
||||||
|
position: relative;
|
||||||
|
aspect-ratio: 1;
|
||||||
|
border-radius: 8px;
|
||||||
|
overflow: hidden;
|
||||||
|
background: var(--bg-subtle);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cell img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.remove-btn {
|
||||||
|
position: absolute;
|
||||||
|
top: 5px;
|
||||||
|
right: 5px;
|
||||||
|
width: 22px;
|
||||||
|
height: 22px;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: none;
|
||||||
|
background: rgba(0,0,0,0.55);
|
||||||
|
color: #fff;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
cursor: pointer;
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.15s, background 0.15s;
|
||||||
|
}
|
||||||
|
.cell:hover .remove-btn { opacity: 1; }
|
||||||
|
.remove-btn:hover { background: rgba(220,38,38,0.85); }
|
||||||
|
|
||||||
|
.add-cell {
|
||||||
|
aspect-ratio: 1;
|
||||||
|
border-radius: 8px;
|
||||||
|
border: 1.5px dashed var(--border-bright);
|
||||||
|
background: var(--bg-subtle);
|
||||||
|
color: var(--text-sub);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: border-color 0.15s, color 0.15s;
|
||||||
|
}
|
||||||
|
.add-cell:hover { border-color: var(--accent-border); color: var(--accent); }
|
||||||
|
</style>
|
||||||
484
src/lib/timeline/ShareCard.svelte
Normal file
484
src/lib/timeline/ShareCard.svelte
Normal file
@@ -0,0 +1,484 @@
|
|||||||
|
<script>
|
||||||
|
import { toPng } from 'html-to-image';
|
||||||
|
|
||||||
|
/** @type {{ entries: import('../stores/journalStore.js').JournalEntry[], onClose: () => void }} */
|
||||||
|
let { entries, onClose } = $props();
|
||||||
|
|
||||||
|
let cardEl = $state(null);
|
||||||
|
let downloading = $state(false);
|
||||||
|
|
||||||
|
const continentMap = {
|
||||||
|
'Japan': 'Asia', 'South Korea': 'Asia', 'China': 'Asia', 'Thailand': 'Asia',
|
||||||
|
'Vietnam': 'Asia', 'Indonesia': 'Asia', 'Malaysia': 'Asia', 'Singapore': 'Asia',
|
||||||
|
'India': 'Asia', 'Taiwan': 'Asia', 'Philippines': 'Asia', 'Cambodia': 'Asia',
|
||||||
|
'Nepal': 'Asia', 'Bangladesh': 'Asia',
|
||||||
|
'France': 'Europe', 'Spain': 'Europe', 'Italy': 'Europe', 'Germany': 'Europe',
|
||||||
|
'UK': 'Europe', 'Netherlands': 'Europe', 'Portugal': 'Europe', 'Greece': 'Europe',
|
||||||
|
'Sweden': 'Europe', 'Norway': 'Europe', 'Denmark': 'Europe', 'Finland': 'Europe',
|
||||||
|
'Switzerland': 'Europe', 'Austria': 'Europe', 'Belgium': 'Europe', 'Poland': 'Europe',
|
||||||
|
'Czech Republic': 'Europe', 'Hungary': 'Europe', 'Croatia': 'Europe', 'Turkey': 'Europe',
|
||||||
|
'USA': 'N. America', 'Canada': 'N. America', 'Mexico': 'N. America',
|
||||||
|
'Brazil': 'S. America', 'Argentina': 'S. America', 'Chile': 'S. America',
|
||||||
|
'Peru': 'S. America', 'Colombia': 'S. America',
|
||||||
|
'Australia': 'Oceania', 'New Zealand': 'Oceania',
|
||||||
|
'Morocco': 'Africa', 'Egypt': 'Africa', 'Kenya': 'Africa', 'South Africa': 'Africa',
|
||||||
|
};
|
||||||
|
|
||||||
|
const flightHoursMap = {
|
||||||
|
'Japan': 13, 'South Korea': 13, 'China': 12, 'Thailand': 11, 'Vietnam': 12,
|
||||||
|
'Indonesia': 14, 'Malaysia': 11, 'Singapore': 11, 'India': 9, 'Taiwan': 13,
|
||||||
|
'France': 9, 'Spain': 10, 'Italy': 10, 'Germany': 9, 'UK': 8, 'Netherlands': 9,
|
||||||
|
'Portugal': 9, 'Greece': 11, 'Sweden': 10, 'Norway': 9, 'Switzerland': 9,
|
||||||
|
'Turkey': 11, 'Austria': 10, 'Belgium': 9, 'Poland': 10,
|
||||||
|
'USA': 14, 'Canada': 13, 'Mexico': 13,
|
||||||
|
'Brazil': 10, 'Argentina': 12, 'Chile': 13,
|
||||||
|
'Australia': 20, 'New Zealand': 23,
|
||||||
|
'Morocco': 10, 'Egypt': 12, 'Kenya': 14, 'South Africa': 16,
|
||||||
|
};
|
||||||
|
|
||||||
|
let stats = $derived.by(() => {
|
||||||
|
if (entries.length === 0) return null;
|
||||||
|
|
||||||
|
const totalDays = entries.reduce((s, e) => s + e.days, 0);
|
||||||
|
const countries = [...new Set(entries.map(e => e.location.country))];
|
||||||
|
const cities = [...new Set(entries.flatMap(e => e.location.cities))];
|
||||||
|
|
||||||
|
// Continent days
|
||||||
|
const contDays = {};
|
||||||
|
for (const e of entries) {
|
||||||
|
const cont = continentMap[e.location.country] ?? 'Other';
|
||||||
|
contDays[cont] = (contDays[cont] ?? 0) + e.days;
|
||||||
|
}
|
||||||
|
const topContinent = Object.entries(contDays).sort((a, b) => b[1] - a[1])[0];
|
||||||
|
|
||||||
|
// Longest trip
|
||||||
|
const longest = [...entries].sort((a, b) => b.days - a.days)[0];
|
||||||
|
|
||||||
|
// Date range
|
||||||
|
const dates = entries.map(e => new Date(e.date));
|
||||||
|
const firstDate = new Date(Math.min(...dates));
|
||||||
|
const lastDate = new Date(Math.max(...dates));
|
||||||
|
const spanDays = Math.round((lastDate - firstDate) / 86400000);
|
||||||
|
const spanMonths = Math.round(spanDays / 30);
|
||||||
|
|
||||||
|
// Flight hours estimate
|
||||||
|
const flightTrips = entries.filter(e => e.transport === 'flight');
|
||||||
|
const flightHrs = flightTrips.reduce((s, e) => s + (flightHoursMap[e.location.country] ?? 10), 0);
|
||||||
|
|
||||||
|
// Solo vs friends
|
||||||
|
const soloCount = entries.filter(e => e.tripType === 'solo').length;
|
||||||
|
const friendCount = entries.filter(e => e.tripType === 'friends').length;
|
||||||
|
const familyCount = entries.filter(e => e.tripType === 'family').length;
|
||||||
|
|
||||||
|
// Most visited country
|
||||||
|
const countryCounts = {};
|
||||||
|
for (const e of entries) countryCounts[e.location.country] = (countryCounts[e.location.country] ?? 0) + 1;
|
||||||
|
const favCountry = Object.entries(countryCounts).sort((a, b) => b[1] - a[1])[0];
|
||||||
|
|
||||||
|
const yearStart = firstDate.getFullYear();
|
||||||
|
const yearEnd = lastDate.getFullYear();
|
||||||
|
|
||||||
|
return {
|
||||||
|
totalDays, countries, cities, contDays, topContinent,
|
||||||
|
longest, flightHrs, soloCount, friendCount, familyCount,
|
||||||
|
favCountry, spanMonths, yearStart, yearEnd,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
async function download() {
|
||||||
|
if (!cardEl) return;
|
||||||
|
downloading = true;
|
||||||
|
try {
|
||||||
|
const dataUrl = await toPng(cardEl, { pixelRatio: 3 });
|
||||||
|
const a = document.createElement('a');
|
||||||
|
a.download = 'my-journey.png';
|
||||||
|
a.href = dataUrl;
|
||||||
|
a.click();
|
||||||
|
} finally {
|
||||||
|
downloading = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function fmtYear(y1, y2) {
|
||||||
|
return y1 === y2 ? `${y1}` : `${y1} – ${y2}`;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<!-- Overlay -->
|
||||||
|
<div class="overlay" role="dialog" aria-modal="true">
|
||||||
|
<div class="overlay-inner">
|
||||||
|
|
||||||
|
<!-- Controls -->
|
||||||
|
<div class="controls">
|
||||||
|
<button class="ctrl-btn" onclick={onClose}>
|
||||||
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
|
||||||
|
<path d="M18 6 6 18M6 6l12 12"/>
|
||||||
|
</svg>
|
||||||
|
Close
|
||||||
|
</button>
|
||||||
|
<button class="ctrl-btn ctrl-btn--primary" onclick={download} disabled={downloading}>
|
||||||
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
|
||||||
|
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"/>
|
||||||
|
</svg>
|
||||||
|
{downloading ? 'Saving…' : 'Save as PNG'}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- The card (Instagram story 9:16) -->
|
||||||
|
{#if stats}
|
||||||
|
<div class="card-wrap">
|
||||||
|
<div class="card" bind:this={cardEl}>
|
||||||
|
|
||||||
|
<!-- Background layers -->
|
||||||
|
<div class="bg-gradient"></div>
|
||||||
|
<div class="bg-grid"></div>
|
||||||
|
|
||||||
|
<!-- Header -->
|
||||||
|
<div class="card-header">
|
||||||
|
<span class="card-brand">MAP JOURNAL</span>
|
||||||
|
<span class="card-year">{fmtYear(stats.yearStart, stats.yearEnd)}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Hero stat -->
|
||||||
|
<div class="hero">
|
||||||
|
<p class="hero-num">{stats.totalDays}</p>
|
||||||
|
<p class="hero-label">days of travel</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Stat grid -->
|
||||||
|
<div class="stat-grid">
|
||||||
|
<div class="stat-box">
|
||||||
|
<p class="stat-num">{stats.countries.length}</p>
|
||||||
|
<p class="stat-desc">countries</p>
|
||||||
|
</div>
|
||||||
|
<div class="stat-box">
|
||||||
|
<p class="stat-num">{stats.cities.length}</p>
|
||||||
|
<p class="stat-desc">cities</p>
|
||||||
|
</div>
|
||||||
|
<div class="stat-box">
|
||||||
|
<p class="stat-num">{stats.flightHrs}h</p>
|
||||||
|
<p class="stat-desc">in the air</p>
|
||||||
|
</div>
|
||||||
|
<div class="stat-box">
|
||||||
|
<p class="stat-num">{Object.keys(stats.contDays).length}</p>
|
||||||
|
<p class="stat-desc">continents</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Fun facts -->
|
||||||
|
<div class="facts">
|
||||||
|
{#if stats.topContinent}
|
||||||
|
<div class="fact">
|
||||||
|
<span class="fact-icon">🌏</span>
|
||||||
|
<span class="fact-text">Spent <strong>{stats.topContinent[1]} days</strong> in {stats.topContinent[0]}</span>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
{#if stats.longest}
|
||||||
|
<div class="fact">
|
||||||
|
<span class="fact-icon">📍</span>
|
||||||
|
<span class="fact-text">Longest stay: <strong>{stats.longest.days} days</strong> in {stats.longest.location.cities.join(', ')}</span>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
{#if stats.flightHrs > 0}
|
||||||
|
<div class="fact">
|
||||||
|
<span class="fact-icon">✈️</span>
|
||||||
|
<span class="fact-text">~<strong>{stats.flightHrs} hrs</strong> crossing skies</span>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
{#if stats.favCountry && stats.favCountry[1] > 1}
|
||||||
|
<div class="fact">
|
||||||
|
<span class="fact-icon">❤️</span>
|
||||||
|
<span class="fact-text">Kept coming back to <strong>{stats.favCountry[0]}</strong></span>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
<div class="fact">
|
||||||
|
<span class="fact-icon">{stats.soloCount >= stats.friendCount ? '🧳' : '👥'}</span>
|
||||||
|
<span class="fact-text">{stats.soloCount} solo{stats.friendCount > 0 ? ` · ${stats.friendCount} with friends` : ''}{stats.familyCount > 0 ? ` · ${stats.familyCount} with family` : ''}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Continent bar -->
|
||||||
|
{#if Object.keys(stats.contDays).length > 0}
|
||||||
|
<div class="cont-section">
|
||||||
|
<div class="cont-bar">
|
||||||
|
{#each Object.entries(stats.contDays).sort((a,b)=>b[1]-a[1]) as [cont, days]}
|
||||||
|
<div class="cont-seg" style="flex:{days}; background: var(--cont-{cont.replace('. ','').toLowerCase().replace(' ','-')}, #818cf8)"
|
||||||
|
title="{cont}: {days}d"></div>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
<div class="cont-legend">
|
||||||
|
{#each Object.entries(stats.contDays).sort((a,b)=>b[1]-a[1]) as [cont, days]}
|
||||||
|
<span class="cont-item">
|
||||||
|
<span class="cont-dot" style="background: var(--cont-{cont.replace('. ','').toLowerCase().replace(' ','-')}, #818cf8)"></span>
|
||||||
|
{cont} {days}d
|
||||||
|
</span>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<!-- Footer -->
|
||||||
|
<div class="card-footer">
|
||||||
|
<span>mapjournal.app</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
/* ── Overlay ── */
|
||||||
|
.overlay {
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
background: rgba(0,0,0,0.7);
|
||||||
|
z-index: 200;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 24px;
|
||||||
|
backdrop-filter: blur(4px);
|
||||||
|
}
|
||||||
|
.overlay-inner {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
gap: 16px;
|
||||||
|
height: 100%;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Controls ── */
|
||||||
|
.controls {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
.ctrl-btn {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 7px;
|
||||||
|
font-family: var(--sans);
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 400;
|
||||||
|
padding: 8px 18px;
|
||||||
|
border-radius: 8px;
|
||||||
|
border: 1px solid rgba(255,255,255,0.2);
|
||||||
|
background: rgba(255,255,255,0.1);
|
||||||
|
color: #fff;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background 0.15s;
|
||||||
|
}
|
||||||
|
.ctrl-btn:hover { background: rgba(255,255,255,0.18); }
|
||||||
|
.ctrl-btn--primary {
|
||||||
|
background: #7c3aed;
|
||||||
|
border-color: #7c3aed;
|
||||||
|
}
|
||||||
|
.ctrl-btn--primary:hover { background: #6d28d9; }
|
||||||
|
.ctrl-btn:disabled { opacity: 0.6; cursor: default; }
|
||||||
|
|
||||||
|
/* ── Card wrap (scrollable preview) ── */
|
||||||
|
.card-wrap {
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Card itself (Instagram story 9:16 → 360×640 preview) ── */
|
||||||
|
.card {
|
||||||
|
width: 360px;
|
||||||
|
min-height: 640px;
|
||||||
|
border-radius: 20px;
|
||||||
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding: 32px 28px 24px;
|
||||||
|
gap: 0;
|
||||||
|
font-family: 'Bricolage Grotesque', system-ui, sans-serif;
|
||||||
|
background: #0f0a1e;
|
||||||
|
color: #fff;
|
||||||
|
|
||||||
|
/* continent color vars */
|
||||||
|
--cont-asia: #f87171;
|
||||||
|
--cont-europe: #818cf8;
|
||||||
|
--cont-africa: #fb923c;
|
||||||
|
--cont-namerica: #4ade80;
|
||||||
|
--cont-n-america: #4ade80;
|
||||||
|
--cont-samerica: #fbbf24;
|
||||||
|
--cont-s-america: #fbbf24;
|
||||||
|
--cont-oceania: #c084fc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Backgrounds */
|
||||||
|
.bg-gradient {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
background:
|
||||||
|
radial-gradient(ellipse 60% 40% at 80% 10%, rgba(124,58,237,0.35) 0%, transparent 70%),
|
||||||
|
radial-gradient(ellipse 50% 50% at 10% 80%, rgba(99,102,241,0.25) 0%, transparent 60%);
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
.bg-grid {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
background-image:
|
||||||
|
linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
|
||||||
|
linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
|
||||||
|
background-size: 32px 32px;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Header */
|
||||||
|
.card-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 36px;
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
.card-brand {
|
||||||
|
font-size: 9px;
|
||||||
|
font-weight: 500;
|
||||||
|
letter-spacing: 0.22em;
|
||||||
|
color: #a5b4fc;
|
||||||
|
}
|
||||||
|
.card-year {
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 300;
|
||||||
|
color: rgba(255,255,255,0.4);
|
||||||
|
letter-spacing: 0.06em;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hero */
|
||||||
|
.hero {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
margin-bottom: 28px;
|
||||||
|
}
|
||||||
|
.hero-num {
|
||||||
|
font-size: 88px;
|
||||||
|
font-weight: 400;
|
||||||
|
line-height: 1;
|
||||||
|
letter-spacing: -4px;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
.hero-label {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 300;
|
||||||
|
color: #a5b4fc;
|
||||||
|
letter-spacing: 0.04em;
|
||||||
|
margin-top: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Stat grid */
|
||||||
|
.stat-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(4, 1fr);
|
||||||
|
gap: 8px;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
.stat-box {
|
||||||
|
background: rgba(255,255,255,0.05);
|
||||||
|
border: 1px solid rgba(255,255,255,0.08);
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 10px 8px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.stat-num {
|
||||||
|
font-size: 22px;
|
||||||
|
font-weight: 400;
|
||||||
|
color: #fff;
|
||||||
|
letter-spacing: -0.5px;
|
||||||
|
line-height: 1;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
.stat-desc {
|
||||||
|
font-size: 9px;
|
||||||
|
font-weight: 400;
|
||||||
|
color: rgba(255,255,255,0.4);
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Facts */
|
||||||
|
.facts {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 10px;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
.fact {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
background: rgba(255,255,255,0.04);
|
||||||
|
border: 1px solid rgba(255,255,255,0.07);
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 10px 14px;
|
||||||
|
}
|
||||||
|
.fact-icon { font-size: 16px; flex-shrink: 0; }
|
||||||
|
.fact-text {
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 300;
|
||||||
|
color: rgba(255,255,255,0.7);
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
.fact-text strong { color: #fff; font-weight: 400; }
|
||||||
|
|
||||||
|
/* Continent bar */
|
||||||
|
.cont-section {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
.cont-bar {
|
||||||
|
display: flex;
|
||||||
|
height: 6px;
|
||||||
|
border-radius: 3px;
|
||||||
|
overflow: hidden;
|
||||||
|
gap: 2px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
.cont-seg { border-radius: 3px; min-width: 4px; }
|
||||||
|
.cont-legend {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 6px 12px;
|
||||||
|
}
|
||||||
|
.cont-item {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
font-size: 9px;
|
||||||
|
font-weight: 300;
|
||||||
|
color: rgba(255,255,255,0.5);
|
||||||
|
letter-spacing: 0.04em;
|
||||||
|
}
|
||||||
|
.cont-dot {
|
||||||
|
width: 6px;
|
||||||
|
height: 6px;
|
||||||
|
border-radius: 50%;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Footer */
|
||||||
|
.card-footer {
|
||||||
|
margin-top: auto;
|
||||||
|
padding-top: 16px;
|
||||||
|
border-top: 1px solid rgba(255,255,255,0.08);
|
||||||
|
font-size: 9px;
|
||||||
|
font-weight: 300;
|
||||||
|
color: rgba(255,255,255,0.25);
|
||||||
|
letter-spacing: 0.12em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
235
src/lib/timeline/SharePreview.svelte
Normal file
235
src/lib/timeline/SharePreview.svelte
Normal file
@@ -0,0 +1,235 @@
|
|||||||
|
<script>
|
||||||
|
/** @type {{ entries: import('../stores/journalStore.js').JournalEntry[], onClick: () => void }} */
|
||||||
|
let { entries, onClick } = $props();
|
||||||
|
|
||||||
|
const continentMap = {
|
||||||
|
'Japan':'Asia','South Korea':'Asia','China':'Asia','Thailand':'Asia','Vietnam':'Asia',
|
||||||
|
'Indonesia':'Asia','Malaysia':'Asia','Singapore':'Asia','India':'Asia','Taiwan':'Asia',
|
||||||
|
'Philippines':'Asia','Cambodia':'Asia','Nepal':'Asia',
|
||||||
|
'France':'Europe','Spain':'Europe','Italy':'Europe','Germany':'Europe','UK':'Europe',
|
||||||
|
'Netherlands':'Europe','Portugal':'Europe','Greece':'Europe','Sweden':'Europe',
|
||||||
|
'Norway':'Europe','Denmark':'Europe','Finland':'Europe','Switzerland':'Europe',
|
||||||
|
'Austria':'Europe','Belgium':'Europe','Poland':'Europe','Czech Republic':'Europe',
|
||||||
|
'Hungary':'Europe','Croatia':'Europe','Turkey':'Europe',
|
||||||
|
'USA':'N. America','Canada':'N. America','Mexico':'N. America',
|
||||||
|
'Brazil':'S. America','Argentina':'S. America','Chile':'S. America','Peru':'S. America',
|
||||||
|
'Australia':'Oceania','New Zealand':'Oceania',
|
||||||
|
'Morocco':'Africa','Egypt':'Africa','Kenya':'Africa','South Africa':'Africa',
|
||||||
|
};
|
||||||
|
|
||||||
|
const continentColors = {
|
||||||
|
'Asia':'#f87171','Europe':'#818cf8','N. America':'#4ade80',
|
||||||
|
'S. America':'#fbbf24','Africa':'#fb923c','Oceania':'#c084fc',
|
||||||
|
};
|
||||||
|
|
||||||
|
let stats = $derived.by(() => {
|
||||||
|
const totalDays = entries.reduce((s, e) => s + e.days, 0);
|
||||||
|
const countries = [...new Set(entries.map(e => e.location.country))];
|
||||||
|
const contDays = {};
|
||||||
|
for (const e of entries) {
|
||||||
|
const c = continentMap[e.location.country] ?? 'Other';
|
||||||
|
contDays[c] = (contDays[c] ?? 0) + e.days;
|
||||||
|
}
|
||||||
|
const top = Object.entries(contDays).sort((a, b) => b[1] - a[1]);
|
||||||
|
return { totalDays, countries, contDays, top, trips: entries.length };
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<button class="preview-card" onclick={onClick} aria-label="Share your journey">
|
||||||
|
|
||||||
|
<div class="pc-bg"></div>
|
||||||
|
<div class="pc-grid-pattern"></div>
|
||||||
|
|
||||||
|
<div class="pc-header">
|
||||||
|
<span class="pc-brand">MAP JOURNAL</span>
|
||||||
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" class="pc-share-icon">
|
||||||
|
<circle cx="18" cy="5" r="3"/><circle cx="6" cy="12" r="3"/><circle cx="18" cy="19" r="3"/>
|
||||||
|
<path d="m8.59 13.51 6.83 3.98M15.41 6.51l-6.82 3.98"/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="pc-hero">
|
||||||
|
<span class="pc-num">{stats.totalDays}</span>
|
||||||
|
<span class="pc-label">days traveled</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="pc-row">
|
||||||
|
<div class="pc-stat">
|
||||||
|
<span class="pc-stat-num">{stats.countries.length}</span>
|
||||||
|
<span class="pc-stat-label">countries</span>
|
||||||
|
</div>
|
||||||
|
<div class="pc-stat">
|
||||||
|
<span class="pc-stat-num">{stats.trips}</span>
|
||||||
|
<span class="pc-stat-label">trips</span>
|
||||||
|
</div>
|
||||||
|
<div class="pc-stat">
|
||||||
|
<span class="pc-stat-num">{Object.keys(stats.contDays).length}</span>
|
||||||
|
<span class="pc-stat-label">continents</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if stats.top.length > 0}
|
||||||
|
<div class="pc-bar-wrap">
|
||||||
|
<div class="pc-bar">
|
||||||
|
{#each stats.top as [cont, days]}
|
||||||
|
<div class="pc-seg" style="flex:{days}; background:{continentColors[cont] ?? '#818cf8'}"></div>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
<div class="pc-bar-labels">
|
||||||
|
{#each stats.top.slice(0,3) as [cont, days]}
|
||||||
|
<span class="pc-bar-label" style="color:{continentColors[cont] ?? '#818cf8'}">{cont}</span>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<div class="pc-cta">Share your journey →</div>
|
||||||
|
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.preview-card {
|
||||||
|
position: sticky;
|
||||||
|
top: 40px;
|
||||||
|
width: 100%;
|
||||||
|
background: #1a1630;
|
||||||
|
border-radius: 12px;
|
||||||
|
overflow: hidden;
|
||||||
|
color: #fff;
|
||||||
|
cursor: pointer;
|
||||||
|
border: 1px solid rgba(255,255,255,0.06);
|
||||||
|
text-align: left;
|
||||||
|
padding: 16px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 12px;
|
||||||
|
transition: transform 0.15s, box-shadow 0.15s;
|
||||||
|
box-shadow: 0 2px 12px rgba(0,0,0,0.08);
|
||||||
|
font-family: var(--sans);
|
||||||
|
}
|
||||||
|
.preview-card:hover {
|
||||||
|
transform: translateY(-1px);
|
||||||
|
box-shadow: 0 4px 20px rgba(124,58,237,0.12);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-bg {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
background:
|
||||||
|
radial-gradient(ellipse 80% 60% at 90% 0%, rgba(124,58,237,0.2) 0%, transparent 60%),
|
||||||
|
radial-gradient(ellipse 60% 60% at 0% 100%, rgba(99,102,241,0.1) 0%, transparent 60%);
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
.pc-grid-pattern {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
background-image:
|
||||||
|
linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
|
||||||
|
linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
|
||||||
|
background-size: 24px 24px;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
.pc-brand {
|
||||||
|
font-size: 8px;
|
||||||
|
font-weight: 500;
|
||||||
|
letter-spacing: 0.2em;
|
||||||
|
color: #a5b4fc;
|
||||||
|
}
|
||||||
|
.pc-share-icon { color: #a5b4fc; flex-shrink: 0; }
|
||||||
|
|
||||||
|
.pc-hero {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 2px;
|
||||||
|
}
|
||||||
|
.pc-num {
|
||||||
|
font-size: 40px;
|
||||||
|
font-weight: 400;
|
||||||
|
line-height: 1;
|
||||||
|
letter-spacing: -1.5px;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
.pc-label {
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 300;
|
||||||
|
color: #a5b4fc;
|
||||||
|
letter-spacing: 0.04em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-row {
|
||||||
|
display: flex;
|
||||||
|
gap: 0;
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
.pc-stat {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 2px;
|
||||||
|
padding-right: 12px;
|
||||||
|
border-right: 1px solid rgba(255,255,255,0.08);
|
||||||
|
}
|
||||||
|
.pc-stat:last-child { border-right: none; padding-right: 0; padding-left: 12px; }
|
||||||
|
.pc-stat:not(:first-child):not(:last-child) { padding-left: 12px; }
|
||||||
|
.pc-stat-num {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 400;
|
||||||
|
color: #fff;
|
||||||
|
letter-spacing: -0.5px;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
.pc-stat-label {
|
||||||
|
font-size: 9px;
|
||||||
|
font-weight: 300;
|
||||||
|
color: rgba(255,255,255,0.4);
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-bar-wrap {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
.pc-bar {
|
||||||
|
display: flex;
|
||||||
|
height: 4px;
|
||||||
|
border-radius: 2px;
|
||||||
|
overflow: hidden;
|
||||||
|
gap: 2px;
|
||||||
|
}
|
||||||
|
.pc-seg { border-radius: 2px; min-width: 3px; }
|
||||||
|
.pc-bar-labels {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
.pc-bar-label {
|
||||||
|
font-size: 9px;
|
||||||
|
font-weight: 300;
|
||||||
|
letter-spacing: 0.04em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-cta {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 400;
|
||||||
|
color: #a5b4fc;
|
||||||
|
letter-spacing: 0.04em;
|
||||||
|
padding-top: 4px;
|
||||||
|
border-top: 1px solid rgba(255,255,255,0.08);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
338
src/lib/timeline/TimelineCard.svelte
Normal file
338
src/lib/timeline/TimelineCard.svelte
Normal file
@@ -0,0 +1,338 @@
|
|||||||
|
<script>
|
||||||
|
import { flagEmoji } from '../shared/countries.js';
|
||||||
|
|
||||||
|
/** @type {{ entry: import('../stores/journalStore.js').JournalEntry, onClick: () => void }} */
|
||||||
|
let { entry, onClick } = $props();
|
||||||
|
|
||||||
|
function formatDate(/** @type {string} */ iso) {
|
||||||
|
return new Date(iso).toLocaleDateString('en-US', {
|
||||||
|
month: 'short', day: 'numeric', year: 'numeric',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
let mainPhoto = $derived(entry.photos[0] ?? null);
|
||||||
|
let thumbPhotos = $derived(entry.photos.slice(1, 4));
|
||||||
|
let extraCount = $derived(entry.photos.length > 4 ? entry.photos.length - 4 : 0);
|
||||||
|
|
||||||
|
const transportIcons = {
|
||||||
|
flight: `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07A19.5 19.5 0 0 1 4.18 10a19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 3.09 0h3a2 2 0 0 1 2 1.72c.127.96.361 1.903.7 2.81a2 2 0 0 1-.45 2.11L7.09 8a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.907.339 1.85.573 2.81.7A2 2 0 0 1 21 15z"/></svg>`,
|
||||||
|
train: `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="2" width="16" height="16" rx="2"/><path d="M4 12h16M8 20l-2 2M16 20l2 2M12 12v6"/><circle cx="8.5" cy="7.5" r="1"/><circle cx="15.5" cy="7.5" r="1"/></svg>`,
|
||||||
|
bus: `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M8 6v6M15 6v6M2 12h19.6M18 18h2a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h2m0 0v2m8-2v2M6 18h12"/><circle cx="8" cy="18" r="2"/><circle cx="16" cy="18" r="2"/></svg>`,
|
||||||
|
car: `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M5 17H3a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v9a2 2 0 0 1-2 2h-2"/><circle cx="7.5" cy="17.5" r="2.5"/><circle cx="17.5" cy="17.5" r="2.5"/></svg>`,
|
||||||
|
ship: `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M2 21c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1 .6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1"/><path d="M19.38 20A11.6 11.6 0 0 0 21 14l-9-4-9 4c0 2.9.94 5.34 2.81 7.76"/><path d="M19 13V7a1 1 0 0 0-1-1H6a1 1 0 0 0-1 1v6"/><path d="M12 10v4"/><path d="M12 3v4"/></svg>`,
|
||||||
|
walk: `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="4" r="2"/><path d="m9 22 1-7-2.5-2.5L9 9l6 1-1 4.5L16 22"/><path d="M6.5 11.5 4 12l2 6"/><path d="M17.5 11.5 20 12l-2 6"/></svg>`,
|
||||||
|
};
|
||||||
|
let transportLabel = $derived({ flight: 'Flight', train: 'Train', bus: 'Bus', car: 'Car', ship: 'Ship', walk: 'Walk' }[entry.transport] ?? '');
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<li class="v-item">
|
||||||
|
<div class="v-dot" aria-hidden="true"></div>
|
||||||
|
|
||||||
|
<div class="v-content">
|
||||||
|
<!-- Country above card -->
|
||||||
|
<div class="above-card">
|
||||||
|
<span class="flag">{flagEmoji(entry.location.country)}</span>
|
||||||
|
<span class="country-name">{entry.location.country}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Card -->
|
||||||
|
<div class="entry-card" role="button" tabindex="0"
|
||||||
|
onclick={onClick}
|
||||||
|
onkeydown={(e) => e.key === 'Enter' && onClick()}>
|
||||||
|
|
||||||
|
<!-- Trip badge — top-right of card, outside photo -->
|
||||||
|
<span class="trip-badge trip-badge--{entry.tripType}">
|
||||||
|
{entry.tripType === 'solo' ? 'Solo' : entry.tripType === 'family' ? 'Family' : 'Friends'}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<!-- Photos -->
|
||||||
|
<div class="photo-grid" class:has-thumbs={thumbPhotos.length > 0}>
|
||||||
|
<div class="photo-main">
|
||||||
|
{#if mainPhoto}
|
||||||
|
<img src={mainPhoto} alt="" loading="lazy"
|
||||||
|
onerror={(e) => {
|
||||||
|
e.currentTarget.style.display = 'none';
|
||||||
|
e.currentTarget.nextElementSibling.style.display = 'flex';
|
||||||
|
}} />
|
||||||
|
<div class="photo-fallback" style="display:none">
|
||||||
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.2">
|
||||||
|
<rect x="3" y="3" width="18" height="18" rx="3"/>
|
||||||
|
<circle cx="8.5" cy="8.5" r="1.5"/>
|
||||||
|
<path d="M21 15l-5-5L5 21"/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
|
<div class="photo-fallback">
|
||||||
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.2">
|
||||||
|
<rect x="3" y="3" width="18" height="18" rx="3"/>
|
||||||
|
<circle cx="8.5" cy="8.5" r="1.5"/>
|
||||||
|
<path d="M21 15l-5-5L5 21"/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if thumbPhotos.length > 0}
|
||||||
|
<div class="photo-thumbs">
|
||||||
|
{#each thumbPhotos as photo, i}
|
||||||
|
<div class="photo-thumb">
|
||||||
|
<img src={photo} alt="" loading="lazy"
|
||||||
|
onerror={(e) => {
|
||||||
|
e.currentTarget.style.display = 'none';
|
||||||
|
e.currentTarget.nextElementSibling.style.display = 'flex';
|
||||||
|
}} />
|
||||||
|
<div class="thumb-fallback" style="display:none">
|
||||||
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.2">
|
||||||
|
<rect x="3" y="3" width="18" height="18" rx="3"/>
|
||||||
|
<circle cx="8.5" cy="8.5" r="1.5"/>
|
||||||
|
<path d="M21 15l-5-5L5 21"/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
{#if i === 2 && extraCount > 0}
|
||||||
|
<div class="extra-overlay">+{extraCount}</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Info bar -->
|
||||||
|
<div class="card-info">
|
||||||
|
<span class="city">{entry.location.cities.join(', ')}</span>
|
||||||
|
<div class="meta">
|
||||||
|
{#if entry.transport}
|
||||||
|
<span class="transport-chip transport-chip--{entry.transport}">
|
||||||
|
{@html transportIcons[entry.transport] ?? ''}
|
||||||
|
{transportLabel}
|
||||||
|
</span>
|
||||||
|
<span class="dot-sep">·</span>
|
||||||
|
{/if}
|
||||||
|
<span>{formatDate(entry.date)}</span>
|
||||||
|
<span class="dot-sep">·</span>
|
||||||
|
<span>{entry.days} {entry.days === 1 ? 'day' : 'days'}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
/* ── Timeline row ── */
|
||||||
|
.v-item {
|
||||||
|
display: flex;
|
||||||
|
gap: 14px;
|
||||||
|
align-items: flex-start;
|
||||||
|
padding-bottom: 48px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.v-item:last-child { padding-bottom: 0; }
|
||||||
|
.v-item:not(:last-child)::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
left: 4px;
|
||||||
|
top: 34px;
|
||||||
|
bottom: 0;
|
||||||
|
width: 1px;
|
||||||
|
background: var(--border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.v-dot {
|
||||||
|
flex-shrink: 0;
|
||||||
|
width: 9px;
|
||||||
|
height: 9px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: var(--bg);
|
||||||
|
border: 1.5px solid var(--accent);
|
||||||
|
margin-top: 6px;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Content column (above-card + card) ── */
|
||||||
|
.v-content {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Country above card ── */
|
||||||
|
.above-card {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
padding-left: 2px;
|
||||||
|
}
|
||||||
|
.flag { font-size: 16px; line-height: 1; }
|
||||||
|
.country-name {
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 400;
|
||||||
|
color: var(--text-h);
|
||||||
|
letter-spacing: -0.2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Card ── */
|
||||||
|
.entry-card {
|
||||||
|
position: relative;
|
||||||
|
border-radius: 12px;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
background: var(--bg-raised);
|
||||||
|
box-shadow: 0 1px 4px rgba(0,0,0,0.05);
|
||||||
|
cursor: pointer;
|
||||||
|
overflow: hidden;
|
||||||
|
transition: box-shadow 0.2s, transform 0.15s;
|
||||||
|
container-type: inline-size;
|
||||||
|
container-name: card;
|
||||||
|
}
|
||||||
|
.entry-card:hover {
|
||||||
|
box-shadow: 0 6px 20px rgba(0,0,0,0.09);
|
||||||
|
transform: translateY(-2px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Trip badge — absolute top-right of card ── */
|
||||||
|
.trip-badge {
|
||||||
|
position: absolute;
|
||||||
|
top: 10px;
|
||||||
|
right: 10px;
|
||||||
|
z-index: 2;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 300;
|
||||||
|
padding: 3px 10px;
|
||||||
|
border-radius: 20px;
|
||||||
|
letter-spacing: 0.04em;
|
||||||
|
backdrop-filter: blur(6px);
|
||||||
|
}
|
||||||
|
.trip-badge--solo { background: rgba(245,158,11,0.85); color: #fff; }
|
||||||
|
.trip-badge--friends { background: rgba(124,58,237,0.85); color: #fff; }
|
||||||
|
.trip-badge--family { background: rgba(16,185,129,0.85); color: #fff; }
|
||||||
|
|
||||||
|
/* ── Photo grid — fixed height, always consistent ── */
|
||||||
|
.photo-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
height: 180px;
|
||||||
|
background: var(--bg-subtle);
|
||||||
|
}
|
||||||
|
.photo-grid.has-thumbs {
|
||||||
|
grid-template-columns: 2fr 1fr;
|
||||||
|
gap: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@container card (max-width: 300px) {
|
||||||
|
.photo-grid.has-thumbs { grid-template-columns: 1fr; }
|
||||||
|
.photo-thumbs { display: none; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Main photo ── */
|
||||||
|
.photo-main {
|
||||||
|
overflow: hidden;
|
||||||
|
height: 100%;
|
||||||
|
background: var(--bg-subtle);
|
||||||
|
}
|
||||||
|
.photo-main img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.photo-fallback {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: var(--text-sub);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Thumbs ── */
|
||||||
|
.photo-thumbs {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 2px;
|
||||||
|
}
|
||||||
|
.photo-thumb {
|
||||||
|
position: relative;
|
||||||
|
flex: 1;
|
||||||
|
overflow: hidden;
|
||||||
|
min-height: 0;
|
||||||
|
background: var(--bg-subtle);
|
||||||
|
}
|
||||||
|
.photo-thumb img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.thumb-fallback {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: var(--text-sub);
|
||||||
|
background: var(--bg-subtle);
|
||||||
|
}
|
||||||
|
.extra-overlay {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
background: rgba(0,0,0,0.4);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 400;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Info bar ── */
|
||||||
|
.card-info {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 10px 14px;
|
||||||
|
background: var(--bg);
|
||||||
|
border-top: 1px solid var(--border);
|
||||||
|
gap: 8px;
|
||||||
|
min-height: 44px;
|
||||||
|
}
|
||||||
|
.city {
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 300;
|
||||||
|
color: var(--text);
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
.meta {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 5px;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 300;
|
||||||
|
color: var(--text-sub);
|
||||||
|
white-space: nowrap;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
.dot-sep { color: var(--border-bright); }
|
||||||
|
|
||||||
|
.transport-chip {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 400;
|
||||||
|
padding: 2px 7px;
|
||||||
|
border-radius: 20px;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
background: var(--bg-subtle);
|
||||||
|
color: var(--text-sub);
|
||||||
|
}
|
||||||
|
.transport-chip--flight { color: #7c3aed; background: rgba(124,58,237,0.07); border-color: rgba(124,58,237,0.2); }
|
||||||
|
.transport-chip--train { color: #0369a1; background: rgba(3,105,161,0.07); border-color: rgba(3,105,161,0.2); }
|
||||||
|
.transport-chip--bus { color: #15803d; background: rgba(21,128,61,0.07); border-color: rgba(21,128,61,0.2); }
|
||||||
|
.transport-chip--car { color: #b45309; background: rgba(180,83,9,0.07); border-color: rgba(180,83,9,0.2); }
|
||||||
|
.transport-chip--ship { color: #0e7490; background: rgba(14,116,144,0.07); border-color: rgba(14,116,144,0.2); }
|
||||||
|
.transport-chip--walk { color: #65a30d; background: rgba(101,163,13,0.07); border-color: rgba(101,163,13,0.2); }
|
||||||
|
</style>
|
||||||
40
src/lib/timeline/TimelineToolbar.svelte
Normal file
40
src/lib/timeline/TimelineToolbar.svelte
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<script>
|
||||||
|
const sortOptions = [
|
||||||
|
{ value: 'date-desc', label: 'Newest first' },
|
||||||
|
{ value: 'date-asc', label: 'Oldest first' },
|
||||||
|
{ value: 'country-asc', label: 'Country A → Z' },
|
||||||
|
{ value: 'country-desc', label: 'Country Z → A' },
|
||||||
|
];
|
||||||
|
|
||||||
|
let { sortKey, onSort } = $props();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="toolbar"></div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.toolbar {
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
select {
|
||||||
|
font-family: var(--sans);
|
||||||
|
font-size: var(--text-xs);
|
||||||
|
font-weight: 300;
|
||||||
|
letter-spacing: 0.06em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
padding: 6px 28px 6px 12px;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 6px;
|
||||||
|
background: var(--bg-subtle);
|
||||||
|
color: var(--text);
|
||||||
|
cursor: pointer;
|
||||||
|
appearance: none;
|
||||||
|
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2352525b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: right 10px center;
|
||||||
|
transition: border-color 0.15s, color 0.15s;
|
||||||
|
}
|
||||||
|
select:hover { border-color: var(--border-bright); color: var(--text-h); }
|
||||||
|
select:focus { outline: 1px solid var(--accent-border); outline-offset: 2px; }
|
||||||
|
</style>
|
||||||
322
src/lib/timeline/TimelineView.svelte
Normal file
322
src/lib/timeline/TimelineView.svelte
Normal file
@@ -0,0 +1,322 @@
|
|||||||
|
<script>
|
||||||
|
import { get } from 'svelte/store';
|
||||||
|
import { journals } from '../stores/journalStore.js';
|
||||||
|
import TimelineToolbar from './TimelineToolbar.svelte';
|
||||||
|
import TimelineCard from './TimelineCard.svelte';
|
||||||
|
import JournalDetail from './JournalDetail.svelte';
|
||||||
|
import EditForm from './EditForm.svelte';
|
||||||
|
import ShareCard from './ShareCard.svelte';
|
||||||
|
import SharePreview from './SharePreview.svelte';
|
||||||
|
|
||||||
|
let { onDetailChange = () => {}, pendingCountry = '', onNewEntryClear = () => {} } = $props();
|
||||||
|
let selectedId = $state(/** @type {string|null} */(null));
|
||||||
|
let view = $state(/** @type {'list'|'detail'|'edit'|'new'} */('list'));
|
||||||
|
let showShare = $state(false);
|
||||||
|
let newEntryCountry = $state('');
|
||||||
|
|
||||||
|
// When App passes a country from the map, capture it locally before clearing
|
||||||
|
$effect(() => {
|
||||||
|
if (pendingCountry) {
|
||||||
|
newEntryCountry = pendingCountry;
|
||||||
|
selectedId = null;
|
||||||
|
view = 'new';
|
||||||
|
onNewEntryClear();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
let selected = $derived(selectedId ? (entries.find(e => e.id === selectedId) ?? null) : null);
|
||||||
|
|
||||||
|
let entries = $state(get(journals));
|
||||||
|
$effect(() => {
|
||||||
|
const unsub = journals.subscribe((v) => { entries = v; });
|
||||||
|
return unsub;
|
||||||
|
});
|
||||||
|
|
||||||
|
let sortKey = $state('date-desc');
|
||||||
|
|
||||||
|
let sortedEntries = $state(/** @type {typeof entries} */([]));
|
||||||
|
$effect(() => {
|
||||||
|
const key = sortKey;
|
||||||
|
sortedEntries = [...entries].sort((a, b) => {
|
||||||
|
if (key === 'date-asc') return a.date.localeCompare(b.date);
|
||||||
|
if (key === 'date-desc') return b.date.localeCompare(a.date);
|
||||||
|
if (key === 'country-asc') return a.location.country.localeCompare(b.location.country) || b.date.localeCompare(a.date);
|
||||||
|
if (key === 'country-desc') return b.location.country.localeCompare(a.location.country) || b.date.localeCompare(a.date);
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function getYear(iso) {
|
||||||
|
return new Date(iso).getFullYear();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="journal-page">
|
||||||
|
|
||||||
|
{#if view === 'new'}
|
||||||
|
<div class="detail-scroll">
|
||||||
|
<EditForm initialCountry={newEntryCountry} onBack={() => { view = 'list'; newEntryCountry = ''; onDetailChange(false); }} />
|
||||||
|
</div>
|
||||||
|
{:else if view === 'edit' && selected}
|
||||||
|
<div class="detail-scroll">
|
||||||
|
<EditForm entry={selected} onBack={() => { view = 'detail'; }} />
|
||||||
|
</div>
|
||||||
|
{:else if view === 'detail' && selected}
|
||||||
|
<div class="detail-scroll">
|
||||||
|
<JournalDetail
|
||||||
|
entry={selected}
|
||||||
|
onBack={() => { selectedId = null; view = 'list'; onDetailChange(false); }}
|
||||||
|
onEdit={() => { view = 'edit'; }}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
|
<div class="right-panel">
|
||||||
|
<div class="two-col">
|
||||||
|
<!-- Timeline column -->
|
||||||
|
<div class="timeline-col">
|
||||||
|
<div class="page-header">
|
||||||
|
<h1 class="page-title">My Journey</h1>
|
||||||
|
<button class="new-btn" onclick={() => { view = 'new'; }}>
|
||||||
|
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round">
|
||||||
|
<path d="M12 5v14M5 12h14"/>
|
||||||
|
</svg>
|
||||||
|
New entry
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<TimelineToolbar {sortKey} onSort={(k) => (sortKey = k)} />
|
||||||
|
|
||||||
|
{#if sortedEntries.length === 0}
|
||||||
|
<p class="empty">No journal entries yet.</p>
|
||||||
|
{:else}
|
||||||
|
<div class="sort-row">
|
||||||
|
<span class="sort-label">Sort by</span>
|
||||||
|
<select class="sort-select" onchange={(e) => (sortKey = e.currentTarget.value)}>
|
||||||
|
<option value="date-desc" selected={sortKey === 'date-desc'}>Newest first</option>
|
||||||
|
<option value="date-asc" selected={sortKey === 'date-asc'}>Oldest first</option>
|
||||||
|
<option value="country-asc" selected={sortKey === 'country-asc'}>Country A → Z</option>
|
||||||
|
<option value="country-desc" selected={sortKey === 'country-desc'}>Country Z → A</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<ol class="v-list">
|
||||||
|
{#each sortedEntries as entry, i (entry.id)}
|
||||||
|
{#if i === 0 || getYear(entry.date) !== getYear(sortedEntries[i - 1].date)}
|
||||||
|
<li class="year-marker" aria-hidden="true">
|
||||||
|
<span class="year-label">{getYear(entry.date)}</span>
|
||||||
|
</li>
|
||||||
|
{/if}
|
||||||
|
<TimelineCard {entry} onClick={() => { selectedId = entry.id; view = 'detail'; onDetailChange(true); }} />
|
||||||
|
{/each}
|
||||||
|
</ol>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<footer class="page-footer">
|
||||||
|
{sortedEntries.length} {sortedEntries.length === 1 ? 'entry' : 'entries'}
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Share preview column -->
|
||||||
|
{#if sortedEntries.length > 0}
|
||||||
|
<div class="share-col">
|
||||||
|
<SharePreview entries={sortedEntries} onClick={() => (showShare = true)} />
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if showShare}
|
||||||
|
<ShareCard entries={sortedEntries} onClose={() => (showShare = false)} />
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.journal-page {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
min-width: 0;
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Right panel ── */
|
||||||
|
.right-panel {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
overflow-y: auto;
|
||||||
|
background: var(--bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Two-column layout ── */
|
||||||
|
.two-col {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 240px;
|
||||||
|
gap: 48px;
|
||||||
|
max-width: 1020px;
|
||||||
|
width: 100%;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 48px 48px 80px;
|
||||||
|
align-items: start;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timeline-col { min-width: 0; }
|
||||||
|
|
||||||
|
.share-col { padding-top: 60px; }
|
||||||
|
|
||||||
|
/* ── Responsive: narrow viewport ── */
|
||||||
|
@media (max-width: 860px) {
|
||||||
|
.two-col {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
padding: 32px 24px 60px;
|
||||||
|
}
|
||||||
|
.share-col { padding-top: 0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Detail view ── */
|
||||||
|
.detail-scroll {
|
||||||
|
flex: 1;
|
||||||
|
overflow-y: auto;
|
||||||
|
background: var(--bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Timeline list ── */
|
||||||
|
.v-list {
|
||||||
|
list-style: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Year marker */
|
||||||
|
.year-marker {
|
||||||
|
padding: 24px 0 14px;
|
||||||
|
}
|
||||||
|
.year-label {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 0.04em;
|
||||||
|
color: #7c3aed;
|
||||||
|
border-left: 3px solid #7c3aed;
|
||||||
|
padding-left: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-footer {
|
||||||
|
margin-top: 56px;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 300;
|
||||||
|
letter-spacing: 0.1em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
color: var(--text-sub);
|
||||||
|
padding-top: 24px;
|
||||||
|
border-top: 1px solid var(--border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty { text-align: center; color: var(--text-sub); padding: 80px 0; }
|
||||||
|
|
||||||
|
.sort-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 8px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
padding-top: 20px;
|
||||||
|
}
|
||||||
|
.sort-label {
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 400;
|
||||||
|
letter-spacing: 0.08em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
color: var(--text-sub);
|
||||||
|
}
|
||||||
|
.sort-select {
|
||||||
|
font-family: var(--sans);
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 300;
|
||||||
|
letter-spacing: 0.04em;
|
||||||
|
padding: 4px 24px 4px 10px;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 6px;
|
||||||
|
background: var(--bg-subtle);
|
||||||
|
color: var(--text);
|
||||||
|
cursor: pointer;
|
||||||
|
appearance: none;
|
||||||
|
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2352525b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: right 8px center;
|
||||||
|
}
|
||||||
|
.sort-select:hover { border-color: var(--border-bright); color: var(--text-h); }
|
||||||
|
|
||||||
|
.page-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-title {
|
||||||
|
font-size: var(--text-xl);
|
||||||
|
font-weight: 400;
|
||||||
|
color: var(--text-h);
|
||||||
|
letter-spacing: -0.5px;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.new-btn {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
font-family: var(--sans);
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 300;
|
||||||
|
color: #fff;
|
||||||
|
background: var(--accent);
|
||||||
|
border: 1px solid var(--accent);
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 7px 14px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background 0.15s;
|
||||||
|
white-space: nowrap;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
.new-btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
|
||||||
|
|
||||||
|
.share-nudge {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
width: 100%;
|
||||||
|
padding: 10px 14px;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
border-radius: 10px;
|
||||||
|
border: 1px dashed var(--border-bright);
|
||||||
|
background: var(--bg-subtle);
|
||||||
|
cursor: pointer;
|
||||||
|
transition: border-color 0.15s, background 0.15s;
|
||||||
|
font-family: var(--sans);
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
.share-nudge:hover {
|
||||||
|
border-color: var(--accent-light);
|
||||||
|
background: var(--accent-bg);
|
||||||
|
}
|
||||||
|
.nudge-left {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 7px;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 400;
|
||||||
|
color: var(--text-h);
|
||||||
|
}
|
||||||
|
.nudge-right {
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 300;
|
||||||
|
color: var(--text-sub);
|
||||||
|
letter-spacing: 0.02em;
|
||||||
|
}
|
||||||
|
.share-nudge:hover .nudge-right { color: var(--accent); }
|
||||||
|
</style>
|
||||||
255
src/lib/world-map/StatsPanel.svelte
Normal file
255
src/lib/world-map/StatsPanel.svelte
Normal file
@@ -0,0 +1,255 @@
|
|||||||
|
<script>
|
||||||
|
import { CONTINENTS, getContinent, continentTotals } from './continents.js';
|
||||||
|
import { getSelected } from '../layout/selection.svelte.js';
|
||||||
|
|
||||||
|
let hoveredSeg = $state(null);
|
||||||
|
|
||||||
|
const continentColors = {
|
||||||
|
'Europe': '#6366f1',
|
||||||
|
'Asia': '#f43f5e',
|
||||||
|
'Africa': '#fb923c',
|
||||||
|
'N. America': '#06b6d4',
|
||||||
|
'S. America': '#f59e0b',
|
||||||
|
'Oceania': '#8b5cf6'
|
||||||
|
};
|
||||||
|
|
||||||
|
let counts = $derived.by(() => {
|
||||||
|
const c = {};
|
||||||
|
for (const cont of CONTINENTS) c[cont] = 0;
|
||||||
|
for (const id of getSelected()) {
|
||||||
|
const cont = getContinent(id);
|
||||||
|
if (cont) c[cont]++;
|
||||||
|
}
|
||||||
|
return c;
|
||||||
|
});
|
||||||
|
|
||||||
|
let total = $derived(getSelected().size);
|
||||||
|
let grandTotal = $derived(Object.values(continentTotals).reduce((a, b) => a + b, 0));
|
||||||
|
let pct = $derived(grandTotal > 0 ? Math.round(total / grandTotal * 100) : 0);
|
||||||
|
|
||||||
|
let segments = $derived.by(() => {
|
||||||
|
if (total === 0) return [];
|
||||||
|
const segs = [];
|
||||||
|
let deg = 0;
|
||||||
|
for (const cont of CONTINENTS) {
|
||||||
|
const angle = Math.min(counts[cont] / total * 360, 359.99);
|
||||||
|
if (angle > 0) {
|
||||||
|
const startDeg = deg;
|
||||||
|
const endDeg = deg + angle;
|
||||||
|
const sr = (startDeg - 90) * Math.PI / 180;
|
||||||
|
const er = (endDeg - 90) * Math.PI / 180;
|
||||||
|
const cx = 50, cy = 50, outerR = 44, innerR = 22;
|
||||||
|
const x1 = cx + outerR * Math.cos(sr);
|
||||||
|
const y1 = cy + outerR * Math.sin(sr);
|
||||||
|
const x2 = cx + outerR * Math.cos(er);
|
||||||
|
const y2 = cy + outerR * Math.sin(er);
|
||||||
|
const x3 = cx + innerR * Math.cos(er);
|
||||||
|
const y3 = cy + innerR * Math.sin(er);
|
||||||
|
const x4 = cx + innerR * Math.cos(sr);
|
||||||
|
const y4 = cy + innerR * Math.sin(sr);
|
||||||
|
const largeArc = angle > 180 ? 1 : 0;
|
||||||
|
const path = `M ${x1} ${y1} A ${outerR} ${outerR} 0 ${largeArc} 1 ${x2} ${y2} L ${x3} ${y3} A ${innerR} ${innerR} 0 ${largeArc} 0 ${x4} ${y4} Z`;
|
||||||
|
segs.push({ cont, color: continentColors[cont], path, angle });
|
||||||
|
deg += angle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return segs;
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<!-- count -->
|
||||||
|
<div class="stat-block">
|
||||||
|
<span class="big-num">{total}</span>
|
||||||
|
<span class="stat-sub">countries visited</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="vdivider"></div>
|
||||||
|
|
||||||
|
<!-- world % -->
|
||||||
|
<div class="stat-block">
|
||||||
|
<span class="big-num accent">{pct}%</span>
|
||||||
|
<span class="stat-sub">of the world</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="vdivider"></div>
|
||||||
|
|
||||||
|
<!-- donut -->
|
||||||
|
<div class="donut-block">
|
||||||
|
<svg viewBox="0 0 100 100" class="donut-svg">
|
||||||
|
{#if segments.length > 0}
|
||||||
|
{#each segments as seg}
|
||||||
|
<g class="seg-group"
|
||||||
|
onmouseenter={() => hoveredSeg = seg}
|
||||||
|
onmouseleave={() => hoveredSeg = null}>
|
||||||
|
<path d={seg.path} fill={seg.color} />
|
||||||
|
</g>
|
||||||
|
{/each}
|
||||||
|
<circle cx="50" cy="50" r="22" fill="#fff" />
|
||||||
|
{:else}
|
||||||
|
<circle cx="50" cy="50" r="44" fill="#f1f5f9" />
|
||||||
|
<circle cx="50" cy="50" r="22" fill="#fff" />
|
||||||
|
{/if}
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
<div class="donut-info">
|
||||||
|
<span class="section-label">by continent</span>
|
||||||
|
{#if hoveredSeg}
|
||||||
|
<div class="tooltip" style="--dot:{hoveredSeg.color}">
|
||||||
|
<span class="tt-name">{hoveredSeg.cont}</span>
|
||||||
|
<span class="tt-val">{counts[hoveredSeg.cont]} / {continentTotals[hoveredSeg.cont]}</span>
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
|
<span class="hint">hover a slice</span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="vdivider"></div>
|
||||||
|
|
||||||
|
<!-- progress bar -->
|
||||||
|
<div class="bar-block">
|
||||||
|
<span class="section-label" style="margin-bottom:6px">world coverage</span>
|
||||||
|
<div class="bar-bg">
|
||||||
|
<div class="bar-fill" style="width:{pct}%"></div>
|
||||||
|
</div>
|
||||||
|
<span class="disclaimer">All UN countries · Kosovo · HK · Taiwan</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.card {
|
||||||
|
position: absolute;
|
||||||
|
top: 16px;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 16px;
|
||||||
|
box-shadow: 0 4px 20px rgba(0,0,0,0.10), 0 1px 4px rgba(0,0,0,0.06);
|
||||||
|
border: 1px solid rgba(0,0,0,0.06);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0;
|
||||||
|
padding: 0 4px;
|
||||||
|
height: 110px;
|
||||||
|
z-index: 10;
|
||||||
|
font-family: var(--sans);
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-block {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
padding: 0 36px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.big-num {
|
||||||
|
font-size: 40px;
|
||||||
|
font-weight: 300;
|
||||||
|
letter-spacing: -2px;
|
||||||
|
color: var(--text-h);
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
.big-num.accent { color: var(--accent); }
|
||||||
|
|
||||||
|
.stat-sub {
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 300;
|
||||||
|
color: var(--text-sub);
|
||||||
|
letter-spacing: 0.03em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vdivider {
|
||||||
|
width: 1px;
|
||||||
|
height: 56px;
|
||||||
|
background: var(--border);
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* donut */
|
||||||
|
.donut-block {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
gap: 14px;
|
||||||
|
padding: 0 28px;
|
||||||
|
}
|
||||||
|
.donut-svg {
|
||||||
|
width: 72px;
|
||||||
|
height: 72px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
.seg-group { cursor: pointer; }
|
||||||
|
.seg-group:hover path { opacity: 0.8; }
|
||||||
|
|
||||||
|
.donut-info {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 6px;
|
||||||
|
min-width: 130px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tooltip {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 7px;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
.tooltip::before {
|
||||||
|
content: '';
|
||||||
|
width: 8px;
|
||||||
|
height: 8px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: var(--dot);
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
.tt-name { font-weight: 400; color: var(--text-h); }
|
||||||
|
.tt-val { font-weight: 300; color: var(--text-sub); }
|
||||||
|
|
||||||
|
.section-label {
|
||||||
|
font-size: 10px;
|
||||||
|
font-weight: 500;
|
||||||
|
letter-spacing: 0.14em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
color: var(--text-sub);
|
||||||
|
}
|
||||||
|
|
||||||
|
.hint {
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--text-sub);
|
||||||
|
opacity: 0.45;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* bar */
|
||||||
|
.bar-block {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding: 0 28px;
|
||||||
|
gap: 0;
|
||||||
|
min-width: 160px;
|
||||||
|
}
|
||||||
|
.bar-bg {
|
||||||
|
width: 100%;
|
||||||
|
height: 5px;
|
||||||
|
background: var(--bg-subtle);
|
||||||
|
border-radius: 4px;
|
||||||
|
overflow: hidden;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
.bar-fill {
|
||||||
|
height: 100%;
|
||||||
|
background: linear-gradient(90deg, var(--accent), #a78bfa);
|
||||||
|
border-radius: 4px;
|
||||||
|
transition: width 0.3s ease;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
.disclaimer {
|
||||||
|
font-size: 11px;
|
||||||
|
color: var(--text-sub);
|
||||||
|
opacity: 0.5;
|
||||||
|
letter-spacing: 0.02em;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
162
src/lib/world-map/WorldMap.svelte
Normal file
162
src/lib/world-map/WorldMap.svelte
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
<script>
|
||||||
|
import { onMount } from 'svelte';
|
||||||
|
import * as d3 from 'd3';
|
||||||
|
import { feature } from 'topojson-client';
|
||||||
|
import worldData from 'world-atlas/countries-50m.json';
|
||||||
|
import { getSelected, toggle, setTotalCount } from '../layout/selection.svelte.js';
|
||||||
|
|
||||||
|
let { onCountryClick = (_name) => {} } = $props();
|
||||||
|
|
||||||
|
const TERRITORY_PARENT = {
|
||||||
|
'016': '840', '060': '826', '086': '826', '092': '826', '136': '826',
|
||||||
|
'184': '554', '234': '208', '238': '826', '239': '826', '248': '246',
|
||||||
|
'258': '250', '260': '250', '304': '208', '316': '840', '334': '036',
|
||||||
|
'446': '156', '500': '826', '531': '528', '533': '528', '534': '528',
|
||||||
|
'540': '250', '570': '554', '574': '036', '580': '840', '612': '826',
|
||||||
|
'630': '840', '652': '250', '654': '826', '660': '826', '663': '250',
|
||||||
|
'666': '250', '796': '826', '831': '826', '832': '826', '833': '826',
|
||||||
|
'850': '840', '876': '250',
|
||||||
|
};
|
||||||
|
|
||||||
|
function effId(d) {
|
||||||
|
return TERRITORY_PARENT[d.id] || d.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
let frameEl;
|
||||||
|
|
||||||
|
function fitProjection(proj, w, h) {
|
||||||
|
proj.fitSize([w, h], { type: 'Sphere' });
|
||||||
|
const s = proj.scale() * 1.5;
|
||||||
|
proj.scale(s).translate([w / 2, h * 0.70]);
|
||||||
|
}
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
const width = frameEl.clientWidth;
|
||||||
|
const height = frameEl.clientHeight;
|
||||||
|
|
||||||
|
const projection = d3.geoMercator();
|
||||||
|
fitProjection(projection, width, height);
|
||||||
|
|
||||||
|
const path = d3.geoPath().projection(projection);
|
||||||
|
|
||||||
|
const countries = feature(worldData, worldData.objects.countries)
|
||||||
|
.features.filter(f => (f.id || f.properties.name === 'Kosovo') && f.id !== '010');
|
||||||
|
|
||||||
|
countries.forEach(f => { if (!f.id) f.id = 'XK'; });
|
||||||
|
|
||||||
|
const sovereignIds = new Set(countries.map(f => effId(f)));
|
||||||
|
setTotalCount(sovereignIds.size);
|
||||||
|
|
||||||
|
const svg = d3.select(frameEl).append('svg').attr('width', width).attr('height', height);
|
||||||
|
const g = svg.append('g');
|
||||||
|
|
||||||
|
const tooltip = d3.select(frameEl).append('div').attr('class', 'tooltip').style('display', 'none');
|
||||||
|
|
||||||
|
function updateFill(sel) {
|
||||||
|
sel.attr('fill', d => getSelected().has(effId(d)) ? '#22c55e' : '#ffffff');
|
||||||
|
g.selectAll('.micro-state').attr('fill', d => getSelected().has(effId(d)) ? '#22c55e' : '#ffffff');
|
||||||
|
}
|
||||||
|
|
||||||
|
function attachEvents(sel) {
|
||||||
|
sel
|
||||||
|
.on('click', (event, d) => {
|
||||||
|
toggle(effId(d));
|
||||||
|
updateFill(d3.select(event.currentTarget));
|
||||||
|
onCountryClick(d.properties.name);
|
||||||
|
})
|
||||||
|
.on('mouseenter', (event, d) => {
|
||||||
|
d3.select(event.currentTarget).attr('fill', getSelected().has(effId(d)) ? '#16a34a' : '#f0f6fa');
|
||||||
|
tooltip.style('display', 'block').text(d.properties.name);
|
||||||
|
})
|
||||||
|
.on('mousemove', (event) => {
|
||||||
|
const [x, y] = d3.pointer(event, frameEl);
|
||||||
|
tooltip.style('left', (x + 10) + 'px').style('top', (y - 28) + 'px');
|
||||||
|
})
|
||||||
|
.on('mouseleave', (event, d) => {
|
||||||
|
d3.select(event.currentTarget).attr('fill', getSelected().has(effId(d)) ? '#22c55e' : '#ffffff');
|
||||||
|
tooltip.style('display', 'none');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const paths = g.selectAll('path').data(countries).join('path')
|
||||||
|
.attr('d', path).attr('fill', '#ffffff').attr('stroke', '#d4d4d4').attr('stroke-width', 0.5);
|
||||||
|
attachEvents(paths);
|
||||||
|
|
||||||
|
function renderMicrostates() {
|
||||||
|
g.selectAll('.micro-state').remove();
|
||||||
|
const threshold = Math.max(4, 16 / d3.zoomTransform(svg.node()).k);
|
||||||
|
paths.each(function (d) {
|
||||||
|
if (effId(d) !== d.id) return;
|
||||||
|
const { width, height } = this.getBBox();
|
||||||
|
if (width < threshold && height < threshold) {
|
||||||
|
const [cx, cy] = path.centroid(d);
|
||||||
|
const c = g.append('circle').attr('class', 'micro-state').datum(d)
|
||||||
|
.attr('cx', cx).attr('cy', cy).attr('r', 2)
|
||||||
|
.attr('fill', getSelected().has(effId(d)) ? '#22c55e' : '#ffffff')
|
||||||
|
.attr('stroke', '#94a3b8').attr('stroke-width', 0.5);
|
||||||
|
attachEvents(c);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
renderMicrostates();
|
||||||
|
|
||||||
|
const zoom = d3.zoom().scaleExtent([1, 32]).on('zoom', (event) => {
|
||||||
|
g.attr('transform', event.transform);
|
||||||
|
renderMicrostates();
|
||||||
|
});
|
||||||
|
|
||||||
|
svg.call(zoom);
|
||||||
|
svg.on('dblclick.zoom', null);
|
||||||
|
svg.on('dblclick', (event) => {
|
||||||
|
const [x, y] = d3.pointer(event);
|
||||||
|
svg.transition().duration(300).call(zoom.scaleBy, 2, [x, y]);
|
||||||
|
});
|
||||||
|
|
||||||
|
const observer = new ResizeObserver((entries) => {
|
||||||
|
for (const entry of entries) {
|
||||||
|
const { width, height } = entry.contentRect;
|
||||||
|
svg.attr('width', width).attr('height', height);
|
||||||
|
fitProjection(projection, width, height);
|
||||||
|
const countryPaths = g.selectAll('path');
|
||||||
|
countryPaths.attr('d', path);
|
||||||
|
updateFill(countryPaths);
|
||||||
|
renderMicrostates();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
observer.observe(frameEl);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
observer.disconnect();
|
||||||
|
svg.remove();
|
||||||
|
};
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div bind:this={frameEl} class="map-frame"></div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.map-frame {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
background: #a4c8e0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.map-frame :global(svg) { display: block; cursor: grab; }
|
||||||
|
.map-frame :global(svg:active) { cursor: grabbing; }
|
||||||
|
.map-frame :global(svg path) { cursor: pointer; }
|
||||||
|
|
||||||
|
.map-frame :global(.tooltip) {
|
||||||
|
position: absolute;
|
||||||
|
padding: 4px 10px;
|
||||||
|
background: #1f2937;
|
||||||
|
color: #fff;
|
||||||
|
font: 14px/1.4 sans-serif;
|
||||||
|
border-radius: 4px;
|
||||||
|
pointer-events: none;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
212
src/lib/world-map/continents.js
Normal file
212
src/lib/world-map/continents.js
Normal file
@@ -0,0 +1,212 @@
|
|||||||
|
export const CONTINENTS = ['Europe', 'Asia', 'Africa', 'N. America', 'S. America', 'Oceania'];
|
||||||
|
|
||||||
|
const map = {
|
||||||
|
'004': 'Asia', // Afghanistan
|
||||||
|
'008': 'Europe', // Albania
|
||||||
|
'012': 'Africa', // Algeria
|
||||||
|
'020': 'Europe', // Andorra
|
||||||
|
'024': 'Africa', // Angola
|
||||||
|
'028': 'N. America', // Antigua and Barb.
|
||||||
|
'031': 'Asia', // Azerbaijan
|
||||||
|
'032': 'S. America', // Argentina
|
||||||
|
'036': 'Oceania', // Australia
|
||||||
|
'040': 'Europe', // Austria
|
||||||
|
'044': 'N. America', // Bahamas
|
||||||
|
'048': 'Asia', // Bahrain
|
||||||
|
'050': 'Asia', // Bangladesh
|
||||||
|
'051': 'Asia', // Armenia
|
||||||
|
'052': 'N. America', // Barbados
|
||||||
|
'056': 'Europe', // Belgium
|
||||||
|
'064': 'Asia', // Bhutan
|
||||||
|
'068': 'S. America', // Bolivia
|
||||||
|
'070': 'Europe', // Bosnia and Herz.
|
||||||
|
'072': 'Africa', // Botswana
|
||||||
|
'076': 'S. America', // Brazil
|
||||||
|
'084': 'N. America', // Belize
|
||||||
|
'090': 'Oceania', // Solomon Is.
|
||||||
|
'096': 'Asia', // Brunei
|
||||||
|
'100': 'Europe', // Bulgaria
|
||||||
|
'104': 'Asia', // Myanmar
|
||||||
|
'108': 'Africa', // Burundi
|
||||||
|
'112': 'Europe', // Belarus
|
||||||
|
'116': 'Asia', // Cambodia
|
||||||
|
'120': 'Africa', // Cameroon
|
||||||
|
'124': 'N. America', // Canada
|
||||||
|
'132': 'Africa', // Cabo Verde
|
||||||
|
'140': 'Africa', // Central African Rep.
|
||||||
|
'144': 'Asia', // Sri Lanka
|
||||||
|
'148': 'Africa', // Chad
|
||||||
|
'152': 'S. America', // Chile
|
||||||
|
'156': 'Asia', // China
|
||||||
|
'158': 'Asia', // Taiwan
|
||||||
|
'170': 'S. America', // Colombia
|
||||||
|
'174': 'Africa', // Comoros
|
||||||
|
'178': 'Africa', // Congo
|
||||||
|
'180': 'Africa', // Dem. Rep. Congo
|
||||||
|
'188': 'N. America', // Costa Rica
|
||||||
|
'191': 'Europe', // Croatia
|
||||||
|
'192': 'N. America', // Cuba
|
||||||
|
'196': 'Asia', // Cyprus
|
||||||
|
'203': 'Europe', // Czechia
|
||||||
|
'204': 'Africa', // Benin
|
||||||
|
'208': 'Europe', // Denmark
|
||||||
|
'212': 'N. America', // Dominica
|
||||||
|
'214': 'N. America', // Dominican Rep.
|
||||||
|
'218': 'S. America', // Ecuador
|
||||||
|
'222': 'N. America', // El Salvador
|
||||||
|
'226': 'Africa', // Eq. Guinea
|
||||||
|
'231': 'Africa', // Ethiopia
|
||||||
|
'232': 'Africa', // Eritrea
|
||||||
|
'233': 'Europe', // Estonia
|
||||||
|
'242': 'Oceania', // Fiji
|
||||||
|
'246': 'Europe', // Finland
|
||||||
|
'250': 'Europe', // France
|
||||||
|
'262': 'Africa', // Djibouti
|
||||||
|
'266': 'Africa', // Gabon
|
||||||
|
'268': 'Asia', // Georgia
|
||||||
|
'270': 'Africa', // Gambia
|
||||||
|
'275': 'Asia', // Palestine
|
||||||
|
'276': 'Europe', // Germany
|
||||||
|
'288': 'Africa', // Ghana
|
||||||
|
'296': 'Oceania', // Kiribati
|
||||||
|
'300': 'Europe', // Greece
|
||||||
|
'308': 'N. America', // Grenada
|
||||||
|
'320': 'N. America', // Guatemala
|
||||||
|
'324': 'Africa', // Guinea
|
||||||
|
'328': 'S. America', // Guyana
|
||||||
|
'332': 'N. America', // Haiti
|
||||||
|
'336': 'Europe', // Vatican
|
||||||
|
'340': 'N. America', // Honduras
|
||||||
|
'344': 'Asia', // Hong Kong
|
||||||
|
'348': 'Europe', // Hungary
|
||||||
|
'352': 'Europe', // Iceland
|
||||||
|
'356': 'Asia', // India
|
||||||
|
'360': 'Asia', // Indonesia
|
||||||
|
'364': 'Asia', // Iran
|
||||||
|
'368': 'Asia', // Iraq
|
||||||
|
'372': 'Europe', // Ireland
|
||||||
|
'376': 'Asia', // Israel
|
||||||
|
'380': 'Europe', // Italy
|
||||||
|
'384': 'Africa', // Cote d'Ivoire
|
||||||
|
'388': 'N. America', // Jamaica
|
||||||
|
'392': 'Asia', // Japan
|
||||||
|
'398': 'Asia', // Kazakhstan
|
||||||
|
'400': 'Asia', // Jordan
|
||||||
|
'404': 'Africa', // Kenya
|
||||||
|
'408': 'Asia', // North Korea
|
||||||
|
'410': 'Asia', // South Korea
|
||||||
|
'414': 'Asia', // Kuwait
|
||||||
|
'417': 'Asia', // Kyrgyzstan
|
||||||
|
'418': 'Asia', // Laos
|
||||||
|
'422': 'Asia', // Lebanon
|
||||||
|
'426': 'Africa', // Lesotho
|
||||||
|
'428': 'Europe', // Latvia
|
||||||
|
'430': 'Africa', // Liberia
|
||||||
|
'434': 'Africa', // Libya
|
||||||
|
'438': 'Europe', // Liechtenstein
|
||||||
|
'440': 'Europe', // Lithuania
|
||||||
|
'442': 'Europe', // Luxembourg
|
||||||
|
'450': 'Africa', // Madagascar
|
||||||
|
'454': 'Africa', // Malawi
|
||||||
|
'458': 'Asia', // Malaysia
|
||||||
|
'462': 'Asia', // Maldives
|
||||||
|
'466': 'Africa', // Mali
|
||||||
|
'470': 'Europe', // Malta
|
||||||
|
'478': 'Africa', // Mauritania
|
||||||
|
'480': 'Africa', // Mauritius
|
||||||
|
'484': 'N. America', // Mexico
|
||||||
|
'492': 'Europe', // Monaco
|
||||||
|
'496': 'Asia', // Mongolia
|
||||||
|
'498': 'Europe', // Moldova
|
||||||
|
'499': 'Europe', // Montenegro
|
||||||
|
'504': 'Africa', // Morocco
|
||||||
|
'508': 'Africa', // Mozambique
|
||||||
|
'512': 'Asia', // Oman
|
||||||
|
'516': 'Africa', // Namibia
|
||||||
|
'520': 'Oceania', // Nauru
|
||||||
|
'524': 'Asia', // Nepal
|
||||||
|
'528': 'Europe', // Netherlands
|
||||||
|
'548': 'Oceania', // Vanuatu
|
||||||
|
'554': 'Oceania', // New Zealand
|
||||||
|
'558': 'N. America', // Nicaragua
|
||||||
|
'562': 'Africa', // Niger
|
||||||
|
'566': 'Africa', // Nigeria
|
||||||
|
'578': 'Europe', // Norway
|
||||||
|
'583': 'Oceania', // Micronesia
|
||||||
|
'584': 'Oceania', // Marshall Is.
|
||||||
|
'585': 'Oceania', // Palau
|
||||||
|
'586': 'Asia', // Pakistan
|
||||||
|
'591': 'N. America', // Panama
|
||||||
|
'598': 'Oceania', // Papua New Guinea
|
||||||
|
'600': 'S. America', // Paraguay
|
||||||
|
'604': 'S. America', // Peru
|
||||||
|
'608': 'Asia', // Philippines
|
||||||
|
'616': 'Europe', // Poland
|
||||||
|
'620': 'Europe', // Portugal
|
||||||
|
'624': 'Africa', // Guinea-Bissau
|
||||||
|
'626': 'Asia', // Timor-Leste
|
||||||
|
'634': 'Asia', // Qatar
|
||||||
|
'642': 'Europe', // Romania
|
||||||
|
'643': 'Europe', // Russia
|
||||||
|
'646': 'Africa', // Rwanda
|
||||||
|
'659': 'N. America', // St. Kitts and Nevis
|
||||||
|
'662': 'N. America', // Saint Lucia
|
||||||
|
'670': 'N. America', // St. Vin. and Gren.
|
||||||
|
'674': 'Europe', // San Marino
|
||||||
|
'678': 'Africa', // Sao Tome and Principe
|
||||||
|
'682': 'Asia', // Saudi Arabia
|
||||||
|
'686': 'Africa', // Senegal
|
||||||
|
'688': 'Europe', // Serbia
|
||||||
|
'690': 'Africa', // Seychelles
|
||||||
|
'694': 'Africa', // Sierra Leone
|
||||||
|
'702': 'Asia', // Singapore
|
||||||
|
'703': 'Europe', // Slovakia
|
||||||
|
'704': 'Asia', // Vietnam
|
||||||
|
'705': 'Europe', // Slovenia
|
||||||
|
'706': 'Africa', // Somalia
|
||||||
|
'710': 'Africa', // South Africa
|
||||||
|
'716': 'Africa', // Zimbabwe
|
||||||
|
'724': 'Europe', // Spain
|
||||||
|
'728': 'Africa', // S. Sudan
|
||||||
|
'729': 'Africa', // Sudan
|
||||||
|
'732': 'Africa', // W. Sahara
|
||||||
|
'740': 'S. America', // Suriname
|
||||||
|
'748': 'Africa', // eSwatini
|
||||||
|
'752': 'Europe', // Sweden
|
||||||
|
'756': 'Europe', // Switzerland
|
||||||
|
'760': 'Asia', // Syria
|
||||||
|
'762': 'Asia', // Tajikistan
|
||||||
|
'764': 'Asia', // Thailand
|
||||||
|
'768': 'Africa', // Togo
|
||||||
|
'776': 'Oceania', // Tonga
|
||||||
|
'780': 'N. America', // Trinidad and Tobago
|
||||||
|
'784': 'Asia', // United Arab Emirates
|
||||||
|
'788': 'Africa', // Tunisia
|
||||||
|
'792': 'Asia', // Turkey
|
||||||
|
'795': 'Asia', // Turkmenistan
|
||||||
|
'800': 'Africa', // Uganda
|
||||||
|
'804': 'Europe', // Ukraine
|
||||||
|
'807': 'Europe', // Macedonia
|
||||||
|
'818': 'Africa', // Egypt
|
||||||
|
'826': 'Europe', // United Kingdom
|
||||||
|
'834': 'Africa', // Tanzania
|
||||||
|
'840': 'N. America', // United States of America
|
||||||
|
'854': 'Africa', // Burkina Faso
|
||||||
|
'858': 'S. America', // Uruguay
|
||||||
|
'860': 'Asia', // Uzbekistan
|
||||||
|
'862': 'S. America', // Venezuela
|
||||||
|
'882': 'Oceania', // Samoa
|
||||||
|
'887': 'Asia', // Yemen
|
||||||
|
'894': 'Africa', // Zambia
|
||||||
|
'XK': 'Europe', // Kosovo
|
||||||
|
};
|
||||||
|
|
||||||
|
export const continentTotals = CONTINENTS.reduce((acc, c) => (acc[c] = 0, acc), {});
|
||||||
|
for (const id of Object.keys(map)) {
|
||||||
|
const cont = map[id];
|
||||||
|
if (cont) continentTotals[cont]++;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getContinent(id) {
|
||||||
|
return map[id] ?? null;
|
||||||
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
import { defineConfig } from 'vite'
|
import { defineConfig } from 'vite'
|
||||||
import { svelte } from '@sveltejs/vite-plugin-svelte'
|
import { svelte } from '@sveltejs/vite-plugin-svelte'
|
||||||
|
|
||||||
// https://vite.dev/config/
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [svelte()],
|
plugins: [svelte()],
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user