Compare commits

..

2 Commits

11 changed files with 237 additions and 53 deletions

View File

@@ -37,6 +37,8 @@ function mapUserRow(row) {
isAdmin: !!row.is_admin,
avatarSrc: row.avatar_src || '',
createdAt: Number(row.created_at),
tierListCount: Number(row.tierlist_count || 0),
recentActivityAt: Number(row.recent_activity_at || row.created_at || 0),
}
}
@@ -326,9 +328,24 @@ async function updateUserProfile({ id, nickname, avatarSrc }) {
}
async function listUsers() {
const rows = await query(
'SELECT id, email, nickname, is_admin, avatar_src, created_at FROM users ORDER BY created_at ASC, email ASC'
)
const rows = await query(`
SELECT
u.id,
u.email,
u.nickname,
u.is_admin,
u.avatar_src,
u.created_at,
COUNT(t.id) AS tierlist_count,
GREATEST(
u.created_at,
COALESCE(MAX(t.updated_at), 0)
) AS recent_activity_at
FROM users u
LEFT JOIN tierlists t ON t.author_id = u.id
GROUP BY u.id, u.email, u.nickname, u.is_admin, u.avatar_src, u.created_at
ORDER BY recent_activity_at DESC, u.created_at ASC, u.email ASC
`)
return rows.map(mapUserRow)
}

View File

@@ -1,5 +1,13 @@
# 의사결정 이력
## 2026-03-27 v0.1.46
- 티어표 편집 중 등급 행에 넣은 아이템도 다시 제외할 수 있어야 배치 실험이 쉬우므로, 별도 제거 버튼으로 아이템 풀로 되돌리는 흐름을 제공하기로 결정했다.
- 관리자 회원 관리는 수정 기능만으로는 부족하므로, 운영 판단에 바로 필요한 아바타, 작성 티어표 수, 최근 활동 시각을 함께 보여주기로 했다.
## 2026-03-27 v0.1.45
- 카드형 목록의 별표는 개수 표시로 읽히기 쉬우므로, 목록에서는 상태/개수만 보여주고 실제 즐겨찾기 토글은 상세 화면에서 처리하는 편이 오해가 적다고 정리했다.
- 토스트는 같은 메시지가 짧게 반복될 때 누적 표시가 더 낫고, 종료도 급격히 끊기지 않도록 페이드아웃을 넣는 편이 사용자 경험상 자연스럽다고 판단했다.
## 2026-03-27 v0.1.44
- 전역 토스트는 공통 composable을 템플릿에 넘길 때 top-level ref로 풀어줘야 하므로, 렌더링 구조를 단순하게 유지하는 편이 안전하다고 정리했다.
- 공개 티어표가 많아질수록 게임별 목록 안에서 바로 제목/작성자 검색이 가능해야 하므로, 검색은 별도 페이지보다 각 게임 허브 안에서 먼저 제공하기로 결정했다.

View File

