feat: memento-frontend 디자인 구성 및 셋팅
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"APP_ENV": "development",
|
||||
"API_BASE_URL": "https://api.dev.example.com/",
|
||||
"API_BASE_URL": "http://localhost:8080/",
|
||||
"REQUEST_TIMEOUT_MS": 15000,
|
||||
"MAX_RETRY_ATTEMPTS": 2,
|
||||
"TELEMETRY_ENABLED": false,
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"CAPABILITY_OVERRIDES": {
|
||||
"REALTIME": "DEFAULT",
|
||||
"WEB_WORKER": "DEFAULT",
|
||||
"SERVICE_WORKER": "DEFAULT",
|
||||
"SERVICE_WORKER": "DISABLED",
|
||||
"OFFLINE_COMMANDS": "DEFAULT"
|
||||
},
|
||||
"FEATURE_OVERRIDES": {
|
||||
|
||||
@@ -1,13 +1,214 @@
|
||||
<!doctype html>
|
||||
<html lang="ko">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="description" content="Clean Architecture frontend template" />
|
||||
<title>Memento</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/bootstrap/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
|
||||
<meta name="theme-color" content="#f4f4f1">
|
||||
<title>Memento — Living Archive</title>
|
||||
<link rel="manifest" href="/manifest.webmanifest">
|
||||
<link rel="stylesheet" href="/beta.css">
|
||||
</head>
|
||||
<body>
|
||||
<svg class="svg-defs" aria-hidden="true">
|
||||
<symbol id="i-home" viewBox="0 0 24 24"><path d="M3 11 12 3l9 8v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z"/></symbol>
|
||||
<symbol id="i-grid" viewBox="0 0 24 24"><rect x="3" y="3" width="7" height="7" rx="1"/><rect x="14" y="3" width="7" height="7" rx="1"/><rect x="3" y="14" width="7" height="7" rx="1"/><rect x="14" y="14" width="7" height="7" rx="1"/></symbol>
|
||||
<symbol id="i-spark" viewBox="0 0 24 24"><path d="m12 3 1.7 4.3L18 9l-4.3 1.7L12 15l-1.7-4.3L6 9l4.3-1.7z"/><path d="m19 14 .9 2.1L22 17l-2.1.9L19 20l-.9-2.1L16 17l2.1-.9z"/></symbol>
|
||||
<symbol id="i-search" viewBox="0 0 24 24"><circle cx="11" cy="11" r="7"/><path d="m20 20-4-4"/></symbol>
|
||||
<symbol id="i-plus" viewBox="0 0 24 24"><path d="M12 5v14M5 12h14"/></symbol>
|
||||
<symbol id="i-back" viewBox="0 0 24 24"><path d="m15 18-6-6 6-6"/></symbol>
|
||||
</svg>
|
||||
|
||||
<div class="shell">
|
||||
<aside class="sidebar">
|
||||
<div class="brand"><span class="brand-mark"></span>Memento</div>
|
||||
<nav class="nav">
|
||||
<button class="active" data-page="home"><svg><use href="#i-home"/></svg><span>홈</span></button>
|
||||
<button data-page="library"><svg><use href="#i-grid"/></svg><span>라이브러리</span></button>
|
||||
<button data-page="memories"><svg><use href="#i-spark"/></svg><span>Memories</span></button>
|
||||
<button data-page="search"><svg><use href="#i-search"/></svg><span>검색</span></button>
|
||||
</nav>
|
||||
<div class="sidebar-footer">
|
||||
<button class="profile-mini" data-profile><span class="avatar"></span><span class="profile-copy"><strong>동현</strong><span>개인 저장소</span></span><span class="dot"></span></button>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<header class="mobile-top"><div class="brand"><span class="brand-mark"></span>Memento</div><button class="profile-mini mobile-profile" data-profile><span class="avatar"></span></button></header>
|
||||
|
||||
<main class="main">
|
||||
<section class="page active" id="page-home">
|
||||
<div class="page-head">
|
||||
<div><div class="greeting">9월 15일 화요일 · Galaxy 동기화 완료</div><h1 class="h1">좋은 오후예요.</h1></div>
|
||||
<div class="page-head-actions"><button class="btn" data-upload><svg><use href="#i-plus"/></svg><span>사진 추가</span></button><button class="icon-btn" data-page="search"><svg><use href="#i-search"/></svg></button></div>
|
||||
</div>
|
||||
|
||||
<section class="discovery-card">
|
||||
<div class="discovery-media"><div class="collage"><div><img src="./assets/photo-1.jpg"></div><div><img src="./assets/photo-7.jpg"></div><div><img src="./assets/photo-8.jpg"></div></div></div>
|
||||
<div class="discovery-copy">
|
||||
<div class="kicker"><span class="spark">✦</span>새로운 순간을 찾았어요</div>
|
||||
<h2>3박 4일의 제주를<br>하나의 Memory로 묶었습니다.</h2>
|
||||
<p>7월 12일부터 15일까지 촬영한 84장의 사진과 영상을 시간과 장소의 흐름으로 정리했습니다.</p>
|
||||
<div class="discovery-meta"><span>84개 미디어</span><span>4개 장소</span><span>3개 순간</span></div>
|
||||
<div class="discovery-actions"><button class="btn primary" data-open-memory>Memory 보기</button><button class="btn dark-ghost" id="saveSuggested">보관하기</button></div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section"><div class="section-head"><h2 class="h3">다시 떠오른 기억</h2><button class="btn ghost" data-page="memories">모두 보기</button></div>
|
||||
<div class="memory-strip">
|
||||
<article class="memory-card" data-open-memory><img src="./assets/photo-2.jpg"><div class="memory-copy"><span>1년 전 오늘</span><strong>강릉에서 보낸 주말</strong></div></article>
|
||||
<article class="memory-card"><img src="./assets/photo-3.jpg"><div class="memory-copy"><span>지난 가을</span><strong>가평 드라이브</strong></div></article>
|
||||
<article class="memory-card"><img src="./assets/photo-4.jpg"><div class="memory-copy"><span>3년 전</span><strong>처음 떠난 부산</strong></div></article>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section"><div class="section-head"><h2 class="h3">오늘 들어온 사진</h2><button class="btn ghost" data-page="library">라이브러리 열기</button></div>
|
||||
<div class="intake-row">
|
||||
<div class="today-media"><div class="today-head"><div><strong>42장</strong><span>Galaxy · 16:42 동기화</span></div><span class="badge accent">중복 3장 건너뜀</span></div><div class="today-grid" id="todayGrid"></div></div>
|
||||
<aside class="sync-card"><div class="sync-top"><div><span>오늘의 백업</span><strong>72%</strong></div><span class="badge accent">진행 중</span></div><div><div class="bar"><span></span></div><p>Wi‑Fi · 원본 화질 · 영상 2개 남음</p></div></aside>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section"><div class="section-head"><h2 class="h3">보관함 상태</h2></div>
|
||||
<div class="status-row">
|
||||
<article class="status-card"><span class="badge accent">정리 필요</span><div class="value">128장</div><p>아직 어떤 Memory나 Album에도 포함되지 않았습니다.</p><button class="text-action" data-unorganized>지금 정리하기 →</button></article>
|
||||
<article class="status-card"><span class="badge">중복 후보</span><div class="value">14장</div><p>시각적으로 거의 같은 사진을 검토할 수 있습니다.</p><button class="text-action" data-duplicate>검토하기 →</button></article>
|
||||
<article class="status-card"><span class="badge">저장 공간</span><div class="value">428 GB</div><p>1 TB 중 42% 사용 · 원본 3,184개</p><button class="text-action" data-profile>상세 보기 →</button></article>
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<section class="page" id="page-library">
|
||||
<div class="page-head"><div><div class="greeting">모든 원본이 있는 곳</div><h1 class="h1">라이브러리</h1></div><div class="page-head-actions"><button class="btn primary" data-upload><svg><use href="#i-plus"/></svg><span>사진 추가</span></button></div></div>
|
||||
<div class="tool-row">
|
||||
<label class="field"><svg><use href="#i-search"/></svg><input placeholder="날짜, 장소, 파일명 검색"></label>
|
||||
<button class="chip" data-filter="date">날짜</button><button class="chip" data-filter="type">유형</button><button class="chip" data-filter="unorganized">정리 안 됨</button><button class="chip" data-filter="duplicate">중복 후보</button>
|
||||
<div class="view-switch"><button class="active" data-view="mosaic">▦</button><button data-view="dense">▤</button></div>
|
||||
</div>
|
||||
<div class="filter-summary" id="filterSummary"><span id="filterText"></span><button class="btn ghost" id="clearFilter">필터 해제</button></div>
|
||||
<div id="libraryContent"></div>
|
||||
</section>
|
||||
|
||||
<section class="page" id="page-memories">
|
||||
<div class="page-head"><div><div class="greeting">사진을 다시 보는 방식</div><h1 class="h1">Memories</h1></div><div class="page-head-actions"><button class="btn" data-page="albums">내 Albums</button><button class="btn primary" data-create-album>+ 새 Album</button></div></div>
|
||||
<div class="memory-sections">
|
||||
<section><div class="section-head"><div><h2 class="h3">새로 발견한 Memory</h2><p class="section-note">사진을 추가하면 자동으로 갱신됩니다.</p></div></div>
|
||||
<div class="suggested-banner"><div class="suggested-visual"><div><img src="./assets/photo-1.jpg"></div><div class="suggested-side"><img src="./assets/photo-7.jpg"><img src="./assets/photo-8.jpg"></div></div><div class="suggested-copy"><span class="badge accent">추천</span><h2>제주, 여름의 끝</h2><p>84장의 사진 · 4개 장소 · 3개의 순간을 하나의 흐름으로 묶었습니다.</p><div class="inline-actions"><button class="btn accent" data-open-memory>미리보기</button><button class="btn" data-save-memory>보관하기</button></div></div></div>
|
||||
</section>
|
||||
<section><div class="section-head"><h2 class="h3">저장된 Memories</h2><button class="btn ghost" data-sort-memories>정렬: 최근 본 순</button></div><div class="memory-grid" id="savedMemories"></div></section>
|
||||
<section><div class="section-head"><div><h2 class="h3">내가 만든 Albums</h2><p class="section-note">직접 만든 컬렉션은 자동 Memory와 구분해서 관리합니다.</p></div><button class="btn ghost" data-page="albums">모두 보기</button></div><div class="memory-grid" id="manualAlbums"></div></section>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="page" id="page-search">
|
||||
<div class="page-head"><div><div class="greeting">기억을 찾는 여러 가지 방법</div><h1 class="h1">검색</h1></div></div>
|
||||
<label class="field big-search"><svg><use href="#i-search"/></svg><input placeholder="제주, 2026년 7월, 동영상, 카메라..."></label>
|
||||
<div class="search-layout">
|
||||
<section><div class="section-head"><h2 class="h3">최근 검색</h2></div><div class="recent-searches"><button class="chip" data-search-term="제주">제주</button><button class="chip" data-search-term="작년 여름">작년 여름</button><button class="chip" data-search-term="동영상">동영상</button><button class="chip" data-search-term="Galaxy S24">Galaxy S24</button></div></section>
|
||||
<section><div class="section-head"><h2 class="h3">사람</h2><button class="btn ghost" data-page="people">모두 보기</button></div><div class="people-row"><div class="person" data-person="나"><div class="person-avatar">나</div><span>나</span></div><div class="person" data-person="가족"><div class="person-avatar warm">가</div><span>가족</span></div><div class="person" data-person="친구"><div class="person-avatar lilac">친</div><span>친구</span></div><div class="person" data-page="people"><div class="person-avatar pale">+</div><span>이름 지정</span></div></div></section>
|
||||
<section><div class="section-head"><h2 class="h3">장소</h2><button class="btn ghost" data-page="places-map">지도에서 보기</button></div><div class="place-grid"><article class="place-card" data-place-name="제주도"><img src="./assets/photo-1.jpg"><div class="place-copy"><span>168장 · 4번의 방문</span><strong>제주도</strong></div></article><article class="place-card" data-place-name="서울"><img src="./assets/photo-5.jpg"><div class="place-copy"><span>624장</span><strong>서울</strong></div></article><article class="place-card" data-place-name="강릉"><img src="./assets/photo-2.jpg"><div class="place-copy"><span>91장</span><strong>강릉</strong></div></article></div></section>
|
||||
<section><div class="section-head"><h2 class="h3">미디어 유형</h2></div><div class="type-grid"><article class="type-card" data-media-type="동영상"><div><strong>동영상</strong><span>237개</span></div><div class="iconbox">▶</div></article><article class="type-card" data-media-type="스크린샷"><div><strong>스크린샷</strong><span>184개</span></div><div class="iconbox">▣</div></article><article class="type-card" data-media-type="RAW"><div><strong>RAW</strong><span>42개</span></div><div class="iconbox">R</div></article><article class="type-card" data-media-type="즐겨찾기"><div><strong>즐겨찾기</strong><span>126개</span></div><div class="iconbox">★</div></article></div></section>
|
||||
<section><div class="section-head"><h2 class="h3">연도</h2></div><div class="year-row"><article data-year="2026"><strong>2026</strong><span>812개</span></article><article data-year="2025"><strong>2025</strong><span>1,102개</span></article><article data-year="2024"><strong>2024</strong><span>738개</span></article><article data-year="2023"><strong>2023</strong><span>411개</span></article><article data-year="2022"><strong>2022</strong><span>121개</span></article></div></section>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="page detail-page" id="page-place">
|
||||
<div class="back-row"><button class="btn ghost" data-back>← 검색으로</button></div>
|
||||
<div class="place-detail-head"><div class="osm-map"><iframe id="placeMap" title="장소 지도" src="https://www.openstreetmap.org/export/embed.html?bbox=126.13%2C33.15%2C126.95%2C33.58&layer=mapnik"></iframe></div><div class="place-detail-copy"><span class="badge accent">동적 컬렉션</span><h1 id="placeTitle">제주도</h1><p id="placeDesc">GPS 메타데이터가 제주도로 분류된 168장의 사진과 영상 · 사진이 추가되면 자동으로 갱신됩니다.</p></div></div>
|
||||
<section class="section"><div class="section-head"><h2 class="h3">이 장소에서의 기록</h2></div><div class="memory-grid"><article class="memory-item" data-open-memory><div class="memory-cover"><img src="./assets/photo-1.jpg"><span class="badge accent item-type">Memory</span><span class="item-count">84</span></div><div class="memory-info"><strong id="placeRecordTitle">제주, 여름의 끝</strong><span>2026.07.12 — 07.15</span></div></article><article class="memory-item" data-open-memory><div class="memory-cover"><img src="./assets/photo-8.jpg"><span class="badge item-type">방문 묶음</span><span class="item-count">37</span></div><div class="memory-info"><strong>2024년 5월 제주</strong><span>2024.05.04 — 05.06</span></div></article></div></section>
|
||||
<section class="section"><div class="section-head"><h2 class="h3"><span id="placeAllTitle">제주에서 찍은 모든 사진</span></h2><button class="chip" data-place-sort>최신순</button></div><div class="detail-grid" id="placePhotos"></div></section>
|
||||
</section>
|
||||
|
||||
<section class="page detail-page" id="page-memory">
|
||||
<div class="detail-hero"><img id="memoryDetailCover" src="./assets/photo-1.jpg"><button class="icon-btn detail-back" data-back><svg><use href="#i-back"/></svg></button><div class="detail-actions"><button class="btn" data-share>공유</button><button class="btn" data-edit-memory>편집</button></div><div class="detail-copy"><span class="badge translucent">Memory</span><h1 id="memoryDetailTitle">제주, 여름의 끝</h1><p id="memoryDetailMeta">2026.07.12 — 07.15 · 제주 · 84개의 사진과 영상</p></div></div>
|
||||
<div class="detail-tabs"><button class="active" data-detail-tab="story">Story</button><button data-detail-tab="photos">전체 사진</button><button data-detail-tab="info">정보</button></div>
|
||||
<div class="story-pane" id="storyPane"><div class="story">
|
||||
<article class="moment"><div class="moment-label">7월 12일 · 27개</div><h2>협재 · 첫날 오후</h2><div class="moment-meta">12:40 — 16:10 · 협재해수욕장 주변</div><div class="story-wide viewable"><img src="./assets/photo-1.jpg"></div><div class="story-pair"><div class="viewable"><img src="./assets/photo-2.jpg"></div><div class="viewable"><img src="./assets/photo-3.jpg"></div></div></article>
|
||||
<article class="moment"><div class="moment-label">7월 13일 · 31개</div><h2>애월 · 늦은 오후</h2><div class="moment-meta">16:40 — 19:05 · 애월</div><div class="story-mosaic"><div class="viewable"><img src="./assets/photo-5.jpg"></div><div class="viewable"><img src="./assets/photo-6.jpg"></div><div class="viewable"><img src="./assets/photo-7.jpg"></div></div><div class="map-wrap"><iframe title="협재에서 애월 경로" src="https://www.openstreetmap.org/export/embed.html?bbox=126.12%2C33.30%2C126.45%2C33.50&layer=mapnik"></iframe></div></article>
|
||||
<article class="moment"><div class="moment-label">7월 14일 · 26개</div><h2>제주시 · 마지막 저녁</h2><div class="moment-meta">18:10 — 21:02 · 제주시</div><div class="story-wide last viewable"><img src="./assets/photo-8.jpg"></div></article>
|
||||
</div></div>
|
||||
<div class="all-photos" id="allPhotos"><div class="detail-grid" id="memoryPhotos"></div></div>
|
||||
<div class="all-photos" id="infoPane"><div class="info-card"><div class="section-head"><h2 class="h3">Memory 정보</h2><span class="badge accent">자동 구성</span></div><p>촬영 시간, GPS, 사진 간 시간 간격을 기준으로 자동 구성되었습니다. 사용자는 커버·제목·구간 합치기/나누기만 수정하면 됩니다.</p><div class="status-row compact"><article><span>미디어</span><strong>84</strong></article><article><span>장소</span><strong>4</strong></article><article><span>기간</span><strong>4일</strong></article></div></div></div>
|
||||
</section>
|
||||
|
||||
<section class="page" id="page-albums">
|
||||
<div class="page-head"><div><div class="greeting">직접 만든 컬렉션</div><h1 class="h1">내 Albums</h1></div><div class="page-head-actions"><button class="btn ghost" data-page="memories">← Memories</button><button class="btn primary" data-create-album>+ 새 Album</button></div></div>
|
||||
<div class="collection-toolbar"><label class="field"><svg><use href="#i-search"/></svg><input id="albumSearch" placeholder="Album 검색"></label><div class="inline-actions"><button class="chip active" data-album-filter="all">전체</button><button class="chip" data-album-filter="shared">공유 중</button><button class="chip" data-album-sort>최근 수정순</button></div></div>
|
||||
<div class="album-full-grid" id="albumsPageGrid"></div>
|
||||
</section>
|
||||
|
||||
<section class="page detail-page" id="page-album">
|
||||
<div class="album-manual-head">
|
||||
<div class="album-manual-cover"><img id="albumDetailCover" src="./assets/photo-6.jpg"></div>
|
||||
<div class="album-manual-copy"><button class="btn ghost album-inline-back" data-page="albums">← Albums</button><span class="badge">수동 Album</span><h1 id="albumDetailTitle">가족 사진</h1><p id="albumDetailMeta">124개의 사진과 영상 · 최근 수정 9월 14일</p><div class="inline-actions"><button class="btn primary" data-add-album-photos>+ 사진 추가</button><button class="btn" data-share>공유</button><button class="icon-btn" data-album-more>•••</button></div></div>
|
||||
</div>
|
||||
<div class="detail-tabs album-tabs"><button class="active" data-album-tab="grid">사진</button><button data-album-tab="story">Story</button><button data-album-tab="info">정보</button></div>
|
||||
<div class="album-pane active" id="albumGridPane"><div class="album-grid-toolbar"><div><strong>124개 항목</strong><span>직접 정렬</span></div><div class="inline-actions"><button class="chip" data-album-order>직접 설정</button><button class="btn" data-album-select>선택</button></div></div><div class="detail-grid album-photo-grid" id="albumPhotos"></div></div>
|
||||
<div class="album-pane" id="albumStoryPane"><div class="story"><article class="moment"><div class="moment-label">지난 설날 · 36개</div><h2>다 같이 모였던 오후</h2><div class="moment-meta">2026.02.17 · 서울</div><div class="story-wide viewable"><img src="./assets/photo-6.jpg"></div><div class="story-pair"><div class="viewable"><img src="./assets/photo-9.jpg"></div><div class="viewable"><img src="./assets/photo-10.jpg"></div></div></article><article class="moment"><div class="moment-label">5월 · 28개</div><h2>봄 나들이</h2><div class="moment-meta">2026.05.05 · 경기</div><div class="story-wide viewable"><img src="./assets/photo-11.jpg"></div></article></div></div>
|
||||
<div class="album-pane" id="albumInfoPane"><div class="info-card"><div class="section-head"><h2 class="h3">Album 정보</h2><button class="btn" data-edit-album>편집</button></div><div class="settings-list"><div><span>이름</span><strong>가족 사진</strong></div><div><span>생성일</span><strong>2025.01.03</strong></div><div><span>공유</span><strong>비공개</strong></div><div><span>정렬</span><strong>직접 설정</strong></div><div><span>커버</span><strong>직접 선택</strong></div></div></div></div>
|
||||
</section>
|
||||
|
||||
<section class="page" id="page-people">
|
||||
<div class="page-head"><div><div class="greeting">얼굴을 기준으로 모아보기</div><h1 class="h1">사람</h1></div><button class="btn ghost" data-page="search">← 검색</button></div>
|
||||
<section><div class="section-head"><h2 class="h3">이름 지정됨</h2></div><div class="people-full-grid"><article data-person="나"><div class="person-photo tone-a">나</div><strong>나</strong><span>842장</span></article><article data-person="가족"><div class="person-photo tone-b">가</div><strong>가족</strong><span>381장</span></article><article data-person="친구"><div class="person-photo tone-c">친</div><strong>친구</strong><span>264장</span></article></div></section>
|
||||
<section class="section"><div class="section-head"><div><h2 class="h3">이름 미지정</h2><p class="section-note">자주 함께 등장한 얼굴부터 보여줍니다.</p></div></div><div class="people-full-grid"><article data-name-person><div class="person-photo tone-d">?</div><strong>이름 지정</strong><span>97장</span></article><article data-name-person><div class="person-photo tone-e">?</div><strong>이름 지정</strong><span>63장</span></article><article data-name-person><div class="person-photo tone-f">?</div><strong>이름 지정</strong><span>41장</span></article></div></section>
|
||||
</section>
|
||||
|
||||
<section class="page detail-page" id="page-person">
|
||||
<div class="page-head"><button class="btn ghost" data-page="people">← 사람</button></div>
|
||||
<div class="person-detail-head"><div class="person-photo tone-b big-person" id="personInitial">가</div><div><span class="badge accent">사람</span><h1 id="personTitle">가족</h1><p id="personMeta">381장의 사진 · 12개의 Memory</p><div class="inline-actions"><button class="btn" data-rename-person>이름 변경</button><button class="btn ghost" data-toast="이 얼굴을 다른 사람과 합치는 UI는 개발 단계에서 연결합니다.">얼굴 합치기</button></div></div></div>
|
||||
<section class="section"><div class="section-head"><h2 class="h3">함께한 Memories</h2></div><div class="memory-grid"><article class="memory-item" data-open-memory><div class="memory-cover"><img src="./assets/photo-1.jpg"><span class="item-count">84</span></div><div class="memory-info"><strong>제주, 여름의 끝</strong><span>2026.07.12 — 07.15</span></div></article><article class="memory-item" data-open-memory><div class="memory-cover"><img src="./assets/photo-2.jpg"><span class="item-count">67</span></div><div class="memory-info"><strong>강릉에서 보낸 주말</strong><span>2025.09.14 — 09.15</span></div></article></div></section>
|
||||
<section class="section"><div class="section-head"><h2 class="h3">모든 사진</h2><button class="chip" data-person-sort>최신순</button></div><div class="detail-grid" id="personPhotos"></div></section>
|
||||
</section>
|
||||
|
||||
<section class="page" id="page-places-map">
|
||||
<div class="page-head"><div><div class="greeting">GPS가 있는 사진</div><h1 class="h1">장소 지도</h1></div><button class="btn ghost" data-page="search">← 검색</button></div>
|
||||
<div class="places-layout"><div class="places-big-map"><iframe title="모든 장소 지도" src="https://www.openstreetmap.org/export/embed.html?bbox=126.0%2C33.0%2C129.5%2C38.0&layer=mapnik"></iframe></div><aside class="place-list"><button data-place-name="제주도"><span><strong>제주도</strong><small>168장 · 4번 방문</small></span><span>›</span></button><button data-place-name="서울"><span><strong>서울</strong><small>624장 · 38번 방문</small></span><span>›</span></button><button data-place-name="강릉"><span><strong>강릉</strong><small>91장 · 3번 방문</small></span><span>›</span></button><button data-place-name="부산"><span><strong>부산</strong><small>108장 · 2번 방문</small></span><span>›</span></button></aside></div>
|
||||
</section>
|
||||
|
||||
<section class="page" id="page-settings">
|
||||
<div class="page-head"><div><div class="greeting">개인 저장소 설정</div><h1 class="h1" id="settingsTitle">동기화된 기기</h1></div><button class="btn ghost" data-profile>프로필 열기</button></div>
|
||||
<div class="settings-shell"><nav class="settings-nav"><button data-settings="devices" class="active">동기화된 기기</button><button data-settings="backup-settings">모바일 백업</button><button data-settings="storage">저장소 및 백업</button><button data-settings="account">계정</button></nav><div class="settings-content" id="settingsContent"></div></div>
|
||||
</section>
|
||||
|
||||
</main>
|
||||
|
||||
<nav class="mobile-tabs"><button class="active" data-page="home"><svg><use href="#i-home"/></svg><small>홈</small></button><button data-page="library"><svg><use href="#i-grid"/></svg><small>라이브러리</small></button><button data-page="memories"><svg><use href="#i-spark"/></svg><small>Memories</small></button><button data-page="search"><svg><use href="#i-search"/></svg><small>검색</small></button></nav>
|
||||
|
||||
<div class="selection-bar" id="selectionBar"><span class="count" id="selectionCount">0개 선택</span><button>Memory에 추가</button><button>이동</button><button>즐겨찾기</button><button id="clearSelection">취소</button></div>
|
||||
<div class="scrim" id="scrim"></div>
|
||||
<div class="modal" id="uploadModal"><div class="modal-head"><div><strong>사진 추가</strong><span>원본은 Repository에 한 번만 저장됩니다.</span></div><button class="icon-btn" data-close>×</button></div><div class="modal-body"><div class="dropzone"><strong>사진이나 영상을 여기에 놓으세요</strong><p>업로드 전에 checksum을 비교해 이미 있는 원본은 건너뜁니다.</p><button class="btn primary" id="fakeChoose">파일 선택</button></div><div class="upload-options"><button class="option-card" data-folder-upload><strong>폴더 가져오기</strong><span>PC 폴더를 한 번에 가져옵니다.</span></button><button class="option-card" data-sync-settings><strong>휴대폰 동기화</strong><span>모바일 백업 설정으로 이동합니다.</span></button></div><div class="queue" id="uploadQueue"><div class="queue-item"><div class="queue-thumb"><img src="./assets/photo-1.jpg"></div><div><strong>IMG_20260915_142205.jpg</strong><div class="progress"><span></span></div></div><span>64%</span></div><div class="queue-item"><div class="queue-thumb"><img src="./assets/photo-2.jpg"></div><div><strong>IMG_20260915_142207.jpg</strong><span>동일 파일 발견 · 업로드 건너뜀</span></div><span class="badge accent">중복</span></div></div></div></div>
|
||||
|
||||
<div class="drawer" id="profileDrawer"><div class="drawer-head"><strong>프로필 & 저장소</strong><button class="icon-btn" data-close>×</button></div><div class="drawer-body"><div class="profile-card"><span class="avatar big"></span><div><strong>동현</strong><span>Keycloak 계정 · donghyeon</span></div></div><div class="stat-grid"><article><span>저장 공간</span><strong>428 GB</strong><small>1 TB 중 42%</small></article><article><span>미디어</span><strong>3,184</strong><small>사진 2,947 · 영상 237</small></article></div><div class="menu-list"><button data-profile-page="devices">동기화된 기기 <span>Galaxy · 2분 전 ›</span></button><button data-profile-page="backup-settings">모바일 백업 설정 <span>›</span></button><button data-profile-page="storage">저장소 및 백업 <span>›</span></button><button data-profile-page="account">계정 설정 <span>›</span></button><a href="./login-v2.html">로그인 화면 보기 <span>↗</span></a><button class="danger" data-logout>로그아웃 <span>›</span></button></div></div></div>
|
||||
|
||||
|
||||
<div class="modal" id="createAlbumModal"><div class="modal-head"><div><strong>새 Album</strong><span>직접 관리할 사진 컬렉션을 만듭니다.</span></div><button class="icon-btn" data-close>×</button></div><div class="modal-body">
|
||||
<label class="form-label">Album 이름<input id="newAlbumName" class="text-input" value="새로운 Album"></label>
|
||||
<div class="form-label">커버 미리보기<div class="cover-picker"><button class="active"><img src="./assets/photo-6.jpg"></button><button><img src="./assets/photo-9.jpg"></button><button><img src="./assets/photo-10.jpg"></button><button><img src="./assets/photo-11.jpg"></button></div></div>
|
||||
<label class="check-row"><span><strong>사진 추가 후 Story 자동 구성</strong><small>촬영 시간과 위치가 있는 경우 Story 보기도 함께 만듭니다.</small></span><input type="checkbox" checked></label>
|
||||
<div class="modal-actions"><button class="btn ghost" data-close>취소</button><button class="btn primary" id="confirmCreateAlbum">Album 만들기</button></div>
|
||||
</div></div>
|
||||
|
||||
<div class="modal" id="shareModal"><div class="modal-head"><div><strong>공유</strong><span>링크로 Memory 또는 Album을 공유합니다.</span></div><button class="icon-btn" data-close>×</button></div><div class="modal-body">
|
||||
<div class="share-link"><span>https://gpt.hyeonworks.com/s/mem-7F2A</span><button class="btn" id="copyShare">복사</button></div>
|
||||
<label class="check-row"><span><strong>다운로드 허용</strong><small>공유 받은 사람이 원본을 내려받을 수 있습니다.</small></span><input type="checkbox"></label>
|
||||
<label class="check-row"><span><strong>만료일 사용</strong><small>7일 후 링크가 자동으로 만료됩니다.</small></span><input type="checkbox" checked></label>
|
||||
<div class="modal-actions"><button class="btn ghost" data-close>닫기</button><button class="btn primary" id="applyShare">공유 설정 저장</button></div>
|
||||
</div></div>
|
||||
|
||||
<div class="modal" id="editMemoryModal"><div class="modal-head"><div><strong>Memory 편집</strong><span>자동 구성 결과를 필요한 만큼만 보정합니다.</span></div><button class="icon-btn" data-close>×</button></div><div class="modal-body">
|
||||
<label class="form-label">제목<input class="text-input" value="제주, 여름의 끝"></label>
|
||||
<div class="edit-options"><button class="option-card" data-toast="커버 선택 모드를 열었습니다."><strong>커버 변경</strong><span>대표 사진을 고릅니다.</span></button><button class="option-card" data-toast="Moment 합치기/나누기 모드를 열었습니다."><strong>Moment 조정</strong><span>자동 묶음을 합치거나 나눕니다.</span></button></div>
|
||||
<label class="check-row"><span><strong>새 사진이 추가되면 자동 갱신</strong><small>같은 기간과 장소의 사진을 발견하면 이 Memory에 제안합니다.</small></span><input type="checkbox" checked></label>
|
||||
<div class="modal-actions"><button class="btn ghost" data-close>취소</button><button class="btn primary" id="saveMemoryEdit">저장</button></div>
|
||||
</div></div>
|
||||
|
||||
<div class="modal" id="actionModal"><div class="modal-head"><div><strong id="actionTitle">작업</strong><span id="actionSubtitle"></span></div><button class="icon-btn" data-close>×</button></div><div class="modal-body"><div id="actionBody"></div><div class="modal-actions"><button class="btn ghost" data-close>취소</button><button class="btn primary" id="actionConfirm">확인</button></div></div></div>
|
||||
|
||||
<div class="viewer" id="viewer"><button class="viewer-close" id="viewerClose">×</button><img id="viewerImage" src="./assets/photo-1.jpg"><div class="viewer-meta">2026.07.13 · 제주 · 서버 원본</div></div>
|
||||
<div class="toast" id="toast"></div>
|
||||
<script src="/beta.js"></script>
|
||||
</div>
|
||||
|
||||
<div id="root" hidden aria-hidden="true"></div>
|
||||
<script type="module" src="/src/bootstrap/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -131,7 +131,11 @@
|
||||
"check:types:fixture:http-route-id": "tsc -p tests/fixtures/typecheck/tsconfig.http-route-id.json",
|
||||
"check:types:fixture:feature-contribution-input": "tsc -p tests/fixtures/typecheck/tsconfig.feature-contribution-input.json",
|
||||
"check:types:fixture:feature-capability-selection": "tsc -p tests/fixtures/typecheck/tsconfig.feature-capability-selection.json",
|
||||
"check:types:fixture:direct-feature-composition": "tsc -p tests/fixtures/typecheck/tsconfig.direct-feature-composition.json"
|
||||
"check:types:fixture:direct-feature-composition": "tsc -p tests/fixtures/typecheck/tsconfig.direct-feature-composition.json",
|
||||
"dev:local": "vite",
|
||||
"dev:api": "APP_PROFILE=development vite",
|
||||
"build:dev": "APP_PROFILE=development node scripts/build-frontend.ts",
|
||||
"build:prod": "APP_PROFILE=production node scripts/build-frontend.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tanstack/react-query": "5.101.4",
|
||||
|
||||
|
After Width: | Height: | Size: 285 KiB |
|
After Width: | Height: | Size: 422 KiB |
|
After Width: | Height: | Size: 300 KiB |
|
After Width: | Height: | Size: 283 KiB |
|
After Width: | Height: | Size: 153 KiB |
|
After Width: | Height: | Size: 339 KiB |
|
After Width: | Height: | Size: 563 KiB |
|
After Width: | Height: | Size: 234 KiB |
|
After Width: | Height: | Size: 358 KiB |
|
After Width: | Height: | Size: 423 KiB |
|
After Width: | Height: | Size: 260 KiB |
@@ -0,0 +1,32 @@
|
||||
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.css');
|
||||
:root{--bg:#f4f4f1;--surface:#fff;--surface2:#ecece7;--ink:#171816;--sub:#6d7069;--line:#dddeda;--accent:#496356;--accent2:#dfe9e2;--danger:#a34b42;--side:232px;--shadow:0 18px 50px rgba(25,27,23,.08)}
|
||||
*{box-sizing:border-box}html,body{margin:0;background:var(--bg);color:var(--ink);font-family:'Pretendard Variable',Pretendard,-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;letter-spacing:-.012em}button,input{font:inherit}button{cursor:pointer}img{display:block;width:100%;height:100%;object-fit:cover}a{text-decoration:none;color:inherit}.svg-defs{position:absolute;width:0;height:0;overflow:hidden}
|
||||
.sidebar{position:fixed;inset:0 auto 0 0;width:var(--side);padding:22px 16px 18px;background:rgba(244,244,241,.93);backdrop-filter:blur(18px);border-right:1px solid rgba(0,0,0,.055);z-index:60}.brand{display:flex;align-items:center;gap:10px;padding:2px 8px 28px;font-size:20px;font-weight:780;letter-spacing:-.03em}.brand-mark{width:29px;height:29px;border-radius:10px;background:#171816;position:relative}.brand-mark:after{content:'';position:absolute;inset:7px;border:2px solid #fff;border-radius:50%}.nav{display:grid;gap:5px}.nav button{height:43px;border:0;background:transparent;border-radius:12px;padding:0 12px;display:flex;align-items:center;gap:12px;color:#646760;font-size:13px;text-align:left}.nav button svg,.page-head-actions svg,.field svg,.mobile-tabs svg,.detail-back svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.nav button.active{background:#e6e7e2;color:#161715;font-weight:700}.sidebar-footer{position:absolute;left:16px;right:16px;bottom:18px}.profile-mini{width:100%;border:0;background:transparent;border-radius:14px;padding:9px;display:flex;align-items:center;gap:10px;text-align:left}.profile-mini:hover{background:#e8e9e4}.profile-copy{flex:1}.profile-copy strong{font-size:13px;display:block}.profile-copy span{display:block;font-size:11px;color:var(--sub);margin-top:2px}.avatar{width:36px;height:36px;border-radius:50%;background:linear-gradient(135deg,#9db0a4,#d7c5a9);flex:none}.dot{width:8px;height:8px;border-radius:50%;background:#5e8b6c;box-shadow:0 0 0 3px #e5efe8}
|
||||
.main{margin-left:var(--side);padding:30px 38px 96px}.page{display:none;max-width:1360px;margin:0 auto}.page.active{display:block}.page-head{display:flex;align-items:flex-end;justify-content:space-between;gap:18px;margin-bottom:26px}.page-head-actions{display:flex;gap:8px;align-items:center}.greeting{font-size:13px;color:var(--sub);margin-bottom:6px}.h1{font-size:34px;line-height:1.08;letter-spacing:-.045em;margin:0;font-weight:760}.h2{font-size:24px;letter-spacing:-.03em;margin:0;font-weight:740}.h3{font-size:18px;letter-spacing:-.02em;margin:0;font-weight:710}.btn,.icon-btn,.chip{height:40px;border:1px solid var(--line);background:#fff;color:var(--ink);border-radius:12px;padding:0 14px;font-size:13px;font-weight:660}.btn{display:inline-flex;align-items:center;gap:7px;justify-content:center}.btn.primary{background:#171816;border-color:#171816;color:#fff}.btn.accent{background:var(--accent);border-color:var(--accent);color:#fff}.btn.ghost{background:transparent;border-color:transparent;color:var(--sub)}.btn.dark-ghost{background:transparent;color:#d6d9d5;border-color:rgba(255,255,255,.18)}.icon-btn{width:40px;padding:0;border-radius:50%;display:grid;place-items:center}.chip{height:34px;border-radius:999px;padding:0 12px;color:var(--sub);font-size:12px}.chip.active{background:var(--accent2);border-color:#c8d8cd;color:#2f4c3d}.badge{display:inline-flex;align-items:center;gap:6px;height:25px;border-radius:999px;padding:0 9px;background:var(--surface2);font-size:11px;font-weight:680;color:var(--sub)}.badge.accent{background:var(--accent2);color:#2f4c3d}.badge.translucent{background:rgba(255,255,255,.18);color:#fff}.field{height:44px;border:1px solid var(--line);background:#fff;border-radius:12px;display:flex;align-items:center;gap:9px;padding:0 13px}.field input{border:0;outline:0;background:transparent;width:100%;font:inherit}.section{margin-top:38px}.section-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}.section-note{font-size:12px;color:var(--sub);margin:4px 0 0}
|
||||
.discovery-card{display:grid;grid-template-columns:1.1fr .9fr;background:#1d211e;border-radius:26px;overflow:hidden;min-height:430px;box-shadow:var(--shadow)}.discovery-media{position:relative;min-height:430px}.collage{position:absolute;inset:0;display:grid;grid-template-columns:1.45fr .8fr;grid-template-rows:1fr 1fr;gap:3px}.collage>div:first-child{grid-row:1/3}.discovery-media:after{content:'';position:absolute;inset:0;background:linear-gradient(90deg,transparent 60%,rgba(29,33,30,.25))}.discovery-copy{padding:38px 36px;color:#f8f8f6;display:flex;flex-direction:column;justify-content:center}.kicker{font-size:12px;color:#bdc9c1;font-weight:700;display:flex;align-items:center;gap:8px}.spark{width:28px;height:28px;border-radius:50%;background:#31433a;display:grid;place-items:center}.discovery-copy h2{font-size:38px;line-height:1.08;letter-spacing:-.05em;margin:18px 0 10px}.discovery-copy p{color:#c8cbc6;line-height:1.6;margin:0 0 24px;font-size:14px}.discovery-meta{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:26px}.discovery-meta span{border:1px solid rgba(255,255,255,.15);border-radius:999px;padding:7px 10px;font-size:11px;color:#d9ddd9}.discovery-actions{display:flex;gap:8px}
|
||||
.memory-strip{display:grid;grid-template-columns:1.35fr 1fr 1fr;gap:10px}.memory-card{height:260px;border-radius:18px;overflow:hidden;position:relative;cursor:pointer}.memory-card:after,.place-card:after{content:'';position:absolute;inset:0;background:linear-gradient(180deg,transparent 42%,rgba(0,0,0,.62))}.memory-copy{position:absolute;left:17px;right:17px;bottom:16px;z-index:2;color:#fff}.memory-copy span{display:block;font-size:12px;opacity:.76}.memory-copy strong{display:block;font-size:18px;margin-top:4px}
|
||||
.intake-row{display:grid;grid-template-columns:1fr 270px;gap:14px}.today-media{background:#fff;border:1px solid var(--line);border-radius:18px;padding:16px}.today-head{display:flex;align-items:center;justify-content:space-between}.today-head strong{font-size:17px}.today-head>div span{font-size:12px;color:var(--sub);margin-left:7px}.today-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:5px;margin-top:12px}.today-grid div{aspect-ratio:1;border-radius:9px;overflow:hidden}.sync-card{background:#e9ede9;border-radius:18px;padding:18px;display:flex;flex-direction:column;justify-content:space-between}.sync-top{display:flex;align-items:flex-start;justify-content:space-between}.sync-top>div span{display:block;font-size:12px;color:var(--sub)}.sync-top strong{display:block;font-size:28px;letter-spacing:-.04em;margin-top:3px}.sync-card p{font-size:11px;color:var(--sub);margin:8px 0 0}.bar{height:6px;background:rgba(73,99,86,.14);border-radius:999px;overflow:hidden}.bar span{display:block;width:72%;height:100%;background:var(--accent)}
|
||||
.status-row{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}.status-card{background:#fff;border:1px solid var(--line);border-radius:16px;padding:16px}.status-card .value{font-size:24px;font-weight:740;margin:8px 0 2px}.status-card p{font-size:12px;color:var(--sub);margin:0;line-height:1.45}.text-action{border:0;background:transparent;color:var(--accent);font-size:12px;font-weight:680;padding:12px 0 0}
|
||||
.tool-row{display:flex;align-items:center;gap:8px;position:sticky;top:10px;z-index:30;margin-bottom:16px}.tool-row .field{width:340px}.view-switch{display:flex;border:1px solid var(--line);background:#fff;border-radius:11px;padding:3px}.view-switch button{width:32px;height:32px;border:0;border-radius:8px;background:transparent;color:var(--sub)}.view-switch button.active{background:var(--surface2);color:var(--ink)}.filter-summary{display:none;background:var(--accent2);color:#2f4c3d;border-radius:12px;padding:11px 13px;margin-bottom:14px;align-items:center;justify-content:space-between;font-size:13px}.filter-summary.show{display:flex}.month-head{display:flex;align-items:center;justify-content:space-between;margin:28px 0 10px}.month-head .left{display:flex;align-items:baseline;gap:8px}.month-head span{font-size:12px;color:var(--sub)}.media-grid{display:grid;grid-template-columns:repeat(6,1fr);grid-auto-rows:92px;gap:3px;grid-auto-flow:dense}.media-tile{position:relative;overflow:hidden;background:#ddd;cursor:pointer;border-radius:3px}.media-tile.wide{grid-column:span 2}.media-tile.tall{grid-row:span 2}.media-tile.large{grid-column:span 2;grid-row:span 2}.media-tile img{transition:transform .25s}.media-tile:hover img{transform:scale(1.018)}.select-mark{position:absolute;left:8px;top:8px;width:22px;height:22px;border-radius:50%;background:rgba(255,255,255,.94);border:1px solid rgba(0,0,0,.14);display:grid;place-items:center;font-size:11px;opacity:0;z-index:2}.media-tile:hover .select-mark,.media-tile.selected .select-mark{opacity:1}.media-tile.selected:after{content:'';position:absolute;inset:0;border:3px solid #fff;box-shadow:inset 0 0 0 3px var(--accent)}.media-tile.selected .select-mark{background:var(--accent);color:#fff}.media-state{position:absolute;right:7px;bottom:7px;display:flex;gap:5px}.media-pill{background:rgba(20,21,19,.62);backdrop-filter:blur(5px);color:#fff;border-radius:999px;padding:4px 7px;font-size:10px}.media-warning{background:#94633d}
|
||||
.memory-sections{display:grid;gap:32px}.suggested-banner{display:grid;grid-template-columns:1.05fr .95fr;background:#e9ede9;border-radius:22px;overflow:hidden}.suggested-visual{min-height:280px;display:grid;grid-template-columns:2fr 1fr;gap:3px}.suggested-side{display:grid;grid-template-rows:1fr 1fr;gap:3px}.suggested-copy{padding:30px;display:flex;flex-direction:column;justify-content:center}.suggested-copy h2{font-size:29px;letter-spacing:-.04em;margin:12px 0 8px}.suggested-copy p{font-size:14px;color:var(--sub);line-height:1.55;margin:0}.inline-actions{display:flex;gap:8px;margin-top:14px}.memory-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:18px}.memory-item{cursor:pointer}.memory-cover{aspect-ratio:4/3;border-radius:18px;overflow:hidden;position:relative}.item-type{position:absolute;left:10px;top:10px}.item-count{position:absolute;right:10px;bottom:10px;background:rgba(0,0,0,.5);color:#fff;border-radius:999px;padding:4px 8px;font-size:10px}.memory-info{padding:11px 2px}.memory-info strong{font-size:16px;display:block}.memory-info span{font-size:12px;color:var(--sub);display:block;margin-top:3px}
|
||||
.big-search{height:52px;max-width:760px}.search-layout{display:grid;gap:34px}.recent-searches{display:flex;gap:8px;flex-wrap:wrap}.people-row{display:flex;gap:18px;overflow:auto;padding-bottom:3px}.person{min-width:78px;text-align:center}.person-avatar{width:66px;height:66px;border-radius:50%;margin:auto;background:linear-gradient(135deg,#c8d2ca,#d8c5b4);display:grid;place-items:center;font-weight:750;font-size:18px;color:#45554b}.person-avatar.warm{background:linear-gradient(135deg,#d7c6b6,#b9c2c9)}.person-avatar.lilac{background:linear-gradient(135deg,#c8c0d4,#c9d8cc)}.person-avatar.pale{background:linear-gradient(135deg,#d5cfae,#c5b8aa)}.person span{display:block;font-size:12px;margin-top:7px}.place-grid{display:grid;grid-template-columns:1.3fr 1fr 1fr;gap:10px}.place-card{height:210px;border-radius:18px;overflow:hidden;position:relative;cursor:pointer}.place-copy{position:absolute;left:16px;bottom:15px;z-index:2;color:#fff}.place-copy span{display:block;font-size:11px;opacity:.78}.place-copy strong{font-size:18px;display:block;margin-top:2px}.type-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:10px}.type-card{background:#fff;border:1px solid var(--line);border-radius:15px;padding:16px;display:flex;align-items:center;justify-content:space-between}.type-card strong{font-size:14px;display:block}.type-card span{display:block;font-size:11px;color:var(--sub);margin-top:3px}.iconbox{width:36px;height:36px;border-radius:10px;background:var(--surface2);display:grid;place-items:center}.year-row{display:grid;grid-template-columns:repeat(5,1fr);gap:8px}.year-row article{background:#fff;border:1px solid var(--line);border-radius:14px;padding:16px}.year-row strong{font-size:24px;display:block}.year-row span{font-size:11px;color:var(--sub);display:block;margin-top:4px}
|
||||
.detail-page{max-width:1180px}.back-row{margin-bottom:12px}.place-detail-head{background:#e7ebe7;border-radius:24px;overflow:hidden}.osm-map{height:340px}.osm-map iframe,.map-wrap iframe{width:100%;height:100%;border:0}.place-detail-copy{padding:24px}.place-detail-copy h1{font-size:38px;letter-spacing:-.045em;margin:10px 0 5px}.place-detail-copy p{font-size:13px;color:var(--sub);margin:0}.detail-hero{height:67vh;min-height:520px;border-radius:26px;overflow:hidden;position:relative}.detail-hero:after{content:'';position:absolute;inset:0;background:linear-gradient(180deg,rgba(0,0,0,.04),rgba(0,0,0,.65))}.detail-back,.detail-actions{position:absolute;top:18px;z-index:3}.detail-back{left:18px}.detail-actions{right:18px;display:flex;gap:7px}.detail-copy{position:absolute;left:32px;right:32px;bottom:30px;z-index:2;color:#fff}.detail-copy h1{font-size:48px;letter-spacing:-.055em;margin:10px 0 7px}.detail-copy p{font-size:13px;margin:0;opacity:.86}.detail-tabs{display:flex;gap:6px;margin:16px 0 44px;border-bottom:1px solid var(--line)}.detail-tabs button{height:43px;border:0;background:transparent;padding:0 14px;color:var(--sub);font-weight:650;border-bottom:2px solid transparent}.detail-tabs button.active{color:var(--ink);border-bottom-color:var(--ink)}.story{max-width:900px;margin:auto}.moment{margin-bottom:70px}.moment-label{font-size:11px;color:#8a8d87;font-weight:720}.moment h2{font-size:29px;letter-spacing:-.035em;margin:7px 0}.moment-meta{font-size:12px;color:var(--sub);margin-bottom:17px}.story-wide{height:470px;border-radius:18px;overflow:hidden}.story-wide.last{height:430px}.story-pair{display:grid;grid-template-columns:1.15fr .85fr;gap:6px;margin-top:6px}.story-pair>div{height:290px;border-radius:14px;overflow:hidden}.story-mosaic{display:grid;grid-template-columns:1.5fr 1fr;grid-template-rows:190px 190px;gap:6px}.story-mosaic>div{overflow:hidden;border-radius:14px}.story-mosaic>div:first-child{grid-row:1/3}.map-wrap{margin-top:8px;border-radius:18px;overflow:hidden;height:300px;border:1px solid var(--line);background:#e8ece8}.all-photos{display:none}.all-photos.active{display:block}.story-pane.hidden{display:none}.detail-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:3px}.detail-grid>div{aspect-ratio:1;overflow:hidden}.info-card{max-width:720px;margin:auto;background:#fff;border:1px solid var(--line);border-radius:18px;padding:20px}.info-card>p{font-size:13px;color:var(--sub);line-height:1.6}.status-row.compact article{background:var(--surface2);border-radius:14px;padding:14px}.status-row.compact span{display:block;font-size:11px;color:var(--sub)}.status-row.compact strong{font-size:22px;display:block;margin-top:3px}
|
||||
.selection-bar{position:fixed;left:calc(var(--side) + 50%);transform:translateX(-50%);bottom:20px;z-index:95;background:#171816;color:#fff;border-radius:16px;padding:9px 10px;display:none;gap:7px;align-items:center;box-shadow:0 16px 48px rgba(0,0,0,.22)}.selection-bar.show{display:flex}.selection-bar button{border:0;background:#2e302d;color:#fff;border-radius:10px;padding:9px 11px;font-size:12px}.selection-bar .count{padding:0 10px;font-size:12px;font-weight:680}
|
||||
.scrim{position:fixed;inset:0;background:rgba(0,0,0,.34);z-index:150;display:none}.scrim.show{display:block}.modal{position:fixed;left:50%;top:50%;transform:translate(-50%,-46%);width:min(650px,calc(100vw - 28px));max-height:85vh;overflow:auto;background:#fff;border-radius:22px;z-index:160;opacity:0;pointer-events:none;transition:.18s;box-shadow:0 24px 70px rgba(0,0,0,.22)}.modal.show{opacity:1;pointer-events:auto;transform:translate(-50%,-50%)}.modal-head,.drawer-head{display:flex;align-items:center;justify-content:space-between;padding:18px 18px 12px}.modal-head>div>strong{display:block}.modal-head>div>span{display:block;font-size:11px;color:var(--sub);margin-top:3px}.modal-body{padding:0 18px 18px}.dropzone{border:1.5px dashed #c9ccc6;background:#fafaf8;border-radius:16px;padding:34px 20px;text-align:center}.dropzone strong{font-size:18px}.dropzone p{font-size:13px;color:var(--sub)}.upload-options{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:10px}.option-card{border:1px solid var(--line);background:#fff;border-radius:14px;padding:15px;text-align:left}.option-card strong{display:block}.option-card span{display:block;font-size:11px;color:var(--sub);margin-top:5px}.queue{display:none;margin-top:16px}.queue-item{display:grid;grid-template-columns:42px 1fr auto;gap:10px;align-items:center;padding:8px 0}.queue-thumb{width:42px;height:42px;border-radius:9px;overflow:hidden}.queue-item strong{font-size:12px;display:block}.queue-item span{font-size:11px;color:var(--sub)}.progress{height:5px;border-radius:99px;background:#e7e8e3;overflow:hidden;margin-top:5px}.progress span{display:block;width:64%;height:100%;background:var(--accent)}
|
||||
.drawer{position:fixed;right:0;top:0;bottom:0;width:min(400px,92vw);background:#fff;z-index:160;transform:translateX(100%);transition:.2s;box-shadow:-15px 0 45px rgba(0,0,0,.12);visibility:hidden}.drawer.show{transform:none;visibility:visible}.drawer-body{padding:6px 18px 20px}.profile-card{display:flex;align-items:center;gap:11px;padding:10px 0 16px}.avatar.big{width:52px;height:52px}.profile-card strong{display:block}.profile-card span:last-child{display:block;font-size:11px;color:var(--sub);margin-top:3px}.stat-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}.stat-grid article{background:var(--surface2);border-radius:14px;padding:14px}.stat-grid span,.stat-grid small{display:block;font-size:11px;color:var(--sub)}.stat-grid strong{display:block;font-size:22px;margin:3px 0}.menu-list{margin-top:16px;border-top:1px solid var(--line)}.menu-list button,.menu-list a{height:49px;border:0;border-bottom:1px solid var(--line);background:#fff;width:100%;display:flex;align-items:center;justify-content:space-between;font-size:13px;text-align:left}.menu-list span{color:var(--sub);font-size:11px}.menu-list .danger{color:var(--danger)}
|
||||
.viewer{position:fixed;inset:0;background:#10110f;z-index:300;display:none;place-items:center}.viewer.show{display:grid}.viewer img{width:auto;height:auto;max-width:92vw;max-height:88vh;object-fit:contain}.viewer-close{position:absolute;top:18px;left:18px;width:42px;height:42px;border-radius:50%;border:0;background:rgba(255,255,255,.14);color:#fff;font-size:22px}.viewer-meta{position:absolute;bottom:18px;left:50%;transform:translateX(-50%);padding:7px 11px;border-radius:999px;background:rgba(0,0,0,.35);color:#fff;font-size:12px}.toast{position:fixed;right:22px;bottom:22px;z-index:400;background:#171816;color:#fff;border-radius:11px;padding:11px 14px;font-size:12px;opacity:0;transform:translateY(8px);transition:.18s}.toast.show{opacity:1;transform:none}.mobile-top,.mobile-tabs{display:none}
|
||||
@media(max-width:1050px){.media-grid{grid-template-columns:repeat(5,1fr)}.memory-grid{grid-template-columns:repeat(2,1fr)}.today-grid{grid-template-columns:repeat(5,1fr)}.today-grid>div:nth-child(n+6){display:none}.place-grid{grid-template-columns:1fr 1fr}.place-grid>*:last-child{display:none}}
|
||||
@media(max-width:720px){:root{--side:0px}.sidebar{display:none}.mobile-top{display:flex;position:fixed;top:0;left:0;right:0;height:58px;align-items:center;justify-content:space-between;padding:0 14px;background:rgba(244,244,241,.93);backdrop-filter:blur(15px);z-index:70}.mobile-top .brand{padding:0;font-size:18px}.mobile-profile{width:auto;padding:0}.mobile-tabs{display:grid;position:fixed;left:9px;right:9px;bottom:9px;height:62px;grid-template-columns:repeat(4,1fr);padding:5px;background:rgba(23,24,22,.96);border-radius:19px;z-index:110}.mobile-tabs button{border:0;background:transparent;color:#aeb0aa;border-radius:14px;display:grid;place-items:center;font-size:16px}.mobile-tabs button.active{background:#353734;color:#fff}.mobile-tabs svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8}.mobile-tabs small{font-size:9px}.main{margin:0;padding:72px 13px 88px}.page-head{margin-bottom:18px}.h1{font-size:30px}.page-head-actions .btn span{display:none}.discovery-card{grid-template-columns:1fr;min-height:0;border-radius:22px}.discovery-media{min-height:290px}.discovery-copy{padding:24px 21px}.discovery-copy h2{font-size:31px}.memory-strip{grid-template-columns:1.2fr 1fr;gap:8px}.memory-strip>*:last-child{display:none}.memory-card{height:205px}.intake-row{grid-template-columns:1fr}.today-grid{grid-template-columns:repeat(4,1fr);gap:3px}.today-grid>div:nth-child(n+5){display:none}.status-row{grid-template-columns:1fr}.section{margin-top:30px}.tool-row{top:61px;margin-left:-13px;margin-right:-13px;padding:0 13px;overflow:auto}.tool-row .field{min-width:235px}.media-grid{grid-template-columns:repeat(3,1fr);grid-auto-rows:90px}.select-mark{opacity:.72}.suggested-banner{grid-template-columns:1fr}.suggested-visual{min-height:230px}.suggested-copy{padding:22px}.memory-grid{grid-template-columns:1fr 1fr;gap:12px 7px}.memory-cover{aspect-ratio:1;border-radius:14px}.search-layout{gap:28px}.place-grid{grid-template-columns:1fr 1fr;gap:8px}.place-card{height:180px}.type-grid{grid-template-columns:1fr 1fr}.year-row{grid-template-columns:1fr 1fr}.detail-page{margin:-72px -13px -88px;width:auto}.back-row{padding:72px 13px 0}.place-detail-head{border-radius:0}.place-detail-copy{padding:20px}.detail-hero{height:70vh;min-height:520px;border-radius:0}.detail-back,.detail-actions{top:70px}.detail-copy{left:20px;right:20px;bottom:24px}.detail-copy h1{font-size:38px}.detail-tabs{padding:0 13px;margin-top:10px}.story{padding:0 13px}.story-wide{height:52vh}.story-pair>div{height:230px}.story-mosaic{grid-template-rows:165px 165px}.detail-grid{grid-template-columns:repeat(3,1fr)}.selection-bar{left:9px;right:9px;bottom:80px;transform:none;justify-content:space-between}.selection-bar .count{display:none}.modal{left:8px;right:8px;bottom:8px;top:auto;width:auto;transform:translateY(104%);border-radius:20px}.modal.show{transform:none}.upload-options{grid-template-columns:1fr}.viewer-meta{bottom:84px;white-space:nowrap}.toast{left:12px;right:12px;bottom:82px;text-align:center}}
|
||||
|
||||
/* Interaction-complete pages */
|
||||
.collection-toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:18px}.collection-toolbar .field{width:340px}.album-full-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:18px}.album-manual-head{display:grid;grid-template-columns:minmax(300px,.9fr) 1.1fr;gap:26px;align-items:center;background:#fff;border:1px solid var(--line);border-radius:24px;padding:18px}.album-manual-cover{aspect-ratio:4/3;border-radius:18px;overflow:hidden}.album-manual-copy{padding:12px 18px}.album-inline-back{padding-left:0;margin-bottom:18px}.album-manual-copy h1{font-size:40px;letter-spacing:-.045em;margin:10px 0 6px}.album-manual-copy p{color:var(--sub);font-size:13px;margin:0 0 22px}.album-tabs{margin-bottom:28px}.album-pane{display:none}.album-pane.active{display:block}.album-grid-toolbar{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}.album-grid-toolbar>div:first-child strong{font-size:14px}.album-grid-toolbar>div:first-child span{font-size:11px;color:var(--sub);margin-left:8px}.album-photo-grid.select-mode .viewable:after{content:'';position:absolute;left:8px;top:8px;width:22px;height:22px;border-radius:50%;background:#fff;border:1px solid rgba(0,0,0,.15)}.album-photo-grid .viewable{position:relative;cursor:pointer}
|
||||
.people-full-grid{display:grid;grid-template-columns:repeat(6,1fr);gap:18px}.people-full-grid article{text-align:center;cursor:pointer}.person-photo{aspect-ratio:1;border-radius:50%;display:grid;place-items:center;font-size:30px;font-weight:760;color:#45554b;margin-bottom:9px;background:linear-gradient(135deg,#cbd5ce,#ddd0bd)}.tone-a{background:linear-gradient(135deg,#cbd5ce,#ddd0bd)}.tone-b{background:linear-gradient(135deg,#dcc8b7,#c0c9ce)}.tone-c{background:linear-gradient(135deg,#c9c0d8,#ccdbcf)}.tone-d{background:linear-gradient(135deg,#d8cdb0,#c9bcae)}.tone-e{background:linear-gradient(135deg,#bad0cb,#d6c7bd)}.tone-f{background:linear-gradient(135deg,#c9cfd8,#d9c4cf)}.people-full-grid strong{display:block;font-size:14px}.people-full-grid span{display:block;font-size:11px;color:var(--sub);margin-top:3px}.person-detail-head{display:flex;align-items:center;gap:22px;background:#fff;border:1px solid var(--line);border-radius:22px;padding:22px}.big-person{width:116px;height:116px;flex:none;margin:0;font-size:38px}.person-detail-head h1{font-size:34px;letter-spacing:-.04em;margin:8px 0 4px}.person-detail-head p{font-size:12px;color:var(--sub);margin:0 0 13px}
|
||||
.places-layout{display:grid;grid-template-columns:1fr 320px;gap:14px}.places-big-map{height:620px;border-radius:22px;overflow:hidden;border:1px solid var(--line);background:#e7ebe7}.places-big-map iframe{width:100%;height:100%;border:0}.place-list{background:#fff;border:1px solid var(--line);border-radius:18px;overflow:hidden;height:max-content}.place-list button{width:100%;border:0;border-bottom:1px solid var(--line);background:#fff;padding:16px;display:flex;align-items:center;justify-content:space-between;text-align:left}.place-list button:last-child{border-bottom:0}.place-list strong{display:block;font-size:14px}.place-list small{display:block;font-size:11px;color:var(--sub);margin-top:3px}
|
||||
.settings-shell{display:grid;grid-template-columns:220px 1fr;gap:18px}.settings-nav{display:grid;gap:5px;height:max-content}.settings-nav button{height:42px;border:0;background:transparent;border-radius:11px;text-align:left;padding:0 12px;color:var(--sub)}.settings-nav button.active{background:#e6e7e2;color:var(--ink);font-weight:680}.settings-content{background:#fff;border:1px solid var(--line);border-radius:20px;padding:20px;min-height:430px}.settings-card{border:1px solid var(--line);border-radius:15px;padding:15px;margin-bottom:10px}.settings-card:last-child{margin-bottom:0}.settings-card-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.settings-card strong{font-size:14px}.settings-card p{font-size:12px;color:var(--sub);margin:5px 0 0;line-height:1.5}.device-row{display:grid;grid-template-columns:44px 1fr auto;gap:12px;align-items:center}.device-icon{width:44px;height:44px;border-radius:12px;background:var(--surface2);display:grid;place-items:center;font-weight:700}.toggle{width:42px;height:24px;border-radius:999px;background:#c9cbc6;position:relative;border:0;padding:0}.toggle:after{content:'';position:absolute;width:18px;height:18px;border-radius:50%;background:#fff;left:3px;top:3px;transition:.18s}.toggle.on{background:var(--accent)}.toggle.on:after{left:21px}.storage-meter{height:8px;border-radius:99px;background:#e6e7e2;overflow:hidden;margin-top:12px}.storage-meter span{display:block;height:100%;width:42%;background:var(--accent)}
|
||||
.form-label{display:grid;gap:7px;font-size:12px;font-weight:680;margin-bottom:15px}.text-input{height:44px;border:1px solid var(--line);border-radius:12px;padding:0 12px;font:inherit;outline:0}.text-input:focus{border-color:#aabaae;box-shadow:0 0 0 3px #e5eee8}.cover-picker{display:grid;grid-template-columns:repeat(4,1fr);gap:7px}.cover-picker button{border:2px solid transparent;padding:0;border-radius:12px;overflow:hidden;aspect-ratio:1;background:#ddd}.cover-picker button.active{border-color:var(--accent)}.check-row{display:flex;align-items:center;justify-content:space-between;gap:16px;border-top:1px solid var(--line);padding:14px 0}.check-row strong{display:block;font-size:13px}.check-row small{display:block;font-size:11px;color:var(--sub);margin-top:3px;font-weight:400}.check-row input{width:18px;height:18px;accent-color:var(--accent)}.modal-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:18px}.share-link{display:flex;gap:8px;align-items:center;background:var(--surface2);border-radius:12px;padding:10px}.share-link span{flex:1;font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.edit-options{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:10px}.settings-list>div{display:flex;align-items:center;justify-content:space-between;padding:13px 0;border-bottom:1px solid var(--line);font-size:13px}.settings-list>div:last-child{border-bottom:0}.settings-list span{color:var(--sub)}
|
||||
.memory-card,.person,.type-card,.year-row article,.place-card,.memory-item{transition:transform .18s,box-shadow .18s}.memory-card:hover,.place-card:hover,.memory-item:hover{transform:translateY(-2px)}.person:hover,.type-card:hover,.year-row article:hover{transform:translateY(-1px)}.type-card,.year-row article{cursor:pointer}
|
||||
@media(max-width:1050px){.album-full-grid{grid-template-columns:repeat(2,1fr)}.people-full-grid{grid-template-columns:repeat(4,1fr)}.places-layout{grid-template-columns:1fr}.place-list{display:grid;grid-template-columns:1fr 1fr}.place-list button:nth-child(odd){border-right:1px solid var(--line)}.settings-shell{grid-template-columns:180px 1fr}}
|
||||
@media(max-width:720px){.collection-toolbar{align-items:stretch;flex-direction:column}.collection-toolbar .field{width:100%}.album-full-grid{grid-template-columns:1fr 1fr;gap:12px 7px}.album-manual-head{grid-template-columns:1fr;border-radius:0;border-left:0;border-right:0;padding:13px}.album-manual-copy{padding:4px 5px 14px}.album-manual-copy h1{font-size:32px}.people-full-grid{grid-template-columns:repeat(3,1fr);gap:14px}.person-detail-head{border-radius:0;border-left:0;border-right:0}.big-person{width:92px;height:92px}.places-layout{grid-template-columns:1fr}.places-big-map{height:58vh;border-radius:0;margin-left:-13px;margin-right:-13px}.place-list{grid-template-columns:1fr}.place-list button:nth-child(odd){border-right:0}.settings-shell{grid-template-columns:1fr}.settings-nav{display:flex;overflow:auto}.settings-nav button{white-space:nowrap}.cover-picker{grid-template-columns:repeat(4,1fr)}.edit-options{grid-template-columns:1fr}}
|
||||
|
||||
.dense-library .media-grid{grid-template-columns:repeat(9,1fr);grid-auto-rows:78px}.dense-library .media-tile,.dense-library .media-tile.wide,.dense-library .media-tile.tall,.dense-library .media-tile.large{grid-column:span 1;grid-row:span 1}.album-photo-grid.select-mode .viewable.selected:after{content:'✓';position:absolute;inset:0;display:grid;place-items:center;background:rgba(73,99,86,.45);color:#fff;font-size:22px;font-weight:800}.album-photo-grid.select-mode .viewable{cursor:pointer}
|
||||
@media(max-width:720px){.dense-library .media-grid{grid-template-columns:repeat(4,1fr);grid-auto-rows:82px}}
|
||||
@@ -0,0 +1,353 @@
|
||||
const P=Array.from({length:11},(_,i)=>'./assets/photo-'+(i+1)+'.jpg');
|
||||
|
||||
const groups=[
|
||||
['9월 15일','오늘 · Galaxy에서 42개 동기화됨',0],
|
||||
['9월 13일','서울 · 24개 항목',4],
|
||||
['8월 29일','강릉 · 18개 항목',7]
|
||||
];
|
||||
const layout=['large','wide','tall','','wide','','tall','','','wide','',''];
|
||||
const memories=[
|
||||
['강릉에서 보낸 주말','1년 전 오늘 · 67개',P[1],67],
|
||||
['가평 드라이브','2025.10.03 · 41개',P[2],41],
|
||||
['서울의 겨울','2025.12 — 2026.02 · 123개',P[4],123],
|
||||
['처음 떠난 부산','2023.08.18 — 08.21 · 108개',P[7],108],
|
||||
['평범했던 봄','2025.03 — 05 · 96개',P[9],96],
|
||||
['산으로 간 날','2024.11.02 · 34개',P[10],34]
|
||||
];
|
||||
const albums=[
|
||||
['가족 사진','124개 · 최근 수정 9월 14일',P[5],124,false],
|
||||
['프로필 후보','48개 · 최근 수정 9월 10일',P[8],48,false],
|
||||
['2026 제주 베스트','36개 · 공유 중',P[0],36,true],
|
||||
['강아지','82개 · 최근 수정 8월 21일',P[10],82,false],
|
||||
['인테리어 참고','64개 · 최근 수정 8월 08일',P[4],64,false],
|
||||
['친구들과','91개 · 공유 중',P[2],91,true]
|
||||
];
|
||||
|
||||
function memoryCard(a,type){
|
||||
return '<article class="memory-item" '+(type==='Album'?'data-open-album':'data-open-memory')+'><div class="memory-cover"><img src="'+a[2]+'"><span class="badge item-type">'+type+'</span><span class="item-count">'+a[3]+'</span></div><div class="memory-info"><strong>'+a[0]+'</strong><span>'+a[1]+'</span></div></article>';
|
||||
}
|
||||
function albumCard(a){
|
||||
return '<article class="memory-item album-list-item" data-open-album data-shared="'+a[4]+'"><div class="memory-cover"><img src="'+a[2]+'"><span class="badge item-type">'+(a[4]?'공유 Album':'Album')+'</span><span class="item-count">'+a[3]+'</span></div><div class="memory-info"><strong>'+a[0]+'</strong><span>'+a[1]+'</span></div></article>';
|
||||
}
|
||||
|
||||
function buildInitialUI(){
|
||||
const today=document.getElementById('todayGrid');
|
||||
P.slice(0,7).forEach(u=>today.insertAdjacentHTML('beforeend','<div class="viewable"><img src="'+u+'"></div>'));
|
||||
|
||||
const lib=document.getElementById('libraryContent');
|
||||
groups.forEach((g,gi)=>{
|
||||
let html='<div class="month-head"><div class="left"><h3 class="h3">'+g[0]+'</h3><span>'+g[1]+'</span></div><button class="btn ghost" data-select-group="'+gi+'">전체 선택</button></div><div class="media-grid" data-group-grid="'+gi+'">';
|
||||
for(let i=0;i<12;i++){
|
||||
const cls=layout[(i+gi)%layout.length];
|
||||
const state=i===3?'<span class="media-pill">▶ 0:18</span>':i===6?'<span class="media-pill media-warning">중복 후보</span>':i===8?'<span class="media-pill">✓ 서버</span>':'';
|
||||
html+='<div class="media-tile '+cls+'" data-key="'+gi+'-'+i+'" data-group="'+gi+'"><img src="'+P[(g[2]+i)%P.length]+'"><span class="select-mark">✓</span><span class="media-state">'+state+'</span></div>';
|
||||
}
|
||||
html+='</div>';
|
||||
lib.insertAdjacentHTML('beforeend',html);
|
||||
});
|
||||
|
||||
memories.slice(0,4).forEach((a,i)=>document.getElementById('savedMemories').insertAdjacentHTML('beforeend',memoryCard(a,i===0?'Memory':'자동 Memory')));
|
||||
memories.slice(4).forEach(a=>document.getElementById('manualAlbums').insertAdjacentHTML('beforeend',memoryCard(a,'Album')));
|
||||
albums.forEach(a=>document.getElementById('albumsPageGrid').insertAdjacentHTML('beforeend',albumCard(a)));
|
||||
|
||||
['placePhotos','memoryPhotos','personPhotos','albumPhotos'].forEach((id,offset)=>{
|
||||
const el=document.getElementById(id);
|
||||
if(!el)return;
|
||||
for(let i=0;i<15;i++)el.insertAdjacentHTML('beforeend','<div class="viewable"><img src="'+P[(i+offset)%P.length]+'"></div>');
|
||||
});
|
||||
}
|
||||
buildInitialUI();
|
||||
|
||||
let lastPage='home';
|
||||
function showPage(name){
|
||||
if(!['memory','place','album','person'].includes(name))lastPage=name;
|
||||
document.querySelectorAll('.page').forEach(p=>p.classList.toggle('active',p.id==='page-'+name));
|
||||
document.querySelectorAll('[data-page]').forEach(b=>b.classList.toggle('active',b.dataset.page===name));
|
||||
window.scrollTo(0,0);
|
||||
}
|
||||
function updateMemoryDetail(card){
|
||||
if(!card)return;
|
||||
const title=card.querySelector('.memory-info strong,.memory-copy strong,h2')?.textContent?.trim();
|
||||
const img=card.querySelector('img')?.src;
|
||||
const meta=card.querySelector('.memory-info span,.memory-copy span')?.textContent?.trim();
|
||||
if(title)document.getElementById('memoryDetailTitle').textContent=title;
|
||||
if(img)document.getElementById('memoryDetailCover').src=img;
|
||||
if(meta)document.getElementById('memoryDetailMeta').textContent=meta+' · 자동 구성 Memory';
|
||||
}
|
||||
function updateAlbumDetail(card){
|
||||
if(!card)return;
|
||||
const title=card.querySelector('.memory-info strong')?.textContent?.trim()||'가족 사진';
|
||||
const img=card.querySelector('img')?.src;
|
||||
const meta=card.querySelector('.memory-info span')?.textContent?.trim()||'124개';
|
||||
document.getElementById('albumDetailTitle').textContent=title;
|
||||
document.getElementById('albumDetailMeta').textContent=meta;
|
||||
if(img)document.getElementById('albumDetailCover').src=img;
|
||||
}
|
||||
document.addEventListener('click',e=>{
|
||||
const nav=e.target.closest('[data-page]');
|
||||
if(nav){showPage(nav.dataset.page);return;}
|
||||
const memory=e.target.closest('[data-open-memory],.memory-card');
|
||||
if(memory){updateMemoryDetail(memory);showPage('memory');return;}
|
||||
const album=e.target.closest('[data-open-album]');
|
||||
if(album){updateAlbumDetail(album);showPage('album');return;}
|
||||
});
|
||||
document.querySelectorAll('[data-back]').forEach(b=>b.onclick=()=>showPage(lastPage));
|
||||
|
||||
/* overlays */
|
||||
const scrim=document.getElementById('scrim');
|
||||
const modals=[...document.querySelectorAll('.modal')];
|
||||
const drawer=document.getElementById('profileDrawer');
|
||||
function closeOverlay(){
|
||||
scrim.classList.remove('show');
|
||||
modals.forEach(m=>m.classList.remove('show'));
|
||||
drawer.classList.remove('show');
|
||||
}
|
||||
function openOverlay(el){
|
||||
closeOverlay();
|
||||
scrim.classList.add('show');
|
||||
el.classList.add('show');
|
||||
}
|
||||
function openUpload(){openOverlay(document.getElementById('uploadModal'))}
|
||||
function openProfile(){openOverlay(drawer)}
|
||||
document.querySelectorAll('[data-upload]').forEach(b=>b.onclick=openUpload);
|
||||
document.querySelectorAll('[data-profile]').forEach(b=>b.onclick=openProfile);
|
||||
document.querySelectorAll('[data-close]').forEach(b=>b.onclick=closeOverlay);
|
||||
scrim.onclick=closeOverlay;
|
||||
|
||||
/* upload */
|
||||
document.getElementById('fakeChoose').onclick=()=>{
|
||||
document.getElementById('uploadQueue').style.display='block';
|
||||
toast('선택한 파일 2개를 Queue에 추가했습니다.');
|
||||
};
|
||||
document.querySelector('[data-folder-upload]').onclick=()=>{
|
||||
document.getElementById('uploadQueue').style.display='block';
|
||||
toast('폴더에서 128개 항목을 찾았습니다.');
|
||||
};
|
||||
document.querySelector('[data-sync-settings]').onclick=()=>{
|
||||
closeOverlay();
|
||||
openSettings('backup-settings');
|
||||
};
|
||||
|
||||
/* library */
|
||||
const summary=document.getElementById('filterSummary');
|
||||
const filterText=document.getElementById('filterText');
|
||||
let currentFilter='';
|
||||
function setFilter(f,label){
|
||||
currentFilter=f;
|
||||
document.querySelectorAll('[data-filter]').forEach(b=>b.classList.toggle('active',b.dataset.filter===f));
|
||||
const m={
|
||||
date:(label||'2026년 9월')+' · 날짜 필터 적용 중',
|
||||
type:(label||'사진')+' · 미디어 유형 필터 적용 중',
|
||||
unorganized:'정리 안 됨 · 어떤 Memory나 Album에도 포함되지 않은 128장',
|
||||
duplicate:'중복 후보 · 시각적으로 유사한 사진 14장'
|
||||
};
|
||||
filterText.textContent=m[f]||'';
|
||||
summary.classList.toggle('show',!!f);
|
||||
document.querySelectorAll('.media-tile').forEach((tile,i)=>{
|
||||
const hide=f==='duplicate' ? i%6!==0 : f==='unorganized' ? i%4===0 : false;
|
||||
tile.style.display=hide?'none':'';
|
||||
});
|
||||
}
|
||||
document.querySelectorAll('[data-filter]').forEach(b=>b.onclick=()=>setFilter(b.dataset.filter));
|
||||
document.getElementById('clearFilter').onclick=()=>{setFilter('');document.querySelectorAll('.media-tile').forEach(t=>t.style.display='')};
|
||||
document.querySelector('[data-unorganized]').onclick=()=>{showPage('library');setFilter('unorganized')};
|
||||
document.querySelector('[data-duplicate]').onclick=()=>{showPage('library');setFilter('duplicate')};
|
||||
document.querySelectorAll('[data-view]').forEach(b=>b.onclick=()=>{
|
||||
document.querySelectorAll('[data-view]').forEach(x=>x.classList.toggle('active',x===b));
|
||||
document.getElementById('libraryContent').classList.toggle('dense-library',b.dataset.view==='dense');
|
||||
});
|
||||
const librarySearch=document.querySelector('#page-library .field input');
|
||||
librarySearch.addEventListener('keydown',e=>{if(e.key==='Enter'&&librarySearch.value.trim()){filterText.textContent='"'+librarySearch.value.trim()+'" 검색 결과 · 24개 항목';summary.classList.add('show')}});
|
||||
|
||||
let selected=new Set();
|
||||
const selBar=document.getElementById('selectionBar'),selCount=document.getElementById('selectionCount');
|
||||
function updateSelection(){selBar.classList.toggle('show',selected.size>0);selCount.textContent=selected.size+'개 선택'}
|
||||
document.querySelectorAll('.media-tile').forEach(t=>t.onclick=()=>{
|
||||
const k=t.dataset.key;
|
||||
if(selected.has(k)){selected.delete(k);t.classList.remove('selected')}else{selected.add(k);t.classList.add('selected')}
|
||||
updateSelection();
|
||||
});
|
||||
document.querySelectorAll('[data-select-group]').forEach(b=>b.onclick=()=>{
|
||||
const gi=b.dataset.selectGroup;
|
||||
const tiles=[...document.querySelectorAll('.media-tile[data-group="'+gi+'"]')].filter(t=>t.style.display!=='none');
|
||||
const all=tiles.every(t=>selected.has(t.dataset.key));
|
||||
tiles.forEach(t=>{if(all){selected.delete(t.dataset.key);t.classList.remove('selected')}else{selected.add(t.dataset.key);t.classList.add('selected')}});
|
||||
b.textContent=all?'전체 선택':'선택 해제';
|
||||
updateSelection();
|
||||
});
|
||||
document.getElementById('clearSelection').onclick=()=>{
|
||||
selected.clear();document.querySelectorAll('.media-tile.selected').forEach(t=>t.classList.remove('selected'));updateSelection();
|
||||
};
|
||||
document.querySelectorAll('.selection-bar button:not(#clearSelection)').forEach(b=>b.onclick=()=>toast(b.textContent+' · '+selected.size+'개 항목 처리 준비'));
|
||||
|
||||
/* memories + albums */
|
||||
document.getElementById('saveSuggested').onclick=e=>saveMemoryButton(e.currentTarget);
|
||||
document.querySelectorAll('[data-save-memory]').forEach(b=>b.onclick=e=>saveMemoryButton(e.currentTarget));
|
||||
function saveMemoryButton(btn){btn.textContent='보관됨 ✓';btn.disabled=true;toast('Memory에 보관했습니다.')}
|
||||
document.querySelector('[data-sort-memories]').onclick=e=>{
|
||||
const b=e.currentTarget;
|
||||
b.dataset.sort=b.dataset.sort==='date'?'recent':'date';
|
||||
b.textContent=b.dataset.sort==='date'?'정렬: 촬영일 순':'정렬: 최근 본 순';
|
||||
toast(b.textContent+'으로 변경했습니다.');
|
||||
};
|
||||
document.querySelectorAll('[data-create-album]').forEach(b=>b.onclick=()=>openOverlay(document.getElementById('createAlbumModal')));
|
||||
document.querySelectorAll('.cover-picker button').forEach(b=>b.onclick=()=>{document.querySelectorAll('.cover-picker button').forEach(x=>x.classList.toggle('active',x===b))});
|
||||
document.getElementById('confirmCreateAlbum').onclick=()=>{
|
||||
const name=document.getElementById('newAlbumName').value.trim()||'새로운 Album';
|
||||
const a=[name,'0개 · 방금 생성',P[5],0,false];
|
||||
document.getElementById('albumsPageGrid').insertAdjacentHTML('afterbegin',albumCard(a));
|
||||
document.getElementById('manualAlbums').insertAdjacentHTML('afterbegin',memoryCard(a,'Album'));
|
||||
closeOverlay();showPage('albums');toast(name+' Album을 만들었습니다.');
|
||||
};
|
||||
document.querySelectorAll('[data-album-filter]').forEach(b=>b.onclick=()=>{
|
||||
document.querySelectorAll('[data-album-filter]').forEach(x=>x.classList.toggle('active',x===b));
|
||||
document.querySelectorAll('#albumsPageGrid .album-list-item').forEach(card=>card.style.display=b.dataset.albumFilter==='shared'&&card.dataset.shared!=='true'?'none':'');
|
||||
});
|
||||
document.querySelector('[data-album-sort]').onclick=e=>{
|
||||
const grid=document.getElementById('albumsPageGrid');
|
||||
[...grid.children].reverse().forEach(c=>grid.appendChild(c));
|
||||
e.currentTarget.textContent=e.currentTarget.textContent==='최근 수정순'?'이름순':'최근 수정순';
|
||||
};
|
||||
document.getElementById('albumSearch').addEventListener('input',e=>{
|
||||
const q=e.target.value.trim().toLowerCase();
|
||||
document.querySelectorAll('#albumsPageGrid .album-list-item').forEach(card=>card.style.display=card.textContent.toLowerCase().includes(q)?'':'none');
|
||||
});
|
||||
|
||||
/* album detail */
|
||||
document.querySelectorAll('[data-album-tab]').forEach(b=>b.onclick=()=>{
|
||||
document.querySelectorAll('[data-album-tab]').forEach(x=>x.classList.toggle('active',x===b));
|
||||
document.querySelectorAll('.album-pane').forEach(p=>p.classList.remove('active'));
|
||||
document.getElementById(b.dataset.albumTab==='grid'?'albumGridPane':b.dataset.albumTab==='story'?'albumStoryPane':'albumInfoPane').classList.add('active');
|
||||
});
|
||||
document.querySelector('[data-album-order]').onclick=e=>{
|
||||
e.currentTarget.textContent=e.currentTarget.textContent==='직접 설정'?'촬영일 순':'직접 설정';
|
||||
toast('Album 정렬 방식을 '+e.currentTarget.textContent+'으로 변경했습니다.');
|
||||
};
|
||||
document.querySelector('[data-album-select]').onclick=e=>{
|
||||
const grid=document.getElementById('albumPhotos');
|
||||
grid.classList.toggle('select-mode');
|
||||
if(!grid.classList.contains('select-mode')) grid.querySelectorAll('.selected').forEach(x=>x.classList.remove('selected'));
|
||||
e.currentTarget.textContent=grid.classList.contains('select-mode')?'선택 종료':'선택';
|
||||
};
|
||||
document.getElementById('albumPhotos').addEventListener('click',e=>{
|
||||
const item=e.target.closest('.viewable');
|
||||
if(item && document.getElementById('albumPhotos').classList.contains('select-mode')){
|
||||
e.stopPropagation(); item.classList.toggle('selected');
|
||||
}
|
||||
},true);
|
||||
document.querySelector('[data-add-album-photos]').onclick=openUpload;
|
||||
document.querySelector('[data-edit-album]').onclick=()=>openAction('Album 편집','이름과 커버를 변경합니다.','<label class="form-label">Album 이름<input class="text-input" value="가족 사진"></label><label class="form-label">설명<input class="text-input" value="가족과 함께 찍은 사진"></label>','저장',()=>toast('Album 정보를 저장했습니다.'));
|
||||
document.querySelector('[data-album-more]').onclick=()=>openAction('Album 관리','이 Album에 적용할 작업을 선택합니다.','<div class="settings-list"><div><span>커버 사진 변경</span><strong>›</strong></div><div><span>Album 복제</span><strong>›</strong></div><div><span>사진만 제거</span><strong>›</strong></div><div><span style="color:#a34b42">Album 삭제</span><strong>›</strong></div></div>','완료',()=>toast('Album 관리 설정을 반영했습니다.'));
|
||||
|
||||
/* search */
|
||||
const bigSearch=document.querySelector('.big-search input');
|
||||
document.querySelectorAll('[data-search-term]').forEach(b=>b.onclick=()=>{
|
||||
bigSearch.value=b.dataset.searchTerm;
|
||||
if(b.dataset.searchTerm==='제주')openPlace('제주도');else if(b.dataset.searchTerm==='동영상'){showPage('library');setFilter('type','동영상')}else{showPage('library');setFilter('date',b.dataset.searchTerm)}
|
||||
});
|
||||
bigSearch.addEventListener('keydown',e=>{if(e.key==='Enter'&&bigSearch.value.trim()){showPage('library');filterText.textContent='"'+bigSearch.value.trim()+'" 검색 결과';summary.classList.add('show')}});
|
||||
|
||||
const people={나:['나','842장의 사진 · 18개의 Memory'],가족:['가','381장의 사진 · 12개의 Memory'],친구:['친','264장의 사진 · 8개의 Memory']};
|
||||
document.querySelectorAll('[data-person]').forEach(el=>el.onclick=()=>openPerson(el.dataset.person));
|
||||
function openPerson(name){
|
||||
const d=people[name]||[name[0]||'?','사진 모음'];
|
||||
document.getElementById('personTitle').textContent=name;
|
||||
document.getElementById('personInitial').textContent=d[0];
|
||||
document.getElementById('personMeta').textContent=d[1];
|
||||
showPage('person');
|
||||
}
|
||||
document.querySelectorAll('[data-name-person]').forEach(b=>b.onclick=()=>openAction('사람 이름 지정','이 얼굴 그룹에 이름을 붙입니다.','<label class="form-label">이름<input class="text-input" placeholder="이름 입력"></label>','저장',()=>toast('사람 이름을 저장했습니다.')));
|
||||
document.querySelector('[data-rename-person]').onclick=()=>openAction('이름 변경','이 사람의 표시 이름을 변경합니다.','<label class="form-label">이름<input class="text-input" value="'+document.getElementById('personTitle').textContent+'"></label>','저장',()=>toast('이름을 변경했습니다.'));
|
||||
document.querySelector('[data-person-sort]').onclick=e=>{e.currentTarget.textContent=e.currentTarget.textContent==='최신순'?'오래된 순':'최신순'};
|
||||
|
||||
const placeData={
|
||||
제주도:{count:'168',bbox:'126.13%2C33.15%2C126.95%2C33.58'},
|
||||
서울:{count:'624',bbox:'126.76%2C37.42%2C127.18%2C37.70'},
|
||||
강릉:{count:'91',bbox:'128.78%2C37.65%2C129.12%2C37.86'},
|
||||
부산:{count:'108',bbox:'128.85%2C35.02%2C129.30%2C35.30'}
|
||||
};
|
||||
function openPlace(name){
|
||||
const d=placeData[name]||placeData['제주도'];
|
||||
document.getElementById('placeTitle').textContent=name;
|
||||
document.getElementById('placeDesc').textContent='GPS 메타데이터가 '+name+'로 분류된 '+d.count+'장의 사진과 영상 · 사진이 추가되면 자동으로 갱신됩니다.';
|
||||
document.getElementById('placeAllTitle').textContent=name+'에서 찍은 모든 사진';
|
||||
const pr=document.getElementById('placeRecordTitle'); if(pr) pr.textContent=name==='제주도'?'제주, 여름의 끝':name+'에서의 기록';
|
||||
document.getElementById('placeMap').src='https://www.openstreetmap.org/export/embed.html?bbox='+d.bbox+'&layer=mapnik';
|
||||
showPage('place');
|
||||
}
|
||||
document.querySelectorAll('[data-place-name]').forEach(el=>el.onclick=()=>openPlace(el.dataset.placeName));
|
||||
document.querySelectorAll('[data-media-type]').forEach(el=>el.onclick=()=>{showPage('library');setFilter('type',el.dataset.mediaType)});
|
||||
document.querySelectorAll('[data-year]').forEach(el=>el.onclick=()=>{showPage('library');setFilter('date',el.dataset.year)});
|
||||
document.querySelector('[data-place-sort]').onclick=e=>{e.currentTarget.textContent=e.currentTarget.textContent==='최신순'?'오래된 순':'최신순'};
|
||||
|
||||
/* viewer */
|
||||
const viewer=document.getElementById('viewer'),viewerImage=document.getElementById('viewerImage');
|
||||
document.addEventListener('click',e=>{
|
||||
const v=e.target.closest('.viewable');
|
||||
if(v && !v.closest('.album-photo-grid.select-mode')){
|
||||
viewerImage.src=v.querySelector('img').src;viewer.classList.add('show');
|
||||
}
|
||||
});
|
||||
document.getElementById('viewerClose').onclick=()=>viewer.classList.remove('show');
|
||||
viewer.onclick=e=>{if(e.target===viewer)viewer.classList.remove('show')};
|
||||
|
||||
/* memory detail */
|
||||
document.querySelectorAll('[data-detail-tab]').forEach(b=>b.onclick=()=>{
|
||||
document.querySelectorAll('[data-detail-tab]').forEach(x=>x.classList.toggle('active',x===b));
|
||||
document.getElementById('storyPane').classList.toggle('hidden',b.dataset.detailTab!=='story');
|
||||
document.getElementById('allPhotos').classList.toggle('active',b.dataset.detailTab==='photos');
|
||||
document.getElementById('infoPane').classList.toggle('active',b.dataset.detailTab==='info');
|
||||
});
|
||||
document.querySelectorAll('[data-share]').forEach(b=>b.onclick=()=>openOverlay(document.getElementById('shareModal')));
|
||||
document.querySelector('[data-edit-memory]').onclick=()=>openOverlay(document.getElementById('editMemoryModal'));
|
||||
document.getElementById('copyShare').onclick=async()=>{try{await navigator.clipboard.writeText('https://gpt.hyeonworks.com/s/mem-7F2A')}catch{}toast('공유 링크를 복사했습니다.')};
|
||||
document.getElementById('applyShare').onclick=()=>{closeOverlay();toast('공유 설정을 저장했습니다.')};
|
||||
document.getElementById('saveMemoryEdit').onclick=()=>{closeOverlay();toast('Memory 편집 내용을 저장했습니다.')};
|
||||
|
||||
/* settings/profile */
|
||||
const settingsContent=document.getElementById('settingsContent');
|
||||
const settingsTitle=document.getElementById('settingsTitle');
|
||||
const settingsTemplates={
|
||||
devices:['동기화된 기기','<div class="settings-card device-row"><div class="device-icon">📱</div><div><strong>Galaxy S24</strong><p>2분 전 동기화 · Android · 사진 2,118개</p></div><span class="badge accent">현재 기기</span></div><div class="settings-card device-row"><div class="device-icon">💻</div><div><strong>Galaxy Book</strong><p>어제 23:18 · Web · 최근 업로드 312개</p></div><button class="btn ghost" data-toast="기기 연결을 해제했습니다.">연결 해제</button></div>'],
|
||||
'backup-settings':['모바일 백업','<div class="settings-card"><div class="settings-card-head"><div><strong>자동 백업</strong><p>새 사진과 영상을 서버에 자동 업로드합니다.</p></div><button class="toggle on" data-toggle></button></div></div><div class="settings-card"><div class="settings-card-head"><div><strong>Wi‑Fi에서만 백업</strong><p>모바일 데이터 사용을 막습니다.</p></div><button class="toggle on" data-toggle></button></div></div><div class="settings-card"><div class="settings-card-head"><div><strong>동영상 자동 백업</strong><p>원본 동영상도 백업 대상에 포함합니다.</p></div><button class="toggle on" data-toggle></button></div></div>'],
|
||||
storage:['저장소 및 백업','<div class="settings-card"><strong>1 TB 저장소</strong><p>428 GB 사용 · 572 GB 남음</p><div class="storage-meter"><span></span></div></div><div class="settings-card"><div class="settings-card-head"><div><strong>DB 백업</strong><p>오늘 03:00 · 성공 · 184 MB</p></div><span class="badge accent">정상</span></div></div><div class="settings-card"><div class="settings-card-head"><div><strong>원본 무결성 검사</strong><p>마지막 검사 9월 14일 · 문제 없음</p></div><button class="btn" data-toast="무결성 검사를 시작했습니다.">지금 검사</button></div></div>'],
|
||||
account:['계정 설정','<div class="settings-card"><strong>Keycloak 계정</strong><p>donghyeon · 이메일 인증 완료</p><button class="btn" style="margin-top:12px" data-toast="Keycloak 계정 관리 페이지로 이동하는 Mock입니다.">계정 관리</button></div><div class="settings-card"><div class="settings-card-head"><div><strong>세션</strong><p>현재 로그인된 브라우저 2개</p></div><button class="btn" data-toast="다른 세션을 로그아웃했습니다.">다른 세션 로그아웃</button></div></div>']
|
||||
};
|
||||
function openSettings(kind){
|
||||
closeOverlay();
|
||||
const [title,html]=settingsTemplates[kind]||settingsTemplates.devices;
|
||||
settingsTitle.textContent=title;
|
||||
settingsContent.innerHTML=html;
|
||||
document.querySelectorAll('[data-settings]').forEach(b=>b.classList.toggle('active',b.dataset.settings===kind));
|
||||
showPage('settings');
|
||||
bindDynamicActions();
|
||||
}
|
||||
document.querySelectorAll('[data-profile-page]').forEach(b=>b.onclick=()=>openSettings(b.dataset.profilePage));
|
||||
document.querySelectorAll('[data-settings]').forEach(b=>b.onclick=()=>openSettings(b.dataset.settings));
|
||||
document.querySelector('[data-logout]').onclick=()=>openAction('로그아웃','현재 Memento 세션에서 로그아웃합니다.','<p class="body muted">Keycloak 세션 정책에 따라 SSO 세션도 함께 종료할 수 있습니다.</p>','로그아웃',()=>{location.href='./login-v2.html'});
|
||||
|
||||
/* generic action modal */
|
||||
let actionCallback=null;
|
||||
function openAction(title,subtitle,body,confirmLabel,callback){
|
||||
document.getElementById('actionTitle').textContent=title;
|
||||
document.getElementById('actionSubtitle').textContent=subtitle||'';
|
||||
document.getElementById('actionBody').innerHTML=body||'';
|
||||
document.getElementById('actionConfirm').textContent=confirmLabel||'확인';
|
||||
actionCallback=callback||null;
|
||||
openOverlay(document.getElementById('actionModal'));
|
||||
}
|
||||
document.getElementById('actionConfirm').onclick=()=>{const cb=actionCallback;closeOverlay();if(cb)cb()};
|
||||
function bindDynamicActions(){
|
||||
document.querySelectorAll('#settingsContent [data-toast]').forEach(b=>b.onclick=()=>toast(b.dataset.toast));
|
||||
document.querySelectorAll('#settingsContent [data-toggle]').forEach(b=>b.onclick=()=>b.classList.toggle('on'));
|
||||
}
|
||||
document.querySelectorAll('[data-toast]').forEach(b=>b.onclick=()=>toast(b.dataset.toast));
|
||||
|
||||
function toast(msg){
|
||||
const t=document.getElementById('toast');t.textContent=msg;t.classList.add('show');
|
||||
clearTimeout(window.__tt);window.__tt=setTimeout(()=>t.classList.remove('show'),1900);
|
||||
}
|
||||
|
||||
const requestedPage=new URLSearchParams(location.search).get('page');
|
||||
if(requestedPage==='settings')openSettings('devices');
|
||||
else if(requestedPage&&document.getElementById('page-'+requestedPage))showPage(requestedPage);
|
||||
@@ -12,7 +12,7 @@
|
||||
"CAPABILITY_OVERRIDES": {
|
||||
"REALTIME": "DEFAULT",
|
||||
"WEB_WORKER": "DEFAULT",
|
||||
"SERVICE_WORKER": "DEFAULT",
|
||||
"SERVICE_WORKER": "DISABLED",
|
||||
"OFFLINE_COMMANDS": "DEFAULT"
|
||||
},
|
||||
"FEATURE_OVERRIDES": {
|
||||
|
||||
|
After Width: | Height: | Size: 9.5 KiB |
|
After Width: | Height: | Size: 28 KiB |
@@ -0,0 +1 @@
|
||||
<!doctype html><html lang="ko"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="theme-color" content="#f4f4f1"><title>Memento 로그인</title><style>@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.css');:root{--bg:#f4f4f1;--ink:#171816;--sub:#6d7069;--line:#dddeda;--accent:#496356;--accent2:#dfe9e2}*{box-sizing:border-box}body{margin:0;font-family:'Pretendard Variable',Pretendard,-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;background:var(--bg);color:var(--ink);letter-spacing:-.012em}.shell{min-height:100vh;display:grid;grid-template-columns:1.1fr .9fr}.visual{position:relative;overflow:hidden;background:#1d211e}.collage{position:absolute;inset:0;display:grid;grid-template-columns:1.45fr .8fr;grid-template-rows:1fr 1fr;gap:3px}.collage div:first-child{grid-row:1/3}.collage img{width:100%;height:100%;object-fit:cover;display:block}.visual:after{content:'';position:absolute;inset:0;background:linear-gradient(180deg,rgba(0,0,0,.05),rgba(0,0,0,.68))}.visual-copy{position:absolute;left:42px;right:42px;bottom:40px;z-index:2;color:#fff}.visual-copy .badge{display:inline-flex;height:26px;align-items:center;padding:0 10px;border-radius:999px;background:rgba(255,255,255,.16);font-size:11px;font-weight:680}.visual-copy h1{font-size:44px;line-height:1.06;letter-spacing:-.05em;margin:12px 0 9px}.visual-copy p{font-size:14px;line-height:1.6;color:rgba(255,255,255,.8);max-width:520px;margin:0}.panel{display:flex;align-items:center;justify-content:center;padding:42px}.card{width:min(390px,100%)}.brand{display:flex;align-items:center;gap:10px;font-weight:780;font-size:20px;margin-bottom:42px}.brand-mark{width:29px;height:29px;border-radius:10px;background:var(--ink);position:relative}.brand-mark:after{content:'';position:absolute;inset:7px;border:2px solid #fff;border-radius:50%}.status{display:inline-flex;align-items:center;gap:7px;font-size:11px;color:#2f4c3d;background:var(--accent2);border-radius:999px;padding:6px 9px;margin-bottom:13px}.status:before{content:'';width:7px;height:7px;border-radius:50%;background:#5e8b6c}.card h2{font-size:30px;letter-spacing:-.04em;margin:0 0 8px}.sub{font-size:14px;line-height:1.55;color:var(--sub);margin:0}.actions{display:grid;gap:9px;margin-top:26px}.btn{height:47px;border:1px solid var(--line);border-radius:12px;background:#fff;font:inherit;font-size:13px;font-weight:680;cursor:pointer}.btn.primary{background:var(--ink);border-color:var(--ink);color:#fff}.divider{display:flex;align-items:center;gap:10px;color:#999c96;font-size:11px;margin:18px 0}.divider:before,.divider:after{content:'';height:1px;background:var(--line);flex:1}.note{font-size:12px;line-height:1.55;color:var(--sub);padding:13px;background:#ecece7;border-radius:12px}.back{display:inline-block;margin-top:18px;color:var(--sub);font-size:12px;text-decoration:none}@media(max-width:760px){.shell{grid-template-columns:1fr}.visual{display:none}.panel{padding:28px 20px}.card{width:100%}.brand{margin-bottom:54px}}</style></head><body><main class="shell"><section class="visual"><div class="collage"><div><img src="./assets/photo-1.jpg"></div><div><img src="./assets/photo-7.jpg"></div><div><img src="./assets/photo-8.jpg"></div></div><div class="visual-copy"><span class="badge">Private Living Archive</span><h1>사진을 저장하는 데서 끝내지 않습니다.</h1><p>내 서버에 원본을 보관하고, 새로 들어온 사진을 시간과 장소의 흐름으로 정리해 다시 보고 싶은 Memory로 만듭니다.</p></div></section><section class="panel"><div class="card"><div class="brand"><span class="brand-mark"></span>Memento</div><div class="status">개인 저장소 연결 준비됨</div><h2>사진 보관함에 로그인</h2><p class="sub">계정과 인증은 Keycloak이 담당합니다. Memento는 비밀번호를 직접 저장하지 않습니다.</p><div class="actions"><button class="btn primary" onclick="location.href='./'">Keycloak로 계속</button><button class="btn" onclick="location.href='./register-v2.html'">새 계정 만들기</button></div><div class="divider">또는</div><div class="note">실제 구현에서는 이 화면에서 Keycloak Authorization Code Flow로 이동합니다. 회원가입은 Self Registration / Invite / 관리자 승인 정책 중 하나로 제한할 수 있습니다.</div><a class="back" href="./">← 프로토타입으로 돌아가기</a></div></section></main></body></html>
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "Memento",
|
||||
"short_name": "Memento",
|
||||
"description": "개인 사진과 영상을 기억 단위로 정리하는 Memento",
|
||||
"start_url": "/",
|
||||
"scope": "/",
|
||||
"display": "standalone",
|
||||
"background_color": "#f4f4f1",
|
||||
"theme_color": "#171816",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/icons/memento-192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png",
|
||||
"purpose": "any maskable"
|
||||
},
|
||||
{
|
||||
"src": "/icons/memento-512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png",
|
||||
"purpose": "any maskable"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<!doctype html><html lang="ko"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="theme-color" content="#f4f4f1"><title>Memento 회원가입</title><style>@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.css');:root{--bg:#f4f4f1;--ink:#171816;--sub:#6d7069;--line:#dddeda;--accent:#496356;--accent2:#dfe9e2}*{box-sizing:border-box}body{margin:0;font-family:'Pretendard Variable',Pretendard,-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;background:var(--bg);color:var(--ink);letter-spacing:-.012em}.shell{min-height:100vh;display:grid;grid-template-columns:1.05fr .95fr}.visual{position:relative;overflow:hidden;background:#1d211e}.collage{position:absolute;inset:0;display:grid;grid-template-columns:1.4fr .85fr;grid-template-rows:1fr 1fr;gap:3px}.collage div:first-child{grid-row:1/3}.collage img{width:100%;height:100%;object-fit:cover;display:block}.visual:after{content:'';position:absolute;inset:0;background:linear-gradient(180deg,rgba(0,0,0,.05),rgba(0,0,0,.68))}.visual-copy{position:absolute;left:42px;right:42px;bottom:40px;z-index:2;color:#fff}.visual-copy h1{font-size:42px;line-height:1.06;letter-spacing:-.05em;margin:12px 0 9px}.visual-copy p{font-size:14px;line-height:1.6;color:rgba(255,255,255,.8);max-width:520px}.panel{display:flex;align-items:center;justify-content:center;padding:42px}.card{width:min(430px,100%)}.brand{display:flex;align-items:center;gap:10px;font-weight:780;font-size:20px;margin-bottom:34px}.brand-mark{width:29px;height:29px;border-radius:10px;background:var(--ink);position:relative}.brand-mark:after{content:'';position:absolute;inset:7px;border:2px solid #fff;border-radius:50%}.card h2{font-size:30px;letter-spacing:-.04em;margin:0 0 8px}.sub{font-size:13px;line-height:1.55;color:var(--sub);margin:0 0 22px}.form{display:grid;gap:13px}.field{display:grid;gap:6px;font-size:12px;font-weight:680}.field input{height:45px;border:1px solid var(--line);border-radius:12px;background:#fff;padding:0 12px;font:inherit;outline:0}.field input:focus{border-color:#aabaae;box-shadow:0 0 0 3px #e5eee8}.btn{height:47px;border:1px solid var(--line);border-radius:12px;background:#fff;font:inherit;font-size:13px;font-weight:680;cursor:pointer}.btn.primary{background:var(--ink);border-color:var(--ink);color:#fff}.note{font-size:11px;line-height:1.55;color:var(--sub);margin-top:14px}.back{display:inline-block;margin-top:18px;color:var(--sub);font-size:12px;text-decoration:none}.success{display:none;padding:16px;border-radius:14px;background:var(--accent2);color:#2f4c3d;margin-top:16px;font-size:13px}@media(max-width:760px){.shell{grid-template-columns:1fr}.visual{display:none}.panel{padding:28px 20px}.card{width:100%}}</style></head><body><main class="shell"><section class="visual"><div class="collage"><div><img src="./assets/photo-1.jpg"></div><div><img src="./assets/photo-7.jpg"></div><div><img src="./assets/photo-8.jpg"></div></div><div class="visual-copy"><h1>내 사진을 맡길<br>개인 보관함을 만듭니다.</h1><p>실제 서비스에서는 회원가입 정보가 Keycloak에 저장되고, Memento는 인증 결과만 사용합니다.</p></div></section><section class="panel"><div class="card"><div class="brand"><span class="brand-mark"></span>Memento</div><h2>새 계정 만들기</h2><p class="sub">현재는 Keycloak Self Registration을 가정한 UI Mock입니다.</p><form class="form" id="registerForm"><label class="field">이름<input required value="동현"></label><label class="field">이메일<input type="email" required placeholder="name@example.com"></label><label class="field">비밀번호<input type="password" required placeholder="8자 이상"></label><label class="field">비밀번호 확인<input type="password" required placeholder="다시 입력"></label><button class="btn primary" type="submit">계정 만들기</button></form><div class="success" id="success">가입 요청을 만들었습니다. 실제 구현에서는 Keycloak 등록 완료 후 로그인 흐름으로 이동합니다.</div><p class="note">초기 개인용 배포에서는 공개 가입을 끄고 Invite 또는 관리자 승인 방식으로 제한할 수 있습니다.</p><a class="back" href="./login-v2.html">← 로그인으로 돌아가기</a></div></section></main><script>document.getElementById('registerForm').addEventListener('submit',e=>{e.preventDefault();document.getElementById('success').style.display='block';e.target.querySelector('button').textContent='가입 요청 완료 ✓';e.target.querySelector('button').disabled=true});</script></body></html>
|
||||
@@ -19,8 +19,9 @@ import {
|
||||
* §17.2.2 step 4. Scans the completed app `dist` and emits the exact hashed
|
||||
* asset list the Service Worker will verify at install time.
|
||||
*
|
||||
* `service-worker.js` itself and `index.html` are excluded (§17.2.2), as are
|
||||
* the runtime config and release manifest, which are network-only (§18.4).
|
||||
* `service-worker.js`, runtime config and release manifest are excluded.
|
||||
* Memento explicitly includes its approved static index shell below so a
|
||||
* verified read-only shell can be served when navigation is offline.
|
||||
*/
|
||||
|
||||
const OUTPUT = ".generated/frontend-runtime/service-worker-assets.ts";
|
||||
@@ -30,14 +31,26 @@ const OUTPUT = ".generated/frontend-runtime/service-worker-assets.ts";
|
||||
const CACHEABLE_EXTENSIONS = CACHEABLE_ASSET_CONTENT_TYPES;
|
||||
|
||||
const EXCLUDED_FILES: ReadonlySet<string> = new Set([
|
||||
"index.html",
|
||||
SERVICE_WORKER_SCRIPT_PATH,
|
||||
"config.json",
|
||||
"release-manifest.json",
|
||||
"runtime-config.schema.json",
|
||||
]);
|
||||
|
||||
/** Vite emits content-hashed names; only those may be treated as immutable. */
|
||||
/**
|
||||
* Memento's visible Beta shell is intentionally copied byte-for-byte from the
|
||||
* approved design prototype. These stable URLs are still safe to pre-cache:
|
||||
* every row is digest-verified during install and lives in a release-specific
|
||||
* cache. API responses and private originals are never added here.
|
||||
*/
|
||||
const MEMENTO_SHELL_FILES: ReadonlySet<string> = new Set([
|
||||
"index.html",
|
||||
"beta.css",
|
||||
"beta.js",
|
||||
...Array.from({ length: 11 }, (_, index) => `assets/photo-${index + 1}.jpg`),
|
||||
]);
|
||||
|
||||
/** Vite emits content-hashed names; product shell files are the explicit exception. */
|
||||
const HASHED_NAME = /-[A-Za-z0-9_-]{8,}\.[a-z0-9]+$/;
|
||||
|
||||
export async function collectStaticAssets(
|
||||
@@ -52,7 +65,8 @@ export async function collectStaticAssets(
|
||||
const base = path.basename(relative);
|
||||
if (EXCLUDED_FILES.has(base) || relative.startsWith(".vite/")) continue;
|
||||
const contentType = CACHEABLE_EXTENSIONS[path.extname(base).toLowerCase()];
|
||||
if (!contentType || !HASHED_NAME.test(base)) continue;
|
||||
const isProductShell = MEMENTO_SHELL_FILES.has(relative.split(path.sep).join("/"));
|
||||
if (!contentType || (!HASHED_NAME.test(base) && !isProductShell)) continue;
|
||||
|
||||
const absolute = path.join(distDirectory, relative);
|
||||
const bytes = await readFile(absolute);
|
||||
|
||||
@@ -117,6 +117,14 @@ export function createServiceWorkerRuntime(
|
||||
: [],
|
||||
),
|
||||
);
|
||||
const navigationShellUrl =
|
||||
[...manifestUrls].find((url) => {
|
||||
try {
|
||||
return new URL(url).pathname.endsWith("/index.html");
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}) ?? null;
|
||||
const consumedNonces = new Set<string>();
|
||||
type PendingActivation = Readonly<{
|
||||
requesterBuildId: string;
|
||||
@@ -207,6 +215,36 @@ export function createServiceWorkerRuntime(
|
||||
async function onFetch(
|
||||
request: Readonly<{ method: string; url: string; mode?: string }>,
|
||||
): Promise<Response | null> {
|
||||
/**
|
||||
* Memento PWA is online-first. A navigation always attempts the network,
|
||||
* but if the browser is actually offline the exact, digest-verified
|
||||
* index.html from the current release cache becomes the read-only shell.
|
||||
* API calls never enter this branch and remain network-only/passthrough.
|
||||
*/
|
||||
if (
|
||||
request.method === "GET" &&
|
||||
request.mode === "navigate" &&
|
||||
staticEnabled &&
|
||||
config.manifest &&
|
||||
navigationShellUrl
|
||||
) {
|
||||
try {
|
||||
return await scope.fetcher(request.url);
|
||||
} catch {
|
||||
const currentCacheName = staticCacheName(config.manifest.setDigest);
|
||||
try {
|
||||
const currentCache = await scope.caches.open(currentCacheName);
|
||||
const cached = await currentCache.match(navigationShellUrl);
|
||||
if (cached?.status === 200 && cached.type !== "opaque") {
|
||||
return cached;
|
||||
}
|
||||
} catch {
|
||||
// The entry point will perform the normal network fallback.
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
const classification = classifyFetch({
|
||||
method: request.method,
|
||||
requestUrl: request.url,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { resolveRuntimeCapabilities } from "../contracts/runtime-capabilities.ts";
|
||||
import { INSTALLED_RUNTIME_CAPABILITIES } from "../features/installed-runtime-capabilities.ts";
|
||||
import { createMementoGateway } from "../features/memento-web/adapters/create-memento-gateway.ts";
|
||||
import { createCompositionRoot } from "./composition-root.ts";
|
||||
import { loadReleaseManifest } from "./load-release-manifest.ts";
|
||||
import { loadRuntimeConfig } from "./load-runtime-config.ts";
|
||||
@@ -53,10 +54,13 @@ export async function createRuntimeComposition(
|
||||
: {}),
|
||||
});
|
||||
|
||||
const mementoGateway = createMementoGateway(root.config.config);
|
||||
|
||||
return Object.freeze({
|
||||
...root,
|
||||
capabilities,
|
||||
optional,
|
||||
mementoGateway,
|
||||
async dispose(): Promise<void> {
|
||||
// §20.3. Optional runtime first, then the base infrastructure: the query
|
||||
// cache is cleared only after realtime and worker admission has closed,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { createRoot } from "react-dom/client";
|
||||
|
||||
import { recordBootFailure } from "../adapters/diagnostics/index.ts";
|
||||
import { ROUTE_RUNTIME } from "../features/installed-feature-runtimes.tsx";
|
||||
import { BootErrorShell } from "../presentation/boundaries/boot-error-shell.tsx";
|
||||
import "../presentation/styles/theme.css";
|
||||
import { createRuntimeComposition } from "./create-runtime-composition.ts";
|
||||
import { initializeColorScheme } from "./initialize-color-scheme.ts";
|
||||
import { ReleaseManifestError } from "./load-release-manifest.ts";
|
||||
@@ -15,6 +15,14 @@ if (!rootElement) {
|
||||
throw new Error("Missing #root mount element");
|
||||
}
|
||||
|
||||
// Memento owns the visible static Beta shell, but the inherited frontend
|
||||
// foundation still publishes route chunks in its release manifest. Touching the
|
||||
// runtime catalog here keeps those lazy chunks in the build without mounting or
|
||||
// executing the platform router.
|
||||
document.documentElement.dataset.registeredRouteRuntimeCount = String(
|
||||
Object.keys(ROUTE_RUNTIME).length,
|
||||
);
|
||||
|
||||
const root = createRoot(rootElement);
|
||||
|
||||
async function boot(): Promise<void> {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { StrictMode, useEffect } from "react";
|
||||
|
||||
import { ApplicationProvider } from "../presentation/providers/application-provider.tsx";
|
||||
import { ServerStateGenerationProvider } from "../presentation/adapters/query/server-state-generation-provider.tsx";
|
||||
import { AppRouter } from "../presentation/routes/app-router.tsx";
|
||||
import { MementoRuntimeBridge } from "../features/memento-web/presentation/memento-runtime-bridge.tsx";
|
||||
import type { RuntimeComposition } from "./create-runtime-composition.ts";
|
||||
|
||||
/**
|
||||
@@ -44,10 +44,7 @@ export function RuntimeApplication({
|
||||
>
|
||||
<ApplicationProvider application={composition.application}>
|
||||
<PostMountRuntimeStarter composition={composition} />
|
||||
<AppRouter
|
||||
basename={composition.config.build.routerBasePath}
|
||||
buildId={composition.release.buildId}
|
||||
/>
|
||||
<MementoRuntimeBridge gateway={composition.mementoGateway} />
|
||||
</ApplicationProvider>
|
||||
</ServerStateGenerationProvider>
|
||||
</StrictMode>
|
||||
|
||||
@@ -45,6 +45,8 @@ export const CACHEABLE_ASSET_CONTENT_TYPES: Readonly<
|
||||
Record<string, string>
|
||||
> = Object.freeze({
|
||||
".css": "text/css",
|
||||
".html": "text/html",
|
||||
".jpg": "image/jpeg",
|
||||
".js": "text/javascript",
|
||||
".mjs": "text/javascript",
|
||||
".png": "image/png",
|
||||
|
||||
@@ -26,8 +26,9 @@ import {
|
||||
* endpoint, event descriptor and recovery mode (§13.6).
|
||||
* - webWorkers: `NOT_SELECTED`. No profiled CPU-bound task with an owner
|
||||
* exists, so no production worker entry is created (§16.2).
|
||||
* - serviceWorker: `null`. Switching to `ACTIVE` also enables the two-pass
|
||||
* build in `scripts/build-frontend.ts`.
|
||||
* - serviceWorker: `ACTIVE` for the Memento installable PWA shell. The
|
||||
* product selects static app-shell caching only; offline command replay stays
|
||||
* unselected by design.
|
||||
* - offlineCommands: `NOT_SELECTED`. No external package declares a `KEYED`
|
||||
* operation with a recovery descriptor (§19.3).
|
||||
*/
|
||||
@@ -36,7 +37,11 @@ const REALTIME: readonly InstalledRealtimeContribution[] = Object.freeze([]);
|
||||
|
||||
const WEB_WORKERS: readonly InstalledWebWorkerContribution[] = Object.freeze([]);
|
||||
|
||||
const SERVICE_WORKER: InstalledServiceWorkerSelection | null = null;
|
||||
const SERVICE_WORKER: InstalledServiceWorkerSelection = Object.freeze({
|
||||
mode: "ACTIVE",
|
||||
scriptPath: "service-worker.js",
|
||||
handlers: Object.freeze(["PWA_STATIC_ASSETS"] as const),
|
||||
});
|
||||
|
||||
const OFFLINE_COMMANDS: InstalledOfflineCommandContribution | null = null;
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import type { MementoGateway } from "../application/memento-gateway.ts";
|
||||
import type { MementoRuntimeConfig } from "../contracts/memento-api.ts";
|
||||
import { createHttpMementoGateway } from "./http-memento-gateway.ts";
|
||||
import { createMockMementoGateway } from "./mock-memento-gateway.ts";
|
||||
|
||||
/**
|
||||
* Memento product environment boundary.
|
||||
*
|
||||
* local -> deterministic mock gateway
|
||||
* development -> real BFF/API gateway
|
||||
* staging -> real BFF/API gateway
|
||||
* production -> real BFF/API gateway
|
||||
*
|
||||
* Presentation code never branches on the environment.
|
||||
*/
|
||||
export function createMementoGateway(
|
||||
config: MementoRuntimeConfig,
|
||||
): MementoGateway {
|
||||
if (config.APP_ENV === "local") {
|
||||
return createMockMementoGateway();
|
||||
}
|
||||
|
||||
return createHttpMementoGateway({
|
||||
apiBaseUrl: config.API_BASE_URL,
|
||||
timeoutMs: config.REQUEST_TIMEOUT_MS,
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,469 @@
|
||||
import type {
|
||||
AlbumQuery,
|
||||
CreateAlbumInput,
|
||||
CreateShareInput,
|
||||
LibraryQuery,
|
||||
MementoGateway,
|
||||
MemoryQuery,
|
||||
ShareTarget,
|
||||
UpdateAlbumInput,
|
||||
UpdateMediaMetadataInput,
|
||||
UpdateMemoryInput,
|
||||
} from "../application/memento-gateway.ts";
|
||||
import type {
|
||||
AccountSettings,
|
||||
AlbumDetail,
|
||||
AlbumSummary,
|
||||
ApiErrorPayload,
|
||||
BackupSummary,
|
||||
CursorPage,
|
||||
DeviceBackupPolicy,
|
||||
DeviceSummary,
|
||||
DuplicateGroup,
|
||||
DuplicateResolutionInput,
|
||||
HomeResponse,
|
||||
LibraryItem,
|
||||
MediaDetail,
|
||||
MemoryCandidate,
|
||||
MemoryDetail,
|
||||
MemorySummary,
|
||||
MementoCapabilities,
|
||||
PersonSummary,
|
||||
PlaceSummary,
|
||||
PublicShare,
|
||||
SearchResponse,
|
||||
ShareCreateResult,
|
||||
StorageSettings,
|
||||
UploadCommitResult,
|
||||
UploadPreflightInput,
|
||||
UploadPreflightResponse,
|
||||
UploadSession,
|
||||
} from "../contracts/memento-api.ts";
|
||||
|
||||
export class MementoApiError extends Error {
|
||||
readonly status: number;
|
||||
readonly code?: string;
|
||||
readonly traceId?: string;
|
||||
|
||||
constructor(
|
||||
message: string,
|
||||
input: Readonly<{ status: number; code?: string; traceId?: string }>,
|
||||
) {
|
||||
super(message);
|
||||
this.name = "MementoApiError";
|
||||
this.status = input.status;
|
||||
this.code = input.code;
|
||||
this.traceId = input.traceId;
|
||||
}
|
||||
}
|
||||
|
||||
type HttpGatewayOptions = Readonly<{
|
||||
apiBaseUrl: string;
|
||||
timeoutMs: number;
|
||||
fetcher?: typeof fetch;
|
||||
}>;
|
||||
|
||||
type RequestOptions = Readonly<{
|
||||
idempotentCommand?: boolean;
|
||||
expectJson?: boolean;
|
||||
root?: URL;
|
||||
}>;
|
||||
|
||||
const APP_API_PREFIX = "app-api/v1/";
|
||||
const SHARE_API_PREFIX = "share-api/v1/";
|
||||
|
||||
function readCookie(name: string): string | undefined {
|
||||
if (typeof document === "undefined") return undefined;
|
||||
const encoded = encodeURIComponent(name);
|
||||
const match = document.cookie
|
||||
.split(";")
|
||||
.map((part) => part.trim())
|
||||
.find((part) => part.startsWith(`${encoded}=`));
|
||||
return match
|
||||
? decodeURIComponent(match.slice(encoded.length + 1))
|
||||
: undefined;
|
||||
}
|
||||
|
||||
function idempotencyKey(): string {
|
||||
if (typeof crypto !== "undefined" && "randomUUID" in crypto) {
|
||||
return crypto.randomUUID();
|
||||
}
|
||||
return `web-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
||||
}
|
||||
|
||||
function queryString(input: object): string {
|
||||
const search = new URLSearchParams();
|
||||
for (const [key, value] of Object.entries(input)) {
|
||||
if (value === undefined || value === null || value === "") continue;
|
||||
search.set(key, String(value));
|
||||
}
|
||||
const encoded = search.toString();
|
||||
return encoded ? `?${encoded}` : "";
|
||||
}
|
||||
|
||||
function versionHeaders(expectedVersion?: number): HeadersInit | undefined {
|
||||
return Number.isSafeInteger(expectedVersion)
|
||||
? { "If-Match": String(expectedVersion) }
|
||||
: undefined;
|
||||
}
|
||||
|
||||
function withoutVersion<T extends Readonly<{ expectedVersion?: number }>>(
|
||||
input: T,
|
||||
): Omit<T, "expectedVersion"> {
|
||||
const { expectedVersion: _expectedVersion, ...body } = input;
|
||||
return body;
|
||||
}
|
||||
|
||||
export function createHttpMementoGateway(
|
||||
options: HttpGatewayOptions,
|
||||
): MementoGateway {
|
||||
const fetcher = options.fetcher ?? fetch;
|
||||
const base = ensureTrailingSlash(options.apiBaseUrl);
|
||||
const apiRoot = new URL(APP_API_PREFIX, base);
|
||||
const shareRoot = new URL(SHARE_API_PREFIX, base);
|
||||
|
||||
async function request<T>(
|
||||
path: string,
|
||||
init: RequestInit = {},
|
||||
requestOptions: RequestOptions = {},
|
||||
): Promise<T> {
|
||||
const controller = new AbortController();
|
||||
const timeout = globalThis.setTimeout(
|
||||
() => controller.abort(),
|
||||
options.timeoutMs,
|
||||
);
|
||||
const method = (init.method ?? "GET").toUpperCase();
|
||||
const headers = new Headers(init.headers);
|
||||
const isUnsafe = !["GET", "HEAD", "OPTIONS"].includes(method);
|
||||
|
||||
if (isUnsafe) {
|
||||
const csrf = readCookie("XSRF-TOKEN");
|
||||
if (csrf) headers.set("X-XSRF-TOKEN", csrf);
|
||||
}
|
||||
if (requestOptions.idempotentCommand) {
|
||||
headers.set("Idempotency-Key", idempotencyKey());
|
||||
}
|
||||
if (init.body !== undefined && !headers.has("Content-Type")) {
|
||||
headers.set("Content-Type", "application/json");
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetcher(
|
||||
new URL(path.replace(/^\//, ""), requestOptions.root ?? apiRoot),
|
||||
{
|
||||
...init,
|
||||
headers,
|
||||
credentials: "include",
|
||||
signal: controller.signal,
|
||||
},
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
let payload: ApiErrorPayload = {};
|
||||
const contentType = response.headers.get("content-type") ?? "";
|
||||
if (contentType.includes("application/json")) {
|
||||
try {
|
||||
payload = (await response.json()) as ApiErrorPayload;
|
||||
} catch {
|
||||
payload = {};
|
||||
}
|
||||
}
|
||||
throw new MementoApiError(
|
||||
payload.message ?? `Memento API request failed (${response.status})`,
|
||||
{
|
||||
status: response.status,
|
||||
...(payload.code ? { code: payload.code } : {}),
|
||||
...(payload.traceId ? { traceId: payload.traceId } : {}),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
if (response.status === 204 || requestOptions.expectJson === false) {
|
||||
return undefined as T;
|
||||
}
|
||||
return (await response.json()) as T;
|
||||
} finally {
|
||||
globalThis.clearTimeout(timeout);
|
||||
}
|
||||
}
|
||||
|
||||
async function appendUploadChunk(
|
||||
uploadSessionId: string,
|
||||
offset: number,
|
||||
chunk: Blob,
|
||||
): Promise<number> {
|
||||
const controller = new AbortController();
|
||||
const timeout = globalThis.setTimeout(
|
||||
() => controller.abort(),
|
||||
options.timeoutMs,
|
||||
);
|
||||
const headers = new Headers({
|
||||
"Content-Type": "application/offset+octet-stream",
|
||||
"Upload-Offset": String(offset),
|
||||
});
|
||||
const csrf = readCookie("XSRF-TOKEN");
|
||||
if (csrf) headers.set("X-XSRF-TOKEN", csrf);
|
||||
|
||||
try {
|
||||
const response = await fetcher(
|
||||
new URL(`uploads/${encodeURIComponent(uploadSessionId)}`, apiRoot),
|
||||
{
|
||||
method: "PATCH",
|
||||
body: chunk,
|
||||
headers,
|
||||
credentials: "include",
|
||||
signal: controller.signal,
|
||||
},
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
let payload: ApiErrorPayload = {};
|
||||
try {
|
||||
payload = (await response.json()) as ApiErrorPayload;
|
||||
} catch {
|
||||
payload = {};
|
||||
}
|
||||
throw new MementoApiError(
|
||||
payload.message ?? `Upload chunk failed (${response.status})`,
|
||||
{
|
||||
status: response.status,
|
||||
...(payload.code ? { code: payload.code } : {}),
|
||||
...(payload.traceId ? { traceId: payload.traceId } : {}),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
const nextOffset = Number(response.headers.get("Upload-Offset"));
|
||||
if (!Number.isFinite(nextOffset)) {
|
||||
throw new Error("Upload response did not include a valid Upload-Offset");
|
||||
}
|
||||
return nextOffset;
|
||||
} finally {
|
||||
globalThis.clearTimeout(timeout);
|
||||
}
|
||||
}
|
||||
|
||||
const gateway: MementoGateway = {
|
||||
mode: "api",
|
||||
|
||||
getCapabilities: () => request<MementoCapabilities>("capabilities"),
|
||||
getHome: () => request<HomeResponse>("home"),
|
||||
|
||||
getLibrary: (query: LibraryQuery = {}) =>
|
||||
request<CursorPage<LibraryItem>>(`library${queryString(query)}`),
|
||||
getMedia: (mediaId) =>
|
||||
request<MediaDetail>(`media/${encodeURIComponent(mediaId)}`),
|
||||
setMediaFavorite: (mediaId, favorite) =>
|
||||
request<MediaDetail>(
|
||||
`media/${encodeURIComponent(mediaId)}/favorite`,
|
||||
{ method: "PUT", body: JSON.stringify({ favorite }) },
|
||||
{ idempotentCommand: true },
|
||||
),
|
||||
trashMedia: (mediaId) =>
|
||||
request<void>(
|
||||
`media/${encodeURIComponent(mediaId)}/trash`,
|
||||
{ method: "POST" },
|
||||
{ idempotentCommand: true, expectJson: false },
|
||||
),
|
||||
restoreMedia: (mediaId) =>
|
||||
request<void>(
|
||||
`media/${encodeURIComponent(mediaId)}/restore`,
|
||||
{ method: "POST" },
|
||||
{ idempotentCommand: true, expectJson: false },
|
||||
),
|
||||
updateMediaMetadata: (mediaId, input: UpdateMediaMetadataInput) =>
|
||||
request<MediaDetail>(
|
||||
`media/${encodeURIComponent(mediaId)}/metadata`,
|
||||
{
|
||||
method: "PATCH",
|
||||
headers: versionHeaders(input.expectedVersion),
|
||||
body: JSON.stringify(withoutVersion(input)),
|
||||
},
|
||||
),
|
||||
|
||||
getAlbums: (query: AlbumQuery = {}) =>
|
||||
request<CursorPage<AlbumSummary>>(`albums${queryString(query)}`),
|
||||
getAlbum: (albumId) =>
|
||||
request<AlbumDetail>(`albums/${encodeURIComponent(albumId)}`),
|
||||
createAlbum: (input: CreateAlbumInput) =>
|
||||
request<Readonly<{ id: string; title: string; version?: number }>>(
|
||||
"albums",
|
||||
{ method: "POST", body: JSON.stringify(input) },
|
||||
{ idempotentCommand: true },
|
||||
),
|
||||
updateAlbum: (albumId, input: UpdateAlbumInput) =>
|
||||
request<AlbumDetail>(
|
||||
`albums/${encodeURIComponent(albumId)}`,
|
||||
{
|
||||
method: "PATCH",
|
||||
headers: versionHeaders(input.expectedVersion),
|
||||
body: JSON.stringify(withoutVersion(input)),
|
||||
},
|
||||
),
|
||||
deleteAlbum: (albumId, expectedVersion) =>
|
||||
request<void>(
|
||||
`albums/${encodeURIComponent(albumId)}`,
|
||||
{ method: "DELETE", headers: versionHeaders(expectedVersion) },
|
||||
{ expectJson: false },
|
||||
),
|
||||
addAlbumItems: (albumId, mediaIds) =>
|
||||
request<void>(
|
||||
`albums/${encodeURIComponent(albumId)}/items`,
|
||||
{ method: "POST", body: JSON.stringify({ mediaIds }) },
|
||||
{ idempotentCommand: true, expectJson: false },
|
||||
),
|
||||
removeAlbumItem: (albumId, mediaId) =>
|
||||
request<void>(
|
||||
`albums/${encodeURIComponent(albumId)}/items/${encodeURIComponent(mediaId)}`,
|
||||
{ method: "DELETE" },
|
||||
{ expectJson: false },
|
||||
),
|
||||
reorderAlbumItems: (albumId, mediaIds) =>
|
||||
request<void>(
|
||||
`albums/${encodeURIComponent(albumId)}/order`,
|
||||
{ method: "PUT", body: JSON.stringify({ mediaIds }) },
|
||||
{ expectJson: false },
|
||||
),
|
||||
getAlbumStory: (albumId) =>
|
||||
request<readonly unknown[]>(
|
||||
`albums/${encodeURIComponent(albumId)}/story`,
|
||||
),
|
||||
|
||||
getMemories: (query: MemoryQuery = {}) =>
|
||||
request<CursorPage<MemorySummary>>(`memories${queryString(query)}`),
|
||||
getMemory: (memoryId) =>
|
||||
request<MemoryDetail>(`memories/${encodeURIComponent(memoryId)}`),
|
||||
updateMemory: (memoryId, input: UpdateMemoryInput) =>
|
||||
request<MemoryDetail>(
|
||||
`memories/${encodeURIComponent(memoryId)}`,
|
||||
{
|
||||
method: "PATCH",
|
||||
headers: versionHeaders(input.expectedVersion),
|
||||
body: JSON.stringify(withoutVersion(input)),
|
||||
},
|
||||
),
|
||||
getMemoryCandidates: () =>
|
||||
request<CursorPage<MemoryCandidate>>("memory-candidates?status=SUGGESTED"),
|
||||
saveMemoryCandidate: (candidateId) =>
|
||||
request<Readonly<{ memoryId: string; version?: number }>>(
|
||||
`memory-candidates/${encodeURIComponent(candidateId)}/save`,
|
||||
{ method: "POST" },
|
||||
{ idempotentCommand: true },
|
||||
),
|
||||
dismissMemoryCandidate: (candidateId) =>
|
||||
request<void>(
|
||||
`memory-candidates/${encodeURIComponent(candidateId)}/dismiss`,
|
||||
{ method: "POST" },
|
||||
{ idempotentCommand: true, expectJson: false },
|
||||
),
|
||||
regenerateMemory: (memoryId) =>
|
||||
request<void>(
|
||||
`memories/${encodeURIComponent(memoryId)}/regenerate`,
|
||||
{ method: "POST" },
|
||||
{ idempotentCommand: true, expectJson: false },
|
||||
),
|
||||
getMemoryStory: (memoryId) =>
|
||||
request<readonly unknown[]>(
|
||||
`memories/${encodeURIComponent(memoryId)}/story`,
|
||||
),
|
||||
|
||||
getDuplicateGroups: () =>
|
||||
request<CursorPage<DuplicateGroup>>("duplicates/groups"),
|
||||
resolveDuplicateGroup: (groupId, input: DuplicateResolutionInput) =>
|
||||
request<void>(
|
||||
`duplicates/groups/${encodeURIComponent(groupId)}/resolve`,
|
||||
{ method: "POST", body: JSON.stringify(input) },
|
||||
{ idempotentCommand: true, expectJson: false },
|
||||
),
|
||||
|
||||
search: (query: string) =>
|
||||
request<SearchResponse>(`search${queryString({ q: query })}`),
|
||||
getPeople: () => request<CursorPage<PersonSummary>>("people"),
|
||||
getPlaces: () => request<CursorPage<PlaceSummary>>("places"),
|
||||
|
||||
getDevices: () => request<CursorPage<DeviceSummary>>("devices"),
|
||||
getDeviceBackupPolicy: (deviceId) =>
|
||||
request<DeviceBackupPolicy>(
|
||||
`devices/${encodeURIComponent(deviceId)}/backup-policy`,
|
||||
),
|
||||
updateDeviceBackupPolicy: (deviceId, policy) =>
|
||||
request<DeviceBackupPolicy>(
|
||||
`devices/${encodeURIComponent(deviceId)}/backup-policy`,
|
||||
{ method: "PUT", body: JSON.stringify(policy) },
|
||||
),
|
||||
disconnectDevice: (deviceId) =>
|
||||
request<void>(
|
||||
`devices/${encodeURIComponent(deviceId)}/disconnect`,
|
||||
{ method: "POST" },
|
||||
{ idempotentCommand: true, expectJson: false },
|
||||
),
|
||||
getBackupSummary: (deviceId) =>
|
||||
request<BackupSummary>(
|
||||
`devices/${encodeURIComponent(deviceId)}/backup-summary`,
|
||||
),
|
||||
|
||||
getStorageSettings: () => request<StorageSettings>("settings/storage"),
|
||||
getAccount: () => request<AccountSettings>("account"),
|
||||
updateAccount: (input) =>
|
||||
request<AccountSettings>("account", {
|
||||
method: "PATCH",
|
||||
body: JSON.stringify(input),
|
||||
}),
|
||||
runStorageIntegrityScan: () =>
|
||||
request<void>(
|
||||
"settings/storage/integrity-scan",
|
||||
{ method: "POST" },
|
||||
{ idempotentCommand: true, expectJson: false },
|
||||
),
|
||||
|
||||
createShare: (target: ShareTarget, input: CreateShareInput) =>
|
||||
request<ShareCreateResult>(
|
||||
`${target.type === "album" ? "albums" : "memories"}/${encodeURIComponent(target.id)}/shares`,
|
||||
{ method: "POST", body: JSON.stringify(input) },
|
||||
{ idempotentCommand: true },
|
||||
),
|
||||
revokeShare: (shareId) =>
|
||||
request<void>(
|
||||
`shares/${encodeURIComponent(shareId)}`,
|
||||
{ method: "DELETE" },
|
||||
{ expectJson: false },
|
||||
),
|
||||
getPublicShare: (token) =>
|
||||
request<PublicShare>(
|
||||
encodeURIComponent(token),
|
||||
{},
|
||||
{ root: shareRoot },
|
||||
),
|
||||
|
||||
preflightUpload: (input: UploadPreflightInput) =>
|
||||
request<UploadPreflightResponse>("uploads/preflight", {
|
||||
method: "POST",
|
||||
body: JSON.stringify(input),
|
||||
}),
|
||||
createUploadSession: (input) =>
|
||||
request<UploadSession>(
|
||||
"uploads",
|
||||
{ method: "POST", body: JSON.stringify(input) },
|
||||
{ idempotentCommand: true },
|
||||
),
|
||||
appendUploadChunk,
|
||||
commitUpload: (uploadSessionId: string) =>
|
||||
request<UploadCommitResult>(
|
||||
`uploads/${encodeURIComponent(uploadSessionId)}/commit`,
|
||||
{ method: "POST" },
|
||||
{ idempotentCommand: true },
|
||||
),
|
||||
abortUpload: (uploadSessionId: string) =>
|
||||
request<void>(
|
||||
`uploads/${encodeURIComponent(uploadSessionId)}`,
|
||||
{ method: "DELETE" },
|
||||
{ expectJson: false },
|
||||
),
|
||||
};
|
||||
|
||||
return Object.freeze(gateway);
|
||||
}
|
||||
|
||||
function ensureTrailingSlash(value: string): string {
|
||||
return value.endsWith("/") ? value : `${value}/`;
|
||||
}
|
||||
@@ -0,0 +1,405 @@
|
||||
import type { MementoGateway } from "../application/memento-gateway.ts";
|
||||
import type {
|
||||
AlbumSummary,
|
||||
HomeResponse,
|
||||
LibraryItem,
|
||||
MemoryCandidate,
|
||||
MemorySummary,
|
||||
PersonSummary,
|
||||
PlaceSummary,
|
||||
} from "../contracts/memento-api.ts";
|
||||
|
||||
const PHOTOS = Object.freeze(
|
||||
Array.from({ length: 11 }, (_, index) => `/assets/photo-${index + 1}.jpg`),
|
||||
);
|
||||
|
||||
const ALBUMS: readonly AlbumSummary[] = Object.freeze([
|
||||
album("album-family", "가족 사진", 124, false, PHOTOS[5]),
|
||||
album("album-profile", "프로필 후보", 48, false, PHOTOS[8]),
|
||||
album("album-jeju", "2026 제주 베스트", 36, true, PHOTOS[0]),
|
||||
album("album-dog", "강아지", 82, false, PHOTOS[10]),
|
||||
album("album-interior", "인테리어 참고", 64, false, PHOTOS[4]),
|
||||
album("album-friends", "친구들과", 91, true, PHOTOS[2]),
|
||||
]);
|
||||
|
||||
const MEMORIES: readonly MemorySummary[] = Object.freeze([
|
||||
memory("memory-gangneung", "강릉에서 보낸 주말", 67, PHOTOS[1]),
|
||||
memory("memory-gapyeong", "가평 드라이브", 41, PHOTOS[2]),
|
||||
memory("memory-seoul", "서울의 겨울", 123, PHOTOS[4]),
|
||||
memory("memory-busan", "처음 떠난 부산", 108, PHOTOS[7]),
|
||||
]);
|
||||
|
||||
const CANDIDATES: readonly MemoryCandidate[] = Object.freeze([
|
||||
{
|
||||
id: "candidate-jeju-summer",
|
||||
title: "제주, 여름의 끝",
|
||||
mediaCount: 84,
|
||||
momentCount: 3,
|
||||
placeCount: 4,
|
||||
coverMedia: Object.freeze([{ thumbnailUrl: PHOTOS[0] }]),
|
||||
score: 0.91,
|
||||
},
|
||||
]);
|
||||
|
||||
const PEOPLE: readonly PersonSummary[] = Object.freeze([
|
||||
{ id: "person-me", displayName: "나", mediaCount: 842, memoryCount: 18 },
|
||||
{ id: "person-family", displayName: "가족", mediaCount: 381, memoryCount: 12 },
|
||||
{ id: "person-friends", displayName: "친구", mediaCount: 264, memoryCount: 8 },
|
||||
]);
|
||||
|
||||
const PLACES: readonly PlaceSummary[] = Object.freeze([
|
||||
place("place-jeju", "제주도", 168, 4, 33.38, 126.55),
|
||||
place("place-seoul", "서울", 624, 38, 37.56, 126.98),
|
||||
place("place-gangneung", "강릉", 91, 3, 37.75, 128.90),
|
||||
place("place-busan", "부산", 108, 2, 35.18, 129.08),
|
||||
]);
|
||||
|
||||
const LIBRARY: readonly LibraryItem[] = Object.freeze(
|
||||
Array.from({ length: 36 }, (_, index) => ({
|
||||
id: `media-${index + 1}`,
|
||||
mediaType: index % 8 === 3 ? "VIDEO" : "PHOTO",
|
||||
thumbnailUrl: PHOTOS[index % PHOTOS.length] ?? PHOTOS[0]!,
|
||||
takenAt: new Date(Date.UTC(2026, 8, 15 - Math.floor(index / 12), 9, index)).toISOString(),
|
||||
durationMs: index % 8 === 3 ? 18_000 : null,
|
||||
width: 4000,
|
||||
height: 3000,
|
||||
favorite: false,
|
||||
processingState: "READY",
|
||||
duplicateState: index % 12 === 6 ? "CANDIDATE" : "NONE",
|
||||
badges: Object.freeze(["SERVER_BACKED_UP"]),
|
||||
})),
|
||||
);
|
||||
|
||||
const HOME: HomeResponse = Object.freeze({
|
||||
suggestedMemory: Object.freeze({
|
||||
candidateId: CANDIDATES[0]!.id,
|
||||
title: CANDIDATES[0]!.title,
|
||||
mediaCount: CANDIDATES[0]!.mediaCount,
|
||||
placeCount: CANDIDATES[0]!.placeCount,
|
||||
momentCount: CANDIDATES[0]!.momentCount,
|
||||
coverMedia: CANDIDATES[0]!.coverMedia,
|
||||
}),
|
||||
rediscoveries: Object.freeze([]),
|
||||
todayImport: Object.freeze({
|
||||
uploadedCount: 42,
|
||||
duplicateSkippedCount: 3,
|
||||
items: Object.freeze([]),
|
||||
}),
|
||||
backup: Object.freeze({
|
||||
deviceId: "device-galaxy-s24",
|
||||
deviceName: "Galaxy S24",
|
||||
progress: 0.72,
|
||||
state: "SYNCING",
|
||||
}),
|
||||
repository: Object.freeze({
|
||||
unorganizedCount: 128,
|
||||
duplicateCandidateCount: 14,
|
||||
originalBytes: 459_561_500_672,
|
||||
quotaBytes: 1_099_511_627_776,
|
||||
}),
|
||||
});
|
||||
|
||||
export function createMockMementoGateway(): MementoGateway {
|
||||
let albums = [...ALBUMS];
|
||||
|
||||
const gateway: MementoGateway = {
|
||||
mode: "mock",
|
||||
getCapabilities: async () => ({
|
||||
apiVersion: "local-mock",
|
||||
features: Object.freeze({
|
||||
people: true,
|
||||
places: true,
|
||||
duplicates: true,
|
||||
resumableUpload: true,
|
||||
}),
|
||||
}),
|
||||
getHome: async () => HOME,
|
||||
getLibrary: async (query = {}) => {
|
||||
let items = [...LIBRARY];
|
||||
if (query.mediaType) {
|
||||
items = items.filter((item) => item.mediaType === query.mediaType);
|
||||
}
|
||||
if (query.search) {
|
||||
const offset = Math.min(items.length, 24);
|
||||
items = items.slice(0, offset);
|
||||
}
|
||||
if (query.state === "DUPLICATE_CANDIDATE") {
|
||||
items = items.filter((item) => item.duplicateState === "CANDIDATE");
|
||||
}
|
||||
return { items: Object.freeze(items), nextCursor: null };
|
||||
},
|
||||
getMedia: async (mediaId) => ({
|
||||
...(LIBRARY.find((item) => item.id === mediaId) ?? LIBRARY[0]!),
|
||||
filename: `${mediaId}.jpg`,
|
||||
originalUrl: PHOTOS[0],
|
||||
previewUrl: PHOTOS[0],
|
||||
metadata: Object.freeze({ source: "local-mock" }),
|
||||
version: 1,
|
||||
}),
|
||||
setMediaFavorite: async (mediaId, favorite) => ({
|
||||
...(LIBRARY.find((item) => item.id === mediaId) ?? LIBRARY[0]!),
|
||||
favorite,
|
||||
version: 1,
|
||||
}),
|
||||
trashMedia: async () => undefined,
|
||||
restoreMedia: async () => undefined,
|
||||
updateMediaMetadata: async (mediaId, input) => ({
|
||||
...(LIBRARY.find((item) => item.id === mediaId) ?? LIBRARY[0]!),
|
||||
metadata: Object.freeze({ ...input }),
|
||||
version: (input.expectedVersion ?? 0) + 1,
|
||||
}),
|
||||
getAlbums: async (query = {}) => ({
|
||||
items: Object.freeze(
|
||||
albums.filter((item) => {
|
||||
if (query.shared === true && !item.shared) return false;
|
||||
if (
|
||||
query.search &&
|
||||
!item.title.toLocaleLowerCase().includes(query.search.toLocaleLowerCase())
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}),
|
||||
),
|
||||
nextCursor: null,
|
||||
}),
|
||||
getAlbum: async (albumId) => {
|
||||
const item = albums.find((albumItem) => albumItem.id === albumId) ?? albums[0]!;
|
||||
return {
|
||||
...item,
|
||||
description: "로컬 Mock Album",
|
||||
sortMode: "MANUAL",
|
||||
items: LIBRARY.slice(0, Math.min(item.mediaCount, 12)),
|
||||
story: Object.freeze([]),
|
||||
};
|
||||
},
|
||||
createAlbum: async (input) => {
|
||||
const created: AlbumSummary = Object.freeze({
|
||||
id: `album-local-${albums.length + 1}`,
|
||||
title: input.title,
|
||||
mediaCount: input.mediaIds?.length ?? 0,
|
||||
shared: false,
|
||||
cover: Object.freeze({ thumbnailUrl: PHOTOS[5] }),
|
||||
version: 1,
|
||||
});
|
||||
albums = [created, ...albums];
|
||||
return { id: created.id, title: created.title, version: 1 };
|
||||
},
|
||||
updateAlbum: async (albumId, input) => {
|
||||
const current = albums.find((item) => item.id === albumId) ?? albums[0]!;
|
||||
const updated = {
|
||||
...current,
|
||||
title: input.title ?? current.title,
|
||||
version: (input.expectedVersion ?? current.version ?? 0) + 1,
|
||||
};
|
||||
albums = albums.map((item) => (item.id === albumId ? updated : item));
|
||||
return {
|
||||
...updated,
|
||||
description: input.description ?? "로컬 Mock Album",
|
||||
sortMode: input.sortMode ?? "MANUAL",
|
||||
items: LIBRARY.slice(0, 12),
|
||||
story: Object.freeze([]),
|
||||
};
|
||||
},
|
||||
deleteAlbum: async (albumId) => {
|
||||
albums = albums.filter((item) => item.id !== albumId);
|
||||
},
|
||||
addAlbumItems: async () => undefined,
|
||||
removeAlbumItem: async () => undefined,
|
||||
reorderAlbumItems: async () => undefined,
|
||||
getAlbumStory: async () => Object.freeze([]),
|
||||
getMemories: async () => ({ items: MEMORIES, nextCursor: null }),
|
||||
getMemory: async (memoryId) => {
|
||||
const item = MEMORIES.find((memoryItem) => memoryItem.id === memoryId) ?? MEMORIES[0]!;
|
||||
return {
|
||||
...item,
|
||||
description: "로컬 Mock Memory",
|
||||
placeNames: Object.freeze(["제주도"]),
|
||||
items: LIBRARY.slice(0, 12),
|
||||
moments: Object.freeze([]),
|
||||
story: Object.freeze([]),
|
||||
autoUpdate: true,
|
||||
version: 1,
|
||||
};
|
||||
},
|
||||
updateMemory: async (memoryId, input) => {
|
||||
const item = MEMORIES.find((memoryItem) => memoryItem.id === memoryId) ?? MEMORIES[0]!;
|
||||
return {
|
||||
...item,
|
||||
title: input.title ?? item.title,
|
||||
autoUpdate: input.autoUpdate ?? true,
|
||||
version: (input.expectedVersion ?? 0) + 1,
|
||||
};
|
||||
},
|
||||
getMemoryCandidates: async () => ({ items: CANDIDATES, nextCursor: null }),
|
||||
saveMemoryCandidate: async (candidateId) => ({
|
||||
memoryId: `memory-from-${candidateId}`,
|
||||
version: 1,
|
||||
}),
|
||||
dismissMemoryCandidate: async () => undefined,
|
||||
regenerateMemory: async () => undefined,
|
||||
getMemoryStory: async () => Object.freeze([]),
|
||||
getDuplicateGroups: async () => ({
|
||||
items: Object.freeze([
|
||||
Object.freeze({
|
||||
id: "duplicate-group-1",
|
||||
state: "OPEN",
|
||||
recommendedKeepMediaId: LIBRARY[0]!.id,
|
||||
items: Object.freeze([LIBRARY[0]!, LIBRARY[6]!]),
|
||||
}),
|
||||
]),
|
||||
nextCursor: null,
|
||||
}),
|
||||
resolveDuplicateGroup: async () => undefined,
|
||||
search: async () => ({
|
||||
people: PEOPLE,
|
||||
places: PLACES,
|
||||
albums,
|
||||
memories: MEMORIES,
|
||||
media: LIBRARY.slice(0, 12),
|
||||
}),
|
||||
getPeople: async () => ({ items: PEOPLE, nextCursor: null }),
|
||||
getPlaces: async () => ({ items: PLACES, nextCursor: null }),
|
||||
getDevices: async () => ({
|
||||
items: Object.freeze([
|
||||
Object.freeze({
|
||||
id: "device-galaxy-s24",
|
||||
name: "Galaxy S24",
|
||||
platform: "ANDROID",
|
||||
status: "ACTIVE",
|
||||
lastSyncAt: new Date().toISOString(),
|
||||
backup: Object.freeze({ enabled: true, wifiOnly: true }),
|
||||
}),
|
||||
Object.freeze({
|
||||
id: "device-galaxy-book",
|
||||
name: "Galaxy Book",
|
||||
platform: "WEB",
|
||||
status: "ACTIVE",
|
||||
lastSyncAt: new Date(Date.now() - 86_400_000).toISOString(),
|
||||
backup: Object.freeze({ enabled: false, wifiOnly: true }),
|
||||
}),
|
||||
]),
|
||||
nextCursor: null,
|
||||
}),
|
||||
getDeviceBackupPolicy: async () => ({
|
||||
enabled: true,
|
||||
wifiOnly: true,
|
||||
includeVideos: true,
|
||||
version: 1,
|
||||
}),
|
||||
updateDeviceBackupPolicy: async (_deviceId, policy) => ({
|
||||
...policy,
|
||||
version: (policy.version ?? 0) + 1,
|
||||
}),
|
||||
disconnectDevice: async () => undefined,
|
||||
getBackupSummary: async () => ({
|
||||
state: "SYNCING",
|
||||
pendingCount: 12,
|
||||
uploadedCount: 2_118,
|
||||
duplicateSkippedCount: 42,
|
||||
failedCount: 0,
|
||||
lastCompletedAt: new Date().toISOString(),
|
||||
}),
|
||||
getStorageSettings: async () => ({
|
||||
quotaBytes: 1_099_511_627_776,
|
||||
originalBytes: 459_561_500_672,
|
||||
derivedBytes: 32_122_122_240,
|
||||
trashBytes: 9_432_217_600,
|
||||
freeBytes: 607_712_894_976,
|
||||
health: "HEALTHY",
|
||||
lastIntegrityScanAt: "2026-09-14T03:00:00Z",
|
||||
}),
|
||||
getAccount: async () => ({ username: "donghyeon", emailVerified: true }),
|
||||
updateAccount: async (input) => ({
|
||||
username: "donghyeon",
|
||||
emailVerified: true,
|
||||
...input,
|
||||
}),
|
||||
runStorageIntegrityScan: async () => undefined,
|
||||
createShare: async (target, input) => ({
|
||||
shareId: `share-${target.type}-${target.id}`,
|
||||
url: "https://memento.example.com/s/mock",
|
||||
expiresAt: input.expiresAt ?? null,
|
||||
allowDownload: input.allowDownload,
|
||||
version: 1,
|
||||
}),
|
||||
revokeShare: async () => undefined,
|
||||
getPublicShare: async (token) => ({
|
||||
shareId: `share-${token}`,
|
||||
title: "제주, 여름의 끝",
|
||||
targetType: "MEMORY",
|
||||
allowDownload: false,
|
||||
expiresAt: null,
|
||||
coverUrl: PHOTOS[0],
|
||||
items: LIBRARY.slice(0, 12),
|
||||
}),
|
||||
preflightUpload: async () => ({
|
||||
decision: "UPLOAD_REQUIRED" as const,
|
||||
recommendedChunkSize: 8 * 1024 * 1024,
|
||||
}),
|
||||
createUploadSession: async (input) => ({
|
||||
uploadSessionId: `upload-${input.deviceLocalAssetId}`,
|
||||
state: "CREATED",
|
||||
offset: 0,
|
||||
chunkSize: 8 * 1024 * 1024,
|
||||
}),
|
||||
appendUploadChunk: async (_sessionId, offset, chunk) => offset + chunk.size,
|
||||
commitUpload: async (uploadSessionId) => ({
|
||||
result: "CREATED" as const,
|
||||
mediaAssetId: `media-${uploadSessionId}`,
|
||||
processingState: "PROCESSING",
|
||||
}),
|
||||
abortUpload: async () => undefined,
|
||||
};
|
||||
|
||||
return Object.freeze(gateway);
|
||||
}
|
||||
|
||||
function album(
|
||||
id: string,
|
||||
title: string,
|
||||
mediaCount: number,
|
||||
shared: boolean,
|
||||
thumbnailUrl: string | undefined,
|
||||
): AlbumSummary {
|
||||
return Object.freeze({
|
||||
id,
|
||||
title,
|
||||
mediaCount,
|
||||
shared,
|
||||
cover: Object.freeze({ thumbnailUrl }),
|
||||
updatedAt: "2026-09-14T12:00:00Z",
|
||||
version: 1,
|
||||
});
|
||||
}
|
||||
|
||||
function memory(
|
||||
id: string,
|
||||
title: string,
|
||||
mediaCount: number,
|
||||
thumbnailUrl: string | undefined,
|
||||
): MemorySummary {
|
||||
return Object.freeze({
|
||||
id,
|
||||
title,
|
||||
mediaCount,
|
||||
cover: Object.freeze({ thumbnailUrl }),
|
||||
});
|
||||
}
|
||||
|
||||
function place(
|
||||
id: string,
|
||||
name: string,
|
||||
mediaCount: number,
|
||||
visitCount: number,
|
||||
latitude: number,
|
||||
longitude: number,
|
||||
): PlaceSummary {
|
||||
return Object.freeze({
|
||||
id,
|
||||
name,
|
||||
mediaCount,
|
||||
visitCount,
|
||||
center: Object.freeze({ latitude, longitude }),
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
import type {
|
||||
AccountSettings,
|
||||
AlbumDetail,
|
||||
AlbumSummary,
|
||||
BackupSummary,
|
||||
CursorPage,
|
||||
DeviceBackupPolicy,
|
||||
DeviceSummary,
|
||||
DuplicateGroup,
|
||||
DuplicateResolutionInput,
|
||||
HomeResponse,
|
||||
LibraryItem,
|
||||
MediaDetail,
|
||||
MemoryCandidate,
|
||||
MemoryDetail,
|
||||
MemorySummary,
|
||||
MementoCapabilities,
|
||||
MementoDataMode,
|
||||
PersonSummary,
|
||||
PlaceSummary,
|
||||
PublicShare,
|
||||
SearchResponse,
|
||||
ShareCreateResult,
|
||||
StorageSettings,
|
||||
UploadCommitResult,
|
||||
UploadPreflightInput,
|
||||
UploadPreflightResponse,
|
||||
UploadSession,
|
||||
} from "../contracts/memento-api.ts";
|
||||
|
||||
export type LibraryQuery = Readonly<{
|
||||
cursor?: string;
|
||||
limit?: number;
|
||||
dateFrom?: string;
|
||||
dateTo?: string;
|
||||
mediaType?: string;
|
||||
state?: string;
|
||||
favorite?: boolean;
|
||||
year?: number;
|
||||
search?: string;
|
||||
sort?: string;
|
||||
}>;
|
||||
|
||||
export type AlbumQuery = Readonly<{
|
||||
cursor?: string;
|
||||
limit?: number;
|
||||
search?: string;
|
||||
shared?: boolean;
|
||||
sort?: string;
|
||||
}>;
|
||||
|
||||
export type MemoryQuery = Readonly<{
|
||||
cursor?: string;
|
||||
limit?: number;
|
||||
sort?: string;
|
||||
state?: string;
|
||||
search?: string;
|
||||
}>;
|
||||
|
||||
export type CreateAlbumInput = Readonly<{
|
||||
title: string;
|
||||
description?: string | null;
|
||||
coverMediaId?: string | null;
|
||||
sortMode?: "MANUAL" | "CAPTURE_TIME" | string;
|
||||
mediaIds?: readonly string[];
|
||||
}>;
|
||||
|
||||
export type UpdateAlbumInput = Readonly<{
|
||||
title?: string;
|
||||
description?: string | null;
|
||||
sortMode?: string;
|
||||
expectedVersion?: number;
|
||||
}>;
|
||||
|
||||
export type UpdateMemoryInput = Readonly<{
|
||||
title?: string;
|
||||
coverMediaId?: string | null;
|
||||
autoUpdate?: boolean;
|
||||
expectedVersion?: number;
|
||||
}>;
|
||||
|
||||
export type UpdateMediaMetadataInput = Readonly<{
|
||||
takenAt?: string | null;
|
||||
description?: string | null;
|
||||
expectedVersion?: number;
|
||||
}>;
|
||||
|
||||
export type CreateShareInput = Readonly<{
|
||||
allowDownload: boolean;
|
||||
expiresAt?: string | null;
|
||||
}>;
|
||||
|
||||
export type ShareTarget =
|
||||
| Readonly<{ type: "album"; id: string }>
|
||||
| Readonly<{ type: "memory"; id: string }>;
|
||||
|
||||
export interface MementoGateway {
|
||||
readonly mode: MementoDataMode;
|
||||
|
||||
getCapabilities(): Promise<MementoCapabilities>;
|
||||
getHome(): Promise<HomeResponse>;
|
||||
|
||||
getLibrary(query?: LibraryQuery): Promise<CursorPage<LibraryItem>>;
|
||||
getMedia(mediaId: string): Promise<MediaDetail>;
|
||||
setMediaFavorite(mediaId: string, favorite: boolean): Promise<MediaDetail>;
|
||||
trashMedia(mediaId: string): Promise<void>;
|
||||
restoreMedia(mediaId: string): Promise<void>;
|
||||
updateMediaMetadata(
|
||||
mediaId: string,
|
||||
input: UpdateMediaMetadataInput,
|
||||
): Promise<MediaDetail>;
|
||||
|
||||
getAlbums(query?: AlbumQuery): Promise<CursorPage<AlbumSummary>>;
|
||||
getAlbum(albumId: string): Promise<AlbumDetail>;
|
||||
createAlbum(
|
||||
input: CreateAlbumInput,
|
||||
): Promise<Readonly<{ id: string; title: string; version?: number }>>;
|
||||
updateAlbum(albumId: string, input: UpdateAlbumInput): Promise<AlbumDetail>;
|
||||
deleteAlbum(albumId: string, expectedVersion?: number): Promise<void>;
|
||||
addAlbumItems(albumId: string, mediaIds: readonly string[]): Promise<void>;
|
||||
removeAlbumItem(albumId: string, mediaId: string): Promise<void>;
|
||||
reorderAlbumItems(albumId: string, mediaIds: readonly string[]): Promise<void>;
|
||||
getAlbumStory(albumId: string): Promise<readonly unknown[]>;
|
||||
|
||||
getMemories(query?: MemoryQuery): Promise<CursorPage<MemorySummary>>;
|
||||
getMemory(memoryId: string): Promise<MemoryDetail>;
|
||||
updateMemory(memoryId: string, input: UpdateMemoryInput): Promise<MemoryDetail>;
|
||||
getMemoryCandidates(): Promise<CursorPage<MemoryCandidate>>;
|
||||
saveMemoryCandidate(
|
||||
candidateId: string,
|
||||
): Promise<Readonly<{ memoryId: string; version?: number }>>;
|
||||
dismissMemoryCandidate(candidateId: string): Promise<void>;
|
||||
regenerateMemory(memoryId: string): Promise<void>;
|
||||
getMemoryStory(memoryId: string): Promise<readonly unknown[]>;
|
||||
|
||||
getDuplicateGroups(): Promise<CursorPage<DuplicateGroup>>;
|
||||
resolveDuplicateGroup(
|
||||
groupId: string,
|
||||
input: DuplicateResolutionInput,
|
||||
): Promise<void>;
|
||||
|
||||
search(query: string): Promise<SearchResponse>;
|
||||
getPeople(): Promise<CursorPage<PersonSummary>>;
|
||||
getPlaces(): Promise<CursorPage<PlaceSummary>>;
|
||||
|
||||
getDevices(): Promise<CursorPage<DeviceSummary>>;
|
||||
getDeviceBackupPolicy(deviceId: string): Promise<DeviceBackupPolicy>;
|
||||
updateDeviceBackupPolicy(
|
||||
deviceId: string,
|
||||
policy: DeviceBackupPolicy,
|
||||
): Promise<DeviceBackupPolicy>;
|
||||
disconnectDevice(deviceId: string): Promise<void>;
|
||||
getBackupSummary(deviceId: string): Promise<BackupSummary>;
|
||||
|
||||
getStorageSettings(): Promise<StorageSettings>;
|
||||
getAccount(): Promise<AccountSettings>;
|
||||
updateAccount(input: Readonly<Record<string, unknown>>): Promise<AccountSettings>;
|
||||
runStorageIntegrityScan(): Promise<void>;
|
||||
|
||||
createShare(
|
||||
target: ShareTarget,
|
||||
input: CreateShareInput,
|
||||
): Promise<ShareCreateResult>;
|
||||
revokeShare(shareId: string): Promise<void>;
|
||||
getPublicShare(token: string): Promise<PublicShare>;
|
||||
|
||||
preflightUpload(input: UploadPreflightInput): Promise<UploadPreflightResponse>;
|
||||
createUploadSession(input: Readonly<{
|
||||
deviceId?: string | null;
|
||||
deviceLocalAssetId: string;
|
||||
sourceType: "WEB_MANUAL";
|
||||
filename: string;
|
||||
expectedSize: number;
|
||||
mimeType: string;
|
||||
clientSha256?: string | null;
|
||||
}>): Promise<UploadSession>;
|
||||
appendUploadChunk(
|
||||
uploadSessionId: string,
|
||||
offset: number,
|
||||
chunk: Blob,
|
||||
): Promise<number>;
|
||||
commitUpload(uploadSessionId: string): Promise<UploadCommitResult>;
|
||||
abortUpload(uploadSessionId: string): Promise<void>;
|
||||
}
|
||||
@@ -0,0 +1,284 @@
|
||||
export type MementoEnvironment =
|
||||
| "local"
|
||||
| "development"
|
||||
| "staging"
|
||||
| "production";
|
||||
|
||||
export type MementoDataMode = "mock" | "api";
|
||||
|
||||
export type MementoRuntimeConfig = Readonly<{
|
||||
APP_ENV: MementoEnvironment;
|
||||
API_BASE_URL: string;
|
||||
REQUEST_TIMEOUT_MS: number;
|
||||
}>;
|
||||
|
||||
export type CursorPage<T> = Readonly<{
|
||||
items: readonly T[];
|
||||
nextCursor?: string | null;
|
||||
}>;
|
||||
|
||||
export type HomeResponse = Readonly<{
|
||||
suggestedMemory: Readonly<{
|
||||
candidateId: string;
|
||||
title: string;
|
||||
mediaCount: number;
|
||||
placeCount: number;
|
||||
momentCount: number;
|
||||
coverMedia: readonly unknown[];
|
||||
}> | null;
|
||||
rediscoveries: readonly unknown[];
|
||||
todayImport: Readonly<{
|
||||
uploadedCount: number;
|
||||
duplicateSkippedCount: number;
|
||||
items: readonly unknown[];
|
||||
}>;
|
||||
backup: Readonly<{
|
||||
deviceId: string;
|
||||
deviceName: string;
|
||||
progress: number;
|
||||
state: string;
|
||||
}> | null;
|
||||
repository: Readonly<{
|
||||
unorganizedCount: number;
|
||||
duplicateCandidateCount: number;
|
||||
originalBytes: number;
|
||||
quotaBytes: number;
|
||||
}>;
|
||||
}>;
|
||||
|
||||
export type LibraryItem = Readonly<{
|
||||
id: string;
|
||||
mediaType: "PHOTO" | "VIDEO" | string;
|
||||
thumbnailUrl: string;
|
||||
takenAt: string;
|
||||
durationMs?: number | null;
|
||||
width?: number | null;
|
||||
height?: number | null;
|
||||
favorite: boolean;
|
||||
processingState: string;
|
||||
duplicateState: string;
|
||||
badges: readonly string[];
|
||||
}>;
|
||||
|
||||
export type AlbumSummary = Readonly<{
|
||||
id: string;
|
||||
title: string;
|
||||
cover?: Readonly<{
|
||||
mediaId?: string;
|
||||
thumbnailUrl?: string;
|
||||
}> | null;
|
||||
mediaCount: number;
|
||||
shared: boolean;
|
||||
updatedAt?: string;
|
||||
version?: number;
|
||||
}>;
|
||||
|
||||
export type MemorySummary = Readonly<{
|
||||
id: string;
|
||||
title: string;
|
||||
cover?: Readonly<{
|
||||
mediaId?: string;
|
||||
thumbnailUrl?: string;
|
||||
}> | null;
|
||||
mediaCount?: number;
|
||||
startAt?: string;
|
||||
endAt?: string;
|
||||
updatedAt?: string;
|
||||
}>;
|
||||
|
||||
export type MemoryCandidate = Readonly<{
|
||||
id: string;
|
||||
title: string;
|
||||
startAt?: string;
|
||||
endAt?: string;
|
||||
mediaCount: number;
|
||||
momentCount: number;
|
||||
placeCount: number;
|
||||
coverMedia: readonly unknown[];
|
||||
score?: number;
|
||||
}>;
|
||||
|
||||
export type PersonSummary = Readonly<{
|
||||
id: string;
|
||||
displayName: string | null;
|
||||
representativeFaceUrl?: string | null;
|
||||
mediaCount: number;
|
||||
memoryCount: number;
|
||||
}>;
|
||||
|
||||
export type PlaceSummary = Readonly<{
|
||||
id: string;
|
||||
name: string;
|
||||
mediaCount: number;
|
||||
visitCount: number;
|
||||
center?: Readonly<{
|
||||
latitude: number;
|
||||
longitude: number;
|
||||
}>;
|
||||
}>;
|
||||
|
||||
export type DeviceSummary = Readonly<{
|
||||
id: string;
|
||||
name: string;
|
||||
platform: string;
|
||||
status: string;
|
||||
lastSeenAt?: string | null;
|
||||
lastSyncAt?: string | null;
|
||||
backup?: Readonly<{
|
||||
enabled: boolean;
|
||||
wifiOnly: boolean;
|
||||
}>;
|
||||
}>;
|
||||
|
||||
export type StorageSettings = Readonly<{
|
||||
quotaBytes: number;
|
||||
originalBytes: number;
|
||||
derivedBytes: number;
|
||||
trashBytes: number;
|
||||
freeBytes: number;
|
||||
health: string;
|
||||
lastIntegrityScanAt?: string | null;
|
||||
}>;
|
||||
|
||||
export type AccountSettings = Readonly<Record<string, unknown>>;
|
||||
|
||||
export type SearchResponse = Readonly<{
|
||||
people: readonly PersonSummary[];
|
||||
places: readonly PlaceSummary[];
|
||||
albums: readonly AlbumSummary[];
|
||||
memories: readonly MemorySummary[];
|
||||
media: readonly LibraryItem[];
|
||||
}>;
|
||||
|
||||
export type UploadPreflightInput = Readonly<{
|
||||
deviceId?: string | null;
|
||||
deviceLocalAssetId: string;
|
||||
filename: string;
|
||||
sizeBytes: number;
|
||||
mimeType: string;
|
||||
clientSha256?: string | null;
|
||||
takenAtHint?: string | null;
|
||||
}>;
|
||||
|
||||
export type UploadPreflightResponse =
|
||||
| Readonly<{
|
||||
decision: "UPLOAD_REQUIRED";
|
||||
recommendedChunkSize: number;
|
||||
}>
|
||||
| Readonly<{
|
||||
decision: "ALREADY_EXISTS";
|
||||
mediaAssetId: string;
|
||||
reason: string;
|
||||
}>
|
||||
| Readonly<{
|
||||
decision: "RESUME";
|
||||
uploadSessionId: string;
|
||||
receivedBytes: number;
|
||||
}>;
|
||||
|
||||
export type UploadSession = Readonly<{
|
||||
uploadSessionId: string;
|
||||
state: string;
|
||||
offset: number;
|
||||
chunkSize: number;
|
||||
expiresAt?: string;
|
||||
}>;
|
||||
|
||||
export type UploadCommitResult =
|
||||
| Readonly<{
|
||||
result: "CREATED";
|
||||
mediaAssetId: string;
|
||||
processingState: string;
|
||||
}>
|
||||
| Readonly<{
|
||||
result: "DUPLICATE_SKIPPED";
|
||||
duplicateType: string;
|
||||
existingMediaAssetId: string;
|
||||
}>;
|
||||
|
||||
export type ShareCreateResult = Readonly<{
|
||||
shareId: string;
|
||||
url: string;
|
||||
expiresAt?: string | null;
|
||||
allowDownload: boolean;
|
||||
version?: number;
|
||||
}>;
|
||||
|
||||
export type ApiErrorPayload = Readonly<{
|
||||
code?: string;
|
||||
message?: string;
|
||||
traceId?: string;
|
||||
details?: unknown;
|
||||
}>;
|
||||
|
||||
|
||||
export type MediaDetail = LibraryItem &
|
||||
Readonly<{
|
||||
filename?: string;
|
||||
originalUrl?: string;
|
||||
previewUrl?: string;
|
||||
metadata?: Readonly<Record<string, unknown>>;
|
||||
version?: number;
|
||||
}>;
|
||||
|
||||
export type AlbumDetail = AlbumSummary &
|
||||
Readonly<{
|
||||
description?: string | null;
|
||||
sortMode?: string;
|
||||
items?: readonly LibraryItem[];
|
||||
story?: readonly unknown[];
|
||||
}>;
|
||||
|
||||
export type MemoryDetail = MemorySummary &
|
||||
Readonly<{
|
||||
description?: string | null;
|
||||
placeNames?: readonly string[];
|
||||
items?: readonly LibraryItem[];
|
||||
moments?: readonly unknown[];
|
||||
story?: readonly unknown[];
|
||||
autoUpdate?: boolean;
|
||||
version?: number;
|
||||
}>;
|
||||
|
||||
export type DuplicateGroup = Readonly<{
|
||||
id: string;
|
||||
state: string;
|
||||
recommendedKeepMediaId?: string | null;
|
||||
items: readonly LibraryItem[];
|
||||
}>;
|
||||
|
||||
export type DuplicateResolutionInput = Readonly<{
|
||||
keepMediaId: string;
|
||||
trashMediaIds: readonly string[];
|
||||
}>;
|
||||
|
||||
export type DeviceBackupPolicy = Readonly<{
|
||||
enabled: boolean;
|
||||
wifiOnly: boolean;
|
||||
includeVideos: boolean;
|
||||
version?: number;
|
||||
}>;
|
||||
|
||||
export type BackupSummary = Readonly<{
|
||||
state: string;
|
||||
pendingCount: number;
|
||||
uploadedCount: number;
|
||||
duplicateSkippedCount: number;
|
||||
failedCount: number;
|
||||
lastCompletedAt?: string | null;
|
||||
}>;
|
||||
|
||||
export type PublicShare = Readonly<{
|
||||
shareId: string;
|
||||
title: string;
|
||||
targetType: "ALBUM" | "MEMORY" | string;
|
||||
allowDownload: boolean;
|
||||
expiresAt?: string | null;
|
||||
coverUrl?: string | null;
|
||||
items: readonly LibraryItem[];
|
||||
}>;
|
||||
|
||||
export type MementoCapabilities = Readonly<{
|
||||
apiVersion?: string;
|
||||
features?: Readonly<Record<string, boolean>>;
|
||||
}>;
|
||||
@@ -0,0 +1,24 @@
|
||||
import { useEffect } from "react";
|
||||
|
||||
import type { MementoGateway } from "../application/memento-gateway.ts";
|
||||
import { installMementoPrototypeIntegration } from "./memento-prototype-integration.ts";
|
||||
|
||||
/**
|
||||
* Non-visual bridge between the exact Beta prototype DOM and the Memento input
|
||||
* port. Adapter selection is a bootstrap concern; presentation only sees the
|
||||
* feature-owned gateway contract.
|
||||
*/
|
||||
export function MementoRuntimeBridge({
|
||||
gateway,
|
||||
}: Readonly<{ gateway: MementoGateway }>) {
|
||||
useEffect(() => {
|
||||
document.documentElement.dataset.mementoDataMode = gateway.mode;
|
||||
const cleanup = installMementoPrototypeIntegration(document.body, gateway);
|
||||
return () => {
|
||||
cleanup();
|
||||
delete document.documentElement.dataset.mementoDataMode;
|
||||
};
|
||||
}, [gateway]);
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { createMementoGateway } from "../../src/features/memento-web/adapters/create-memento-gateway.ts";
|
||||
import type { MementoEnvironment } from "../../src/features/memento-web/contracts/memento-api.ts";
|
||||
|
||||
const API_BASE_URL = "http://localhost:8080/";
|
||||
|
||||
function config(APP_ENV: MementoEnvironment) {
|
||||
return {
|
||||
APP_ENV,
|
||||
API_BASE_URL,
|
||||
REQUEST_TIMEOUT_MS: 10_000,
|
||||
} as const;
|
||||
}
|
||||
|
||||
describe("Memento environment gateway selection", () => {
|
||||
it("uses the deterministic mock only for local", async () => {
|
||||
const gateway = createMementoGateway(config("local"));
|
||||
|
||||
expect(gateway.mode).toBe("mock");
|
||||
const home = await gateway.getHome();
|
||||
expect(home.suggestedMemory?.title).toBe("제주, 여름의 끝");
|
||||
expect(home.repository.duplicateCandidateCount).toBe(14);
|
||||
});
|
||||
|
||||
it.each(["development", "staging", "production"] as const)(
|
||||
"uses the real BFF/API gateway for %s",
|
||||
(environment) => {
|
||||
expect(createMementoGateway(config(environment)).mode).toBe("api");
|
||||
},
|
||||
);
|
||||
});
|
||||
@@ -1,17 +1,27 @@
|
||||
import { defineConfig } from "vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
import { readFile } from "node:fs/promises";
|
||||
|
||||
import tailwindcss from "@tailwindcss/vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
import { defineConfig, type Plugin } from "vite";
|
||||
|
||||
import { viteModuleInventoryPlugin } from "./scripts/lib/vite-module-inventory.ts";
|
||||
|
||||
const RUNTIME_PROFILES = Object.freeze([
|
||||
"local",
|
||||
"development",
|
||||
"staging",
|
||||
"production",
|
||||
] as const);
|
||||
|
||||
type RuntimeProfile = (typeof RUNTIME_PROFILES)[number];
|
||||
|
||||
/**
|
||||
* §6.1. One sub-path, declared once.
|
||||
*
|
||||
* `VITE_ROUTER_BASE_PATH` already drives the router and the Service Worker
|
||||
* scope. Vite's asset `base` was left at its default, so a build served from
|
||||
* `/app/` emitted root-absolute asset URLs and loaded nothing: the three
|
||||
* consumers of the same setting disagreed. They are read from one value here so
|
||||
* a sub-path deployment is coherent or fails at build time.
|
||||
* VITE_ROUTER_BASE_PATH drives Vite assets and the optional Service Worker.
|
||||
* Memento's current beta shell does not need React Router, but retaining one
|
||||
* deployment base contract keeps the derived application compatible with the
|
||||
* frontend foundation.
|
||||
*/
|
||||
function routerBasePath(environment: NodeJS.ProcessEnv): string {
|
||||
const declared = environment["VITE_ROUTER_BASE_PATH"];
|
||||
@@ -24,9 +34,68 @@ function routerBasePath(environment: NodeJS.ProcessEnv): string {
|
||||
return declared;
|
||||
}
|
||||
|
||||
function runtimeProfile(environment: NodeJS.ProcessEnv): RuntimeProfile {
|
||||
const declared = environment["APP_PROFILE"] ?? "local";
|
||||
if ((RUNTIME_PROFILES as readonly string[]).includes(declared)) {
|
||||
return declared as RuntimeProfile;
|
||||
}
|
||||
throw new Error(
|
||||
`APP_PROFILE must be one of ${RUNTIME_PROFILES.join(", ")}; received ${declared}`,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Vite dev normally copies public/config.json, which would make every local
|
||||
* dev server run the local profile. This middleware serves config/runtime
|
||||
* directly so the runtime profile also works without a production build:
|
||||
*
|
||||
* pnpm dev -> local profile -> mock gateway
|
||||
* pnpm dev:api -> development profile -> real API gateway
|
||||
*
|
||||
* RUNTIME_API_BASE_URL may replace only the endpoint. No secret is accepted.
|
||||
*/
|
||||
function mementoRuntimeProfilePlugin(
|
||||
environment: NodeJS.ProcessEnv,
|
||||
): Plugin {
|
||||
const profile = runtimeProfile(environment);
|
||||
|
||||
return {
|
||||
name: "memento-runtime-profile",
|
||||
configureServer(server) {
|
||||
server.middlewares.use(async (request, response, next) => {
|
||||
const pathname = request.url?.split("?", 1)[0];
|
||||
if (pathname !== "/config.json" || request.method !== "GET") {
|
||||
next();
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const source = JSON.parse(
|
||||
await readFile(`config/runtime/${profile}.json`, "utf8"),
|
||||
) as Record<string, unknown>;
|
||||
const apiOverride = environment["RUNTIME_API_BASE_URL"];
|
||||
if (apiOverride) source["API_BASE_URL"] = apiOverride;
|
||||
|
||||
response.statusCode = 200;
|
||||
response.setHeader("Content-Type", "application/json; charset=utf-8");
|
||||
response.setHeader("Cache-Control", "no-store");
|
||||
response.end(`${JSON.stringify(source, null, 2)}\n`);
|
||||
} catch (error) {
|
||||
next(error as Error);
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export default defineConfig({
|
||||
base: routerBasePath(process.env),
|
||||
plugins: [react(), tailwindcss(), viteModuleInventoryPlugin()],
|
||||
plugins: [
|
||||
mementoRuntimeProfilePlugin(process.env),
|
||||
react(),
|
||||
tailwindcss(),
|
||||
viteModuleInventoryPlugin(),
|
||||
],
|
||||
build: {
|
||||
manifest: true,
|
||||
sourcemap: false,
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { resolve as resolvePath } from "node:path";
|
||||
import { pathToFileURL } from "node:url";
|
||||
import { defineConfig } from "vite";
|
||||
|
||||
import {
|
||||
@@ -20,17 +22,24 @@ import { resolveServiceWorkerBuildInput } from "./scripts/lib/service-worker-bui
|
||||
|
||||
const selection = INSTALLED_RUNTIME_CAPABILITIES.serviceWorker;
|
||||
|
||||
async function readGenerated<T>(path: string, exportName: string): Promise<T> {
|
||||
async function readGenerated<T>(
|
||||
relativePath: string,
|
||||
exportName: string,
|
||||
): Promise<T> {
|
||||
const moduleUrl = pathToFileURL(
|
||||
resolvePath(process.cwd(), relativePath),
|
||||
).href;
|
||||
try {
|
||||
const module = (await import(path)) as Record<string, unknown>;
|
||||
const module = (await import(moduleUrl)) as Record<string, unknown>;
|
||||
if (!(exportName in module)) {
|
||||
throw new TypeError(`Generated module does not export ${exportName}.`);
|
||||
}
|
||||
return module[exportName] as T;
|
||||
} catch (error) {
|
||||
throw new TypeError(`Required generated module is unavailable: ${path}`, {
|
||||
cause: error,
|
||||
});
|
||||
throw new TypeError(
|
||||
`Required generated module is unavailable: ${relativePath}`,
|
||||
{ cause: error },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +52,7 @@ const contractSet = await readGenerated<{ setDigest?: string }>(
|
||||
"BUILD_CONTRACT_SET",
|
||||
);
|
||||
const runtimeConfig = JSON.parse(
|
||||
await readFile("public/config.json", "utf8"),
|
||||
await readFile("dist/config.json", "utf8"),
|
||||
) as Record<string, string>;
|
||||
|
||||
const buildId = process.env.VITE_BUILD_ID ?? "local-build";
|
||||
@@ -58,6 +67,9 @@ const buildInput = resolveServiceWorkerBuildInput({
|
||||
});
|
||||
|
||||
export default defineConfig({
|
||||
// The app build already copied public/. Re-copying it in this second pass
|
||||
// would overwrite the profile-specific dist/config.json with public/config.json.
|
||||
publicDir: false,
|
||||
build: {
|
||||
// §17.2.2: exactly one input, exactly one output, no additional chunk.
|
||||
emptyOutDir: false,
|
||||
|
||||