v0.1.18 - 설정 화면과 기간형 D-DAY 관리 추가

This commit is contained in:
2026-04-22 09:47:04 +09:00
parent 4355185203
commit fe538fc88b
13 changed files with 1033 additions and 173 deletions

View File

@@ -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

View 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>

View 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>

View File

@@ -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 },
})
}

View File

@@ -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,
})
}