benjamin5607 commited on
Commit
a0fa0db
Β·
verified Β·
1 Parent(s): 879c3c9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +77 -50
app.py CHANGED
@@ -8,7 +8,7 @@ import requests
8
  import io
9
 
10
  # ==========================================
11
- # πŸ” 1. μ‹œν¬λ¦Ώ 및 μ„€μ •
12
  # ==========================================
13
  GROQ_API_KEY = os.environ.get("GROQ_API_KEY", "")
14
  SHEET_URL = os.environ.get("PRIVATE_SHEET_URL", "")
@@ -24,7 +24,7 @@ st.markdown("""
24
  """, unsafe_allow_html=True)
25
 
26
  # ==========================================
27
- # 2. 데이터 처리
28
  # ==========================================
29
  PLACE_DB = {}
30
  try:
@@ -32,8 +32,11 @@ try:
32
  response = requests.get(SHEET_URL)
33
  response.encoding = 'utf-8'
34
  df = pd.read_csv(io.StringIO(response.text), on_bad_lines='skip')
 
 
35
  for col in df.select_dtypes(include=['object']).columns:
36
  df[col] = df[col].astype(str).str.replace(r'[\r\n\t]+', ' ', regex=True).str.replace('"', '\\"').str.replace("'", "\\'")
 
37
  if 'Country' in df.columns:
38
  for country, group in df.groupby('Country'):
39
  PLACE_DB[country] = group.fillna("").to_dict(orient='records')
@@ -49,7 +52,7 @@ db_json_str = json.dumps(PLACE_DB, ensure_ascii=False)
49
  db_base64 = base64.b64encode(db_json_str.encode('utf-8')).decode('utf-8')
50
 
51
  # ==========================================
52
- # 3. 톡합 ν”„λ‘ νŠΈμ—”λ“œ (μ—¬κΆŒ + μŠ€ν…œν”„ κΈ°λŠ₯ μΆ”κ°€)
53
  # ==========================================
54
  html_template = """
55
  <!DOCTYPE html>
@@ -64,32 +67,37 @@ html_template = """
64
  body { margin: 0; padding: 0; background: var(--dark); color: var(--text); font-family: 'Segoe UI', sans-serif; overflow: hidden; }
65
  .page { position: absolute; top: 0; left: 0; width: 100%; height: 100vh; transition: transform 0.5s ease; display: flex; flex-direction: column; }
66
 
67
- /* 상단 λ„€λΉ„κ²Œμ΄μ…˜ */
68
  .top-nav { height: 60px; display: flex; justify-content: space-between; align-items: center; padding: 0 20px; z-index: 500; }
69
- .passport-btn { font-size: 24px; cursor: pointer; background: rgba(255,255,255,0.1); padding: 8px; border-radius: 12px; }
 
 
 
70
 
