v0.1.18 - 설정 화면과 기간형 D-DAY 관리 추가
This commit is contained in:
13
HANDOFF.md
13
HANDOFF.md
@@ -4,7 +4,7 @@
|
||||
|
||||
- 프로젝트명: 10 Minute Planner 웹 UI
|
||||
- 기술 스택: Vue 3 + Vite + TailwindCSS + JavaScript
|
||||
- 현재 기준 버전: `v0.1.17`
|
||||
- 현재 기준 버전: `v0.1.18`
|
||||
- Git 원격 저장소: `https://git.sori.studio/zenn/planner.sori.studio.git`
|
||||
|
||||
## 기준 디자인
|
||||
@@ -55,6 +55,7 @@
|
||||
- 프론트 플래너 API 클라이언트는 `src/lib/plannerApi.js`에 추가되었다.
|
||||
- 프론트 목표 API 클라이언트는 `src/lib/goalsApi.js`에 추가되었다.
|
||||
- 루트에서 `npm run dev:backend`, `npm run db:generate`, `npm run db:migrate`로 백엔드 명령을 호출할 수 있다.
|
||||
- 화면 탭은 `PLANNER / STATS / GOALS / SETTINGS` 기준으로 확장되었다.
|
||||
- 상단 전환 버튼으로 `PLANNER / STATS` 화면을 오갈 수 있다.
|
||||
- 통계 화면에서는 전체 집중 시간, 평균 완료율, 기록 일수, 최근 7일 흐름, 최근 기록, 베스트 데이를 보여준다.
|
||||
- 통계 화면은 시작일/종료일을 직접 선택해 그 기간 기준으로 지표를 다시 계산할 수 있다.
|
||||
@@ -127,10 +128,12 @@
|
||||
- 현재는 로그인 전 플래너 진입을 막고, 인증 후에만 실제 플래너/통계 화면을 사용하도록 변경했다.
|
||||
- 클라우드 저장 상태는 헤더가 아니라 오른쪽 하단의 작은 토스트 형태로 표시되도록 변경했다.
|
||||
- 저장 완료 토스트는 한 줄짜리의 작은 상태 문구로 줄여서 존재감을 낮췄다.
|
||||
- D-DAY는 본문 직접 입력이 아니라, 날짜별로 선택한 대표 목표를 보여주는 구조로 실제 연결되기 시작했다.
|
||||
- 오른쪽 패널에 `D-DAY 사용` 토글, 목표 검색, 목표 선택, 목표 생성 폼이 추가되었다.
|
||||
- 목표가 없거나 `D-DAY 사용`이 꺼져 있으면 본문 D-DAY 블록은 숨긴다.
|
||||
- 목표 데이터는 현재 사용자 기준으로 서버에서 관리되며, 플래너 레코드에는 목표 사용 여부와 선택한 목표 ID를 함께 저장한다.
|
||||
- D-DAY는 플래너 안에서 목표를 고르는 구조가 아니라, GOALS 화면에서 목표와 표시 기간을 먼저 설정하는 구조로 정리했다.
|
||||
- 플래너 화면 오른쪽 패널에서는 현재 날짜에 적용된 목표가 있을 때만 D-DAY 토글을 켤 수 있고, 목표 검색 UI는 제거했다.
|
||||
- 목표는 `active_from`, `active_until` 기간을 가질 수 있고, 현재 날짜가 그 범위에 들어올 때만 플래너 본문 D-DAY 후보가 된다.
|
||||
- TASK LABELS도 별도 버튼 2개 대신 동일한 토글 UI로 단순화했다. ON이면 01~15를 채우고 OFF이면 비운다.
|
||||
- SETTINGS 화면이 추가되어 닉네임, 이메일, 비밀번호 변경을 분리해서 관리할 수 있다.
|
||||
- 백엔드에는 `/api/auth/profile`, `/api/auth/password`, `/api/goals/:goalId` 수정 API가 추가되었다.
|
||||
- 이미지 저장 기능은 추후 `print-only` 또는 별도 export 전용 레이아웃을 기준으로 구현하면 화면/인쇄/공유 결과를 맞추기 쉽다.
|
||||
- Docker Compose는 프론트엔드와 백엔드를 함께 올리는 기준으로 설계하되, NAS 환경에 맞는 볼륨과 재시작 정책도 함께 고려한다.
|
||||
|
||||
|
||||
7
TODO.md
7
TODO.md
@@ -42,6 +42,8 @@
|
||||
- [ ] 다음날 할 일 자동 제안 규칙을 정리한다.
|
||||
- [x] 오른쪽 패널에 `D-DAY 사용` 토글과 목표 검색/선택 UI를 추가한다.
|
||||
- [x] 목표를 여러 개 생성하고 날짜별 대표 목표를 선택할 수 있게 한다.
|
||||
- [x] 목표 관리 화면을 별도로 분리하고, 플래너에서는 D-DAY 표시 ON/OFF만 제어한다.
|
||||
- [x] 목표별로 D-DAY 표시 시작일과 종료일을 설정할 수 있게 한다.
|
||||
- [ ] 목표 완료 처리와 보관 상태를 구분한다.
|
||||
- [ ] 목표 편집/삭제 UI를 추가한다.
|
||||
- [ ] 목표 목록 정렬 규칙과 검색 UX를 다듬는다.
|
||||
@@ -76,6 +78,7 @@
|
||||
|
||||
- [ ] 회원 가입 / 로그인 방식 후보를 정리한다.
|
||||
- [x] 회원 가입 / 로그인 방식 후보를 정리한다.
|
||||
- [x] 사용자 설정 화면에서 닉네임 / 이메일 / 비밀번호 수정 흐름을 분리한다.
|
||||
- [ ] 사용자별 문서 분리 저장 구조를 설계한다.
|
||||
- [ ] 공유가 아닌 개인 보관용 서비스 흐름으로 요구사항을 정리한다.
|
||||
- [x] 향후 출력 기능을 위한 인쇄 레이아웃 요구사항을 정리한다.
|
||||
@@ -106,5 +109,7 @@
|
||||
- 로그인 상태일 때는 서버 저장을 우선 사용하는 흐름으로 전환 중이다.
|
||||
- 로그인 전에는 플래너 본문을 사용하지 못하도록 막고, 인증 후 사용 흐름으로 정리했다.
|
||||
- 현재는 각 날짜 플래너가 대표 목표 하나를 선택해 `D-DAY`에 연결하는 구조다.
|
||||
- 목표가 선택되지 않았거나 `D-DAY 사용`이 꺼져 있으면 본문 `D-DAY` 영역은 숨긴다.
|
||||
- 목표는 별도 GOALS 화면에서 검색/생성/기간 설정을 관리하고, 플래너에서는 표시 ON/OFF만 다룬다.
|
||||
- 목표가 현재 날짜에 적용되지 않았거나 `D-DAY 사용`이 꺼져 있으면 본문 `D-DAY` 영역은 숨긴다.
|
||||
- TASK LABELS는 버튼 묶음 대신 동일한 토글 패턴으로 단순화했다.
|
||||
- 구현할 때마다 완료된 항목은 체크하고, 큰 결정사항은 `HANDOFF.md`에도 함께 반영한다.
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
import { sqlite } from './client.js'
|
||||
|
||||
function ensureColumn(tableName, columnName, definition) {
|
||||
const columns = sqlite.prepare(`PRAGMA table_info(${tableName})`).all()
|
||||
const hasColumn = columns.some((column) => column.name === columnName)
|
||||
|
||||
if (!hasColumn) {
|
||||
sqlite.exec(`ALTER TABLE ${tableName} ADD COLUMN ${columnName} ${definition}`)
|
||||
}
|
||||
}
|
||||
|
||||
export function ensureDatabaseSchema() {
|
||||
sqlite.exec(`
|
||||
CREATE TABLE IF NOT EXISTS users (
|
||||
@@ -38,6 +47,8 @@ export function ensureDatabaseSchema() {
|
||||
user_id INTEGER NOT NULL,
|
||||
title TEXT NOT NULL,
|
||||
target_date TEXT NOT NULL,
|
||||
active_from TEXT,
|
||||
active_until TEXT,
|
||||
status TEXT NOT NULL DEFAULT 'active',
|
||||
color TEXT NOT NULL DEFAULT '#1c1917',
|
||||
created_at INTEGER NOT NULL,
|
||||
@@ -46,4 +57,7 @@ export function ensureDatabaseSchema() {
|
||||
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
|
||||
);
|
||||
`)
|
||||
|
||||
ensureColumn('goals', 'active_from', 'TEXT')
|
||||
ensureColumn('goals', 'active_until', 'TEXT')
|
||||
}
|
||||
|
||||
@@ -37,6 +37,8 @@ export const goals = sqliteTable('goals', {
|
||||
userId: integer('user_id').notNull().references(() => users.id, { onDelete: 'cascade' }),
|
||||
title: text('title').notNull(),
|
||||
targetDate: text('target_date').notNull(),
|
||||
activeFrom: text('active_from'),
|
||||
activeUntil: text('active_until'),
|
||||
status: text('status').notNull().default('active'),
|
||||
color: text('color').notNull().default('#1c1917'),
|
||||
createdAt: integer('created_at', { mode: 'timestamp_ms' }).notNull(),
|
||||
|
||||
@@ -16,6 +16,16 @@ const loginSchema = z.object({
|
||||
password: z.string().min(1).max(72),
|
||||
})
|
||||
|
||||
const profileSchema = z.object({
|
||||
email: z.string().trim().email(),
|
||||
nickname: z.string().trim().min(2).max(30),
|
||||
})
|
||||
|
||||
const passwordSchema = z.object({
|
||||
currentPassword: z.string().min(1).max(72),
|
||||
newPassword: z.string().min(8).max(72),
|
||||
})
|
||||
|
||||
function sanitizeUser(user) {
|
||||
return {
|
||||
id: user.id,
|
||||
@@ -129,4 +139,93 @@ export async function registerAuthRoutes(app) {
|
||||
user: sanitizeUser(user),
|
||||
}
|
||||
})
|
||||
|
||||
app.put('/api/auth/profile', async (request, reply) => {
|
||||
const user = await findAuthenticatedUser(request)
|
||||
|
||||
if (!user) {
|
||||
return reply.code(401).send({
|
||||
message: '인증이 필요합니다.',
|
||||
})
|
||||
}
|
||||
|
||||
const payload = profileSchema.safeParse(request.body)
|
||||
|
||||
if (!payload.success) {
|
||||
return reply.code(400).send({
|
||||
message: '프로필 입력값이 올바르지 않습니다.',
|
||||
issues: payload.error.flatten(),
|
||||
})
|
||||
}
|
||||
|
||||
const normalizedEmail = payload.data.email.toLowerCase()
|
||||
|
||||
const [existingUser] = await db
|
||||
.select()
|
||||
.from(users)
|
||||
.where(eq(users.email, normalizedEmail))
|
||||
.limit(1)
|
||||
|
||||
if (existingUser && existingUser.id !== user.id) {
|
||||
return reply.code(409).send({
|
||||
message: '이미 사용 중인 이메일입니다.',
|
||||
})
|
||||
}
|
||||
|
||||
const [updatedUser] = await db
|
||||
.update(users)
|
||||
.set({
|
||||
email: normalizedEmail,
|
||||
nickname: payload.data.nickname,
|
||||
updatedAt: new Date(),
|
||||
})
|
||||
.where(eq(users.id, user.id))
|
||||
.returning()
|
||||
|
||||
return {
|
||||
message: '프로필이 수정되었습니다.',
|
||||
user: sanitizeUser(updatedUser),
|
||||
}
|
||||
})
|
||||
|
||||
app.put('/api/auth/password', async (request, reply) => {
|
||||
const user = await findAuthenticatedUser(request)
|
||||
|
||||
if (!user) {
|
||||
return reply.code(401).send({
|
||||
message: '인증이 필요합니다.',
|
||||
})
|
||||
}
|
||||
|
||||
const payload = passwordSchema.safeParse(request.body)
|
||||
|
||||
if (!payload.success) {
|
||||
return reply.code(400).send({
|
||||
message: '비밀번호 입력값이 올바르지 않습니다.',
|
||||
issues: payload.error.flatten(),
|
||||
})
|
||||
}
|
||||
|
||||
const passwordMatches = await verifyPassword(payload.data.currentPassword, user.passwordHash)
|
||||
|
||||
if (!passwordMatches) {
|
||||
return reply.code(401).send({
|
||||
message: '현재 비밀번호가 올바르지 않습니다.',
|
||||
})
|
||||
}
|
||||
|
||||
const passwordHash = await hashPassword(payload.data.newPassword)
|
||||
|
||||
await db
|
||||
.update(users)
|
||||
.set({
|
||||
passwordHash,
|
||||
updatedAt: new Date(),
|
||||
})
|
||||
.where(eq(users.id, user.id))
|
||||
|
||||
return {
|
||||
message: '비밀번호가 변경되었습니다.',
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { and, asc, eq, like } from 'drizzle-orm'
|
||||
import { and, asc, desc, eq, like } from 'drizzle-orm'
|
||||
import { z } from 'zod'
|
||||
import { db } from '../db/client.js'
|
||||
import { goals } from '../db/schema.js'
|
||||
@@ -7,6 +7,18 @@ import { findAuthenticatedUser } from '../lib/authSession.js'
|
||||
const goalSchema = z.object({
|
||||
title: z.string().trim().min(1).max(80),
|
||||
targetDate: z.string().regex(/^\d{4}-\d{2}-\d{2}$/),
|
||||
activeFrom: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional().nullable(),
|
||||
activeUntil: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional().nullable(),
|
||||
status: z.enum(['active', 'done', 'archived']).optional(),
|
||||
color: z.string().trim().min(4).max(32).optional(),
|
||||
})
|
||||
|
||||
const goalUpdateSchema = z.object({
|
||||
title: z.string().trim().min(1).max(80).optional(),
|
||||
targetDate: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional(),
|
||||
activeFrom: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional().nullable(),
|
||||
activeUntil: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional().nullable(),
|
||||
status: z.enum(['active', 'done', 'archived']).optional(),
|
||||
color: z.string().trim().min(4).max(32).optional(),
|
||||
})
|
||||
|
||||
@@ -59,7 +71,7 @@ export async function registerGoalRoutes(app) {
|
||||
.select()
|
||||
.from(goals)
|
||||
.where(and(...filters))
|
||||
.orderBy(asc(goals.targetDate), asc(goals.id))
|
||||
.orderBy(desc(goals.updatedAt), asc(goals.targetDate), asc(goals.id))
|
||||
|
||||
return { goals: items }
|
||||
})
|
||||
@@ -88,10 +100,13 @@ export async function registerGoalRoutes(app) {
|
||||
userId: user.id,
|
||||
title: payload.data.title,
|
||||
targetDate: payload.data.targetDate,
|
||||
activeFrom: payload.data.activeFrom ?? null,
|
||||
activeUntil: payload.data.activeUntil ?? null,
|
||||
color: payload.data.color ?? '#1c1917',
|
||||
status: 'active',
|
||||
status: payload.data.status ?? 'active',
|
||||
createdAt: now,
|
||||
updatedAt: now,
|
||||
completedAt: payload.data.status === 'done' ? now : null,
|
||||
})
|
||||
.returning()
|
||||
|
||||
@@ -100,4 +115,90 @@ export async function registerGoalRoutes(app) {
|
||||
goal,
|
||||
})
|
||||
})
|
||||
|
||||
app.patch('/api/goals/:goalId', async (request, reply) => {
|
||||
const user = await requireAuthenticatedUser(request, reply)
|
||||
|
||||
if (!user) {
|
||||
return
|
||||
}
|
||||
|
||||
const params = z.object({
|
||||
goalId: z.coerce.number().int().positive(),
|
||||
}).safeParse(request.params)
|
||||
|
||||
if (!params.success) {
|
||||
return reply.code(400).send({
|
||||
message: '목표 식별자가 올바르지 않습니다.',
|
||||
})
|
||||
}
|
||||
|
||||
const payload = goalUpdateSchema.safeParse(request.body)
|
||||
|
||||
if (!payload.success) {
|
||||
return reply.code(400).send({
|
||||
message: '목표 수정값이 올바르지 않습니다.',
|
||||
issues: payload.error.flatten(),
|
||||
})
|
||||
}
|
||||
|
||||
const [existingGoal] = await db
|
||||
.select()
|
||||
.from(goals)
|
||||
.where(and(eq(goals.id, params.data.goalId), eq(goals.userId, user.id)))
|
||||
.limit(1)
|
||||
|
||||
if (!existingGoal) {
|
||||
return reply.code(404).send({
|
||||
message: '목표를 찾을 수 없습니다.',
|
||||
})
|
||||
}
|
||||
|
||||
const nextValues = {
|
||||
updatedAt: new Date(),
|
||||
}
|
||||
|
||||
if (payload.data.title !== undefined) {
|
||||
nextValues.title = payload.data.title
|
||||
}
|
||||
|
||||
if (payload.data.targetDate !== undefined) {
|
||||
nextValues.targetDate = payload.data.targetDate
|
||||
}
|
||||
|
||||
if (payload.data.activeFrom !== undefined) {
|
||||
nextValues.activeFrom = payload.data.activeFrom
|
||||
}
|
||||
|
||||
if (payload.data.activeUntil !== undefined) {
|
||||
nextValues.activeUntil = payload.data.activeUntil
|
||||
}
|
||||
|
||||
if (payload.data.status !== undefined) {
|
||||
nextValues.status = payload.data.status
|
||||
}
|
||||
|
||||
if (payload.data.color !== undefined) {
|
||||
nextValues.color = payload.data.color
|
||||
}
|
||||
|
||||
if (payload.data.status === 'done' && !existingGoal.completedAt) {
|
||||
nextValues.completedAt = new Date()
|
||||
}
|
||||
|
||||
if (payload.data.status && payload.data.status !== 'done') {
|
||||
nextValues.completedAt = null
|
||||
}
|
||||
|
||||
const [goal] = await db
|
||||
.update(goals)
|
||||
.set(nextValues)
|
||||
.where(and(eq(goals.id, params.data.goalId), eq(goals.userId, user.id)))
|
||||
.returning()
|
||||
|
||||
return {
|
||||
message: '목표가 수정되었습니다.',
|
||||
goal,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "ten-minute-planner",
|
||||
"version": "0.1.17",
|
||||
"version": "0.1.18",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "ten-minute-planner",
|
||||
"version": "0.1.17",
|
||||
"version": "0.1.18",
|
||||
"dependencies": {
|
||||
"vue": "^3.5.13"
|
||||
},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "ten-minute-planner",
|
||||
"private": true,
|
||||
"version": "0.1.17",
|
||||
"version": "0.1.18",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
530
src/App.vue
530
src/App.vue
@@ -1,8 +1,10 @@
|
||||
<script setup>
|
||||
import { computed, onMounted, reactive, ref, watch, nextTick } from 'vue'
|
||||
import AuthDialog from './components/AuthDialog.vue'
|
||||
import GoalsDashboard from './components/GoalsDashboard.vue'
|
||||
import MiniCalendar from './components/MiniCalendar.vue'
|
||||
import PlannerPage from './components/PlannerPage.vue'
|
||||
import SettingsDashboard from './components/SettingsDashboard.vue'
|
||||
import StatsDashboard from './components/StatsDashboard.vue'
|
||||
import {
|
||||
clearAuthState,
|
||||
@@ -11,8 +13,10 @@ import {
|
||||
persistAuthState,
|
||||
readAuthState,
|
||||
signup,
|
||||
updatePassword,
|
||||
updateProfile,
|
||||
} from './lib/authClient'
|
||||
import { createGoal, fetchGoals } from './lib/goalsApi'
|
||||
import { createGoal, fetchGoals, updateGoal } from './lib/goalsApi'
|
||||
import { deletePlannerEntry, fetchPlannerEntries, savePlannerEntry } from './lib/plannerApi'
|
||||
import {
|
||||
createInitialPlannerRecords,
|
||||
@@ -32,8 +36,10 @@ const authToken = ref('')
|
||||
const currentUser = ref(null)
|
||||
const goals = ref([])
|
||||
const goalQuery = ref('')
|
||||
const goalStatusFilter = ref('all')
|
||||
const goalBusy = ref(false)
|
||||
const goalMessage = ref('')
|
||||
const editingGoalId = ref(null)
|
||||
const syncStatus = ref('local')
|
||||
const syncMessage = ref('')
|
||||
const syncToastVisible = ref(false)
|
||||
@@ -49,7 +55,23 @@ const authForm = reactive({
|
||||
const goalForm = reactive({
|
||||
title: '',
|
||||
targetDate: '',
|
||||
activeFrom: '',
|
||||
activeUntil: '',
|
||||
status: 'active',
|
||||
})
|
||||
const profileForm = reactive({
|
||||
nickname: '',
|
||||
email: '',
|
||||
})
|
||||
const passwordForm = reactive({
|
||||
currentPassword: '',
|
||||
newPassword: '',
|
||||
confirmPassword: '',
|
||||
})
|
||||
const profileBusy = ref(false)
|
||||
const passwordBusy = ref(false)
|
||||
const profileMessage = ref('')
|
||||
const passwordMessage = ref('')
|
||||
|
||||
const hours = [
|
||||
'6', '7', '8', '9', '10', '11', '12',
|
||||
@@ -314,18 +336,35 @@ const markedDateKeys = computed(() =>
|
||||
const isAuthenticated = computed(() => Boolean(authToken.value && currentUser.value))
|
||||
const filteredGoals = computed(() => {
|
||||
const query = goalQuery.value.trim().toLowerCase()
|
||||
return goals.value.filter((goal) => {
|
||||
if (goalStatusFilter.value !== 'all' && goal.status !== goalStatusFilter.value) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (!query) {
|
||||
return goals.value
|
||||
}
|
||||
if (!query) {
|
||||
return true
|
||||
}
|
||||
|
||||
return goals.value.filter((goal) =>
|
||||
goal.title.toLowerCase().includes(query),
|
||||
)
|
||||
return goal.title.toLowerCase().includes(query)
|
||||
})
|
||||
})
|
||||
const plannerGoal = computed(() =>
|
||||
goals.value.find((goal) => goal.id === planner.value.selectedGoalId) ?? null,
|
||||
const activePlannerGoals = computed(() =>
|
||||
goals.value
|
||||
.filter((goal) => {
|
||||
if (goal.status !== 'active' || !goal.activeFrom || !goal.activeUntil) {
|
||||
return false
|
||||
}
|
||||
|
||||
const selectedKey = toKey(selectedDate.value)
|
||||
return selectedKey >= goal.activeFrom && selectedKey <= goal.activeUntil
|
||||
})
|
||||
.sort((left, right) => {
|
||||
const leftDistance = Math.abs(startOfDay(toDateValue(left.targetDate)).getTime() - startOfDay(selectedDate.value).getTime())
|
||||
const rightDistance = Math.abs(startOfDay(toDateValue(right.targetDate)).getTime() - startOfDay(selectedDate.value).getTime())
|
||||
return leftDistance - rightDistance
|
||||
}),
|
||||
)
|
||||
const plannerGoal = computed(() => activePlannerGoals.value[0] ?? null)
|
||||
const plannerDday = computed(() => {
|
||||
if (!planner.value.goalEnabled || !plannerGoal.value) {
|
||||
return ''
|
||||
@@ -342,6 +381,7 @@ const plannerDday = computed(() => {
|
||||
const showPlannerDday = computed(() =>
|
||||
planner.value.goalEnabled && Boolean(plannerGoal.value),
|
||||
)
|
||||
const hasActiveGoalForSelectedDate = computed(() => Boolean(plannerGoal.value))
|
||||
|
||||
const filledTasks = computed(() =>
|
||||
planner.value.tasks.filter((task) => task.title.trim()),
|
||||
@@ -411,18 +451,11 @@ function updateComment(record, value) {
|
||||
}
|
||||
|
||||
function updateGoalEnabled(record, value) {
|
||||
record.goalEnabled = value
|
||||
|
||||
if (!value) {
|
||||
record.selectedGoalId = null
|
||||
if (value && !hasActiveGoalForSelectedDate.value) {
|
||||
return
|
||||
}
|
||||
|
||||
schedulePlannerSyncForRecord(record)
|
||||
}
|
||||
|
||||
function selectGoalForPlanner(record, goalId) {
|
||||
record.goalEnabled = true
|
||||
record.selectedGoalId = goalId
|
||||
record.goalEnabled = value
|
||||
schedulePlannerSyncForRecord(record)
|
||||
}
|
||||
|
||||
@@ -624,10 +657,21 @@ watch(
|
||||
{ deep: true },
|
||||
)
|
||||
|
||||
watch(
|
||||
[selectedDate, plannerGoal],
|
||||
() => {
|
||||
if (!plannerGoal.value && planner.value.goalEnabled) {
|
||||
planner.value.goalEnabled = false
|
||||
schedulePlannerSyncForRecord(planner.value)
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
function fillTaskLabelsWithNumbers(record) {
|
||||
record.tasks.forEach((task, index) => {
|
||||
task.label = createTaskLabel(index)
|
||||
})
|
||||
schedulePlannerSyncForRecord(record)
|
||||
}
|
||||
|
||||
function clearTaskLabels(record) {
|
||||
@@ -637,6 +681,10 @@ function clearTaskLabels(record) {
|
||||
schedulePlannerSyncForRecord(record)
|
||||
}
|
||||
|
||||
function areTaskLabelsNumbered(record) {
|
||||
return record.tasks.every((task, index) => task.label === createTaskLabel(index))
|
||||
}
|
||||
|
||||
function setSyncFeedback(status, message, options = {}) {
|
||||
const {
|
||||
visible = true,
|
||||
@@ -670,6 +718,21 @@ function resetAuthForm() {
|
||||
function resetGoalForm() {
|
||||
goalForm.title = ''
|
||||
goalForm.targetDate = ''
|
||||
goalForm.activeFrom = ''
|
||||
goalForm.activeUntil = ''
|
||||
goalForm.status = 'active'
|
||||
editingGoalId.value = null
|
||||
}
|
||||
|
||||
function syncProfileForm() {
|
||||
profileForm.nickname = currentUser.value?.nickname ?? ''
|
||||
profileForm.email = currentUser.value?.email ?? ''
|
||||
}
|
||||
|
||||
function resetPasswordForm() {
|
||||
passwordForm.currentPassword = ''
|
||||
passwordForm.newPassword = ''
|
||||
passwordForm.confirmPassword = ''
|
||||
}
|
||||
|
||||
function openAuthDialog(mode = 'login') {
|
||||
@@ -698,6 +761,7 @@ async function applyAuthSuccess(data) {
|
||||
})
|
||||
await loadGoals()
|
||||
await hydratePlannerRecordsFromApi()
|
||||
syncProfileForm()
|
||||
closeAuthDialog()
|
||||
}
|
||||
|
||||
@@ -746,6 +810,7 @@ async function restoreAuthSession() {
|
||||
})
|
||||
await loadGoals()
|
||||
await hydratePlannerRecordsFromApi()
|
||||
syncProfileForm()
|
||||
} catch (error) {
|
||||
authToken.value = ''
|
||||
currentUser.value = null
|
||||
@@ -763,11 +828,14 @@ function logout() {
|
||||
goals.value = []
|
||||
goalQuery.value = ''
|
||||
goalMessage.value = ''
|
||||
goalStatusFilter.value = 'all'
|
||||
setSyncFeedback('local', '로그인 후 클라우드 저장을 사용할 수 있습니다.', {
|
||||
visible: false,
|
||||
})
|
||||
clearAuthState()
|
||||
restoreLocalPlannerRecords()
|
||||
resetGoalForm()
|
||||
resetPasswordForm()
|
||||
}
|
||||
|
||||
async function loadGoals() {
|
||||
@@ -779,7 +847,7 @@ async function loadGoals() {
|
||||
|
||||
try {
|
||||
const result = await fetchGoals(authToken.value, {
|
||||
status: 'active',
|
||||
status: 'all',
|
||||
})
|
||||
|
||||
goals.value = result.goals
|
||||
@@ -793,7 +861,17 @@ async function loadGoals() {
|
||||
|
||||
async function submitGoal() {
|
||||
if (!goalForm.title.trim() || !goalForm.targetDate) {
|
||||
goalMessage.value = '목표 이름과 날짜를 입력해 주세요.'
|
||||
goalMessage.value = '목표 이름과 목표일을 입력해 주세요.'
|
||||
return
|
||||
}
|
||||
|
||||
if ((goalForm.activeFrom && !goalForm.activeUntil) || (!goalForm.activeFrom && goalForm.activeUntil)) {
|
||||
goalMessage.value = '표시 시작일과 종료일은 함께 입력해 주세요.'
|
||||
return
|
||||
}
|
||||
|
||||
if (goalForm.activeFrom && goalForm.activeUntil && goalForm.activeFrom > goalForm.activeUntil) {
|
||||
goalMessage.value = '표시 종료일은 시작일보다 빠를 수 없습니다.'
|
||||
return
|
||||
}
|
||||
|
||||
@@ -804,15 +882,15 @@ async function submitGoal() {
|
||||
const result = await createGoal(authToken.value, {
|
||||
title: goalForm.title.trim(),
|
||||
targetDate: goalForm.targetDate,
|
||||
activeFrom: goalForm.activeFrom || null,
|
||||
activeUntil: goalForm.activeUntil || null,
|
||||
status: goalForm.status,
|
||||
})
|
||||
|
||||
goals.value = [...goals.value, result.goal].sort((left, right) =>
|
||||
left.targetDate.localeCompare(right.targetDate),
|
||||
)
|
||||
selectGoalForPlanner(planner.value, result.goal.id)
|
||||
await loadGoals()
|
||||
resetGoalForm()
|
||||
goalQuery.value = ''
|
||||
goalMessage.value = '목표가 추가되었습니다.'
|
||||
goalMessage.value = result.message || '목표가 추가되었습니다.'
|
||||
} catch (error) {
|
||||
goalMessage.value = error.message || '목표를 추가하지 못했습니다.'
|
||||
} finally {
|
||||
@@ -820,6 +898,122 @@ async function submitGoal() {
|
||||
}
|
||||
}
|
||||
|
||||
function updateGoalFormField({ field, value }) {
|
||||
goalForm[field] = value
|
||||
}
|
||||
|
||||
function startGoalEdit(goal) {
|
||||
editingGoalId.value = goal.id
|
||||
goalForm.title = goal.title ?? ''
|
||||
goalForm.targetDate = goal.targetDate ?? ''
|
||||
goalForm.activeFrom = goal.activeFrom ?? ''
|
||||
goalForm.activeUntil = goal.activeUntil ?? ''
|
||||
goalForm.status = goal.status ?? 'active'
|
||||
goalMessage.value = ''
|
||||
}
|
||||
|
||||
async function saveGoalEdit() {
|
||||
if (!editingGoalId.value) {
|
||||
return
|
||||
}
|
||||
|
||||
if (!goalForm.title.trim() || !goalForm.targetDate) {
|
||||
goalMessage.value = '목표 이름과 목표일을 입력해 주세요.'
|
||||
return
|
||||
}
|
||||
|
||||
if ((goalForm.activeFrom && !goalForm.activeUntil) || (!goalForm.activeFrom && goalForm.activeUntil)) {
|
||||
goalMessage.value = '표시 시작일과 종료일은 함께 입력해 주세요.'
|
||||
return
|
||||
}
|
||||
|
||||
if (goalForm.activeFrom && goalForm.activeUntil && goalForm.activeFrom > goalForm.activeUntil) {
|
||||
goalMessage.value = '표시 종료일은 시작일보다 빠를 수 없습니다.'
|
||||
return
|
||||
}
|
||||
|
||||
goalBusy.value = true
|
||||
goalMessage.value = ''
|
||||
|
||||
try {
|
||||
const result = await updateGoal(authToken.value, editingGoalId.value, {
|
||||
title: goalForm.title.trim(),
|
||||
targetDate: goalForm.targetDate,
|
||||
activeFrom: goalForm.activeFrom || null,
|
||||
activeUntil: goalForm.activeUntil || null,
|
||||
status: goalForm.status,
|
||||
})
|
||||
|
||||
await loadGoals()
|
||||
resetGoalForm()
|
||||
goalMessage.value = result.message || '목표가 수정되었습니다.'
|
||||
} catch (error) {
|
||||
goalMessage.value = error.message || '목표를 수정하지 못했습니다.'
|
||||
} finally {
|
||||
goalBusy.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function updateProfileField({ field, value }) {
|
||||
profileForm[field] = value
|
||||
}
|
||||
|
||||
function updatePasswordField({ field, value }) {
|
||||
passwordForm[field] = value
|
||||
}
|
||||
|
||||
async function submitProfileForm() {
|
||||
profileBusy.value = true
|
||||
profileMessage.value = ''
|
||||
|
||||
try {
|
||||
const result = await updateProfile(authToken.value, {
|
||||
nickname: profileForm.nickname,
|
||||
email: profileForm.email,
|
||||
})
|
||||
|
||||
currentUser.value = result.user
|
||||
persistAuthState({
|
||||
token: authToken.value,
|
||||
user: result.user,
|
||||
})
|
||||
syncProfileForm()
|
||||
profileMessage.value = '프로필이 저장되었습니다.'
|
||||
} catch (error) {
|
||||
profileMessage.value = error.message || '프로필을 저장하지 못했습니다.'
|
||||
} finally {
|
||||
profileBusy.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function submitPasswordForm() {
|
||||
if (!passwordForm.currentPassword || !passwordForm.newPassword || !passwordForm.confirmPassword) {
|
||||
passwordMessage.value = '모든 비밀번호 항목을 입력해 주세요.'
|
||||
return
|
||||
}
|
||||
|
||||
if (passwordForm.newPassword !== passwordForm.confirmPassword) {
|
||||
passwordMessage.value = '새 비밀번호 확인이 일치하지 않습니다.'
|
||||
return
|
||||
}
|
||||
|
||||
passwordBusy.value = true
|
||||
passwordMessage.value = ''
|
||||
|
||||
try {
|
||||
await updatePassword(authToken.value, {
|
||||
currentPassword: passwordForm.currentPassword,
|
||||
newPassword: passwordForm.newPassword,
|
||||
})
|
||||
resetPasswordForm()
|
||||
passwordMessage.value = '비밀번호가 변경되었습니다.'
|
||||
} catch (error) {
|
||||
passwordMessage.value = error.message || '비밀번호를 변경하지 못했습니다.'
|
||||
} finally {
|
||||
passwordBusy.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function replacePlannerRecords(nextRecords) {
|
||||
Object.keys(plannerRecords).forEach((key) => {
|
||||
delete plannerRecords[key]
|
||||
@@ -987,136 +1181,159 @@ onMounted(() => {
|
||||
|
||||
<template>
|
||||
<main class="min-h-screen px-4 py-6 text-ink sm:px-6 lg:px-10">
|
||||
<div class="print-root mx-auto flex max-w-[1680px] flex-col gap-6">
|
||||
<header class="print-hidden flex flex-col gap-4 rounded-[28px] border border-white/60 bg-white/70 p-5 backdrop-blur sm:p-6">
|
||||
<div class="flex flex-col gap-3 lg:flex-row lg:items-end lg:justify-between">
|
||||
<div class="print-root mx-auto flex max-w-[1760px] flex-col gap-6 xl:grid xl:grid-cols-[280px_minmax(0,1fr)] xl:items-start">
|
||||
<aside class="print-hidden rounded-[28px] border border-white/60 bg-white/70 p-5 backdrop-blur sm:p-6 xl:sticky xl:top-6">
|
||||
<div class="space-y-6">
|
||||
<div class="space-y-2">
|
||||
<p class="text-[11px] font-bold uppercase tracking-[0.28em] text-stone-500">10 Minute Planner</p>
|
||||
<h1 class="text-2xl font-semibold tracking-[-0.04em] text-stone-900 sm:text-4xl">
|
||||
다이어리처럼 보이되, 앱답게 빠르게 이동하는 플래너
|
||||
<h1 class="text-2xl font-semibold tracking-[-0.04em] text-stone-900">
|
||||
다이어리처럼 보이되,<br>앱답게 빠르게 이동하는 플래너
|
||||
</h1>
|
||||
<p class="max-w-3xl text-sm font-medium leading-6 text-stone-600">
|
||||
기본 모드는 Figma의 1페이지 + 보조 정보 패널 구성을 따르고, 비교용으로 2페이지 펼침 보기도 함께 제공합니다.
|
||||
<p class="text-sm font-medium leading-6 text-stone-600">
|
||||
A5 본문을 최대한 넓게 쓰기 위해 상단 헤더 대신 왼쪽 사이드 내비게이션 구조로 정리했습니다.
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex flex-wrap items-center gap-3">
|
||||
<div class="inline-flex items-center gap-2 rounded-full border border-stone-200 bg-white px-2 py-2">
|
||||
<template v-if="isAuthenticated">
|
||||
<div class="px-2">
|
||||
<p class="text-[10px] font-bold tracking-[0.16em] text-stone-500">SIGNED IN</p>
|
||||
<p class="text-sm font-semibold tracking-[0.02em] text-stone-900">
|
||||
{{ currentUser.nickname }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<section class="rounded-[24px] border border-stone-200 bg-white/80 p-4">
|
||||
<template v-if="isAuthenticated">
|
||||
<p class="text-[10px] font-bold tracking-[0.16em] text-stone-500">SIGNED IN</p>
|
||||
<p class="mt-2 text-lg font-semibold tracking-[-0.03em] text-stone-900">{{ currentUser.nickname }}</p>
|
||||
<p class="mt-1 text-sm font-semibold text-stone-500">{{ currentUser.email }}</p>
|
||||
<button
|
||||
type="button"
|
||||
class="mt-4 w-full rounded-full border border-stone-200 px-4 py-3 text-xs font-bold tracking-[0.16em] text-stone-600 transition hover:border-stone-400 hover:text-ink"
|
||||
@click="logout"
|
||||
>
|
||||
LOGOUT
|
||||
</button>
|
||||
</template>
|
||||
<template v-else>
|
||||
<p class="text-[10px] font-bold tracking-[0.16em] text-stone-500">ACCOUNT</p>
|
||||
<p class="mt-2 text-sm font-semibold leading-6 text-stone-700">
|
||||
로그인 후 문서, 통계, 목표 관리가 모두 계정 기준으로 연결됩니다.
|
||||
</p>
|
||||
<div class="mt-4 grid gap-2">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-full border border-stone-200 px-3 py-2 text-xs font-bold tracking-[0.14em] text-stone-600 transition hover:border-stone-400 hover:text-ink"
|
||||
@click="logout"
|
||||
>
|
||||
LOGOUT
|
||||
</button>
|
||||
</template>
|
||||
<template v-else>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-full border border-stone-200 px-3 py-2 text-xs font-bold tracking-[0.14em] text-stone-600 transition hover:border-stone-400 hover:text-ink"
|
||||
class="w-full rounded-full border border-stone-200 px-4 py-3 text-xs font-bold tracking-[0.16em] text-stone-600 transition hover:border-stone-400 hover:text-ink"
|
||||
@click="openAuthDialog('login')"
|
||||
>
|
||||
LOGIN
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-full border border-stone-900 bg-stone-900 px-3 py-2 text-xs font-bold tracking-[0.14em] text-white transition hover:bg-stone-700"
|
||||
class="w-full rounded-full border border-stone-900 bg-stone-900 px-4 py-3 text-xs font-bold tracking-[0.16em] text-white transition hover:bg-stone-700"
|
||||
@click="openAuthDialog('signup')"
|
||||
>
|
||||
SIGN UP
|
||||
</button>
|
||||
</template>
|
||||
</div>
|
||||
<div
|
||||
v-if="isAuthenticated"
|
||||
class="inline-flex rounded-full border border-stone-200 bg-stone-100 p-1"
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
</section>
|
||||
|
||||
<section v-if="isAuthenticated" class="rounded-[24px] border border-stone-200 bg-white/80 p-4">
|
||||
<p class="text-[10px] font-bold tracking-[0.16em] text-stone-500">NAVIGATION</p>
|
||||
<div class="mt-4 grid grid-cols-2 gap-2">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-full px-4 py-2 text-xs font-bold tracking-[0.14em] transition"
|
||||
:class="screenMode === 'planner' ? 'bg-white text-ink shadow-sm' : 'text-stone-500'"
|
||||
class="rounded-2xl px-3 py-3 text-xs font-bold tracking-[0.14em] transition"
|
||||
:class="screenMode === 'planner' ? 'bg-stone-900 text-white' : 'bg-stone-100 text-stone-500'"
|
||||
@click="screenMode = 'planner'"
|
||||
>
|
||||
PLANNER
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-full px-4 py-2 text-xs font-bold tracking-[0.14em] transition"
|
||||
:class="screenMode === 'stats' ? 'bg-white text-ink shadow-sm' : 'text-stone-500'"
|
||||
class="rounded-2xl px-3 py-3 text-xs font-bold tracking-[0.14em] transition"
|
||||
:class="screenMode === 'stats' ? 'bg-stone-900 text-white' : 'bg-stone-100 text-stone-500'"
|
||||
@click="screenMode = 'stats'"
|
||||
>
|
||||
STATS
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
v-if="isAuthenticated"
|
||||
class="inline-flex rounded-full border border-stone-200 bg-stone-100 p-1"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-full px-4 py-2 text-xs font-bold tracking-[0.14em] transition"
|
||||
:class="viewMode === 'focus' ? 'bg-white text-ink shadow-sm' : 'text-stone-500'"
|
||||
class="rounded-2xl px-3 py-3 text-xs font-bold tracking-[0.14em] transition"
|
||||
:class="screenMode === 'goals' ? 'bg-stone-900 text-white' : 'bg-stone-100 text-stone-500'"
|
||||
@click="screenMode = 'goals'"
|
||||
>
|
||||
GOALS
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-2xl px-3 py-3 text-xs font-bold tracking-[0.14em] transition"
|
||||
:class="screenMode === 'settings' ? 'bg-stone-900 text-white' : 'bg-stone-100 text-stone-500'"
|
||||
@click="screenMode = 'settings'"
|
||||
>
|
||||
SETTINGS
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section v-if="isAuthenticated && screenMode === 'planner'" class="rounded-[24px] border border-stone-200 bg-white/80 p-4">
|
||||
<p class="text-[10px] font-bold tracking-[0.16em] text-stone-500">VIEW</p>
|
||||
<div class="mt-4 grid gap-2">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-2xl px-4 py-3 text-xs font-bold tracking-[0.14em] transition"
|
||||
:class="viewMode === 'focus' ? 'bg-stone-900 text-white' : 'bg-stone-100 text-stone-500'"
|
||||
@click="viewMode = 'focus'"
|
||||
>
|
||||
1 PAGE + INFO
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-full px-4 py-2 text-xs font-bold tracking-[0.14em] transition"
|
||||
:class="viewMode === 'spread' ? 'bg-white text-ink shadow-sm' : 'text-stone-500'"
|
||||
class="rounded-2xl px-4 py-3 text-xs font-bold tracking-[0.14em] transition"
|
||||
:class="viewMode === 'spread' ? 'bg-stone-900 text-white' : 'bg-stone-100 text-stone-500'"
|
||||
@click="viewMode = 'spread'"
|
||||
>
|
||||
2 PAGE SPREAD
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
v-if="isAuthenticated"
|
||||
class="inline-flex items-center gap-2 rounded-full border border-stone-200 bg-white px-2 py-2"
|
||||
>
|
||||
</section>
|
||||
|
||||
<section v-if="isAuthenticated && screenMode === 'planner'" class="rounded-[24px] border border-stone-200 bg-white/80 p-4">
|
||||
<p class="text-[10px] font-bold tracking-[0.16em] text-stone-500">DAY MOVE</p>
|
||||
<div class="mt-4 grid gap-2">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-full border border-stone-200 px-3 py-2 text-xs font-bold tracking-[0.14em] text-stone-600 transition hover:border-stone-400 hover:text-ink"
|
||||
class="rounded-2xl border border-stone-200 px-4 py-3 text-xs font-bold tracking-[0.14em] text-stone-600 transition hover:border-stone-400 hover:text-ink"
|
||||
@click="shiftDate(-1)"
|
||||
>
|
||||
PREV DAY
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-full border border-stone-200 px-3 py-2 text-xs font-bold tracking-[0.14em] text-stone-600 transition hover:border-stone-400 hover:text-ink"
|
||||
class="rounded-2xl border border-stone-200 px-4 py-3 text-xs font-bold tracking-[0.14em] text-stone-600 transition hover:border-stone-400 hover:text-ink"
|
||||
@click="shiftDate(1)"
|
||||
>
|
||||
NEXT DAY
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
v-if="isAuthenticated && screenMode === 'planner'"
|
||||
class="inline-flex items-center gap-2 rounded-full border border-stone-200 bg-white px-2 py-2"
|
||||
>
|
||||
</section>
|
||||
|
||||
<section v-if="isAuthenticated && screenMode === 'planner'" class="rounded-[24px] border border-stone-200 bg-white/80 p-4">
|
||||
<p class="text-[10px] font-bold tracking-[0.16em] text-stone-500">PRINT</p>
|
||||
<div class="mt-4 grid gap-2">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-full border border-stone-200 px-3 py-2 text-xs font-bold tracking-[0.14em] text-stone-600 transition hover:border-stone-400 hover:text-ink"
|
||||
class="rounded-2xl border border-stone-200 px-4 py-3 text-xs font-bold tracking-[0.14em] text-stone-600 transition hover:border-stone-400 hover:text-ink"
|
||||
@click="printSelectedPlanner('single')"
|
||||
>
|
||||
PRINT 1-UP
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-full border border-stone-200 px-3 py-2 text-xs font-bold tracking-[0.14em] text-stone-600 transition hover:border-stone-400 hover:text-ink"
|
||||
class="rounded-2xl border border-stone-200 px-4 py-3 text-xs font-bold tracking-[0.14em] text-stone-600 transition hover:border-stone-400 hover:text-ink"
|
||||
@click="printSelectedPlanner('double')"
|
||||
>
|
||||
PRINT 2-UP
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</header>
|
||||
</aside>
|
||||
|
||||
<div class="min-w-0 space-y-6">
|
||||
<section
|
||||
v-if="!isAuthenticated"
|
||||
class="print-hidden rounded-[32px] border border-white/60 bg-white/65 p-6 shadow-[0_24px_80px_rgba(28,25,23,0.08)] sm:p-8"
|
||||
@@ -1216,24 +1433,23 @@ onMounted(() => {
|
||||
</section>
|
||||
|
||||
<section class="border border-stone-200 bg-white/80 p-5">
|
||||
<p class="mb-3 text-[11px] font-bold tracking-[0.22em] text-ink">TASK LABELS</p>
|
||||
<p class="text-[11px] font-semibold leading-5 tracking-[0.06em] text-stone-600">
|
||||
왼쪽 라벨은 직접 입력할 수 있고, 필요하면 아래 버튼으로 순번을 한 번에 채울 수 있습니다.
|
||||
</p>
|
||||
<div class="mt-4 flex flex-wrap gap-2">
|
||||
<div class="flex items-start justify-between gap-3">
|
||||
<div>
|
||||
<p class="text-[11px] font-bold tracking-[0.22em] text-ink">TASK LABELS</p>
|
||||
<p class="mt-2 text-[11px] font-semibold leading-5 tracking-[0.06em] text-stone-600">
|
||||
ON이면 왼쪽 라벨을 01, 02 형태로 채우고 OFF이면 비워 둡니다.
|
||||
</p>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-full border border-stone-200 px-3 py-2 text-[10px] font-bold tracking-[0.14em] text-stone-600 transition hover:border-stone-400 hover:text-ink"
|
||||
@click="fillTaskLabelsWithNumbers(planner)"
|
||||
class="relative h-8 w-16 shrink-0 rounded-full transition"
|
||||
:class="areTaskLabelsNumbered(planner) ? 'bg-stone-900' : 'bg-stone-300'"
|
||||
@click="areTaskLabelsNumbered(planner) ? clearTaskLabels(planner) : fillTaskLabelsWithNumbers(planner)"
|
||||
>
|
||||
번호 채우기
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-full border border-stone-200 px-3 py-2 text-[10px] font-bold tracking-[0.14em] text-stone-600 transition hover:border-stone-400 hover:text-ink"
|
||||
@click="clearTaskLabels(planner)"
|
||||
>
|
||||
라벨 비우기
|
||||
<span
|
||||
class="absolute top-1 h-6 w-6 rounded-full bg-white shadow-sm transition"
|
||||
:class="areTaskLabelsNumbered(planner) ? 'left-9' : 'left-1'"
|
||||
/>
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
@@ -1256,86 +1472,41 @@ onMounted(() => {
|
||||
<div>
|
||||
<p class="text-[11px] font-bold tracking-[0.22em] text-ink">D-DAY 사용</p>
|
||||
<p class="mt-2 text-[11px] font-semibold leading-5 tracking-[0.06em] text-stone-600">
|
||||
목표를 검색해서 오늘의 대표 목표로 선택하면 본문 상단 D-DAY에 표시됩니다.
|
||||
목표 검색과 기간 설정은 GOALS 화면에서 관리하고, 여기서는 현재 날짜에 D-DAY를 보여줄지 여부만 제어합니다.
|
||||
</p>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-full border px-3 py-2 text-[10px] font-bold tracking-[0.16em] transition"
|
||||
:class="planner.goalEnabled ? 'border-stone-900 bg-stone-900 text-white' : 'border-stone-300 text-stone-500'"
|
||||
class="relative h-8 w-16 shrink-0 rounded-full transition disabled:cursor-not-allowed disabled:opacity-50"
|
||||
:class="planner.goalEnabled ? 'bg-stone-900' : 'bg-stone-300'"
|
||||
:disabled="!hasActiveGoalForSelectedDate"
|
||||
@click="updateGoalEnabled(planner, !planner.goalEnabled)"
|
||||
>
|
||||
{{ planner.goalEnabled ? 'ON' : 'OFF' }}
|
||||
<span
|
||||
class="absolute top-1 h-6 w-6 rounded-full bg-white shadow-sm transition"
|
||||
:class="planner.goalEnabled ? 'left-9' : 'left-1'"
|
||||
/>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="mt-4 space-y-3">
|
||||
<div v-if="planner.goalEnabled && plannerGoal" class="rounded-2xl border border-stone-200 bg-white px-4 py-3">
|
||||
<div v-if="plannerGoal" class="rounded-2xl border border-stone-200 bg-white px-4 py-3">
|
||||
<p class="text-[10px] font-bold tracking-[0.16em] text-stone-500">현재 목표</p>
|
||||
<p class="mt-2 text-sm font-semibold tracking-[0.02em] text-stone-900">{{ plannerGoal.title }}</p>
|
||||
<p class="mt-1 text-[11px] font-semibold tracking-[0.06em] text-stone-500">
|
||||
목표일 {{ plannerGoal.targetDate }} / {{ plannerDday }}
|
||||
목표일 {{ plannerGoal.targetDate }} / 적용 {{ plannerGoal.activeFrom }} ~ {{ plannerGoal.activeUntil }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div v-if="goals.length > 0" class="space-y-2">
|
||||
<input
|
||||
v-model="goalQuery"
|
||||
type="text"
|
||||
class="w-full rounded-2xl border border-stone-300 bg-white px-4 py-3 text-sm font-semibold text-stone-800 outline-none transition focus:border-stone-500"
|
||||
placeholder="목표 검색"
|
||||
/>
|
||||
<div class="max-h-52 space-y-2 overflow-y-auto pr-1">
|
||||
<button
|
||||
v-for="goal in filteredGoals"
|
||||
:key="goal.id"
|
||||
type="button"
|
||||
class="w-full rounded-2xl border px-4 py-3 text-left transition"
|
||||
:class="planner.selectedGoalId === goal.id ? 'border-stone-900 bg-stone-900 text-white' : 'border-stone-200 bg-white text-stone-800 hover:border-stone-400'"
|
||||
@click="selectGoalForPlanner(planner, goal.id)"
|
||||
>
|
||||
<p class="text-sm font-semibold tracking-[0.02em]">{{ goal.title }}</p>
|
||||
<p
|
||||
class="mt-1 text-[11px] font-semibold tracking-[0.06em]"
|
||||
:class="planner.selectedGoalId === goal.id ? 'text-stone-200' : 'text-stone-500'"
|
||||
>
|
||||
목표일 {{ goal.targetDate }}
|
||||
</p>
|
||||
</button>
|
||||
</div>
|
||||
<div v-if="plannerGoal" class="rounded-2xl border border-stone-200 bg-[#fbf7f0] px-4 py-4">
|
||||
<p class="text-[11px] font-semibold leading-5 tracking-[0.06em] text-stone-600">
|
||||
이 날짜에는 이미 적용된 목표가 있으므로 토글만으로 표시 여부를 빠르게 조절할 수 있습니다.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div v-else class="rounded-2xl border border-dashed border-stone-300 bg-white/70 px-4 py-4">
|
||||
<p class="text-[11px] font-semibold leading-5 tracking-[0.06em] text-stone-500">
|
||||
아직 목표가 없습니다. 아래에서 첫 목표를 추가해 주세요.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="rounded-2xl border border-stone-200 bg-[#fbf7f0] p-4">
|
||||
<p class="text-[10px] font-bold tracking-[0.16em] text-stone-500">새 목표 추가</p>
|
||||
<div class="mt-3 space-y-2">
|
||||
<input
|
||||
v-model="goalForm.title"
|
||||
type="text"
|
||||
class="w-full rounded-2xl border border-stone-300 bg-white px-4 py-3 text-sm font-semibold text-stone-800 outline-none transition focus:border-stone-500"
|
||||
placeholder="예: 자격증 시험 / 런칭 / 프로젝트 마감"
|
||||
/>
|
||||
<input
|
||||
v-model="goalForm.targetDate"
|
||||
type="date"
|
||||
class="w-full rounded-2xl border border-stone-300 bg-white px-4 py-3 text-sm font-semibold text-stone-800 outline-none transition focus:border-stone-500"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
class="w-full rounded-full bg-stone-900 px-4 py-3 text-[10px] font-bold tracking-[0.18em] text-white transition hover:bg-stone-700 disabled:cursor-not-allowed disabled:bg-stone-400"
|
||||
:disabled="goalBusy"
|
||||
@click="submitGoal"
|
||||
>
|
||||
{{ goalBusy ? '추가 중...' : 'GOAL ADD' }}
|
||||
</button>
|
||||
</div>
|
||||
<p v-if="goalMessage" class="mt-3 text-[11px] font-semibold leading-5 tracking-[0.06em] text-stone-600">
|
||||
{{ goalMessage }}
|
||||
현재 날짜에 적용된 목표가 없습니다. GOALS 화면에서 표시 기간을 지정하면 여기 토글이 자동으로 활성화됩니다.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1436,6 +1607,42 @@ onMounted(() => {
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<GoalsDashboard
|
||||
v-else-if="screenMode === 'goals'"
|
||||
class="print-hidden"
|
||||
:goals="filteredGoals"
|
||||
:query="goalQuery"
|
||||
:status="goalStatusFilter"
|
||||
:form="goalForm"
|
||||
:editing-goal-id="editingGoalId"
|
||||
:busy="goalBusy"
|
||||
:message="goalMessage"
|
||||
:selected-date-key="toKey(selectedDate)"
|
||||
@update:query="goalQuery = $event"
|
||||
@update:status="goalStatusFilter = $event"
|
||||
@update:form-field="updateGoalFormField"
|
||||
@submit:create="submitGoal"
|
||||
@start-edit="startGoalEdit"
|
||||
@cancel-edit="resetGoalForm(); goalMessage = ''"
|
||||
@submit:update="saveGoalEdit"
|
||||
/>
|
||||
|
||||
<SettingsDashboard
|
||||
v-else-if="screenMode === 'settings'"
|
||||
class="print-hidden"
|
||||
:user="currentUser"
|
||||
:profile-form="profileForm"
|
||||
:password-form="passwordForm"
|
||||
:profile-busy="profileBusy"
|
||||
:password-busy="passwordBusy"
|
||||
:profile-message="profileMessage"
|
||||
:password-message="passwordMessage"
|
||||
@update:profile-field="updateProfileField"
|
||||
@update:password-field="updatePasswordField"
|
||||
@submit:profile="submitProfileForm"
|
||||
@submit:password="submitPasswordForm"
|
||||
/>
|
||||
|
||||
<StatsDashboard
|
||||
v-else
|
||||
class="print-hidden"
|
||||
@@ -1523,6 +1730,7 @@ onMounted(() => {
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<AuthDialog
|
||||
|
||||
233
src/components/GoalsDashboard.vue
Normal file
233
src/components/GoalsDashboard.vue
Normal file
@@ -0,0 +1,233 @@
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
goals: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
query: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
status: {
|
||||
type: String,
|
||||
default: 'all',
|
||||
},
|
||||
form: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
editingGoalId: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
busy: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
message: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
selectedDateKey: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
})
|
||||
|
||||
const emit = defineEmits([
|
||||
'update:query',
|
||||
'update:status',
|
||||
'update:form-field',
|
||||
'submit:create',
|
||||
'start-edit',
|
||||
'cancel-edit',
|
||||
'submit:update',
|
||||
])
|
||||
|
||||
function updateField(field, event) {
|
||||
emit('update:form-field', {
|
||||
field,
|
||||
value: event.target.value,
|
||||
})
|
||||
}
|
||||
|
||||
function isActiveOnSelectedDate(goal) {
|
||||
if (!goal.activeFrom || !goal.activeUntil || !props.selectedDateKey) {
|
||||
return false
|
||||
}
|
||||
|
||||
return props.selectedDateKey >= goal.activeFrom && props.selectedDateKey <= goal.activeUntil
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="grid gap-6 xl:grid-cols-[380px_minmax(0,1fr)]">
|
||||
<form class="rounded-[28px] border border-white/60 bg-white/75 p-6" @submit.prevent="emit(editingGoalId ? 'submit:update' : 'submit:create')">
|
||||
<p class="text-[11px] font-bold uppercase tracking-[0.24em] text-stone-500">
|
||||
{{ editingGoalId ? 'Edit Goal' : 'Create Goal' }}
|
||||
</p>
|
||||
<div class="mt-5 space-y-4">
|
||||
<div class="space-y-2">
|
||||
<label class="text-[11px] font-bold tracking-[0.16em] text-stone-600">목표 이름</label>
|
||||
<input
|
||||
:value="form.title"
|
||||
type="text"
|
||||
class="w-full rounded-2xl border border-stone-300 bg-white px-4 py-3 text-sm font-semibold text-stone-800 outline-none transition focus:border-stone-500"
|
||||
placeholder="예: 자격증 시험 / 프로젝트 런칭 / 운동 루틴"
|
||||
@input="updateField('title', $event)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="space-y-2">
|
||||
<label class="text-[11px] font-bold tracking-[0.16em] text-stone-600">목표일</label>
|
||||
<input
|
||||
:value="form.targetDate"
|
||||
type="date"
|
||||
class="w-full rounded-2xl border border-stone-300 bg-white px-4 py-3 text-sm font-semibold text-stone-800 outline-none transition focus:border-stone-500"
|
||||
@input="updateField('targetDate', $event)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="grid gap-4 sm:grid-cols-2">
|
||||
<div class="space-y-2">
|
||||
<label class="text-[11px] font-bold tracking-[0.16em] text-stone-600">표시 시작일</label>
|
||||
<input
|
||||
:value="form.activeFrom"
|
||||
type="date"
|
||||
class="w-full rounded-2xl border border-stone-300 bg-white px-4 py-3 text-sm font-semibold text-stone-800 outline-none transition focus:border-stone-500"
|
||||
@input="updateField('activeFrom', $event)"
|
||||
/>
|
||||
</div>
|
||||
<div class="space-y-2">
|
||||
<label class="text-[11px] font-bold tracking-[0.16em] text-stone-600">표시 종료일</label>
|
||||
<input
|
||||
:value="form.activeUntil"
|
||||
type="date"
|
||||
class="w-full rounded-2xl border border-stone-300 bg-white px-4 py-3 text-sm font-semibold text-stone-800 outline-none transition focus:border-stone-500"
|
||||
@input="updateField('activeUntil', $event)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="space-y-2">
|
||||
<label class="text-[11px] font-bold tracking-[0.16em] text-stone-600">상태</label>
|
||||
<select
|
||||
:value="form.status"
|
||||
class="w-full rounded-2xl border border-stone-300 bg-white px-4 py-3 text-sm font-semibold text-stone-800 outline-none transition focus:border-stone-500"
|
||||
@change="updateField('status', $event)"
|
||||
>
|
||||
<option value="active">진행 중</option>
|
||||
<option value="done">완료</option>
|
||||
<option value="archived">보관</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<p class="rounded-2xl border border-stone-200 bg-[#fbf7f0] px-4 py-3 text-[11px] font-semibold leading-5 tracking-[0.06em] text-stone-600">
|
||||
여기서 목표와 표시 기간을 설정해 두면, 플래너 작성 화면에서는 해당 날짜에 보여줄지 여부만 간단히 ON/OFF 할 수 있습니다.
|
||||
</p>
|
||||
|
||||
<p
|
||||
v-if="message"
|
||||
class="rounded-2xl border border-stone-300 bg-white/80 px-4 py-3 text-sm font-semibold leading-6 text-stone-700"
|
||||
>
|
||||
{{ message }}
|
||||
</p>
|
||||
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<button
|
||||
type="submit"
|
||||
class="rounded-full bg-stone-900 px-5 py-3 text-xs font-bold tracking-[0.18em] text-white transition hover:bg-stone-700 disabled:cursor-not-allowed disabled:bg-stone-400"
|
||||
:disabled="busy"
|
||||
>
|
||||
{{ busy ? '저장 중...' : editingGoalId ? '목표 수정' : '목표 추가' }}
|
||||
</button>
|
||||
<button
|
||||
v-if="editingGoalId"
|
||||
type="button"
|
||||
class="rounded-full border border-stone-300 px-5 py-3 text-xs font-bold tracking-[0.18em] text-stone-600 transition hover:border-stone-500 hover:text-stone-900"
|
||||
@click="emit('cancel-edit')"
|
||||
>
|
||||
취소
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<section class="rounded-[28px] border border-white/60 bg-white/75 p-6">
|
||||
<div class="flex flex-col gap-4 md:flex-row md:items-end md:justify-between">
|
||||
<div>
|
||||
<p class="text-[11px] font-bold uppercase tracking-[0.24em] text-stone-500">Goal Library</p>
|
||||
<p class="mt-2 text-sm font-semibold leading-6 text-stone-600">
|
||||
목표가 많아져도 플래너 작성 화면이 길어지지 않도록, 전체 관리는 이 화면에서 처리합니다.
|
||||
</p>
|
||||
</div>
|
||||
<div class="grid gap-2 sm:grid-cols-[220px_140px]">
|
||||
<input
|
||||
:value="query"
|
||||
type="text"
|
||||
class="rounded-2xl border border-stone-300 bg-white px-4 py-3 text-sm font-semibold text-stone-800 outline-none transition focus:border-stone-500"
|
||||
placeholder="목표 검색"
|
||||
@input="emit('update:query', $event.target.value)"
|
||||
/>
|
||||
<select
|
||||
:value="status"
|
||||
class="rounded-2xl border border-stone-300 bg-white px-4 py-3 text-sm font-semibold text-stone-800 outline-none transition focus:border-stone-500"
|
||||
@change="emit('update:status', $event.target.value)"
|
||||
>
|
||||
<option value="all">전체</option>
|
||||
<option value="active">진행 중</option>
|
||||
<option value="done">완료</option>
|
||||
<option value="archived">보관</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-5 grid gap-4">
|
||||
<article
|
||||
v-for="goal in goals"
|
||||
:key="goal.id"
|
||||
class="rounded-[24px] border border-stone-200 bg-white px-5 py-5"
|
||||
>
|
||||
<div class="flex flex-col gap-3 md:flex-row md:items-start md:justify-between">
|
||||
<div class="space-y-2">
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<p class="text-lg font-semibold tracking-[-0.03em] text-stone-900">{{ goal.title }}</p>
|
||||
<span
|
||||
class="rounded-full px-3 py-1 text-[10px] font-bold tracking-[0.16em]"
|
||||
:class="goal.status === 'done' ? 'bg-emerald-100 text-emerald-700' : goal.status === 'archived' ? 'bg-stone-200 text-stone-600' : 'bg-stone-900 text-white'"
|
||||
>
|
||||
{{ goal.status === 'done' ? '완료' : goal.status === 'archived' ? '보관' : '진행 중' }}
|
||||
</span>
|
||||
<span
|
||||
v-if="isActiveOnSelectedDate(goal)"
|
||||
class="rounded-full bg-amber-100 px-3 py-1 text-[10px] font-bold tracking-[0.16em] text-amber-700"
|
||||
>
|
||||
현재 날짜에 표시 중
|
||||
</span>
|
||||
</div>
|
||||
<p class="text-sm font-semibold text-stone-600">목표일 {{ goal.targetDate }}</p>
|
||||
<p class="text-[11px] font-semibold tracking-[0.06em] text-stone-500">
|
||||
{{ goal.activeFrom && goal.activeUntil ? `표시 기간 ${goal.activeFrom} ~ ${goal.activeUntil}` : '표시 기간 미설정' }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-full border border-stone-300 px-4 py-2 text-[11px] font-bold tracking-[0.16em] text-stone-600 transition hover:border-stone-500 hover:text-stone-900"
|
||||
@click="emit('start-edit', goal)"
|
||||
>
|
||||
수정
|
||||
</button>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
<div
|
||||
v-if="goals.length === 0"
|
||||
class="rounded-[24px] border border-dashed border-stone-300 bg-white px-5 py-8 text-center"
|
||||
>
|
||||
<p class="text-sm font-semibold text-stone-600">조건에 맞는 목표가 없습니다.</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
</template>
|
||||
171
src/components/SettingsDashboard.vue
Normal file
171
src/components/SettingsDashboard.vue
Normal file
@@ -0,0 +1,171 @@
|
||||
<script setup>
|
||||
import { computed } from 'vue'
|
||||
|
||||
const props = defineProps({
|
||||
user: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
profileForm: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
passwordForm: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
profileBusy: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
passwordBusy: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
profileMessage: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
passwordMessage: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
})
|
||||
|
||||
const emit = defineEmits([
|
||||
'update:profile-field',
|
||||
'update:password-field',
|
||||
'submit:profile',
|
||||
'submit:password',
|
||||
])
|
||||
|
||||
const initials = computed(() =>
|
||||
`${props.user.nickname?.slice(0, 1) ?? ''}${props.user.email?.slice(0, 1) ?? ''}`.toUpperCase(),
|
||||
)
|
||||
|
||||
function updateProfileField(field, event) {
|
||||
emit('update:profile-field', {
|
||||
field,
|
||||
value: event.target.value,
|
||||
})
|
||||
}
|
||||
|
||||
function updatePasswordField(field, event) {
|
||||
emit('update:password-field', {
|
||||
field,
|
||||
value: event.target.value,
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="grid gap-6 xl:grid-cols-[360px_minmax(0,1fr)]">
|
||||
<aside class="rounded-[28px] border border-white/60 bg-white/70 p-6">
|
||||
<p class="text-[11px] font-bold uppercase tracking-[0.28em] text-stone-500">Settings</p>
|
||||
<div class="mt-6 flex items-center gap-4">
|
||||
<div class="flex h-20 w-20 items-center justify-center rounded-full bg-stone-900 text-2xl font-bold tracking-[0.04em] text-white">
|
||||
{{ initials || 'U' }}
|
||||
</div>
|
||||
<div>
|
||||
<p class="text-xl font-semibold tracking-[-0.04em] text-stone-900">{{ user.nickname }}</p>
|
||||
<p class="mt-1 text-sm font-semibold text-stone-500">{{ user.email }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-6 space-y-3 rounded-[24px] border border-stone-200 bg-[#fbf7f0] p-4">
|
||||
<p class="text-[10px] font-bold tracking-[0.18em] text-stone-500">PROFILE NOTE</p>
|
||||
<p class="text-sm font-semibold leading-6 text-stone-700">
|
||||
썸네일 이미지는 다음 단계에서 붙이는 편이 자연스럽습니다. 이번 단계에서는 계정 정보 수정과 비밀번호 변경 흐름을 먼저 안정화합니다.
|
||||
</p>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<div class="grid gap-6">
|
||||
<form class="rounded-[28px] border border-white/60 bg-white/75 p-6" @submit.prevent="emit('submit:profile')">
|
||||
<p class="text-[11px] font-bold uppercase tracking-[0.24em] text-stone-500">Account Profile</p>
|
||||
<div class="mt-5 grid gap-4 md:grid-cols-2">
|
||||
<div class="space-y-2">
|
||||
<label class="text-[11px] font-bold tracking-[0.16em] text-stone-600">닉네임</label>
|
||||
<input
|
||||
:value="profileForm.nickname"
|
||||
type="text"
|
||||
class="w-full rounded-2xl border border-stone-300 bg-white px-4 py-3 text-sm font-semibold text-stone-800 outline-none transition focus:border-stone-500"
|
||||
@input="updateProfileField('nickname', $event)"
|
||||
/>
|
||||
</div>
|
||||
<div class="space-y-2">
|
||||
<label class="text-[11px] font-bold tracking-[0.16em] text-stone-600">이메일</label>
|
||||
<input
|
||||
:value="profileForm.email"
|
||||
type="email"
|
||||
class="w-full rounded-2xl border border-stone-300 bg-white px-4 py-3 text-sm font-semibold text-stone-800 outline-none transition focus:border-stone-500"
|
||||
@input="updateProfileField('email', $event)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p
|
||||
v-if="profileMessage"
|
||||
class="mt-4 rounded-2xl border border-stone-300 bg-white/80 px-4 py-3 text-sm font-semibold leading-6 text-stone-700"
|
||||
>
|
||||
{{ profileMessage }}
|
||||
</p>
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
class="mt-5 rounded-full bg-stone-900 px-5 py-3 text-xs font-bold tracking-[0.18em] text-white transition hover:bg-stone-700 disabled:cursor-not-allowed disabled:bg-stone-400"
|
||||
:disabled="profileBusy"
|
||||
>
|
||||
{{ profileBusy ? '저장 중...' : '프로필 저장' }}
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<form class="rounded-[28px] border border-white/60 bg-white/75 p-6" @submit.prevent="emit('submit:password')">
|
||||
<p class="text-[11px] font-bold uppercase tracking-[0.24em] text-stone-500">Password</p>
|
||||
<div class="mt-5 grid gap-4 md:grid-cols-2">
|
||||
<div class="space-y-2 md:col-span-2">
|
||||
<label class="text-[11px] font-bold tracking-[0.16em] text-stone-600">현재 비밀번호</label>
|
||||
<input
|
||||
:value="passwordForm.currentPassword"
|
||||
type="password"
|
||||
class="w-full rounded-2xl border border-stone-300 bg-white px-4 py-3 text-sm font-semibold text-stone-800 outline-none transition focus:border-stone-500"
|
||||
@input="updatePasswordField('currentPassword', $event)"
|
||||
/>
|
||||
</div>
|
||||
<div class="space-y-2">
|
||||
<label class="text-[11px] font-bold tracking-[0.16em] text-stone-600">새 비밀번호</label>
|
||||
<input
|
||||
:value="passwordForm.newPassword"
|
||||
type="password"
|
||||
class="w-full rounded-2xl border border-stone-300 bg-white px-4 py-3 text-sm font-semibold text-stone-800 outline-none transition focus:border-stone-500"
|
||||
@input="updatePasswordField('newPassword', $event)"
|
||||
/>
|
||||
</div>
|
||||
<div class="space-y-2">
|
||||
<label class="text-[11px] font-bold tracking-[0.16em] text-stone-600">새 비밀번호 확인</label>
|
||||
<input
|
||||
:value="passwordForm.confirmPassword"
|
||||
type="password"
|
||||
class="w-full rounded-2xl border border-stone-300 bg-white px-4 py-3 text-sm font-semibold text-stone-800 outline-none transition focus:border-stone-500"
|
||||
@input="updatePasswordField('confirmPassword', $event)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p
|
||||
v-if="passwordMessage"
|
||||
class="mt-4 rounded-2xl border border-stone-300 bg-white/80 px-4 py-3 text-sm font-semibold leading-6 text-stone-700"
|
||||
>
|
||||
{{ passwordMessage }}
|
||||
</p>
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
class="mt-5 rounded-full border border-stone-900 px-5 py-3 text-xs font-bold tracking-[0.18em] text-stone-900 transition hover:bg-stone-900 hover:text-white disabled:cursor-not-allowed disabled:border-stone-300 disabled:text-stone-400"
|
||||
:disabled="passwordBusy"
|
||||
>
|
||||
{{ passwordBusy ? '변경 중...' : '비밀번호 변경' }}
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
@@ -79,3 +79,19 @@ export async function fetchCurrentUser(token) {
|
||||
token,
|
||||
})
|
||||
}
|
||||
|
||||
export async function updateProfile(token, { email, nickname }) {
|
||||
return request('/api/auth/profile', {
|
||||
method: 'PUT',
|
||||
token,
|
||||
body: { email, nickname },
|
||||
})
|
||||
}
|
||||
|
||||
export async function updatePassword(token, { currentPassword, newPassword }) {
|
||||
return request('/api/auth/password', {
|
||||
method: 'PUT',
|
||||
token,
|
||||
body: { currentPassword, newPassword },
|
||||
})
|
||||
}
|
||||
|
||||
@@ -47,3 +47,11 @@ export async function createGoal(token, payload) {
|
||||
body: payload,
|
||||
})
|
||||
}
|
||||
|
||||
export async function updateGoal(token, goalId, payload) {
|
||||
return request(`/api/goals/${goalId}`, {
|
||||
method: 'PATCH',
|
||||
token,
|
||||
body: payload,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user