Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b97d7eacda |
@@ -296,6 +296,11 @@ async function adminUpdateUser({ id, email, nickname, isAdmin }) {
|
|||||||
return findUserById(id)
|
return findUserById(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function adminUpdateUserPassword({ id, passwordHash }) {
|
||||||
|
await query('UPDATE users SET password_hash = ? WHERE id = ?', [passwordHash, id])
|
||||||
|
return findUserById(id)
|
||||||
|
}
|
||||||
|
|
||||||
async function adminDeleteUser(id) {
|
async function adminDeleteUser(id) {
|
||||||
await query('DELETE FROM users WHERE id = ?', [id])
|
await query('DELETE FROM users WHERE id = ?', [id])
|
||||||
}
|
}
|
||||||
@@ -399,7 +404,25 @@ async function createCustomItem({ id, ownerId, src, label }) {
|
|||||||
return { id, ownerId, src, label, origin: 'custom', createdAt }
|
return { id, ownerId, src, label, origin: 'custom', createdAt }
|
||||||
}
|
}
|
||||||
|
|
||||||
async function listCustomItems() {
|
async function listCustomItems({ queryText = '', page = 1, limit = 50 } = {}) {
|
||||||
|
const normalizedLimit = Math.min(Math.max(Number(limit) || 50, 1), 200)
|
||||||
|
const normalizedPage = Math.max(Number(page) || 1, 1)
|
||||||
|
const offset = (normalizedPage - 1) * normalizedLimit
|
||||||
|
const hasQuery = !!(queryText || '').trim()
|
||||||
|
const search = `%${(queryText || '').trim()}%`
|
||||||
|
const whereClause = hasQuery ? 'WHERE c.label LIKE ? OR c.src LIKE ? OR u.email LIKE ? OR u.nickname LIKE ?' : ''
|
||||||
|
const params = hasQuery ? [search, search, search, search] : []
|
||||||
|
|
||||||
|
const countRows = await query(
|
||||||
|
`
|
||||||
|
SELECT COUNT(*) AS count
|
||||||
|
FROM custom_items c
|
||||||
|
INNER JOIN users u ON u.id = c.owner_id
|
||||||
|
${whereClause}
|
||||||
|
`,
|
||||||
|
params
|
||||||
|
)
|
||||||
|
|
||||||
const rows = await query(
|
const rows = await query(
|
||||||
`
|
`
|
||||||
SELECT
|
SELECT
|
||||||
@@ -412,20 +435,27 @@ async function listCustomItems() {
|
|||||||
u.email
|
u.email
|
||||||
FROM custom_items c
|
FROM custom_items c
|
||||||
INNER JOIN users u ON u.id = c.owner_id
|
INNER JOIN users u ON u.id = c.owner_id
|
||||||
|
${whereClause}
|
||||||
ORDER BY c.created_at DESC
|
ORDER BY c.created_at DESC
|
||||||
LIMIT 200
|
LIMIT ? OFFSET ?
|
||||||
`
|
`,
|
||||||
|
[...params, normalizedLimit, offset]
|
||||||
)
|
)
|
||||||
|
|
||||||
return rows.map((row) => ({
|
return {
|
||||||
id: row.id,
|
items: rows.map((row) => ({
|
||||||
ownerId: row.owner_id,
|
id: row.id,
|
||||||
src: row.src,
|
ownerId: row.owner_id,
|
||||||
label: row.label,
|
src: row.src,
|
||||||
createdAt: Number(row.created_at),
|
label: row.label,
|
||||||
ownerName: row.nickname || row.email,
|
createdAt: Number(row.created_at),
|
||||||
ownerEmail: row.email,
|
ownerName: row.nickname || row.email,
|
||||||
}))
|
ownerEmail: row.email,
|
||||||
|
})),
|
||||||
|
total: Number(countRows[0]?.count || 0),
|
||||||
|
page: normalizedPage,
|
||||||
|
limit: normalizedLimit,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function listPublicTierLists(gameId) {
|
async function listPublicTierLists(gameId) {
|
||||||
@@ -539,6 +569,7 @@ module.exports = {
|
|||||||
updateUserProfile,
|
updateUserProfile,
|
||||||
listUsers,
|
listUsers,
|
||||||
adminUpdateUser,
|
adminUpdateUser,
|
||||||
|
adminUpdateUserPassword,
|
||||||
adminDeleteUser,
|
adminDeleteUser,
|
||||||
listGames,
|
listGames,
|
||||||
findGameById,
|
findGameById,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
const path = require('path')
|
const path = require('path')
|
||||||
const express = require('express')
|
const express = require('express')
|
||||||
const multer = require('multer')
|
const multer = require('multer')
|
||||||
|
const bcrypt = require('bcryptjs')
|
||||||
const { z } = require('zod')
|
const { z } = require('zod')
|
||||||
const { nanoid } = require('nanoid')
|
const { nanoid } = require('nanoid')
|
||||||
const {
|
const {
|
||||||
@@ -14,6 +15,7 @@ const {
|
|||||||
listCustomItems,
|
listCustomItems,
|
||||||
listUsers,
|
listUsers,
|
||||||
adminUpdateUser,
|
adminUpdateUser,
|
||||||
|
adminUpdateUserPassword,
|
||||||
adminDeleteUser,
|
adminDeleteUser,
|
||||||
} = require('../db')
|
} = require('../db')
|
||||||
const { requireAdmin } = require('../middleware/auth')
|
const { requireAdmin } = require('../middleware/auth')
|
||||||
@@ -83,8 +85,20 @@ router.delete('/games/:gameId', requireAdmin, async (req, res) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
router.get('/custom-items', requireAdmin, async (req, res) => {
|
router.get('/custom-items', requireAdmin, async (req, res) => {
|
||||||
const items = await listCustomItems()
|
const schema = z.object({
|
||||||
res.json({ items })
|
q: z.string().trim().max(120).optional().default(''),
|
||||||
|
page: z.coerce.number().int().min(1).optional().default(1),
|
||||||
|
limit: z.coerce.number().int().min(1).max(200).optional().default(50),
|
||||||
|
})
|
||||||
|
const parsed = schema.safeParse(req.query)
|
||||||
|
if (!parsed.success) return res.status(400).json({ error: 'bad_request' })
|
||||||
|
|
||||||
|
const result = await listCustomItems({
|
||||||
|
queryText: parsed.data.q,
|
||||||
|
page: parsed.data.page,
|
||||||
|
limit: parsed.data.limit,
|
||||||
|
})
|
||||||
|
res.json(result)
|
||||||
})
|
})
|
||||||
|
|
||||||
router.get('/users', requireAdmin, async (req, res) => {
|
router.get('/users', requireAdmin, async (req, res) => {
|
||||||
@@ -136,4 +150,19 @@ router.delete('/users/:userId', requireAdmin, async (req, res) => {
|
|||||||
res.json({ ok: true })
|
res.json({ ok: true })
|
||||||
})
|
})
|
||||||
|
|
||||||
|
router.patch('/users/:userId/password', requireAdmin, async (req, res) => {
|
||||||
|
const schema = z.object({
|
||||||
|
password: z.string().min(6).max(120),
|
||||||
|
})
|
||||||
|
const parsed = schema.safeParse(req.body)
|
||||||
|
if (!parsed.success) return res.status(400).json({ error: 'bad_request' })
|
||||||
|
|
||||||
|
const user = await findUserById(req.params.userId)
|
||||||
|
if (!user) return res.status(404).json({ error: 'not_found' })
|
||||||
|
|
||||||
|
const passwordHash = await bcrypt.hash(parsed.data.password, 10)
|
||||||
|
await adminUpdateUserPassword({ id: user.id, passwordHash })
|
||||||
|
res.json({ ok: true })
|
||||||
|
})
|
||||||
|
|
||||||
module.exports = router
|
module.exports = router
|
||||||
|
|||||||
@@ -56,3 +56,9 @@
|
|||||||
- 비로그인 사용자가 새 티어표를 편집하다 저장 단계에서 막히는 경험은 손실 위험이 크므로, 작성 시작 자체를 로그인 사용자로 제한하고 공개 티어표는 읽기 전용으로 보여주기로 결정했다.
|
- 비로그인 사용자가 새 티어표를 편집하다 저장 단계에서 막히는 경험은 손실 위험이 크므로, 작성 시작 자체를 로그인 사용자로 제한하고 공개 티어표는 읽기 전용으로 보여주기로 결정했다.
|
||||||
- 커스텀 이미지 업로드는 단일 파일 선택만으로는 불편하므로, 다중 선택과 드래그 앤 드롭을 기본 흐름으로 보강했다.
|
- 커스텀 이미지 업로드는 단일 파일 선택만으로는 불편하므로, 다중 선택과 드래그 앤 드롭을 기본 흐름으로 보강했다.
|
||||||
- 관리자에게는 게임 관리뿐 아니라 회원 관리 책임도 필요하므로, 회원 목록 조회/수정/삭제 기능을 추가하기로 결정했다.
|
- 관리자에게는 게임 관리뿐 아니라 회원 관리 책임도 필요하므로, 회원 목록 조회/수정/삭제 기능을 추가하기로 결정했다.
|
||||||
|
|
||||||
|
## 2026-03-19 v0.1.13
|
||||||
|
- 관리자 페이지는 기능 수가 늘어난 만큼 게임, 아이템, 회원 관리 탭으로 나누는 편이 더 안전하다고 판단했다.
|
||||||
|
- 사용자 커스텀 아이템은 수량이 빠르게 커질 수 있으므로, 검색과 페이지네이션을 기본 제공하는 관리 화면으로 보는 방향을 채택했다.
|
||||||
|
- 메일 기반 복구가 없으므로, 관리자가 회원 비밀번호를 직접 초기화할 수 있는 기능을 제공하기로 결정했다.
|
||||||
|
- 티어표 구조는 게임마다 다르므로, 기본 5단은 시작 템플릿일 뿐 사용자가 행을 직접 추가/삭제할 수 있어야 한다고 결정했다.
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
## `/editor/:gameId/new`, `/editor/:gameId/:tierListId`
|
## `/editor/:gameId/new`, `/editor/:gameId/:tierListId`
|
||||||
- 화면 파일: `frontend/src/views/TierEditorView.vue`
|
- 화면 파일: `frontend/src/views/TierEditorView.vue`
|
||||||
- 역할: 티어 그룹 편집, 관리자 아이템/커스텀 아이템 다중 드래그 앤 드롭 업로드, 작성 권한 제어, 저장, 공개 여부 설정, PNG 다운로드
|
- 역할: 티어 그룹 편집, 티어 행 추가/삭제, 관리자 아이템/커스텀 아이템 다중 드래그 앤 드롭 업로드, 작성 권한 제어, 저장, 공개 여부 설정, PNG 다운로드
|
||||||
- 연동 API: `GET /api/games/:gameId`, `GET /api/tierlists/:id`, `POST /api/tierlists/custom-items`, `POST /api/tierlists`
|
- 연동 API: `GET /api/games/:gameId`, `GET /api/tierlists/:id`, `POST /api/tierlists/custom-items`, `POST /api/tierlists`
|
||||||
|
|
||||||
## `/login`
|
## `/login`
|
||||||
@@ -27,8 +27,8 @@
|
|||||||
|
|
||||||
## `/admin`
|
## `/admin`
|
||||||
- 화면 파일: `frontend/src/views/AdminView.vue`
|
- 화면 파일: `frontend/src/views/AdminView.vue`
|
||||||
- 역할: 작업 모드 선택, 기존 게임 선택 또는 새 게임 생성, 선택된 게임의 썸네일/아이템 관리, 사용자 커스텀 아이템 검토/다운로드, 회원 관리, 파일 입력 초기화, 아이템 삭제, 게임 삭제
|
- 역할: `게임 관리 / 아이템 관리 / 회원 관리` 탭 분리, 선택된 게임의 썸네일/기본 아이템 관리, 사용자 커스텀 아이템 검색/페이지네이션/다운로드, 회원 비밀번호 초기화 포함 회원 관리, 파일 입력 초기화, 아이템 삭제, 게임 삭제
|
||||||
- 연동 API: `POST /api/admin/games`, `POST /api/admin/games/:gameId/thumbnail`, `POST /api/admin/games/:gameId/images`, `GET /api/admin/custom-items`, `GET /api/admin/users`, `PATCH /api/admin/users/:userId`, `DELETE /api/admin/users/:userId`, `DELETE /api/admin/games/:gameId/items/:itemId`, `DELETE /api/admin/games/:gameId`
|
- 연동 API: `POST /api/admin/games`, `POST /api/admin/games/:gameId/thumbnail`, `POST /api/admin/games/:gameId/images`, `GET /api/admin/custom-items`, `GET /api/admin/users`, `PATCH /api/admin/users/:userId`, `PATCH /api/admin/users/:userId/password`, `DELETE /api/admin/users/:userId`, `DELETE /api/admin/games/:gameId/items/:itemId`, `DELETE /api/admin/games/:gameId`
|
||||||
|
|
||||||
## `/profile`
|
## `/profile`
|
||||||
- 화면 파일: `frontend/src/views/ProfileView.vue`
|
- 화면 파일: `frontend/src/views/ProfileView.vue`
|
||||||
|
|||||||
@@ -83,22 +83,24 @@
|
|||||||
- `GET /api/admin/custom-items`
|
- `GET /api/admin/custom-items`
|
||||||
- `GET /api/admin/users`
|
- `GET /api/admin/users`
|
||||||
- `PATCH /api/admin/users/:userId`
|
- `PATCH /api/admin/users/:userId`
|
||||||
|
- `PATCH /api/admin/users/:userId/password`
|
||||||
- `DELETE /api/admin/users/:userId`
|
- `DELETE /api/admin/users/:userId`
|
||||||
- `DELETE /api/admin/games/:gameId/items/:itemId`
|
- `DELETE /api/admin/games/:gameId/items/:itemId`
|
||||||
- `DELETE /api/admin/games/:gameId`
|
- `DELETE /api/admin/games/:gameId`
|
||||||
|
|
||||||
## 관리자 화면 메모
|
## 관리자 화면 메모
|
||||||
- 썸네일은 16:9 비율 미리보기 후 `썸네일 적용` 버튼으로 실제 반영한다.
|
- 썸네일은 16:9 비율 미리보기 후 `썸네일 적용` 버튼으로 실제 반영한다.
|
||||||
- 아이템 추가는 이름 입력, 파일 선택, 1:1 미리보기 확인 뒤 저장하는 흐름이다.
|
- 게임 기본 아이템 추가는 이름 입력, 파일 선택, 1:1 미리보기 확인 뒤 저장하는 흐름이다.
|
||||||
- 아이템 미리보기는 반응형 환경에서도 최대 `192px` 크기 안에서 표시한다.
|
- 아이템 미리보기는 반응형 환경에서도 최대 `192px` 크기 안에서 표시한다.
|
||||||
- 게임 전환 또는 업로드 성공 뒤에는 파일 입력값을 초기화해 같은 파일도 다시 선택할 수 있다.
|
- 게임 전환 또는 업로드 성공 뒤에는 파일 입력값을 초기화해 같은 파일도 다시 선택할 수 있다.
|
||||||
- 사용자 업로드 커스텀 아이템은 관리자 화면 하단 검토 영역에서 목록/다운로드할 수 있다.
|
- 사용자 업로드 커스텀 아이템은 관리자 화면의 아이템 관리 탭에서 검색, 페이지네이션, 다운로드할 수 있다.
|
||||||
- 관리자 화면에서는 회원 이메일/닉네임/권한 수정과 계정 삭제가 가능하다.
|
- 관리자 화면에서는 회원 이메일/닉네임/권한 수정, 비밀번호 초기화, 계정 삭제가 가능하다.
|
||||||
|
|
||||||
## 티어표 접근 메모
|
## 티어표 접근 메모
|
||||||
- `new` 작성 경로는 로그인한 사용자만 진입할 수 있다.
|
- `new` 작성 경로는 로그인한 사용자만 진입할 수 있다.
|
||||||
- 비로그인 사용자는 공개된 티어표를 열람만 할 수 있고, 편집 UI와 저장 동작은 비활성화된다.
|
- 비로그인 사용자는 공개된 티어표를 열람만 할 수 있고, 편집 UI와 저장 동작은 비활성화된다.
|
||||||
- 커스텀 이미지 추가는 다중 파일 선택과 드래그 앤 드롭을 모두 지원한다.
|
- 커스텀 이미지 추가는 다중 파일 선택과 드래그 앤 드롭을 모두 지원한다.
|
||||||
|
- 티어 행은 기본 5단으로 시작하지만, 사용자가 직접 추가하거나 제거할 수 있다.
|
||||||
|
|
||||||
## 운영 환경 변수
|
## 운영 환경 변수
|
||||||
- 프런트엔드
|
- 프런트엔드
|
||||||
|
|||||||
@@ -16,3 +16,4 @@
|
|||||||
- 자동 테스트와 최소한의 배포 체크리스트를 만든다.
|
- 자동 테스트와 최소한의 배포 체크리스트를 만든다.
|
||||||
- 관리자용 커스텀 아이템 승인/복제, 아이템 정렬 UI를 추가한다.
|
- 관리자용 커스텀 아이템 승인/복제, 아이템 정렬 UI를 추가한다.
|
||||||
- 회원 검색/필터, 일괄 권한 변경 같은 관리 보조 기능을 추가한다.
|
- 회원 검색/필터, 일괄 권한 변경 같은 관리 보조 기능을 추가한다.
|
||||||
|
- 티어 행 프리셋 저장, 색상 관리, 행 복제 같은 고급 편집 기능을 추가한다.
|
||||||
|
|||||||
@@ -85,3 +85,9 @@
|
|||||||
- **작성 권한 제한**: 비로그인 사용자는 새 티어표 작성 화면으로 직접 진입할 수 없도록 하고, 공개된 티어표는 읽기 전용으로만 보이게 조정
|
- **작성 권한 제한**: 비로그인 사용자는 새 티어표 작성 화면으로 직접 진입할 수 없도록 하고, 공개된 티어표는 읽기 전용으로만 보이게 조정
|
||||||
- **커스텀 이미지 업로드 개선**: 에디터의 커스텀 이미지 추가 영역에 다중 파일 선택과 드래그 앤 드롭 업로드를 추가
|
- **커스텀 이미지 업로드 개선**: 에디터의 커스텀 이미지 추가 영역에 다중 파일 선택과 드래그 앤 드롭 업로드를 추가
|
||||||
- **회원 관리 추가**: 관리자 페이지에서 가입 회원 목록 조회, 이메일/닉네임/권한 수정, 계정 삭제가 가능한 관리 영역과 API를 추가
|
- **회원 관리 추가**: 관리자 페이지에서 가입 회원 목록 조회, 이메일/닉네임/권한 수정, 계정 삭제가 가능한 관리 영역과 API를 추가
|
||||||
|
|
||||||
|
## 2026-03-19 v0.1.13
|
||||||
|
- **관리자 탭 구조 정리**: 관리자 페이지를 `게임 관리 / 아이템 관리 / 회원 관리` 탭으로 분리하고 기능별 작업 영역을 명확히 분리
|
||||||
|
- **커스텀 아이템 조회 강화**: 사용자 커스텀 아이템 목록에 파일명 검색, `50/200` 단위 페이지네이션, 다운로드 흐름 추가
|
||||||
|
- **회원 비밀번호 초기화 추가**: 관리자 페이지와 API에서 회원 비밀번호를 직접 재설정할 수 있도록 기능 추가
|
||||||
|
- **가변 티어 행 지원**: 티어표 에디터에서 `S~D` 고정 5단이 아니라 티어 행을 직접 추가/삭제할 수 있도록 보강
|
||||||
|
|||||||
@@ -32,10 +32,13 @@ export const api = {
|
|||||||
|
|
||||||
listGames: () => request('/api/games'),
|
listGames: () => request('/api/games'),
|
||||||
getGame: (gameId) => request(`/api/games/${encodeURIComponent(gameId)}`),
|
getGame: (gameId) => request(`/api/games/${encodeURIComponent(gameId)}`),
|
||||||
listAdminCustomItems: () => request('/api/admin/custom-items'),
|
listAdminCustomItems: ({ q = '', page = 1, limit = 50 } = {}) =>
|
||||||
|
request(`/api/admin/custom-items?q=${encodeURIComponent(q)}&page=${encodeURIComponent(page)}&limit=${encodeURIComponent(limit)}`),
|
||||||
listAdminUsers: () => request('/api/admin/users'),
|
listAdminUsers: () => request('/api/admin/users'),
|
||||||
updateAdminUser: (userId, payload) =>
|
updateAdminUser: (userId, payload) =>
|
||||||
request(`/api/admin/users/${encodeURIComponent(userId)}`, { method: 'PATCH', body: payload }),
|
request(`/api/admin/users/${encodeURIComponent(userId)}`, { method: 'PATCH', body: payload }),
|
||||||
|
updateAdminUserPassword: (userId, payload) =>
|
||||||
|
request(`/api/admin/users/${encodeURIComponent(userId)}/password`, { method: 'PATCH', body: payload }),
|
||||||
deleteAdminUser: (userId) => request(`/api/admin/users/${encodeURIComponent(userId)}`, { method: 'DELETE' }),
|
deleteAdminUser: (userId) => request(`/api/admin/users/${encodeURIComponent(userId)}`, { method: 'DELETE' }),
|
||||||
|
|
||||||
listPublicTierLists: (gameId) =>
|
listPublicTierLists: (gameId) =>
|
||||||
|
|||||||
@@ -7,13 +7,21 @@ import { useAuthStore } from '../stores/auth'
|
|||||||
const auth = useAuthStore()
|
const auth = useAuthStore()
|
||||||
const isAdmin = computed(() => !!auth.user?.isAdmin)
|
const isAdmin = computed(() => !!auth.user?.isAdmin)
|
||||||
|
|
||||||
|
const activeTab = ref('games')
|
||||||
|
const gameMode = ref('existing')
|
||||||
|
|
||||||
const games = ref([])
|
const games = ref([])
|
||||||
const customItems = ref([])
|
|
||||||
const users = ref([])
|
|
||||||
const adminMode = ref('existing')
|
|
||||||
const selectedGameId = ref('')
|
const selectedGameId = ref('')
|
||||||
const selectedGame = ref(null)
|
const selectedGame = ref(null)
|
||||||
|
|
||||||
|
const customItems = ref([])
|
||||||
|
const customItemQuery = ref('')
|
||||||
|
const customItemPage = ref(1)
|
||||||
|
const customItemLimit = ref(50)
|
||||||
|
const customItemTotal = ref(0)
|
||||||
|
|
||||||
|
const users = ref([])
|
||||||
|
|
||||||
const error = ref('')
|
const error = ref('')
|
||||||
const success = ref('')
|
const success = ref('')
|
||||||
|
|
||||||
@@ -31,6 +39,7 @@ const thumbFileInput = ref(null)
|
|||||||
const hasSelectedGame = computed(() => !!selectedGame.value?.game?.id)
|
const hasSelectedGame = computed(() => !!selectedGame.value?.game?.id)
|
||||||
const canApplyThumbnail = computed(() => !!thumbFile.value && !!selectedGameId.value)
|
const canApplyThumbnail = computed(() => !!thumbFile.value && !!selectedGameId.value)
|
||||||
const canAddItem = computed(() => !!uploadFile.value && !!selectedGameId.value)
|
const canAddItem = computed(() => !!uploadFile.value && !!selectedGameId.value)
|
||||||
|
const customItemPageCount = computed(() => Math.max(1, Math.ceil(customItemTotal.value / customItemLimit.value)))
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await auth.refresh()
|
await auth.refresh()
|
||||||
@@ -42,6 +51,16 @@ onUnmounted(() => {
|
|||||||
clearPreviewUrl('thumb')
|
clearPreviewUrl('thumb')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function resetMessages() {
|
||||||
|
error.value = ''
|
||||||
|
success.value = ''
|
||||||
|
}
|
||||||
|
|
||||||
|
function setTab(tab) {
|
||||||
|
resetMessages()
|
||||||
|
activeTab.value = tab
|
||||||
|
}
|
||||||
|
|
||||||
async function refreshGames() {
|
async function refreshGames() {
|
||||||
try {
|
try {
|
||||||
const data = await api.listGames()
|
const data = await api.listGames()
|
||||||
@@ -54,8 +73,15 @@ async function refreshGames() {
|
|||||||
async function refreshCustomItems() {
|
async function refreshCustomItems() {
|
||||||
if (!auth.user?.isAdmin) return
|
if (!auth.user?.isAdmin) return
|
||||||
try {
|
try {
|
||||||
const data = await api.listAdminCustomItems()
|
const data = await api.listAdminCustomItems({
|
||||||
|
q: customItemQuery.value,
|
||||||
|
page: customItemPage.value,
|
||||||
|
limit: customItemLimit.value,
|
||||||
|
})
|
||||||
customItems.value = data.items || []
|
customItems.value = data.items || []
|
||||||
|
customItemTotal.value = data.total || 0
|
||||||
|
customItemPage.value = data.page || 1
|
||||||
|
customItemLimit.value = data.limit || customItemLimit.value
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = '사용자 커스텀 아이템을 불러오지 못했어요.'
|
error.value = '사용자 커스텀 아이템을 불러오지 못했어요.'
|
||||||
}
|
}
|
||||||
@@ -70,17 +96,13 @@ async function refreshUsers() {
|
|||||||
draftEmail: user.email,
|
draftEmail: user.email,
|
||||||
draftNickname: user.nickname || '',
|
draftNickname: user.nickname || '',
|
||||||
draftIsAdmin: !!user.isAdmin,
|
draftIsAdmin: !!user.isAdmin,
|
||||||
|
draftPassword: '',
|
||||||
}))
|
}))
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = '회원 목록을 불러오지 못했어요.'
|
error.value = '회원 목록을 불러오지 못했어요.'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetMessages() {
|
|
||||||
error.value = ''
|
|
||||||
success.value = ''
|
|
||||||
}
|
|
||||||
|
|
||||||
function resetUploadState() {
|
function resetUploadState() {
|
||||||
uploadLabel.value = ''
|
uploadLabel.value = ''
|
||||||
uploadFile.value = null
|
uploadFile.value = null
|
||||||
@@ -91,9 +113,9 @@ function resetUploadState() {
|
|||||||
clearPreviewUrl('thumb')
|
clearPreviewUrl('thumb')
|
||||||
}
|
}
|
||||||
|
|
||||||
function setMode(mode) {
|
function setGameMode(mode) {
|
||||||
resetMessages()
|
resetMessages()
|
||||||
adminMode.value = mode
|
gameMode.value = mode
|
||||||
selectedGameId.value = ''
|
selectedGameId.value = ''
|
||||||
selectedGame.value = null
|
selectedGame.value = null
|
||||||
newGameId.value = ''
|
newGameId.value = ''
|
||||||
@@ -113,12 +135,8 @@ function clearPreviewUrl(type) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function resetFileInput(type) {
|
function resetFileInput(type) {
|
||||||
if (type === 'item' && itemFileInput.value) {
|
if (type === 'item' && itemFileInput.value) itemFileInput.value.value = ''
|
||||||
itemFileInput.value.value = ''
|
if (type === 'thumb' && thumbFileInput.value) thumbFileInput.value.value = ''
|
||||||
}
|
|
||||||
if (type === 'thumb' && thumbFileInput.value) {
|
|
||||||
thumbFileInput.value.value = ''
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadGame() {
|
async function loadGame() {
|
||||||
@@ -151,7 +169,7 @@ async function createGame() {
|
|||||||
|
|
||||||
const data = await res.json()
|
const data = await res.json()
|
||||||
await refreshGames()
|
await refreshGames()
|
||||||
adminMode.value = 'existing'
|
gameMode.value = 'existing'
|
||||||
selectedGameId.value = data.game.id
|
selectedGameId.value = data.game.id
|
||||||
await loadGame()
|
await loadGame()
|
||||||
success.value = '게임이 생성됐어요. 이어서 썸네일과 아이템을 관리할 수 있어요.'
|
success.value = '게임이 생성됐어요. 이어서 썸네일과 아이템을 관리할 수 있어요.'
|
||||||
@@ -163,17 +181,13 @@ async function createGame() {
|
|||||||
function onThumb(event) {
|
function onThumb(event) {
|
||||||
thumbFile.value = event.target.files && event.target.files[0] ? event.target.files[0] : null
|
thumbFile.value = event.target.files && event.target.files[0] ? event.target.files[0] : null
|
||||||
clearPreviewUrl('thumb')
|
clearPreviewUrl('thumb')
|
||||||
if (thumbFile.value) {
|
if (thumbFile.value) thumbPreviewUrl.value = URL.createObjectURL(thumbFile.value)
|
||||||
thumbPreviewUrl.value = URL.createObjectURL(thumbFile.value)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onFile(event) {
|
function onFile(event) {
|
||||||
uploadFile.value = event.target.files && event.target.files[0] ? event.target.files[0] : null
|
uploadFile.value = event.target.files && event.target.files[0] ? event.target.files[0] : null
|
||||||
clearPreviewUrl('item')
|
clearPreviewUrl('item')
|
||||||
if (uploadFile.value) {
|
if (uploadFile.value) itemPreviewUrl.value = URL.createObjectURL(uploadFile.value)
|
||||||
itemPreviewUrl.value = URL.createObjectURL(uploadFile.value)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function uploadThumbnail() {
|
async function uploadThumbnail() {
|
||||||
@@ -224,13 +238,13 @@ async function uploadItem() {
|
|||||||
|
|
||||||
resetUploadState()
|
resetUploadState()
|
||||||
await loadGame()
|
await loadGame()
|
||||||
success.value = '아이템이 추가됐어요.'
|
success.value = '게임 기본 아이템이 추가됐어요.'
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = '아이템 추가 실패(관리자 권한/파일 크기 확인)'
|
error.value = '아이템 추가 실패(관리자 권한/파일 크기 확인)'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function removeItem(itemId) {
|
async function removeGameItem(itemId) {
|
||||||
resetMessages()
|
resetMessages()
|
||||||
try {
|
try {
|
||||||
const res = await fetch(
|
const res = await fetch(
|
||||||
@@ -243,9 +257,9 @@ async function removeItem(itemId) {
|
|||||||
if (!res.ok) throw new Error('failed')
|
if (!res.ok) throw new Error('failed')
|
||||||
|
|
||||||
await loadGame()
|
await loadGame()
|
||||||
success.value = '아이템을 삭제했어요.'
|
success.value = '게임 기본 아이템을 삭제했어요.'
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = '아이템 삭제에 실패했어요.'
|
error.value = '게임 기본 아이템 삭제에 실패했어요.'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,7 +267,7 @@ async function removeGame() {
|
|||||||
resetMessages()
|
resetMessages()
|
||||||
if (!selectedGameId.value || !selectedGame.value?.game) return
|
if (!selectedGameId.value || !selectedGame.value?.game) return
|
||||||
|
|
||||||
const ok = window.confirm(`"${selectedGame.value.game.name}" 게임을 삭제할까요? 관련 아이템과 티어표도 함께 삭제됩니다.`)
|
const ok = window.confirm(`"${selectedGame.value.game.name}" 게임을 삭제할까요? 관련 기본 아이템과 티어표도 함께 삭제됩니다.`)
|
||||||
if (!ok) return
|
if (!ok) return
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -285,12 +299,7 @@ async function saveUser(user) {
|
|||||||
const updated = data.user
|
const updated = data.user
|
||||||
users.value = users.value.map((entry) =>
|
users.value = users.value.map((entry) =>
|
||||||
entry.id === updated.id
|
entry.id === updated.id
|
||||||
? {
|
? { ...entry, ...updated, draftEmail: updated.email, draftNickname: updated.nickname || '', draftIsAdmin: !!updated.isAdmin }
|
||||||
...updated,
|
|
||||||
draftEmail: updated.email,
|
|
||||||
draftNickname: updated.nickname || '',
|
|
||||||
draftIsAdmin: !!updated.isAdmin,
|
|
||||||
}
|
|
||||||
: entry
|
: entry
|
||||||
)
|
)
|
||||||
success.value = '회원 정보를 저장했어요.'
|
success.value = '회원 정보를 저장했어요.'
|
||||||
@@ -299,6 +308,22 @@ async function saveUser(user) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function resetUserPassword(user) {
|
||||||
|
resetMessages()
|
||||||
|
if (!(user.draftPassword || '').trim()) {
|
||||||
|
error.value = '새 비밀번호를 입력해주세요.'
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await api.updateAdminUserPassword(user.id, { password: user.draftPassword })
|
||||||
|
user.draftPassword = ''
|
||||||
|
success.value = '비밀번호를 초기화했어요.'
|
||||||
|
} catch (e) {
|
||||||
|
error.value = '비밀번호 초기화에 실패했어요.'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function removeUser(user) {
|
async function removeUser(user) {
|
||||||
resetMessages()
|
resetMessages()
|
||||||
if (user.id === auth.user?.id) {
|
if (user.id === auth.user?.id) {
|
||||||
@@ -318,6 +343,24 @@ async function removeUser(user) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function submitCustomItemSearch() {
|
||||||
|
customItemPage.value = 1
|
||||||
|
refreshCustomItems()
|
||||||
|
}
|
||||||
|
|
||||||
|
function changeCustomItemLimit(limit) {
|
||||||
|
customItemLimit.value = limit
|
||||||
|
customItemPage.value = 1
|
||||||
|
refreshCustomItems()
|
||||||
|
}
|
||||||
|
|
||||||
|
function moveCustomItemPage(direction) {
|
||||||
|
const nextPage = customItemPage.value + direction
|
||||||
|
if (nextPage < 1 || nextPage > customItemPageCount.value) return
|
||||||
|
customItemPage.value = nextPage
|
||||||
|
refreshCustomItems()
|
||||||
|
}
|
||||||
|
|
||||||
const displayThumbnailUrl = computed(() => {
|
const displayThumbnailUrl = computed(() => {
|
||||||
if (thumbPreviewUrl.value) return thumbPreviewUrl.value
|
if (thumbPreviewUrl.value) return thumbPreviewUrl.value
|
||||||
if (selectedGame.value?.game?.thumbnailSrc) return toApiUrl(selectedGame.value.game.thumbnailSrc)
|
if (selectedGame.value?.game?.thumbnailSrc) return toApiUrl(selectedGame.value.game.thumbnailSrc)
|
||||||
@@ -339,162 +382,192 @@ function fmt(ts) {
|
|||||||
<section class="wrap">
|
<section class="wrap">
|
||||||
<h2 class="title">관리자</h2>
|
<h2 class="title">관리자</h2>
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="desc">작업 종류를 먼저 고르고, 선택한 게임의 관리 화면만 집중해서 정리합니다.</div>
|
<div class="desc">기능이 많아진 만큼 관리 영역을 게임, 아이템, 회원 관리로 나눠서 정리합니다.</div>
|
||||||
<div v-if="!auth.user" class="warn">로그인이 필요해요.</div>
|
<div v-if="!auth.user" class="warn">로그인이 필요해요.</div>
|
||||||
<div v-else-if="!isAdmin" class="warn">이 계정은 관리자 권한이 없어요.</div>
|
<div v-else-if="!isAdmin" class="warn">이 계정은 관리자 권한이 없어요.</div>
|
||||||
|
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<div class="modeTabs">
|
<div class="tabs">
|
||||||
<button class="modeTab" :class="{ 'modeTab--active': adminMode === 'existing' }" @click="setMode('existing')">
|
<button class="tab" :class="{ 'tab--active': activeTab === 'games' }" @click="setTab('games')">게임 관리</button>
|
||||||
등록된 게임 선택
|
<button class="tab" :class="{ 'tab--active': activeTab === 'items' }" @click="setTab('items')">아이템 관리</button>
|
||||||
</button>
|
<button class="tab" :class="{ 'tab--active': activeTab === 'users' }" @click="setTab('users')">회원 관리</button>
|
||||||
<button class="modeTab" :class="{ 'modeTab--active': adminMode === 'new' }" @click="setMode('new')">
|
|
||||||
새 게임 추가
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="error" class="error">{{ error }}</div>
|
<div v-if="error" class="error">{{ error }}</div>
|
||||||
<div v-if="success" class="success">{{ success }}</div>
|
<div v-if="success" class="success">{{ success }}</div>
|
||||||
|
|
||||||
<div class="panel panel--compact">
|
<template v-if="activeTab === 'games'">
|
||||||
<template v-if="adminMode === 'existing'">
|
<div class="modeTabs">
|
||||||
<div class="panel__title">등록된 게임 선택</div>
|
<button class="modeTab" :class="{ 'modeTab--active': gameMode === 'existing' }" @click="setGameMode('existing')">
|
||||||
<select v-model="selectedGameId" class="select" @change="loadGame">
|
등록된 게임 선택
|
||||||
<option value="">게임을 선택해주세요</option>
|
</button>
|
||||||
<option v-for="game in games" :key="game.id" :value="game.id">{{ game.name }} ({{ game.id }})</option>
|
<button class="modeTab" :class="{ 'modeTab--active': gameMode === 'new' }" @click="setGameMode('new')">
|
||||||
</select>
|
새 게임 추가
|
||||||
<div class="hint">게임을 고르면 아래에서 썸네일, 아이템 관리, 삭제 작업을 할 수 있어요.</div>
|
</button>
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-else>
|
|
||||||
<div class="panel__title">새 게임 정보 입력</div>
|
|
||||||
<input v-model="newGameId" class="input" placeholder="game id (영문/숫자)" />
|
|
||||||
<input v-model="newGameName" class="input" placeholder="게임 이름" />
|
|
||||||
<button class="btn btn--primary" @click="createGame">게임 생성</button>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-if="hasSelectedGame" class="panel panel--detail">
|
|
||||||
<div class="detailHead">
|
|
||||||
<div>
|
|
||||||
<div class="panel__title">선택된 게임 정보</div>
|
|
||||||
<div class="selectedGame__name">{{ selectedGame.game.name }}</div>
|
|
||||||
<div class="selectedGame__id">{{ selectedGame.game.id }}</div>
|
|
||||||
</div>
|
|
||||||
<div class="detailHead__actions">
|
|
||||||
<button class="btn btn--danger" @click="removeGame">게임 삭제</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="section section--topGrid">
|
<div class="panel panel--compact">
|
||||||
<section class="adminCard">
|
<template v-if="gameMode === 'existing'">
|
||||||
<div class="section__title">썸네일 적용</div>
|
<div class="panel__title">등록된 게임 선택</div>
|
||||||
<div class="uploadPreviewCard">
|
<select v-model="selectedGameId" class="select" @change="loadGame">
|
||||||
<img
|
<option value="">게임을 선택해주세요</option>
|
||||||
v-if="displayThumbnailUrl"
|
<option v-for="game in games" :key="game.id" :value="game.id">{{ game.name }} ({{ game.id }})</option>
|
||||||
class="selectedThumb"
|
</select>
|
||||||
:src="displayThumbnailUrl"
|
<div class="hint">이 영역은 게임 자체와 관리자 기본 아이템만 관리합니다. 여기서 아이템을 삭제해도 사용자 커스텀 이미지는 삭제되지 않아요.</div>
|
||||||
:alt="selectedGame.game.name"
|
</template>
|
||||||
/>
|
|
||||||
<div v-else class="selectedThumb selectedThumb--empty">썸네일 미리보기</div>
|
|
||||||
</div>
|
|
||||||
<div class="uploadControls">
|
|
||||||
<input ref="thumbFileInput" type="file" accept="image/*" class="inputFile" @change="onThumb" />
|
|
||||||
<button class="btn" :disabled="!canApplyThumbnail" @click="uploadThumbnail">썸네일 적용</button>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section class="adminCard">
|
<template v-else>
|
||||||
<div class="section__title">아이템 추가</div>
|
<div class="panel__title">새 게임 정보 입력</div>
|
||||||
<div class="itemComposer">
|
<input v-model="newGameId" class="input" placeholder="game id (영문/숫자)" />
|
||||||
<div class="itemComposer__form">
|
<input v-model="newGameName" class="input" placeholder="게임 이름" />
|
||||||
<input v-model="uploadLabel" class="input input--compact" placeholder="아이템 이름" />
|
<button class="btn btn--primary" @click="createGame">게임 생성</button>
|
||||||
<input ref="itemFileInput" type="file" accept="image/*" class="inputFile inputFile--tight" @change="onFile" />
|
</template>
|
||||||
<button class="btn" :disabled="!canAddItem" @click="uploadItem">아이템 추가</button>
|
</div>
|
||||||
|
|
||||||
|
<div v-if="hasSelectedGame" class="panel">
|
||||||
|
<div class="detailHead">
|
||||||
|
<div>
|
||||||
|
<div class="panel__title">선택된 게임 정보</div>
|
||||||
|
<div class="selectedGame__name">{{ selectedGame.game.name }}</div>
|
||||||
|
<div class="selectedGame__id">{{ selectedGame.game.id }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="detailHead__actions">
|
||||||
|
<button class="btn btn--danger" @click="removeGame">게임 삭제</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="section section--topGrid">
|
||||||
|
<section class="adminCard">
|
||||||
|
<div class="section__title">썸네일 적용</div>
|
||||||
|
<div class="uploadPreviewCard">
|
||||||
|
<img v-if="displayThumbnailUrl" class="selectedThumb" :src="displayThumbnailUrl" :alt="selectedGame.game.name" />
|
||||||
|
<div v-else class="selectedThumb selectedThumb--empty">썸네일 미리보기</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="itemPreviewCard">
|
<div class="uploadControls">
|
||||||
<div class="itemPreviewFrame">
|
<input ref="thumbFileInput" type="file" accept="image/*" class="inputFile" @change="onThumb" />
|
||||||
<img v-if="itemPreviewUrl" class="itemPreviewImage" :src="itemPreviewUrl" alt="item preview" />
|
<button class="btn" :disabled="!canApplyThumbnail" @click="uploadThumbnail">썸네일 적용</button>
|
||||||
<div v-else class="itemPreviewEmpty">이미지를 선택해주세요</div>
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="adminCard">
|
||||||
|
<div class="section__title">기본 아이템 추가</div>
|
||||||
|
<div class="itemComposer">
|
||||||
|
<div class="itemComposer__form">
|
||||||
|
<input v-model="uploadLabel" class="input input--compact" placeholder="아이템 이름" />
|
||||||
|
<input ref="itemFileInput" type="file" accept="image/*" class="inputFile inputFile--tight" @change="onFile" />
|
||||||
|
<button class="btn" :disabled="!canAddItem" @click="uploadItem">아이템 추가</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="thumbLabel thumbLabel--preview">{{ uploadLabel || '아이템 이름 미리보기' }}</div>
|
<div class="itemPreviewCard">
|
||||||
|
<div class="itemPreviewFrame">
|
||||||
|
<img v-if="itemPreviewUrl" class="itemPreviewImage" :src="itemPreviewUrl" alt="item preview" />
|
||||||
|
<div v-else class="itemPreviewEmpty">이미지를 선택해주세요</div>
|
||||||
|
</div>
|
||||||
|
<div class="thumbLabel thumbLabel--preview">{{ uploadLabel || '아이템 이름 미리보기' }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="section">
|
||||||
|
<div class="section__title">현재 기본 아이템 목록</div>
|
||||||
|
<div v-if="!selectedGame?.items?.length" class="hint">아직 등록된 기본 아이템이 없어요.</div>
|
||||||
|
<div v-else class="thumbGrid">
|
||||||
|
<div v-for="item in selectedGame.items" :key="item.id" class="thumbCard">
|
||||||
|
<img class="thumb thumb--game" :src="toApiUrl(item.src)" :alt="item.label" />
|
||||||
|
<div class="thumbLabel">{{ item.label }}</div>
|
||||||
|
<button class="btn btn--danger btn--small" @click="removeGameItem(item.id)">아이템 삭제</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
<div class="section">
|
<template v-else-if="activeTab === 'items'">
|
||||||
<div class="section__title">현재 아이템 목록</div>
|
<div class="panel">
|
||||||
<div v-if="!selectedGame?.items?.length" class="hint">아직 등록된 아이템이 없어요.</div>
|
<div class="sectionHeader">
|
||||||
<div v-else class="thumbGrid">
|
<div>
|
||||||
<div v-for="item in selectedGame.items" :key="item.id" class="thumbCard">
|
<div class="panel__title">사용자 커스텀 아이템 관리</div>
|
||||||
<img class="thumb" :src="toApiUrl(item.src)" :alt="item.label" />
|
<div class="hint hint--tight">사용자가 업로드한 이미지를 파일명/라벨 기준으로 검색하고, 한 번에 50개 또는 200개씩 페이지 형태로 확인할 수 있어요.</div>
|
||||||
<div class="thumbLabel">{{ item.label }}</div>
|
|
||||||
<button class="btn btn--danger btn--small" @click="removeItem(item.id)">아이템 삭제</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
<button class="btn btn--ghost" @click="refreshCustomItems">새로고침</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="panel">
|
<div class="toolbar">
|
||||||
<div class="sectionHeader">
|
<input v-model="customItemQuery" class="input toolbar__search" placeholder="파일명, 라벨, 업로더 검색" @keydown.enter.prevent="submitCustomItemSearch" />
|
||||||
<div>
|
<button class="btn btn--ghost toolbar__button" @click="submitCustomItemSearch">검색</button>
|
||||||
<div class="panel__title">사용자 커스텀 아이템</div>
|
<select :value="customItemLimit" class="select toolbar__select" @change="changeCustomItemLimit(Number($event.target.value))">
|
||||||
<div class="hint hint--tight">사용자가 직접 올린 이미지를 훑어보고, 필요하면 다운로드해 기본 템플릿으로 재구성할 수 있어요.</div>
|
<option :value="50">50개씩 보기</option>
|
||||||
|
<option :value="200">200개씩 보기</option>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<button class="btn btn--ghost" @click="refreshCustomItems">새로고침</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-if="!customItems.length" class="hint">아직 업로드된 사용자 커스텀 아이템이 없어요.</div>
|
<div class="hint">현재 목록은 사용자 커스텀 이미지 전용입니다. 여기서 보는 항목은 게임 기본 아이템 삭제와 연결되지 않아요.</div>
|
||||||
<div v-else class="customItemGrid">
|
|
||||||
<article v-for="item in customItems" :key="item.id" class="customItemCard">
|
|
||||||
<img class="customItemCard__image" :src="toApiUrl(item.src)" :alt="item.label" />
|
|
||||||
<div class="customItemCard__body">
|
|
||||||
<div class="customItemCard__title">{{ item.label }}</div>
|
|
||||||
<div class="customItemCard__meta">업로더: {{ item.ownerName }}</div>
|
|
||||||
<div class="customItemCard__meta">{{ fmt(item.createdAt) }}</div>
|
|
||||||
<a class="btn btn--small btn--ghost" :href="toApiUrl(item.src)" :download="item.label">이미지 다운로드</a>
|
|
||||||
</div>
|
|
||||||
</article>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="panel">
|
<div v-if="!customItems.length" class="hint">조건에 맞는 커스텀 아이템이 없어요.</div>
|
||||||
<div class="sectionHeader">
|
<div v-else class="customItemGrid">
|
||||||
<div>
|
<article v-for="item in customItems" :key="item.id" class="customItemCard">
|
||||||
<div class="panel__title">회원 관리</div>
|
<img class="customItemCard__image" :src="toApiUrl(item.src)" :alt="item.label" />
|
||||||
<div class="hint hint--tight">가입한 계정의 이메일, 닉네임, 관리자 권한을 수정하거나 계정을 삭제할 수 있어요.</div>
|
<div class="customItemCard__body">
|
||||||
</div>
|
<div class="customItemCard__title">{{ item.label }}</div>
|
||||||
<button class="btn btn--ghost" @click="refreshUsers">새로고침</button>
|
<div class="customItemCard__meta">파일: {{ item.src.split('/').pop() }}</div>
|
||||||
</div>
|
<div class="customItemCard__meta">업로더: {{ item.ownerName }}</div>
|
||||||
|
<div class="customItemCard__meta">{{ fmt(item.createdAt) }}</div>
|
||||||
<div v-if="!users.length" class="hint">아직 가입한 회원이 없어요.</div>
|
<a class="btn btn--small btn--ghost" :href="toApiUrl(item.src)" :download="item.label">이미지 다운로드</a>
|
||||||
<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>
|
</div>
|
||||||
<span class="roleBadge" :class="{ 'roleBadge--admin': user.draftIsAdmin }">
|
</article>
|
||||||
{{ user.draftIsAdmin ? '관리자' : '일반 회원' }}
|
</div>
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<input v-model="user.draftEmail" class="input" placeholder="이메일" />
|
<div class="pager">
|
||||||
<input v-model="user.draftNickname" class="input" placeholder="닉네임" />
|
<button class="btn btn--ghost" :disabled="customItemPage <= 1" @click="moveCustomItemPage(-1)">이전</button>
|
||||||
<label class="checkRow">
|
<div class="pager__info">{{ customItemPage }} / {{ customItemPageCount }} 페이지 · 총 {{ customItemTotal }}개</div>
|
||||||
<input v-model="user.draftIsAdmin" type="checkbox" :disabled="user.id === auth.user?.id" />
|
<button class="btn btn--ghost" :disabled="customItemPage >= customItemPageCount" @click="moveCustomItemPage(1)">다음</button>
|
||||||
<span>관리자 권한</span>
|
</div>
|
||||||
</label>
|
|
||||||
|
|
||||||
<div class="userCard__actions">
|
|
||||||
<button class="btn btn--ghost" @click="saveUser(user)">회원 저장</button>
|
|
||||||
<button class="btn btn--danger" :disabled="user.id === auth.user?.id" @click="removeUser(user)">회원 삭제</button>
|
|
||||||
</div>
|
|
||||||
</article>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</template>
|
||||||
|
|
||||||
|
<template v-else>
|
||||||
|
<div class="panel">
|
||||||
|
<div class="sectionHeader">
|
||||||
|
<div>
|
||||||
|
<div class="panel__title">회원 관리</div>
|
||||||
|
<div class="hint hint--tight">이메일, 닉네임, 관리자 권한을 수정하고 비밀번호도 직접 초기화할 수 있어요.</div>
|
||||||
|
</div>
|
||||||
|
<button class="btn btn--ghost" @click="refreshUsers">새로고침</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="!users.length" class="hint">아직 가입한 회원이 없어요.</div>
|
||||||
|
<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>
|
||||||
|
<span class="roleBadge" :class="{ 'roleBadge--admin': user.draftIsAdmin }">
|
||||||
|
{{ user.draftIsAdmin ? '관리자' : '일반 회원' }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input v-model="user.draftEmail" class="input" placeholder="이메일" />
|
||||||
|
<input v-model="user.draftNickname" class="input" placeholder="닉네임" />
|
||||||
|
<label class="checkRow">
|
||||||
|
<input v-model="user.draftIsAdmin" type="checkbox" :disabled="user.id === auth.user?.id" />
|
||||||
|
<span>관리자 권한</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<div class="passwordBox">
|
||||||
|
<input v-model="user.draftPassword" class="input" type="text" placeholder="새 비밀번호 직접 입력" />
|
||||||
|
<button class="btn btn--ghost" @click="resetUserPassword(user)">비밀번호 초기화</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="userCard__actions">
|
||||||
|
<button class="btn btn--ghost" @click="saveUser(user)">회원 저장</button>
|
||||||
|
<button class="btn btn--danger" :disabled="user.id === auth.user?.id" @click="removeUser(user)">회원 삭제</button>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
@@ -538,12 +611,14 @@ function fmt(ts) {
|
|||||||
border: 1px solid rgba(52, 211, 153, 0.32);
|
border: 1px solid rgba(52, 211, 153, 0.32);
|
||||||
background: rgba(52, 211, 153, 0.14);
|
background: rgba(52, 211, 153, 0.14);
|
||||||
}
|
}
|
||||||
|
.tabs,
|
||||||
.modeTabs {
|
.modeTabs {
|
||||||
margin-top: 14px;
|
margin-top: 14px;
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
.tab,
|
||||||
.modeTab {
|
.modeTab {
|
||||||
padding: 10px 14px;
|
padding: 10px 14px;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
@@ -553,6 +628,7 @@ function fmt(ts) {
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
}
|
}
|
||||||
|
.tab--active,
|
||||||
.modeTab--active {
|
.modeTab--active {
|
||||||
background: rgba(96, 165, 250, 0.2);
|
background: rgba(96, 165, 250, 0.2);
|
||||||
}
|
}
|
||||||
@@ -564,7 +640,7 @@ function fmt(ts) {
|
|||||||
padding: 14px;
|
padding: 14px;
|
||||||
}
|
}
|
||||||
.panel--compact {
|
.panel--compact {
|
||||||
max-width: 640px;
|
max-width: 760px;
|
||||||
}
|
}
|
||||||
.panel__title,
|
.panel__title,
|
||||||
.section__title {
|
.section__title {
|
||||||
@@ -587,6 +663,27 @@ function fmt(ts) {
|
|||||||
padding: 14px;
|
padding: 14px;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
.sectionHeader {
|
||||||
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: flex-start;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
.toolbar {
|
||||||
|
margin-top: 14px;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(0, 1fr) auto auto;
|
||||||
|
gap: 10px;
|
||||||
|
align-items: end;
|
||||||
|
}
|
||||||
|
.toolbar__search,
|
||||||
|
.toolbar__select {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
.toolbar__button {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
.uploadPreviewCard {
|
.uploadPreviewCard {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -664,6 +761,10 @@ function fmt(ts) {
|
|||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
.detailHead__actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
.selectedGame__name {
|
.selectedGame__name {
|
||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
font-size: 22px;
|
font-size: 22px;
|
||||||
@@ -674,10 +775,6 @@ function fmt(ts) {
|
|||||||
opacity: 0.72;
|
opacity: 0.72;
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
}
|
}
|
||||||
.detailHead__actions {
|
|
||||||
display: flex;
|
|
||||||
gap: 8px;
|
|
||||||
}
|
|
||||||
.selectedThumb {
|
.selectedThumb {
|
||||||
width: min(100%, 256px);
|
width: min(100%, 256px);
|
||||||
aspect-ratio: 16 / 9;
|
aspect-ratio: 16 / 9;
|
||||||
@@ -734,7 +831,7 @@ function fmt(ts) {
|
|||||||
.thumbGrid {
|
.thumbGrid {
|
||||||
margin-top: 12px;
|
margin-top: 12px;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
|
grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
|
||||||
gap: 12px;
|
gap: 12px;
|
||||||
}
|
}
|
||||||
.thumbCard {
|
.thumbCard {
|
||||||
@@ -751,6 +848,11 @@ function fmt(ts) {
|
|||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
border: 1px solid rgba(255, 255, 255, 0.12);
|
border: 1px solid rgba(255, 255, 255, 0.12);
|
||||||
}
|
}
|
||||||
|
.thumb--game {
|
||||||
|
max-width: 150px;
|
||||||
|
margin: 0 auto;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
.thumbLabel {
|
.thumbLabel {
|
||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
font-weight: 900;
|
font-weight: 900;
|
||||||
@@ -761,13 +863,6 @@ function fmt(ts) {
|
|||||||
.thumbLabel--preview {
|
.thumbLabel--preview {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
.sectionHeader {
|
|
||||||
display: flex;
|
|
||||||
gap: 12px;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: flex-start;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
.customItemGrid {
|
.customItemGrid {
|
||||||
margin-top: 14px;
|
margin-top: 14px;
|
||||||
display: grid;
|
display: grid;
|
||||||
@@ -781,10 +876,12 @@ function fmt(ts) {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
.customItemCard__image {
|
.customItemCard__image {
|
||||||
width: 100%;
|
width: min(100%, 150px);
|
||||||
aspect-ratio: 1 / 1;
|
aspect-ratio: 1 / 1;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
display: block;
|
display: block;
|
||||||
|
margin: 12px auto 0;
|
||||||
|
border-radius: 12px;
|
||||||
background: rgba(0, 0, 0, 0.18);
|
background: rgba(0, 0, 0, 0.18);
|
||||||
}
|
}
|
||||||
.customItemCard__body {
|
.customItemCard__body {
|
||||||
@@ -800,10 +897,22 @@ function fmt(ts) {
|
|||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
word-break: break-word;
|
word-break: break-word;
|
||||||
}
|
}
|
||||||
|
.pager {
|
||||||
|
margin-top: 16px;
|
||||||
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
.pager__info {
|
||||||
|
opacity: 0.82;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
.userList {
|
.userList {
|
||||||
margin-top: 14px;
|
margin-top: 14px;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
|
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
|
||||||
gap: 12px;
|
gap: 12px;
|
||||||
}
|
}
|
||||||
.userCard {
|
.userCard {
|
||||||
@@ -831,6 +940,11 @@ function fmt(ts) {
|
|||||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
}
|
}
|
||||||
|
.passwordBox {
|
||||||
|
margin-top: 12px;
|
||||||
|
display: grid;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
.roleBadge {
|
.roleBadge {
|
||||||
padding: 6px 10px;
|
padding: 6px 10px;
|
||||||
border-radius: 999px;
|
border-radius: 999px;
|
||||||
@@ -850,9 +964,8 @@ function fmt(ts) {
|
|||||||
opacity: 0.88;
|
opacity: 0.88;
|
||||||
}
|
}
|
||||||
@media (max-width: 980px) {
|
@media (max-width: 980px) {
|
||||||
.section--topGrid {
|
.section--topGrid,
|
||||||
grid-template-columns: 1fr;
|
.toolbar,
|
||||||
}
|
|
||||||
.itemComposer {
|
.itemComposer {
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
}
|
}
|
||||||
@@ -861,16 +974,10 @@ function fmt(ts) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
@media (max-width: 640px) {
|
@media (max-width: 640px) {
|
||||||
.selectedThumb {
|
|
||||||
width: min(100%, 256px);
|
|
||||||
}
|
|
||||||
.thumbGrid,
|
.thumbGrid,
|
||||||
.customItemGrid,
|
.customItemGrid,
|
||||||
.userList {
|
.userList {
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
}
|
}
|
||||||
.itemPreviewCard {
|
|
||||||
max-width: 192px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { computed, nextTick, onMounted, ref } from 'vue'
|
import { computed, nextTick, onMounted, onUnmounted, ref } from 'vue'
|
||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
import Sortable from 'sortablejs'
|
import Sortable from 'sortablejs'
|
||||||
import * as htmlToImage from 'html-to-image'
|
import * as htmlToImage from 'html-to-image'
|
||||||
@@ -38,12 +38,18 @@ const groupListEl = ref(null)
|
|||||||
const poolEl = ref(null)
|
const poolEl = ref(null)
|
||||||
const groupDropEls = ref({})
|
const groupDropEls = ref({})
|
||||||
const fileEl = ref(null)
|
const fileEl = ref(null)
|
||||||
|
const groupSortable = ref(null)
|
||||||
|
const poolSortable = ref(null)
|
||||||
|
const dropSortables = ref([])
|
||||||
|
|
||||||
const isNewTierList = computed(() => tierListId.value === 'new')
|
const isNewTierList = computed(() => tierListId.value === 'new')
|
||||||
const canEdit = computed(() => !!auth.user && (!ownerId.value || ownerId.value === auth.user.id))
|
const canEdit = computed(() => !!auth.user && (!ownerId.value || ownerId.value === auth.user.id))
|
||||||
|
|
||||||
function setGroupDropEl(groupId, el) {
|
function setGroupDropEl(groupId, el) {
|
||||||
if (!el) return
|
if (!el) {
|
||||||
|
delete groupDropEls.value[groupId]
|
||||||
|
return
|
||||||
|
}
|
||||||
groupDropEls.value[groupId] = el
|
groupDropEls.value[groupId] = el
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,7 +81,9 @@ function resolveItemSrc(item) {
|
|||||||
async function initSortables() {
|
async function initSortables() {
|
||||||
if (!poolEl.value || !groupListEl.value) return
|
if (!poolEl.value || !groupListEl.value) return
|
||||||
|
|
||||||
Sortable.create(groupListEl.value, {
|
destroySortables()
|
||||||
|
|
||||||
|
groupSortable.value = Sortable.create(groupListEl.value, {
|
||||||
animation: 160,
|
animation: 160,
|
||||||
handle: '[data-group-handle]',
|
handle: '[data-group-handle]',
|
||||||
ghostClass: 'ghost',
|
ghostClass: 'ghost',
|
||||||
@@ -88,7 +96,7 @@ async function initSortables() {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
Sortable.create(poolEl.value, {
|
poolSortable.value = Sortable.create(poolEl.value, {
|
||||||
group: 'tier-items',
|
group: 'tier-items',
|
||||||
animation: 160,
|
animation: 160,
|
||||||
draggable: '[data-item-id]',
|
draggable: '[data-item-id]',
|
||||||
@@ -98,7 +106,7 @@ async function initSortables() {
|
|||||||
onAdd: () => normalizeSort(poolEl.value),
|
onAdd: () => normalizeSort(poolEl.value),
|
||||||
})
|
})
|
||||||
|
|
||||||
Object.entries(groupDropEls.value).forEach(([gid, el]) => {
|
dropSortables.value = Object.entries(groupDropEls.value).map(([gid, el]) =>
|
||||||
Sortable.create(el, {
|
Sortable.create(el, {
|
||||||
group: 'tier-items',
|
group: 'tier-items',
|
||||||
animation: 160,
|
animation: 160,
|
||||||
@@ -108,7 +116,56 @@ async function initSortables() {
|
|||||||
onSort: () => normalizeSort(el),
|
onSort: () => normalizeSort(el),
|
||||||
onAdd: () => normalizeSort(el),
|
onAdd: () => normalizeSort(el),
|
||||||
})
|
})
|
||||||
})
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function destroySortables() {
|
||||||
|
if (groupSortable.value) {
|
||||||
|
groupSortable.value.destroy()
|
||||||
|
groupSortable.value = null
|
||||||
|
}
|
||||||
|
if (poolSortable.value) {
|
||||||
|
poolSortable.value.destroy()
|
||||||
|
poolSortable.value = null
|
||||||
|
}
|
||||||
|
dropSortables.value.forEach((instance) => instance.destroy())
|
||||||
|
dropSortables.value = []
|
||||||
|
}
|
||||||
|
|
||||||
|
async function syncSortables() {
|
||||||
|
await nextTick()
|
||||||
|
if (canEdit.value) {
|
||||||
|
await initSortables()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function createGroupName() {
|
||||||
|
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||||
|
const index = groups.value.length
|
||||||
|
if (index < alphabet.length) return alphabet[index]
|
||||||
|
return `Tier ${index + 1}`
|
||||||
|
}
|
||||||
|
|
||||||
|
async function addGroup() {
|
||||||
|
groups.value = [
|
||||||
|
...groups.value,
|
||||||
|
{
|
||||||
|
id: `g-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
|
||||||
|
name: createGroupName(),
|
||||||
|
itemIds: [],
|
||||||
|
},
|
||||||
|
]
|
||||||
|
await syncSortables()
|
||||||
|
}
|
||||||
|
|
||||||
|
async function removeGroup(groupId) {
|
||||||
|
if (groups.value.length <= 1) return
|
||||||
|
const target = groups.value.find((group) => group.id === groupId)
|
||||||
|
if (!target) return
|
||||||
|
pool.value = [...target.itemIds, ...pool.value]
|
||||||
|
groups.value = groups.value.filter((group) => group.id !== groupId)
|
||||||
|
delete groupDropEls.value[groupId]
|
||||||
|
await syncSortables()
|
||||||
}
|
}
|
||||||
|
|
||||||
function addCustomImage(file) {
|
function addCustomImage(file) {
|
||||||
@@ -278,6 +335,10 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
})()
|
})()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
destroySortables()
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -314,11 +375,15 @@ onMounted(() => {
|
|||||||
|
|
||||||
<section class="layout">
|
<section class="layout">
|
||||||
<div ref="boardEl" class="board">
|
<div ref="boardEl" class="board">
|
||||||
|
<div v-if="canEdit" class="boardTools">
|
||||||
|
<button class="btn btn--ghost" @click="addGroup">티어 추가</button>
|
||||||
|
</div>
|
||||||
<div ref="groupListEl" class="rows">
|
<div ref="groupListEl" class="rows">
|
||||||
<div v-for="g in groups" :key="g.id" class="row">
|
<div v-for="g in groups" :key="g.id" class="row">
|
||||||
<div class="row__label">
|
<div class="row__label">
|
||||||
<span class="grab" title="드래그로 순서 변경" data-group-handle>↕</span>
|
<span class="grab" title="드래그로 순서 변경" data-group-handle>↕</span>
|
||||||
<input v-model="g.name" class="groupName" :readonly="!canEdit" />
|
<input v-model="g.name" class="groupName" :readonly="!canEdit" />
|
||||||
|
<button v-if="canEdit" class="rowRemoveBtn" :disabled="groups.length <= 1" @click="removeGroup(g.id)">삭제</button>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="row__drop"
|
class="row__drop"
|
||||||
@@ -471,6 +536,11 @@ onMounted(() => {
|
|||||||
border-radius: 16px;
|
border-radius: 16px;
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
}
|
}
|
||||||
|
.boardTools {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
.rows {
|
.rows {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
@@ -517,6 +587,20 @@ onMounted(() => {
|
|||||||
outline: none;
|
outline: none;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
.rowRemoveBtn {
|
||||||
|
padding: 6px 10px;
|
||||||
|
border-radius: 10px;
|
||||||
|
border: 1px solid rgba(239, 68, 68, 0.28);
|
||||||
|
background: rgba(239, 68, 68, 0.12);
|
||||||
|
color: rgba(255, 255, 255, 0.92);
|
||||||
|
cursor: pointer;
|
||||||
|
font-weight: 800;
|
||||||
|
flex: 0 0 auto;
|
||||||
|
}
|
||||||
|
.rowRemoveBtn:disabled {
|
||||||
|
opacity: 0.45;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
.row__drop {
|
.row__drop {
|
||||||
border-radius: 14px;
|
border-radius: 14px;
|
||||||
background: rgba(0, 0, 0, 0.18);
|
background: rgba(0, 0, 0, 0.18);
|
||||||
|
|||||||
Reference in New Issue
Block a user