71
- /* μ—¬κΆŒ νŽ˜μ΄μ§€ */
72
- #passport-page { background: #1e1e2e; z-index: 5000; transform: translateX(-100%); }
73
- .stamp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; padding: 20px; }
74
- .stamp { width: 80px; height: 80px; border-radius: 50%; border: 2px dashed #555; display: flex; align-items: center; justify-content: center; font-size: 10px; color: #555; text-align: center; }
75
- .stamp.active { border: 2px solid var(--gold); color: var(--gold); background: rgba(212,175,55,0.1); font-weight: bold; }
76
-
77
- /* 기타 μŠ€νƒ€μΌ (이전과 동일) */
78
- .lang-btn { background: rgba(0,0,0,0.5); border: 1px solid #555; color: #aaa; padding: 5px 10px; border-radius: 15px; cursor: pointer; font-size: 11px; }
79
- .lang-btn.active { background: var(--gold); color: black; font-weight: bold; }
80
  .type-filter-container { width: 100%; padding: 10px 0; overflow-x: auto; display: flex; gap: 8px; justify-content: center; }
81
- .type-btn { padding: 8px 16px; border-radius: 20px; font-size: 11px; background: #222; color: #888; border: 1px solid #444; white-space: nowrap; }
82
  .type-btn.selected { background: var(--gold); color: black; border-color: var(--gold); }
 
 
83
  .place-list-container { flex: 1; overflow-y: auto; padding: 0 20px 120px 20px; }
84
- .place-card { background: #1a1a1a; border: 1px solid #333; border-radius: 15px; padding: 18px; margin-bottom: 15px; }
85
- .pc-header { display: flex; justify-content: space-between; align-items: center; }
86
- .pc-name { font-size: 18px; font-weight: bold; color: var(--gold); }
87
- .pc-label { font-size: 10px; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--gold); color: var(--gold); }
88
- .pc-desc { font-size: 13px; color: #bbb; margin: 8px 0; line-height: 1.5; }
89
- .btn-action { padding: 10px 18px; border-radius: 8px; border: none; cursor: pointer; font-weight: bold; font-size: 12px; }
90
- .bartender-btn { position: fixed; bottom: 30%; right: 20px; width: 85px; height: 85px; border-radius: 50%; background-image: url('IMAGE_DATA'); background-size: cover; border: 3px solid var(--gold); z-index: 999; }
91
-
92
- #world-map-page { background: #111; z-index: 2000; transform: translateY(100%); }
 
 
 
 
 
 
 
 
93
  #chat-page { background: #000; z-index: 3000; transform: translateY(100%); }
94
  #detail-page { background: #0a0a0a; z-index: 4000; transform: translateX(100%); }
95
  .nav-bar { height: 60px; display: flex; align-items: center; padding: 0 20px; border-bottom: 1px solid #222; }
@@ -99,33 +107,38 @@ html_template = """
99
  <div id="main-page" class="page">
100
  <div class="top-nav">
101
  <div class="passport-btn" onclick="openPassport()">🎫</div>
102
- <div style="display: flex; gap: 5px;">
103
  <div class="lang-btn active" id="btn-KO" onclick="setLanguage('KO', this)">πŸ‡°πŸ‡·</div>
104
  <div class="lang-btn" id="btn-EN" onclick="setLanguage('EN', this)">πŸ‡ΊπŸ‡Έ</div>
 
 
105
  </div>
106
  </div>
107
- <div style="text-align:center; padding-bottom: 10px;">
108
- <div style="color:var(--gold); font-size: 26px; font-weight: 900; letter-spacing: 3px;">DRUNKEN PLANE</div>
109
- <button onclick="openMap()" style="margin-top:10px; padding:10px 20px; background:var(--gold); border:none; border-radius:30px; font-weight:bold;">πŸ—ΊοΈ WORLD MAP</button>
 
110
  </div>
111
- <center><select id="country-select" style="width:85%; padding:12px; background:#111; border:1px solid var(--gold); color:white; border-radius:10px;" onchange="selectCountry(this.value)"></select></center>
 
 
112
  <div class="type-filter-container" id="filter-box"></div>
113
  <div class="place-list-container" id="place-list"></div>
114
  <div class="bartender-btn" onclick="openChat()"></div>
115
  </div>
116
 
117
  <div id="passport-page" class="page">
118
- <div class="nav-bar"><button onclick="closePassport()" style="background:none; border:none; color:var(--gold); font-size:24px;">←</button><span style="margin-left:15px; font-weight:bold;">MY PASSPORT</span></div>
119
- <div style="padding:20px; text-align:center;">
120
- <h2 id="passport-stat" style="color:var(--gold);">0 STAMPS</h2>
121
- <p style="color:#888; font-size:12px;">Visit places to get your stamps!</p>
122
  </div>
123
- <div class="stamp-grid" id="stamp-grid"></div>
124
  </div>
125
 
126
- <div id="world-map-page" class="page"><div class="nav-bar"><button onclick="closeMap()">🏠 HOME</button></div><div id="full-map" style="width:100%; height:100%;"></div></div>
127
- <div id="chat-page" class="page"><div class="nav-bar"><button onclick="closeChat()">←</button> Emily</div><div id="chat-messages" style="flex:1; overflow-y:auto; padding:20px;"></div></div>
128
- <div id="detail-page" class="page"><div class="nav-bar"><button onclick="closeDetail()">←</button> Report</div><div id="repo-content" style="padding:20px;"></div></div>
129
 
130
  <script>
131
  function b64DecodeUnicode(str) { return decodeURIComponent(atob(str).split('').map(function(c) { return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2); }).join('')); }
@@ -135,7 +148,9 @@ html_template = """
135
 
136
  const TRANSLATIONS = {
137
  "KO": { "aiBtn": "AI 리뷰", "mapBtn": "지도", "filters": ["🌐 전체", "🏺 전톡주", "πŸ₯ƒ μœ„μŠ€ν‚€", "🍺 λ§₯μ£Ό", "🍷 와인", "🍹 λ°”"], "types": ["All", "Traditional", "Whiskey", "Beer", "Wine", "Bar"] },
138
- "EN": { "aiBtn": "AI REVIEW", "mapBtn": "MAP", "filters": ["🌐 All", "🏺 Trad.", "πŸ₯ƒ Whiskey", "🍺 Beer", "🍷 Wine", "🍹 Bar"], "types": ["All", "Traditional", "Whiskey", "Beer", "Wine", "Bar"] }
 
 
139
  };
140
 
141
  window.onload = function() {
@@ -146,6 +161,13 @@ html_template = """
146
  renderFilters();
147
  };
148
 
 
 
 
 
 
 
 
149
  function renderFilters() {
150
  const box = document.getElementById('filter-box'); box.innerHTML = "";
151
  const t = TRANSLATIONS[currentLang];
@@ -156,7 +178,6 @@ html_template = """
156
  });
157
  }
158
 
159
- function setLanguage(l, el) { currentLang = l; document.querySelectorAll('.lang-btn').forEach(b => b.classList.remove('active')); el.classList.add('active'); renderFilters(); renderList(); }
160
  function selectCountry(c) { selectedCountry = c; renderList(); }
161
 
162
  function markVisited(name) {
@@ -169,14 +190,17 @@ html_template = """
169
  function renderList() {
170
  const list = document.getElementById('place-list'); list.innerHTML = "";
171
  const filtered = (PLACE_DB[selectedCountry] || []).filter(p => selectedType === "All" || p.category === selectedType);
 
 
172
  filtered.forEach(p => {
173
  const card = document.createElement('div'); card.className = 'place-card';
 
174
  card.innerHTML = `
175
  <div class="pc-header"><div class="pc-name">${p.name}</div><div class="pc-label">${p.category}</div></div>
176
- <div class="pc-desc">${p.desc_ko}</div>
177
- <div style="display:flex; gap:10px;">
178
- <button class="btn-action" style="background:var(--gold);" onclick="markVisited('${p.name}'); openReview('${p.name}')">${TRANSLATIONS[currentLang].aiBtn}</button>
179
- <button class="btn-action" style="background:#333; color:white;" onclick="markVisited('${p.name}'); window.open('https://google.com/maps/search/${p.name}', '_blank')">${TRANSLATIONS[currentLang].mapBtn}</button>
180
  </div>`;
181
  list.appendChild(card);
182
  });
@@ -186,31 +210,34 @@ html_template = """
186
  document.getElementById('passport-page').style.transform = 'translateX(0%)';
187
  const grid = document.getElementById('stamp-grid'); grid.innerHTML = "";
188
  document.getElementById('passport-stat').innerText = visitedPlaces.length + " STAMPS";
189
-
190
- // λͺ¨λ“  κ΅­κ°€μ˜ μž₯μ†Œλ“€μ— λŒ€ν•΄ μŠ€ν…œν”„ μΉΈ 생성
191
  for(let c in PLACE_DB) {
192
  PLACE_DB[c].forEach(p => {
193
- const isVisited = visitedPlaces.includes(p.name);
194
- const div = document.createElement('div');
195
- div.className = 'stamp' + (isVisited ? ' active' : '');
196
- div.innerHTML = isVisited ? `✈️<br>${p.name}` : `?`;
197
  grid.appendChild(div);
198
  });
199
  }
200
  }
201
 
 
202
  function closePassport() { document.getElementById('passport-page').style.transform = 'translateX(-100%)'; }
203
  function openMap() { document.getElementById('world-map-page').style.transform = 'translateY(0%)'; }
204
  function closeMap() { document.getElementById('world-map-page').style.transform = 'translateY(100%)'; }
205
  function openChat() { document.getElementById('chat-page').style.transform = 'translateY(0%)'; }
206
  function closeChat() { document.getElementById('chat-page').style.transform = 'translateY(100%)'; }
207
- function openReview(n) { document.getElementById('detail-page').style.transform = 'translateX(0%)'; document.getElementById('repo-content').innerText = n + "의 에밀리 리뷰 λ‘œλ”©μ€‘..."; }
 
 
 
 
208
  function closeDetail() { document.getElementById('detail-page').style.transform = 'translateX(100%)'; }
209
  </script>
210
  </body>
211
  </html>
212
  """
213
 
 
214
  html_code = html_template.replace("IMAGE_DATA", f"data:image/jpeg;base64,{emily_base64}")
215
  html_code = html_code.replace("DB_DATA_BASE64", db_base64)
216
  html_code = html_code.replace("GROQ_KEY", GROQ_API_KEY)
 
8
  import io
9
 
10
  # ==========================================
11
+ # πŸ” 1. μ‹œν¬λ¦Ώ 및 κΈ°λ³Έ μ„€μ •
12
  # ==========================================
13
  GROQ_API_KEY = os.environ.get("GROQ_API_KEY", "")
14
  SHEET_URL = os.environ.get("PRIVATE_SHEET_URL", "")
 
24
  """, unsafe_allow_html=True)
25
 
26
  # ==========================================
27
+ # 2. 데이터 λ‘œλ“œ 및 μ •μ œ
28
  # ==========================================
29
  PLACE_DB = {}
30
  try:
 
32
  response = requests.get(SHEET_URL)
33
  response.encoding = 'utf-8'
34
  df = pd.read_csv(io.StringIO(response.text), on_bad_lines='skip')
35
+
36
+ # ν…μŠ€νŠΈ μ •μ œ (JSON νŒŒμ‹± μ—λŸ¬ λ°©μ§€)
37
  for col in df.select_dtypes(include=['object']).columns:
38
  df[col] = df[col].astype(str).str.replace(r'[\r\n\t]+', ' ', regex=True).str.replace('"', '\\"').str.replace("'", "\\'")
39
+
40
  if 'Country' in df.columns:
41
  for country, group in df.groupby('Country'):
42
  PLACE_DB[country] = group.fillna("").to_dict(orient='records')
 
52
  db_base64 = base64.b64encode(db_json_str.encode('utf-8')).decode('utf-8')
53
 
54
  # ==========================================
55
+ # 3. 톡합 ν”„λ‘ νŠΈμ—”λ“œ (μ „ κΈ°λŠ₯ 볡원)
56
  # ==========================================
57
  html_template = """
58
  <!DOCTYPE html>
 
67
  body { margin: 0; padding: 0; background: var(--dark); color: var(--text); font-family: 'Segoe UI', sans-serif; overflow: hidden; }
68
  .page { position: absolute; top: 0; left: 0; width: 100%; height: 100vh; transition: transform 0.5s ease; display: flex; flex-direction: column; }
69
 
70
+ /* λ„€λΉ„κ²Œμ΄μ…˜ & UI */
71
  .top-nav { height: 60px; display: flex; justify-content: space-between; align-items: center; padding: 0 20px; z-index: 500; }
72
+ .passport-btn { font-size: 26px; cursor: pointer; background: rgba(255,215,0,0.1); padding: 8px; border-radius: 15px; border: 1px solid rgba(212,175,55,0.3); }
73
+ .lang-switcher { display: flex; gap: 6px; }
74
+ .lang-btn { background: rgba(0,0,0,0.6); border: 1px solid #444; color: #888; padding: 6px 12px; border-radius: 20px; cursor: pointer; font-size: 11px; }
75
+ .lang-btn.active { background: var(--gold); color: black; font-weight: bold; border-color: var(--gold); }
76
 
77
+ /* μΉ΄ν…Œκ³ λ¦¬ ν•„ν„° */
 
 
 
 
 
 
 
 
78
  .type-filter-container { width: 100%; padding: 10px 0; overflow-x: auto; display: flex; gap: 8px; justify-content: center; }
79
+ .type-btn { padding: 8px 16px; border-radius: 20px; font-size: 11px; font-weight: bold; background: #1a1a1a; color: #777; border: 1px solid #333; white-space: nowrap; cursor: pointer; }
80
  .type-btn.selected { background: var(--gold); color: black; border-color: var(--gold); }
81
+
82
+ /* μž₯μ†Œ μΉ΄λ“œ */
83
  .place-list-container { flex: 1; overflow-y: auto; padding: 0 20px 120px 20px; }
84
+ .place-card { background: #161616; border: 1px solid #2a2a2a; border-radius: 18px; padding: 20px; margin-bottom: 15px; position: relative; }
85
+ .pc-header { display: flex; justify-content: space-between; align-items: flex-start; }
86
+ .pc-name { font-size: 19px; font-weight: bold; color: var(--gold); margin-bottom: 5px; }
87
+ .pc-label { font-size: 10px; padding: 3px 9px; border-radius: 12px; background: rgba(212,175,55,0.1); color: var(--gold); border: 1px solid var(--gold); font-weight: 900; }
88
+ .pc-desc { font-size: 13.5px; color: #aaa; line-height: 1.6; margin: 10px 0; }
89
+ .btn-action { flex: 1; padding: 12px; border-radius: 10px; border: none; font-weight: bold; cursor: pointer; font-size: 12px; }
90
+
91
+ /* μ—¬κΆŒ & μŠ€ν…œν”„ */
92
+ #passport-page { background: #0f0f1b; z-index: 5000; transform: translateX(-100%); }
93
+ .stamp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; padding: 20px; }
94
+ .stamp { height: 90px; border-radius: 15px; border: 2px dashed #333; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 10px; color: #444; background: #161625; }
95
+ .stamp.active { border: 2px solid var(--gold); color: var(--gold); background: rgba(212,175,55,0.05); }
96
+
97
+ /* 에밀리 λ²„νŠΌ */
98
+ .bartender-btn { position: fixed; bottom: 30%; right: 20px; width: 85px; height: 85px; border-radius: 50%; background-image: url('IMAGE_DATA'); background-size: cover; border: 3px solid var(--gold); z-index: 999; box-shadow: 0 0 20px rgba(212,175,55,0.5); }
99
+
100
+ #world-map-page { background: #000; z-index: 2000; transform: translateY(100%); }
101
  #chat-page { background: #000; z-index: 3000; transform: translateY(100%); }
102
  #detail-page { background: #0a0a0a; z-index: 4000; transform: translateX(100%); }
103
  .nav-bar { height: 60px; display: flex; align-items: center; padding: 0 20px; border-bottom: 1px solid #222; }
 
107
  <div id="main-page" class="page">
108
  <div class="top-nav">
109
  <div class="passport-btn" onclick="openPassport()">🎫</div>
110
+ <div class="lang-switcher">
111
  <div class="lang-btn active" id="btn-KO" onclick="setLanguage('KO', this)">πŸ‡°πŸ‡·</div>
112
  <div class="lang-btn" id="btn-EN" onclick="setLanguage('EN', this)">πŸ‡ΊπŸ‡Έ</div>
113
+ <div class="lang-btn" id="btn-JP" onclick="setLanguage('JP', this)">πŸ‡―πŸ‡΅</div>
114
+ <div class="lang-btn" id="btn-CN" onclick="setLanguage('CN', this)">πŸ‡¨πŸ‡³</div>
115
  </div>
116
  </div>
117
+
118
+ <div style="text-align:center; padding: 10px 0;">
119
+ <div style="color:var(--gold); font-size: 28px; font-weight: 900; letter-spacing: 4px;">DRUNKEN PLANE</div>
120
+ <button onclick="openMap()" style="margin-top:15px; padding:12px 25px; background:var(--gold); border:none; border-radius:30px; font-weight:bold; cursor:pointer;">πŸ—ΊοΈ EXPLORE WORLD MAP</button>
121
  </div>
122
+
123
+ <center><select id="country-select" style="width:85%; max-width:400px; padding:12px; background:#111; border:1px solid var(--gold); color:white; border-radius:10px; margin-bottom:10px;" onchange="selectCountry(this.value)"></select></center>
124
+
125
  <div class="type-filter-container" id="filter-box"></div>
126
  <div class="place-list-container" id="place-list"></div>
127
  <div class="bartender-btn" onclick="openChat()"></div>
128
  </div>
129
 
130
  <div id="passport-page" class="page">
131
+ <div class="nav-bar"><button onclick="closePassport()" style="background:none; border:none; color:var(--gold); font-size:24px;">←</button><span style="margin-left:15px; font-weight:bold; color:var(--gold)">TRAVELER PASSPORT</span></div>
132
+ <div style="padding:30px; text-align:center; background:#161625; margin:20px; border-radius:20px; border:1px solid #2a2a3a;">
133
+ <div style="font-size:12px; color:#888;">TOTAL VISITED</div>
134
+ <h1 id="passport-stat" style="color:var(--gold); margin:10px 0;">0 STAMPS</h1>
135
  </div>
136
+ <div class="stamp-grid" id="stamp-grid" style="overflow-y:auto;"></div>
137
  </div>
138
 
139
+ <div id="world-map-page" class="page"><div class="nav-bar"><button onclick="closeMap()" style="background:none; border:none; color:var(--gold);">🏠 HOME</button></div><div id="full-map" style="width:100%; height:100%;"></div></div>
140
+ <div id="chat-page" class="page"><div class="nav-bar"><button onclick="closeChat()" style="background:none; border:none; color:var(--gold); font-size:24px;">←</button><span style="margin-left:15px; font-weight:bold; color:var(--gold)">Emily Chat</span></div><div id="chat-messages" style="flex:1; overflow-y:auto; padding:20px;"></div></div>
141
+ <div id="detail-page" class="page"><div class="nav-bar"><button onclick="closeDetail()" style="background:none; border:none; color:var(--gold); font-size:24px;">←</button><span id="repo-header" style="margin-left:15px; font-weight:bold;">Report</span></div><div id="repo-content" style="padding:20px; white-space:pre-wrap; line-height:1.7; color:#ddd;"></div></div>
142
 
143
  <script>
144
  function b64DecodeUnicode(str) { return decodeURIComponent(atob(str).split('').map(function(c) { return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2); }).join('')); }
 
148
 
149
  const TRANSLATIONS = {
150
  "KO": { "aiBtn": "AI 리뷰", "mapBtn": "지도", "filters": ["🌐 전체", "🏺 전톡주", "πŸ₯ƒ μœ„μŠ€ν‚€", "🍺 λ§₯μ£Ό", "🍷 와인", "🍹 λ°”"], "types": ["All", "Traditional", "Whiskey", "Beer", "Wine", "Bar"] },
151
+ "EN": { "aiBtn": "AI REVIEW", "mapBtn": "MAP", "filters": ["🌐 All", "🏺 Trad.", "πŸ₯ƒ Whiskey", "🍺 Beer", "🍷 Wine", "🍹 Bar"], "types": ["All", "Traditional", "Whiskey", "Beer", "Wine", "Bar"] },
152
+ "JP": { "aiBtn": "AI レビγƒ₯γƒΌ", "mapBtn": "εœ°ε›³", "filters": ["🌐 全部", "🏺 伝硱酒", "πŸ₯ƒ ウむスキー", "🍺 ビール", "🍷 ワむン", "🍹 バー"], "types": ["All", "Traditional", "Whiskey", "Beer", "Wine", "Bar"] },
153
+ "CN": { "aiBtn": "AI η‚Ήθ―„", "mapBtn": "εœ°ε›Ύ", "filters": ["🌐 全部", "🏺 δΌ η»Ÿι…’", "πŸ₯ƒ 威士忌", "🍺 ε•€ι…’", "🍷 葑萄酒", "🍹 酒吧"], "types": ["All", "Traditional", "Whiskey", "Beer", "Wine", "Bar"] }
154
  };
155
 
156
  window.onload = function() {
 
161
  renderFilters();
162
  };
163
 
164
+ function setLanguage(l, el) {
165
+ currentLang = l;
166
+ document.querySelectorAll('.lang-btn').forEach(b => b.classList.remove('active'));
167
+ el.classList.add('active');
168
+ renderFilters(); renderList();
169
+ }
170
+
171
  function renderFilters() {
172
  const box = document.getElementById('filter-box'); box.innerHTML = "";
173
  const t = TRANSLATIONS[currentLang];
 
178
  });
179
  }
180
 
 
181
  function selectCountry(c) { selectedCountry = c; renderList(); }
182
 
183
  function markVisited(name) {
 
190
  function renderList() {
191
  const list = document.getElementById('place-list'); list.innerHTML = "";
192
  const filtered = (PLACE_DB[selectedCountry] || []).filter(p => selectedType === "All" || p.category === selectedType);
193
+ const t = TRANSLATIONS[currentLang];
194
+
195
  filtered.forEach(p => {
196
  const card = document.createElement('div'); card.className = 'place-card';
197
+ const desc = p['desc_'+currentLang.toLowerCase()] || p.desc_ko || "Discovering...";
198
  card.innerHTML = `
199
  <div class="pc-header"><div class="pc-name">${p.name}</div><div class="pc-label">${p.category}</div></div>
200
+ <div class="pc-desc">${desc}</div>
201
+ <div style="display:flex; gap:10px; margin-top:15px;">
202
+ <button class="btn-action" style="background:var(--gold); color:black;" onclick="markVisited('${p.name}'); openReview('${p.name}', '${selectedCountry}')">${t.aiBtn}</button>
203
+ <button class="btn-action" style="background:#333; color:white;" onclick="markVisited('${p.name}'); window.open('https://www.google.com/maps/search/${p.name}', '_blank')">${t.mapBtn}</button>
204
  </div>`;
205
  list.appendChild(card);
206
  });
 
210
  document.getElementById('passport-page').style.transform = 'translateX(0%)';
211
  const grid = document.getElementById('stamp-grid'); grid.innerHTML = "";
212
  document.getElementById('passport-stat').innerText = visitedPlaces.length + " STAMPS";
 
 
213
  for(let c in PLACE_DB) {
214
  PLACE_DB[c].forEach(p => {
215
+ const active = visitedPlaces.includes(p.name);
216
+ const div = document.createElement('div'); div.className = 'stamp' + (active ? ' active' : '');
217
+ div.innerHTML = active ? `<span style="font-size:20px;">🍷</span><br><b>${p.name}</b><br>${c}` : `<span style="font-size:20px; filter:grayscale(1);">✈️</span>`;
 
218
  grid.appendChild(div);
219
  });
220
  }
221
  }
222
 
223
+ // --- κΈ°λŠ₯ ν•¨μˆ˜λ“€ ---
224
  function closePassport() { document.getElementById('passport-page').style.transform = 'translateX(-100%)'; }
225
  function openMap() { document.getElementById('world-map-page').style.transform = 'translateY(0%)'; }
226
  function closeMap() { document.getElementById('world-map-page').style.transform = 'translateY(100%)'; }
227
  function openChat() { document.getElementById('chat-page').style.transform = 'translateY(0%)'; }
228
  function closeChat() { document.getElementById('chat-page').style.transform = 'translateY(100%)'; }
229
+ function openReview(n, c) {
230
+ document.getElementById('detail-page').style.transform = 'translateX(0%)';
231
+ document.getElementById('repo-header').innerText = n;
232
+ document.getElementById('repo-content').innerText = "Emily is writing a review for " + n + "...";
233
+ }
234
  function closeDetail() { document.getElementById('detail-page').style.transform = 'translateX(100%)'; }
235
  </script>
236
  </body>
237
  </html>
238
  """
239
 
240
+ # μ΅œμ’… 데이터 μ£Όμž…
241
  html_code = html_template.replace("IMAGE_DATA", f"data:image/jpeg;base64,{emily_base64}")
242
  html_code = html_code.replace("DB_DATA_BASE64", db_base64)
243
  html_code = html_code.replace("GROQ_KEY", GROQ_API_KEY)