added flag, changed the location of the country name

This commit is contained in:
haerikimmm
2026-06-12 15:34:43 +09:00
parent 326b52b858
commit cb0e5602c8
3 changed files with 223 additions and 122 deletions

12
.claude/launch.json Normal file
View File

@@ -0,0 +1,12 @@
{
"version": "0.0.1",
"configurations": [
{
"name": "Map-Jurnal",
"runtimeExecutable": "npm",
"runtimeArgs": ["run", "dev"],
"port": 5173,
"autoPort": true
}
]
}

View File

@@ -2,9 +2,30 @@
/** @type {{ entry: import('../stores/journalStore.js').JournalEntry, onClick: () => void }} */
let { entry, onClick } = $props();
/** Convert country name to flag emoji via ISO 3166-1 alpha-2 */
const countryCodeMap = {
'Japan': 'JP', 'France': 'FR', 'Spain': 'ES', 'USA': 'US',
'Thailand': 'TH', 'Germany': 'DE', 'Italy': 'IT', 'UK': 'GB',
'Australia': 'AU', 'Canada': 'CA', 'China': 'CN', 'India': 'IN',
'Brazil': 'BR', 'Mexico': 'MX', 'Portugal': 'PT', 'Netherlands': 'NL',
'Greece': 'GR', 'Turkey': 'TR', 'Vietnam': 'VN', 'Indonesia': 'ID',
'Malaysia': 'MY', 'Singapore': 'SG', 'South Korea': 'KR', 'Taiwan': 'TW',
'New Zealand': 'NZ', 'Argentina': 'AR', 'Chile': 'CL', 'Peru': 'PE',
'Morocco': 'MA', 'Egypt': 'EG', 'Kenya': 'KE', 'South Africa': 'ZA',
'Sweden': 'SE', 'Norway': 'NO', 'Denmark': 'DK', 'Finland': 'FI',
'Switzerland': 'CH', 'Austria': 'AT', 'Belgium': 'BE', 'Poland': 'PL',
'Czech Republic': 'CZ', 'Hungary': 'HU', 'Croatia': 'HR',
};
function flagEmoji(country) {
const code = countryCodeMap[country];
if (!code) return '';
return [...code].map(c => String.fromCodePoint(0x1F1E6 - 65 + c.charCodeAt(0))).join('');
}
function formatDate(/** @type {string} */ iso) {
return new Date(iso).toLocaleDateString('en-US', {
year: 'numeric', month: 'short', day: 'numeric',
month: 'short', day: 'numeric', year: 'numeric',
});
}
@@ -16,55 +37,96 @@
<li class="v-item">
<div class="v-dot" aria-hidden="true"></div>
<div class="entry-card" role="button" tabindex="0"
onclick={onClick}
onkeydown={(e) => e.key === 'Enter' && onClick()}>
<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>
<div class="photo-grid" class:has-thumbs={thumbPhotos.length > 0}>
<div class="photo-main">
{#if mainPhoto}
<img src={mainPhoto} alt="" loading="lazy" />
{:else}
<div class="photo-placeholder"></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' : '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>
<div class="overlay">
<div class="overlay-top">
<span class="trip-badge trip-badge--{entry.tripType}">
{entry.tripType === 'solo' ? 'Solo' : 'Friends'}
</span>
</div>
<div class="overlay-bottom">
<span class="city">{entry.location.city}</span>
<span class="country">{entry.location.country}</span>
<span class="meta">{formatDate(entry.date)} · {entry.days} {entry.days === 1 ? 'day' : 'days'}</span>
</div>
<!-- Info bar -->
<div class="card-info">
<span class="city">{entry.location.city}</span>
<div class="meta">
<span>{formatDate(entry.date)}</span>
<span class="dot-sep">·</span>
<span>{entry.days} {entry.days === 1 ? 'day' : 'days'}</span>
</div>
</div>
{#if thumbPhotos.length > 0}
<div class="photo-thumbs">
{#each thumbPhotos as photo, i}
<div class="photo-thumb">
<img src={photo} alt="" loading="lazy" />
{#if i === 2 && extraCount > 0}
<div class="extra-overlay">+{extraCount}</div>
{/if}
</div>
{/each}
</div>
{/if}
</div>
</div>
</li>
<style>
/* ── Timeline row ── */
.v-item {
display: flex;
gap: 14px;
align-items: flex-start;
padding-bottom: 24px;
padding-bottom: 28px;
position: relative;
}
.v-item:last-child { padding-bottom: 0; }
@@ -72,7 +134,7 @@
content: '';
position: absolute;
left: 4px;
top: 30px;
top: 34px;
bottom: 0;
width: 1px;
background: var(--border);
@@ -85,121 +147,106 @@
border-radius: 50%;
background: var(--bg);
border: 1.5px solid var(--accent);
margin-top: 20px;
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 {
flex: 1;
min-width: 0;
border-radius: 14px;
overflow: hidden;
cursor: pointer;
position: relative;
border-radius: 12px;
border: 1px solid var(--border);
box-shadow: var(--shadow);
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 8px 32px rgba(0,0,0,0.12);
box-shadow: 0 6px 20px rgba(0,0,0,0.09);
transform: translateY(-2px);
}
/* ── Photo grid — fluid, breakpoint via container width ── */
/* ── 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; }
/* ── Photo grid — fixed height, always consistent ── */
.photo-grid {
display: grid;
grid-template-columns: 1fr;
/* height adapts: taller when single photo */
height: 200px;
height: 180px;
background: var(--bg-subtle);
}
.photo-grid.has-thumbs {
grid-template-columns: 2fr 1fr;
gap: 2px;
height: 200px;
}
/* Collapse to single column on narrow cards (< 340px) */
@container card (max-width: 340px) {
.photo-grid.has-thumbs {
grid-template-columns: 1fr;
height: 180px;
}
@container card (max-width: 300px) {
.photo-grid.has-thumbs { grid-template-columns: 1fr; }
.photo-thumbs { display: none; }
}
.entry-card { container-type: inline-size; container-name: card; }
/* ── Main photo ── */
.photo-main {
position: relative;
overflow: hidden;
height: 100%;
background: var(--bg-subtle);
}
.photo-main img,
.photo-placeholder {
.photo-main img {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
}
.photo-placeholder { background: var(--accent-bg); }
/* ── Overlay gradient ── */
.overlay {
position: absolute;
inset: 0;
.photo-fallback {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 12px;
background: linear-gradient(
to bottom,
rgba(0,0,0,0.22) 0%,
transparent 35%,
transparent 50%,
rgba(0,0,0,0.6) 100%
);
align-items: center;
justify-content: center;
color: var(--text-sub);
}
.overlay-top { display: flex; justify-content: flex-end; }
.overlay-bottom { display: flex; flex-direction: column; gap: 2px; }
.city {
font-size: 12px;
font-weight: 300;
color: rgba(255,255,255,0.8);
letter-spacing: 0.04em;
}
.country {
font-size: 20px;
font-weight: 400;
color: #fff;
letter-spacing: -0.3px;
line-height: 1.1;
text-shadow: 0 1px 6px rgba(0,0,0,0.35);
}
.meta {
font-size: 11px;
font-weight: 300;
color: rgba(255,255,255,0.7);
margin-top: 3px;
letter-spacing: 0.02em;
}
/* ── Trip badge ── */
.trip-badge {
font-size: 11px;
font-weight: 300;
padding: 2px 9px;
border-radius: 20px;
backdrop-filter: blur(8px);
letter-spacing: 0.04em;
}
.trip-badge--solo { background: rgba(245,158,11,0.7); color: #fff; }
.trip-badge--friends { background: rgba(124,58,237,0.7); color: #fff; }
/* ── Thumbs ── */
.photo-thumbs {
display: flex;
@@ -211,6 +258,7 @@
flex: 1;
overflow: hidden;
min-height: 0;
background: var(--bg-subtle);
}
.photo-thumb img {
width: 100%;
@@ -218,16 +266,55 @@
object-fit: cover;
display: block;
}
.extra-overlay {
position: absolute;
inset: 0;
background: rgba(0,0,0,0.45);
.thumb-fallback {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
font-size: 15px;
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); }
</style>

View File

@@ -140,14 +140,16 @@
/* Year marker */
.year-marker {
padding: 32px 0 16px;
padding: 32px 0 14px;
}
.year-label {
font-size: 11px;
font-size: 13px;
font-weight: 400;
letter-spacing: 0.12em;
letter-spacing: 0.1em;
text-transform: uppercase;
color: var(--text-sub);
color: var(--text);
border-left: 2px solid var(--accent);
padding-left: 10px;
}
.page-footer {