@@ -125,16 +125,19 @@
- `티어표 관리` 탭에서는 티어표 안의 커스텀 아이템을 개별 또는 일괄로 기존 게임 템플릿에 복제할 수 있다.
- `freeform` 티어표는 관리자 화면에서 새 게임 ID/이름을 입력해 새로운 게임 템플릿으로 복제 생성할 수 있다.
- 관리자 화면에서는 회원 이메일/닉네임/권한 수정, 비밀번호 초기화, 계정 삭제가 가능하다.
- 회원 관리 카드에는 아바타, 작성 티어표 수, 최근 활동 시각을 함께 표시한다.
## 티어표 접근 메모
- `new` 작성 경로는 로그인한 사용자만 진입할 수 있다.
- 비로그인 사용자는 공개된 티어표를 열람만 할 수 있고, 편집 UI와 저장 동작은 비활성화된다.
- 비공개 티어표라도 관리자는 편집 화면에서 완성본을 열람할 수 있다.
- 공개 티어표는 목록과 상세 화면에서 즐겨찾기 토글 및 개수를 함께 표시한다.
- 카드형 목록에서는 즐겨찾기 수/상태만 표시하고, 실제 토글은 상세 화면에서 처리한다.
- 공개 티어표 목록은 현재 게임 기준으로 제목/작성자 검색을 지원한다.
- `내 즐겨찾기` 화면에서는 즐겨찾기한 순, 최신 업데이트순, 인기순 정렬을 제공한다.
- 커스텀 이미지 추가는 다중 파일 선택과 드래그 앤 드롭을 모두 지원한다.
- 티어 행은 기본 5단으로 시작하지만, 사용자가 직접 추가하거나 제거할 수 있다.
- 티어 행에 넣은 아이템은 작은 제거 버튼으로 다시 우측 아이템 풀로 되돌릴 수 있다.
- 신규 티어표의 공개 여부 기본값은 `ON`이며, 기존 티어표는 편집 화면과 `내 티어표` 목록에서 직접 삭제할 수 있다.
- 제목이 비어 있는 상태로 저장하면 내부 제목은 현재 게임명을 기본값으로 사용한다.
- 제목 입력이 비어 있는 동안에는 무분별한 도배 방지를 위한 관리자 임의 삭제 가능성 안내 문구를 표시한다.
@@ -146,6 +149,7 @@
- 티어표 목록 메타 정보는 최종 업데이트 시각만 간략하게 표시한다.
- 저장 성공 시에는 에디터 안에서 반투명 오버레이 기반 확인 모달을 띄우고, PNG export 이미지는 약 `960px` 보드 폭과 `pixelRatio 1.5`, 외곽 여백, 작성자/날짜 하단 메타를 포함해 생성한다.
- 저장/삭제/가져오기 같은 사용자 행동 피드백은 전역 우측 상단 토스트로 표시한다.
- 전역 토스트는 동일 메시지/타입이 연속 발생하면 하나로 합쳐 카운트를 올리고, 종료 시 짧은 페이드아웃 애니메이션을 사용한다.
- 홈 게임 목록은 관리자 상단 고정 순서가 있으면 그 순서를 먼저 적용하고, 그 외 게임은 최근 생성순으로 뒤에 이어진다.
- `커스텀 티어표 만들기`는 카드가 아니라 홈 우측 상단 버튼으로 진입한다.

View File

@@ -1,7 +1,6 @@
# 할 일 및 이슈
## 즉시 확인 필요
- 회원 관리에서 아바타/작성 티어표 수/최근 활동 같은 보조 정보는 아직 표시하지 않는다.
- 미사용 커스텀 이미지 일괄 삭제는 현재 "참조가 없는 항목" 기준이며, 보관 기간 정책 같은 운영 규칙은 아직 없다.
- 업로드 이미지는 현재 원본 파일을 그대로 저장하므로, 운영 부담이 커지면 서버 저장 전 리사이즈/압축(예: 긴 변 제한, WebP 변환) 도입이 필요하다.
- 관리자 기본 아이템 다중 업로드는 현재 파일명 기반 자동 라벨만 지원하므로, 필요하면 업로드 후 일괄 라벨 수정/정렬 UX를 추가 검토한다.
@@ -10,8 +9,9 @@
- 관리자 티어표 관리의 템플릿 생성은 현재 `freeform`만 직접 지원하므로, 필요하면 일반 게임 티어표의 전체 아이템을 복제한 파생 템플릿 생성 UX도 검토한다.
- 관리자 티어표 관리의 추가 아이템 승격은 현재 커스텀(origin=`custom`) 아이템 기준이므로, 필요하면 “기존 게임 아이템과 비교한 차집합” 기준으로 더 정교하게 확장할 수 있다.
- 즐겨찾기는 현재 `내 즐겨찾기` 목록과 정렬까지 지원하므로, 필요하면 폴더 분류나 메모 같은 개인 정리 기능을 추가 검토한다.
- 전역 토스트는 기본 시간 기반 자동 종료만 지원하므로, 필요하면 중복 합치기나 액션 링크 포함 형태로 확장할 수 있다.
- 전역 토스트는 중복 합치기와 페이드아웃까지 지원하므로, 필요하면 액션 링크나 수동 고정(pin) 같은 상호작용 확장을 검토한다.
- 공개 티어표 검색은 현재 게임별 허브 안에서만 제공하므로, 필요하면 홈 전역 통합 검색도 검토한다.
- 즐겨찾기 토글은 현재 상세 화면 중심이므로, 필요하면 카드 목록에서도 안전한 보조 인터랙션(예: 길게 누르기, 별도 메뉴)을 검토한다.
## 배포 전 작업
- NAS 실제 도메인 기준으로 `VITE_API_ORIGIN`, `CORS_ORIGINS`, `SESSION_SECRET`, `SESSION_COOKIE_SECURE`, `TRUST_PROXY` 값을 설정한다.

