|
|
|
|
@@ -9,6 +9,7 @@ const router = useRouter()
|
|
|
|
|
const toast = useToast()
|
|
|
|
|
const myLists = ref([])
|
|
|
|
|
const error = ref('')
|
|
|
|
|
const brokenThumbnailIds = ref({})
|
|
|
|
|
|
|
|
|
|
watch(error, (message) => {
|
|
|
|
|
if (!message) return
|
|
|
|
|
@@ -37,12 +38,19 @@ function avatarFallbackOf(tierList) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function tierListThumbnailUrl(tierList) {
|
|
|
|
|
if (!tierList?.id || brokenThumbnailIds.value[tierList.id]) return ''
|
|
|
|
|
return tierList.thumbnailSrc ? toApiUrl(tierList.thumbnailSrc) : ''
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function handleThumbnailError(tierListId) {
|
|
|
|
|
if (!tierListId || brokenThumbnailIds.value[tierListId]) return
|
|
|
|
|
brokenThumbnailIds.value = { ...brokenThumbnailIds.value, [tierListId]: true }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onMounted(async () => {
|
|
|
|
|
try {
|
|
|
|
|
const data = await api.listMyTierLists()
|
|
|
|
|
brokenThumbnailIds.value = {}
|
|
|
|
|
myLists.value = data.tierLists || []
|
|
|
|
|
} catch (e) {
|
|
|
|
|
toast.error('로그인이 필요해요.')
|
|
|
|
|
@@ -51,53 +59,87 @@ onMounted(async () => {
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
function openList(t) {
|
|
|
|
|
router.push(`/editor/${t.gameId}/${t.id}`)
|
|
|
|
|
router.push(
|
|
|
|
|
"/editor/" + t.gameId + "/" + t.id,
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<section class="pageWrap">
|
|
|
|
|
<header class="pageHead">
|
|
|
|
|
<div class="pageHead__main">
|
|
|
|
|
<div class="pageHead__eyebrow">Library</div>
|
|
|
|
|
<h2 class="pageHead__title">내 티어표</h2>
|
|
|
|
|
<div class="pageHead__desc">직접 저장한 티어표를 같은 카드 레이아웃으로 다시 열고 정리할 수 있어요.</div>
|
|
|
|
|
</div>
|
|
|
|
|
</header>
|
|
|
|
|
<div class="card">
|
|
|
|
|
<div v-if="myLists.length === 0" class="empty">아직 저장한 티어표가 없어요.</div>
|
|
|
|
|
<div v-else class="list">
|
|
|
|
|
<article v-for="t in myLists" :key="t.id" class="boardCard">
|
|
|
|
|
<button class="boardCard__body" @click="openList(t)">
|
|
|
|
|
<div class="boardCard__thumbWrap">
|
|
|
|
|
<img v-if="tierListThumbnailUrl(t)" class="boardCard__thumb" :src="tierListThumbnailUrl(t)" :alt="t.title" />
|
|
|
|
|
<div v-else class="boardCard__thumbPlaceholder">대표 썸네일</div>
|
|
|
|
|
<section class="dashboardHero">
|
|
|
|
|
<div class="dashboardHero__left">
|
|
|
|
|
<div class="dashboardHero__eyebrow">Library</div>
|
|
|
|
|
<h2 class="dashboardHero__title">내 티어표</h2>
|
|
|
|
|
<p class="dashboardHero__desc">직접 저장한 티어표를 같은 카드 레이아웃으로 다시 열고 정리할 수 있어요.</p>
|
|
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
<section class="panel">
|
|
|
|
|
<div v-if="myLists.length === 0" class="empty">아직 저장한 티어표가 없어요.</div>
|
|
|
|
|
<div v-else class="list">
|
|
|
|
|
<article v-for="t in myLists" :key="t.id" class="boardCard">
|
|
|
|
|
<button class="boardCard__body" @click="openList(t)">
|
|
|
|
|
<div class="boardCard__thumbWrap">
|
|
|
|
|
<img
|
|
|
|
|
v-if="tierListThumbnailUrl(t)"
|
|
|
|
|
class="boardCard__thumb"
|
|
|
|
|
:src="tierListThumbnailUrl(t)"
|
|
|
|
|
alt=""
|
|
|
|
|
@error="handleThumbnailError(t.id)"
|
|
|
|
|
/>
|
|
|
|
|
<div v-else class="boardCard__thumbPlaceholder">대표 썸네일</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="boardCard__head">
|
|
|
|
|
<div class="boardCard__titleRow">
|
|
|
|
|
<div class="boardCard__title">{{ t.title }}</div>
|
|
|
|
|
<div class="favoriteStat">♡ {{ t.favoriteCount || 0 }}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="boardCard__head">
|
|
|
|
|
<div class="boardCard__titleRow">
|
|
|
|
|
<div class="boardCard__title">{{ t.title }}</div>
|
|
|
|
|
<div class="favoriteStat">♡ {{ t.favoriteCount || 0 }}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="boardCard__metaRow">
|
|
|
|
|
<div class="boardCard__author">
|
|
|
|
|
<img v-if="avatarSrcOf(t)" class="boardCard__avatar" :src="avatarSrcOf(t)" :alt="displayNameOf(t)" />
|
|
|
|
|
<div v-else class="boardCard__avatar boardCard__avatar--fallback">{{ avatarFallbackOf(t) }}</div>
|
|
|
|
|
<span class="boardCard__authorName">{{ displayNameOf(t) }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="boardCard__date">{{ fmt(t.updatedAt) }}</div>
|
|
|
|
|
<div class="boardCard__metaRow">
|
|
|
|
|
<div class="boardCard__author">
|
|
|
|
|
<img v-if="avatarSrcOf(t)" class="boardCard__avatar" :src="avatarSrcOf(t)" :alt="displayNameOf(t)" />
|
|
|
|
|
<div v-else class="boardCard__avatar boardCard__avatar--fallback">{{ avatarFallbackOf(t) }}</div>
|
|
|
|
|
<span class="boardCard__authorName">{{ displayNameOf(t) }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="boardCard__date">{{ fmt(t.updatedAt) }}</div>
|
|
|
|
|
</div>
|
|
|
|
|
</button>
|
|
|
|
|
</article>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</button>
|
|
|
|
|
</article>
|
|
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
.card {
|
|
|
|
|
border: 0;
|
|
|
|
|
.dashboardHero {
|
|
|
|
|
display: flex;
|
|
|
|
|
gap: 18px;
|
|
|
|
|
align-items: flex-start;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
padding: 6px 2px 18px;
|
|
|
|
|
}
|
|
|
|
|
.dashboardHero__left {
|
|
|
|
|
display: grid;
|
|
|
|
|
gap: 8px;
|
|
|
|
|
}
|
|
|
|
|
.dashboardHero__eyebrow {
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
color: rgba(255, 255, 255, 0.42);
|
|
|
|
|
text-transform: uppercase;
|
|
|
|
|
letter-spacing: 0.08em;
|
|
|
|
|
}
|
|
|
|
|
.dashboardHero__title {
|
|
|
|
|
margin: 4px 0 6px;
|
|
|
|
|
font-size: 32px;
|
|
|
|
|
letter-spacing: -0.04em;
|
|
|
|
|
color: rgba(255, 255, 255, 0.96);
|
|
|
|
|
}
|
|
|
|
|
.dashboardHero__desc {
|
|
|
|
|
margin: 0;
|
|
|
|
|
color: rgba(255, 255, 255, 0.58);
|
|
|
|
|
max-width: 720px;
|
|
|
|
|
}
|
|
|
|
|
.panel {
|
|
|
|
|
background: transparent;
|
|
|
|
|
border-radius: 0;
|
|
|
|
|
padding: 0;
|
|
|
|
|
@@ -137,6 +179,7 @@ function openList(t) {
|
|
|
|
|
padding: 0;
|
|
|
|
|
width: 100%;
|
|
|
|
|
display: grid;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
}
|
|
|
|
|
.boardCard__thumbWrap {
|
|
|
|
|
min-width: 0;
|
|
|
|
|
@@ -180,6 +223,7 @@ function openList(t) {
|
|
|
|
|
padding: 16px 18px 18px;
|
|
|
|
|
display: grid;
|
|
|
|
|
gap: 8px;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
}
|
|
|
|
|
.boardCard__titleRow,
|
|
|
|
|
.boardCard__metaRow {
|
|
|
|
|
@@ -188,11 +232,9 @@ function openList(t) {
|
|
|
|
|
grid-template-columns: minmax(0, 1fr) auto;
|
|
|
|
|
gap: 10px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.boardCard__titleRow {
|
|
|
|
|
align-items: flex-start;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.boardCard__metaRow {
|
|
|
|
|
align-items: flex-end;
|
|
|
|
|
}
|
|
|
|
|
|