-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathuser.html
More file actions
382 lines (340 loc) · 16 KB
/
user.html
File metadata and controls
382 lines (340 loc) · 16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>개인 상태 관리</title>
<style>
:root{
--glass-bg: rgba(255,255,255,0.03);
--glass-brd: rgba(255,255,255,0.1);
--glass-hover: rgba(255,255,255,0.06);
--text-strong: #fff;
--text: rgba(255,255,255,0.7);
--text-dim: rgba(255,255,255,0.5);
--accent: #4CAF50;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
background: #000;
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
padding: 40px;
}
.main-container { width: 100%; max-width: 1000px; }
/* 공통 카드 스타일 */
.card {
background: var(--glass-bg);
border: 1px solid var(--glass-brd);
border-radius: 20px;
padding: 25px 30px;
backdrop-filter: blur(10px);
transition: background .2s ease, border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.card:hover { background: var(--glass-hover); border-color: rgba(255,255,255,0.18); }
/* 상단 알림 */
.top-alert { display:flex; align-items:center; gap:10px; margin-bottom:30px; }
.top-alert .alert-icon {
width: 8px; height: 8px; background: var(--accent); border-radius: 50%;
box-shadow: 0 0 10px rgba(76,175,80,.5); animation: pulse 2s infinite;
}
.top-alert .alert-text { color: var(--text); font-size: 16px; letter-spacing: .5px; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.6} }
/* 로그인 상태 */
.login-status { display:flex; justify-content:space-between; align-items:center; margin-bottom: 30px; }
.login-indicator { display:flex; align-items:center; gap:12px; }
.status-dot {
width: 12px; height: 12px; background: var(--accent); border-radius: 50%;
box-shadow: 0 0 10px rgba(76,175,80,.5);
}
.login-text { color: var(--text-strong); font-size: 18px; font-weight: 600; letter-spacing: 1px; }
.user-info { color: var(--text-dim); font-size: 14px; }
/* 현재 선택된 상태 */
.current-status-card { margin-bottom: 30px; }
.section-head {
color: var(--text-strong); font-size: 22px; font-weight: 700; letter-spacing: 1px; margin-bottom: 16px;
}
.current-status-display {
color: rgba(255,255,255,0.9);
font-size: 32px; font-weight: 450; letter-spacing: 2px;
padding: 18px 0; border-top: 1px solid rgba(255,255,255,0.1); border-bottom: 1px solid rgba(255,255,255,0.1);
}
/* 상태 선택 섹션 */
.section-title {
color: var(--text-strong); font-size: 28px; font-weight: 700; text-align: center;
margin: 40px 0 22px; letter-spacing: 3px;
}
.status-grid {
display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-bottom: 30px;
}
.status-card { cursor: pointer; position: relative; }
.status-card.selected {
outline: 2px solid #ed098059;
box-shadow: 0 10px 30px #ed098026;
transform: translateY(-2px);
}
.status-card.selected.completed {
outline-color: rgba(76, 175, 80, 0.5);
box-shadow: 0 10px 30px rgba(76, 175, 80, 0.2);
}
.status-label { color: var(--text-strong); font-size: 20px; font-weight: 700; margin-bottom: 10px; letter-spacing: .5px; }
.status-description { color: var(--text-dim); font-size: 14px; line-height: 1.6; }
/* 기타 입력 박스 */
.etc-box { margin-top: 14px; display: none; gap: 10px; align-items: center; flex-wrap: wrap; }
.etc-row { display:flex; gap:10px; width:100%; }
.input {
width: 100%; height: 44px; padding: 0 14px; border-radius: 12px; outline: none; color: #fff; font-size: 14px;
background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
border: 1px solid rgba(255,255,255,0.16); box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}
.input::placeholder { color: var(--text-dim); }
.btn {
display:inline-flex; align-items:center; justify-content:center; height:44px; padding:0 16px; border-radius:12px; cursor:pointer;
background: linear-gradient(180deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05));
border:1px solid rgba(255,255,255,0.2); color:#fff; font-weight: 600; letter-spacing:.5px; transition: .2s;
backdrop-filter: blur(8px);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.secondary { background: linear-gradient(180deg, rgba(76,175,80,0.25), rgba(76,175,80,0.1)); border-color: rgba(76,175,80,0.45);}
/* 칩 리스트 */
.chip-list { display:flex; flex-wrap:wrap; gap:8px; margin-top: 8px; }
.chip {
display:inline-flex; align-items:center; gap:8px; padding:6px 10px; border-radius: 999px;
border:1px solid rgba(255,255,255,0.16); color:#fff; font-size:13px;
background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
}
.chip .del {
background: transparent;
border: 0;
color: #fff;
opacity: .7;
cursor: pointer;
font-size: 18px; /* ← 기존 14px → 18px */
line-height: 1;
padding: 0 4px; /* ← 클릭 영역 넓게 */
}
.chip .del:hover { opacity: 1; }
/* 완료 버튼 */
.submit-button {
display: block; margin: 34px auto 0; padding: 15px 50px;
background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 30px; color: #fff;
font-size: 18px; font-weight: 600; letter-spacing: 2px; cursor: pointer; transition: all 0.3s ease;
backdrop-filter: blur(10px);
}
.submit-button:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(76, 175, 80, 0.2); }
.submit-button:active { transform: translateY(0); }
/* 우상단 시계용 시간 표시 재활용 */
.time-display {
position: fixed; top: 30px; right: 30px; color: var(--text-dim); font-size: 14px; letter-spacing: 1px;
}
#etcAddBtn {
min-width: 50px;
white-space: nowrap;
}
/* 애니메이션 */
@keyframes fadeIn {
from { opacity: 0; transform: translateY(20px); }
to { opacity: 1; transform: translateY(0); }
}
.status-card, .current-status-card, .login-status { animation: fadeIn .5s ease-out; }
@media (max-width: 700px){
.status-grid { grid-template-columns: 1fr; }
}
</style>
</head>
<body>
<div class="main-container">
<!-- 상단 알림 -->
<div class="top-alert card">
<div class="alert-icon"></div>
<div class="alert-text">모바일 뷰: 본인 번호만 이동 가능한 단일 카드형 UI</div>
</div>
<!-- 로그인 상태 -->
<div class="login-status card">
<div class="login-indicator">
<div class="status-dot"></div>
<div class="login-text">로그인됨</div>
</div>
<div class="user-info">1학년 3반 7번</div>
</div>
<!-- 현재 선택된 상태 -->
<div class="current-status-card card">
<div class="section-head">현재 선택된 상태</div>
<div class="current-status-display" id="currentStatus">—</div>
</div>
<!-- 내 위치/상태 선택 -->
<h2 class="section-title">내 위치/상태 선택</h2>
<div class="status-grid">
<div class="status-card card" data-status="화장실(물)">
<div class="status-label">화장실(물)</div>
<div class="status-description">급히 자리 비움</div>
</div>
<div class="status-card card" data-status="복도">
<div class="status-label">복도</div>
<div class="status-description">교실 주변 이동</div>
</div>
<div class="status-card card" data-status="동아리">
<div class="status-label">동아리</div>
<div class="status-description">동아리실/활동</div>
</div>
<div class="status-card card" data-status="방과후">
<div class="status-label">방과후</div>
<div class="status-description">방과후</div>
</div>
<div class="status-card card" data-status="프로젝트">
<div class="status-label">프로젝트</div>
<div class="status-description">프로젝트실</div>
</div>
<div class="status-card card" data-status="조기입실">
<div class="status-label">조기입실</div>
<div class="status-description">아파요ㅠ</div>
</div>
<!-- ✅ 기타: 입력 가능 -->
<div class="status-card card" data-status="기타">
<div class="status-label">기타</div>
<div class="status-description">사유 직접 입력</div>
<div class="etc-box" id="etcBox" aria-hidden="true">
<div class="etc-row">
<input id="etcInput" class="input" type="text" placeholder="예: 병원 예약, 상담, 급한 용무 등 입력" />
<button id="etcAddBtn" class="btn secondary" type="button">추가</button>
</div>
<div id="etcChips" class="chip-list" aria-live="polite"></div>
</div>
</div>
<div class="status-card card" data-status="결석(조퇴)">
<div class="status-label">결석(조퇴)</div>
<div class="status-description">학교장 인정/사유 확인</div>
</div>
</div>
<!-- 완료 버튼 -->
<button class="submit-button" id="submitBtn">완료</button>
<!-- 시간 표시 -->
<div class="time-display" id="timeDisplay"></div>
</div>
<script>
// 현재 시간 표시
function updateTime() {
const now = new Date();
const timeString = now.toLocaleTimeString('ko-KR', { hour: '2-digit', minute: '2-digit', second: '2-digit' });
document.getElementById('timeDisplay').textContent = timeString;
}
updateTime();
setInterval(updateTime, 1000);
// 상태 카드 선택
let selectedStatus = null;
const statusCards = document.querySelectorAll('.status-card');
const currentStatusDisplay = document.getElementById('currentStatus');
// 기타 입력 요소
const etcCard = document.querySelector('.status-card[data-status="기타"]');
const etcBox = document.getElementById('etcBox');
const etcInput = document.getElementById('etcInput');
const etcAddBtn = document.getElementById('etcAddBtn');
const etcChips = document.getElementById('etcChips');
const etcItems = []; // UI 전용 임시 저장
function refreshCurrentStatus() {
if (selectedStatus === '기타' && etcItems.length > 0) {
currentStatusDisplay.textContent = `기타 - ${etcItems.join(', ')}`;
} else {
currentStatusDisplay.textContent = selectedStatus ?? '—';
}
currentStatusDisplay.style.animation = 'none';
setTimeout(() => { currentStatusDisplay.style.animation = 'fadeIn 0.3s ease-out'; }, 10);
}
function setSelected(card) {
// 이미 선택된 걸 다시 누른 경우 → 해제
if (selectedStatus === card.dataset.status) {
card.classList.remove('selected');
selectedStatus = null;
etcBox.style.display = 'none';
etcBox.setAttribute('aria-hidden', 'true');
refreshCurrentStatus();
return;
}
// 새로운 카드 선택
statusCards.forEach(c => c.classList.remove('selected', 'completed'));
card.classList.add('selected');
selectedStatus = card.dataset.status;
// 기타만 입력 박스 오픈
const isEtc = selectedStatus === '기타';
etcBox.style.display = isEtc ? 'flex' : 'none';
etcBox.setAttribute('aria-hidden', String(!isEtc));
refreshCurrentStatus();
if (isEtc) etcInput?.focus();
}
statusCards.forEach(card => {
card.addEventListener('click', () => setSelected(card));
});
// 기타 입력 추가
function addEtcItem(text) {
if (!text) return;
etcItems.length = 0; // 기존 입력 삭제
etcItems.push(text); // 새 입력만 저장
renderChips();
etcInput.value = '';
refreshCurrentStatus();
}
function renderChips() {
etcChips.innerHTML = '';
etcItems.forEach((txt, idx) => {
const chip = document.createElement('span');
chip.className = 'chip';
chip.innerHTML = `<span>${txt}</span><button class="del" aria-label="삭제" data-idx="${idx}">×</button>`;
etcChips.appendChild(chip);
});
}
[etcInput, etcAddBtn, etcChips].forEach(el => {
el.addEventListener('click', (e) => e.stopPropagation());
});
// 칩 삭제 핸들러에도 버블링 방지 추가
etcChips.addEventListener('click', (e) => {
e.stopPropagation(); // ← 추가
const btn = e.target.closest('.del');
if (!btn) return;
const idx = Number(btn.dataset.idx);
etcItems.splice(idx, 1);
renderChips();
refreshCurrentStatus();
});
etcAddBtn.addEventListener('click', () => addEtcItem(etcInput.value.trim()));
etcInput.addEventListener('keydown', (e) => {
if (e.key === 'Enter') {
e.preventDefault();
addEtcItem(etcInput.value.trim());
}
});
etcChips.addEventListener('click', (e) => {
const btn = e.target.closest('.del');
if (!btn) return;
const idx = Number(btn.dataset.idx);
etcItems.splice(idx, 1);
renderChips();
refreshCurrentStatus();
});
// 완료 버튼
document.getElementById('submitBtn').addEventListener('click', function() {
if (!selectedStatus) { alert('상태를 선택해주세요.'); return; }
// 선택된 카드에 completed 클래스 추가
const selectedCard = document.querySelector('.status-card.selected');
if (selectedCard) {
selectedCard.classList.add('completed');
}
const oldText = this.textContent;
this.style.transform = 'scale(0.95)';
this.textContent = '저장됨!';
this.style.background = 'linear-gradient(135deg, rgba(76, 175, 80, 0.3), rgba(76, 175, 80, 0.1))';
setTimeout(() => {
this.style.transform = '';
this.textContent = oldText;
this.style.background = '';
}, 1200);
console.log('선택 상태:', selectedStatus, selectedStatus === '기타' ? { 기타사유: [...etcItems] } : {});
});
// 초기: 아무것도 선택 안 함
</script>
</body>
</html>