View File

@@ -1,5 +1,13 @@
# 업데이트 로그
## 2026-03-27 v0.1.46
- **티어 행 아이템 제거 추가**: 티어표 편집 화면에서 이미 등급 행에 넣은 아이템도 작은 제거 버튼으로 다시 아이템 풀로 빼낼 수 있도록 보강
- **회원 관리 보조 정보 확장**: 관리자 회원 관리 카드에 아바타, 작성 티어표 수, 최근 활동 시각을 함께 표시해 운영 판단에 필요한 정보를 바로 확인할 수 있도록 개선
## 2026-03-27 v0.1.45
- **즐겨찾기 카드 액션 보정**: 카드형 목록에서는 별표를 클릭 액션이 아닌 상태/개수 표시로만 보여주고, 실제 즐겨찾기 토글은 상세 화면에서 처리하도록 조정
- **토스트 중복/페이드아웃 개선**: 같은 메시지 토스트는 하나로 합치고 카운트를 올리도록 변경했으며, 사라질 때는 짧은 페이드아웃 애니메이션을 적용
## 2026-03-27 v0.1.44
- **토스트 렌더링 버그 수정**: 전역 토스트가 빈 카드 여러 개로 보이던 ref 참조 문제를 수정해 실제 메시지만 표시되도록 정리
- **공개 티어표 검색 추가**: 게임별 공개 티어표 목록에서 제목/작성자 기준 검색이 가능하도록 검색창과 API 쿼리 지원 추가

View File

@@ -85,8 +85,11 @@ async function logout() {
<RouterView />
</main>
<div class="toastStack" aria-live="polite" aria-atomic="true">
<div v-for="item in toasts" :key="item.id" class="toast" :class="`toast--${item.type}`">
<div class="toast__message">{{ item.message }}</div>
<div v-for="item in toasts" :key="item.id" class="toast" :class="[`toast--${item.type}`, { 'toast--closing': item.isClosing }]">
<div class="toast__body">
<div class="toast__message">{{ item.message }}</div>
<div v-if="item.count > 1" class="toast__count">x{{ item.count }}</div>
</div>
<button class="toast__close" @click="dismissToast(item.id)">닫기</button>
</div>
</div>
@@ -227,6 +230,13 @@ async function logout() {
background: rgba(11, 18, 32, 0.94);
backdrop-filter: blur(12px);
box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
opacity: 1;
transform: translateY(0);
transition: opacity 220ms ease, transform 220ms ease;
}
.toast--closing {
opacity: 0;
transform: translateY(-6px);
}
.toast--success {
border-color: rgba(52, 211, 153, 0.38);
@@ -241,6 +251,19 @@ async function logout() {
line-height: 1.5;
font-size: 14px;
}
.toast__body {
min-width: 0;
}
.toast__count {
margin-top: 6px;
width: fit-content;
padding: 2px 8px;
border-radius: 999px;
background: rgba(255, 255, 255, 0.08);
font-size: 12px;
font-weight: 800;
opacity: 0.84;
}
.toast__close {
flex: 0 0 auto;
border: 0;

View File

@@ -2,18 +2,48 @@ import { readonly, ref } from 'vue'
const toasts = ref([])
let toastSeq = 0
const TOAST_EXIT_MS = 220
function clearToastTimer(toast) {
if (toast?.timerId) {
window.clearTimeout(toast.timerId)
toast.timerId = 0
}
}
function removeToast(id) {
toasts.value = toasts.value.filter((toast) => toast.id !== id)
}
function dismissToast(id) {
toasts.value = toasts.value.filter((toast) => toast.id !== id)
const target = toasts.value.find((toast) => toast.id === id)
if (!target || target.isClosing) return
clearToastTimer(target)
target.isClosing = true
target.timerId = window.setTimeout(() => removeToast(id), TOAST_EXIT_MS)
}
function showToast(message, { type = 'info', duration = 2600 } = {}) {
if (!message) return ''
const duplicated = toasts.value.find((toast) => toast.message === message && toast.type === type && !toast.isClosing)
if (duplicated) {
duplicated.count = (duplicated.count || 1) + 1
clearToastTimer(duplicated)
if (duration > 0) {
duplicated.timerId = window.setTimeout(() => dismissToast(duplicated.id), duration)
}
toasts.value = [...toasts.value]
return duplicated.id
}
const id = `toast-${++toastSeq}`
toasts.value = [...toasts.value, { id, message, type }]
const nextToast = { id, message, type, count: 1, isClosing: false, timerId: 0 }
toasts.value = [...toasts.value, nextToast]
if (duration > 0) {
window.setTimeout(() => dismissToast(id), duration)
nextToast.timerId = window.setTimeout(() => dismissToast(id), duration)
}
return id

View File

@@ -706,6 +706,18 @@ function fmt(ts) {
})
}
function userAvatarUrl(user) {
return user?.avatarSrc ? toApiUrl(user.avatarSrc) : ''
}
function userDisplayName(user) {
return user?.nickname || user?.email?.split('@')[0] || '알 수 없음'
}
function userAvatarFallback(user) {
return (user?.email?.trim()?.[0] || '?').toUpperCase()
}
function addFeaturedGame(gameId) {
resetMessages()
if (!gameId || featuredGameIds.value.includes(gameId)) return
@@ -1120,15 +1132,32 @@ async function saveFeaturedOrder() {
<div v-else class="userList">
<article v-for="user in users" :key="user.id" class="userCard">
<div class="userCard__head">
<div>
<div class="userCard__title">{{ user.nickname || '닉네임 없음' }}</div>
<div class="userCard__meta">{{ fmt(user.createdAt) }}</div>
<div class="userCard__identity">
<div class="userAvatar">
<img v-if="userAvatarUrl(user)" class="userAvatar__image" :src="userAvatarUrl(user)" :alt="userDisplayName(user)" />
<span v-else class="userAvatar__fallback">{{ userAvatarFallback(user) }}</span>
</div>
<div>
<div class="userCard__title">{{ userDisplayName(user) }}</div>
<div class="userCard__meta">가입일 {{ fmt(user.createdAt) }}</div>
</div>
</div>
<span class="roleBadge" :class="{ 'roleBadge--admin': user.draftIsAdmin }">
{{ user.draftIsAdmin ? '관리자' : '일반 회원' }}
</span>
</div>
<div class="userStats">
<div class="userStat">
<span class="userStat__label">작성 티어표</span>
<strong class="userStat__value">{{ user.tierListCount }}</strong>
</div>
<div class="userStat">
<span class="userStat__label">최근 활동</span>
<strong class="userStat__value">{{ fmt(user.recentActivityAt || user.createdAt) }}</strong>
</div>
</div>
<input v-model="user.draftEmail" class="input" placeholder="이메일" />
<input v-model="user.draftNickname" class="input" placeholder="닉네임" />
<label class="checkRow">
@@ -1679,6 +1708,12 @@ async function saveFeaturedOrder() {
justify-content: space-between;
align-items: flex-start;
}
.userCard__identity {
display: flex;
gap: 12px;
align-items: center;
min-width: 0;
}
.userCard__title {
font-weight: 900;
}
@@ -1687,6 +1722,48 @@ async function saveFeaturedOrder() {
opacity: 0.72;
font-size: 13px;
}
.userAvatar {
width: 48px;
height: 48px;
flex: 0 0 auto;
display: grid;
place-items: center;
border-radius: 999px;
overflow: hidden;
border: 1px solid rgba(255, 255, 255, 0.14);
background: rgba(96, 165, 250, 0.18);
}
.userAvatar__image {
width: 100%;
height: 100%;
object-fit: cover;
}
.userAvatar__fallback {
font-size: 18px;
font-weight: 900;
}
.userStats {
margin-top: 12px;
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 10px;
}
.userStat {
display: grid;
gap: 4px;
padding: 10px 12px;
border-radius: 12px;
border: 1px solid rgba(255, 255, 255, 0.08);
background: rgba(255, 255, 255, 0.03);
}
.userStat__label {
font-size: 12px;
opacity: 0.66;
}
.userStat__value {
font-size: 14px;
font-weight: 900;
}
.userCard__actions {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
@@ -1882,7 +1959,8 @@ async function saveFeaturedOrder() {
.section--topGrid,
.toolbar,
.itemComposer,
.tierAdminCard {
.tierAdminCard,
.userStats {
grid-template-columns: 1fr;
}
.toolbar--secondary {
@@ -1891,6 +1969,9 @@ async function saveFeaturedOrder() {
.itemPreviewCard {
max-width: none;
}
.userCard__identity {
width: 100%;
}
}
@media (max-width: 640px) {
.thumbGrid,

View File

@@ -1,5 +1,5 @@
<script setup>
import { onMounted, ref } from 'vue'
import { computed, onMounted, ref } from 'vue'
import { useRouter } from 'vue-router'
import { api } from '../lib/api'
import { toApiUrl } from '../lib/runtime'
@@ -11,6 +11,9 @@ const toast = useToast()
const favorites = ref([])
const query = ref('')
const sort = ref('favorited')
const sortLabel = computed(() =>
sort.value === 'favorited' ? '즐겨찾기한 날짜' : sort.value === 'updated' ? '최종 업데이트' : '즐겨찾기 수'
)
function fmt(ts) {
return new Date(ts).toLocaleString(undefined, {
@@ -52,16 +55,6 @@ function openTierList(tierList) {
router.push(`/editor/${tierList.gameId}/${tierList.id}`)
}
async function unfavorite(tierList) {
try {
await api.unfavoriteTierList(tierList.id)
favorites.value = favorites.value.filter((entry) => entry.id !== tierList.id)
toast.success('즐겨찾기를 해제했어요.')
} catch (e) {
toast.error('즐겨찾기 해제에 실패했어요.')
}
}
onMounted(loadFavorites)
</script>
@@ -103,9 +96,9 @@ onMounted(loadFavorites)
<div class="row__foot">
<div class="row__meta">
<div>{{ tierList.gameName || tierList.gameId }}</div>
<div>{{ fmt(sort === 'favorited' ? tierList.favoritedAt : tierList.updatedAt) }}</div>
<div>{{ sortLabel }}: {{ fmt(sort === 'favorited' ? tierList.favoritedAt : tierList.updatedAt) }}</div>
</div>
<button class="favoriteBtn" @click="unfavorite(tierList)"> {{ tierList.favoriteCount || 0 }}</button>
<div class="favoriteStat"> {{ tierList.favoriteCount || 0 }}</div>
</div>
</article>
</div>
@@ -239,13 +232,12 @@ onMounted(loadFavorites)
opacity: 0.78;
font-size: 13px;
}
.favoriteBtn {
.favoriteStat {
border: 1px solid rgba(255, 255, 255, 0.12);
background: rgba(255, 255, 255, 0.05);
color: rgba(255, 255, 255, 0.92);
border-radius: 999px;
padding: 7px 10px;
cursor: pointer;
font-weight: 800;
}
@media (max-width: 1100px) {

View File

@@ -4,12 +4,10 @@ import { useRoute, useRouter } from 'vue-router'
import { api } from '../lib/api'
import { toApiUrl } from '../lib/runtime'
import { useAuthStore } from '../stores/auth'
import { useToast } from '../composables/useToast'
const route = useRoute()
const router = useRouter()
const auth = useAuthStore()
const toast = useToast()
const gameId = computed(() => route.params.gameId)
@@ -73,21 +71,6 @@ function openTierList(id) {
router.push(`/editor/${gameId.value}/${id}`)
}
async function toggleFavorite(tierList) {
if (!auth.user) {
router.push(`/login?redirect=/games/${gameId.value}`)
return
}
try {
const data = tierList.isFavorited ? await api.unfavoriteTierList(tierList.id) : await api.favoriteTierList(tierList.id)
tierLists.value = tierLists.value.map((entry) => (entry.id === tierList.id ? { ...entry, ...data.tierList } : entry))
toast.success(tierList.isFavorited ? '즐겨찾기를 해제했어요.' : '즐겨찾기에 추가했어요.')
} catch (e) {
toast.error('즐겨찾기 처리에 실패했어요.')
}
}
function submitSearch() {
loadTierLists()
}
@@ -133,9 +116,9 @@ function submitSearch() {
</button>
<div class="row__foot">
<div class="row__meta">{{ fmt(t.updatedAt) }}</div>
<button class="favoriteBtn" @click="toggleFavorite(t)">
<div class="favoriteStat" :title="t.isFavorited ? '이미 즐겨찾기한 티어표' : '즐겨찾기 수'">
{{ t.isFavorited ? '★' : '☆' }} {{ t.favoriteCount || 0 }}
</button>
</div>
</div>
</article>
</div>
@@ -319,18 +302,14 @@ function submitSearch() {
justify-content: space-between;
margin-top: auto;
}
.favoriteBtn {
.favoriteStat {
border: 1px solid rgba(255, 255, 255, 0.12);
background: rgba(255, 255, 255, 0.05);
color: rgba(255, 255, 255, 0.92);
border-radius: 999px;
padding: 7px 10px;
cursor: pointer;
font-weight: 800;
}
.favoriteBtn:hover {
background: rgba(255, 255, 255, 0.09);
}
@media (max-width: 1100px) {
.list {
grid-template-columns: repeat(2, minmax(0, 1fr));

View File

@@ -115,6 +115,15 @@ function setIconSize(nextSize) {
iconSize.value = nextSize
}
function removeItemFromGroup(groupId, itemId) {
if (!canEdit.value || !groupId || !itemId) return
const targetGroup = groups.value.find((group) => group.id === groupId)
if (!targetGroup) return
if (!targetGroup.itemIds.includes(itemId)) return
targetGroup.itemIds = targetGroup.itemIds.filter((id) => id !== itemId)
pool.value = [itemId, ...pool.value.filter((id) => id !== itemId)]
}
function setGroupDropEl(groupId, el) {
if (!el) {
delete groupDropEls.value[groupId]
@@ -624,6 +633,16 @@ onUnmounted(() => {
<div v-if="!isExporting" class="row__empty" v-show="g.itemIds.length === 0">여기로 드래그해서 배치</div>
<div v-for="id in g.itemIds" :key="id" class="cell" :data-item-id="id">
<img :src="resolveItemSrc(itemsById[id])" class="thumb" :alt="itemsById[id]?.label || id" />
<button
v-if="canEdit && !isExporting"
class="cellRemoveBtn"
type="button"
title="아이템 빼내기"
@pointerdown.stop
@click.stop="removeItemFromGroup(g.id, id)"
>
×
</button>
</div>
</div>
</div>
@@ -1078,6 +1097,29 @@ onUnmounted(() => {
.cell {
display: inline-flex;
flex: 0 0 auto;
position: relative;
}
.cellRemoveBtn {
position: absolute;
top: -6px;
right: -6px;
width: 24px;
height: 24px;
display: grid;
place-items: center;
border-radius: 999px;
border: 1px solid rgba(239, 68, 68, 0.32);
background: rgba(11, 18, 32, 0.92);
color: rgba(255, 255, 255, 0.92);
font-size: 16px;
line-height: 1;
font-weight: 900;
cursor: pointer;
z-index: 2;
box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
}
.cellRemoveBtn:hover {
background: rgba(239, 68, 68, 0.9);
}
.thumb {
width: var(--thumb-size, 80px);