v0.1.55 - 기간 인쇄 모달 추가

This commit is contained in:
2026-04-23 16:23:27 +09:00
parent cb309cf0fa
commit c1c7288127
3 changed files with 264 additions and 96 deletions

View File

@@ -219,6 +219,7 @@
- 플래너 본문 시간 라벨은 `총 시간`에서 `FOCUSED TIME`으로 바꿨다. 인쇄 CSS에서 COMMENT/FOCUSED TIME 라벨이 잘리지 않도록 부모 overflow를 열고, COMMENT는 남는 폭을 채우며 FOCUSED TIME은 오른쪽 210px 칸에 붙도록 조정했다.
- Docker 배포용 루트 `.env`와 개발용 `.env.dev`를 분리했다. `docker-compose.yml`은 운영 `.env`, `docker-compose.dev.yml`은 기존 dev Postgres 볼륨과 맞는 `.env.dev`를 읽는다.
- STATS의 `RANGE FLOW`는 항목 수에 따라 막대 폭과 간격을 조정한다. 1주일 내외는 넓은 막대로 카드 폭을 채우고, 1달 내외는 좁은 막대와 요약 라벨로 한 화면에서 흐름을 보며, 세부 날짜와 집중 시간은 막대 hover 팝업으로 확인한다.
- 왼쪽 사이드바의 인쇄 영역은 `PRINT` 버튼 하나로 줄이고, 클릭 시 모달에서 시작일/종료일과 `1페이지씩` 또는 `2페이지씩` 출력 방식을 선택한다. 인쇄 전용 렌더링은 선택 기간의 날짜를 순서대로 여러 장 생성하며, 2페이지씩 출력에서 홀수 날짜가 남으면 오른쪽은 빈 페이지 프레임으로 둔다.
- `5173` 포트가 직접 `npm run dev` 없이 열려 있으면 대부분 `ten-minute-frontend-dev` 컨테이너가 떠 있는 상태다. 개발용 Docker를 끄려면 `docker compose -f docker-compose.dev.yml down`을 사용한다.
- 현재 환경에서는 Docker 데몬이 꺼져 있어서 `docker compose build` 실검증은 하지 못했고, 데몬 시작 후 다시 확인이 필요하다.
- 이미지 저장 기능은 추후 `print-only` 또는 별도 export 전용 레이아웃을 기준으로 구현하면 화면/인쇄/공유 결과를 맞추기 쉽다.

View File

@@ -36,6 +36,7 @@ const CARRYOVER_CHECK_POLICIES = ['ask', 'all', 'current']
const screenMode = ref('planner')
const viewMode = ref('focus')
const printLayout = ref('single')
const printDialogOpen = ref(false)
const demoMode = ref(false)
const demoDayOffset = ref(0)
const authDialogOpen = ref(false)
@@ -59,6 +60,9 @@ const leftPanelOpen = ref(false)
const rightPanelOpen = ref(false)
const statsRangeStart = ref(toKey(new Date(new Date().setDate(new Date().getDate() - 6))))
const statsRangeEnd = ref(toKey(new Date()))
const printRangeStart = ref(toKey(new Date()))
const printRangeEnd = ref(toKey(new Date()))
const printRangeLayout = ref('single')
const authForm = reactive({
nickname: '',
email: '',
@@ -550,6 +554,56 @@ const calendarDays = computed(() => {
})
})
const normalizedPrintRange = computed(() => {
const startKey = printRangeStart.value || toKey(selectedDate.value)
const endKey = printRangeEnd.value || startKey
if (startKey <= endKey) {
return { startKey, endKey }
}
return { startKey: endKey, endKey: startKey }
})
const printDateKeys = computed(() => {
const dateKeys = []
const currentDate = startOfDay(toDateValue(normalizedPrintRange.value.startKey))
const endDate = startOfDay(toDateValue(normalizedPrintRange.value.endKey))
while (currentDate <= endDate) {
dateKeys.push(toKey(currentDate))
currentDate.setDate(currentDate.getDate() + 1)
}
return dateKeys
})
const printPages = computed(() =>
printDateKeys.value.map((dateKey) => createPrintPage(dateKey)),
)
const printPapers = computed(() => {
if (printLayout.value === 'single') {
return printPages.value.map((page) => [page])
}
const papers = []
for (let index = 0; index < printPages.value.length; index += 2) {
papers.push(printPages.value.slice(index, index + 2))
}
return papers
})
const printPageCountLabel = computed(() => {
const dayCount = printDateKeys.value.length
const paperCount = printRangeLayout.value === 'double' ? Math.ceil(dayCount / 2) : dayCount
const layoutLabel = printRangeLayout.value === 'double' ? '2페이지씩' : '1페이지씩'
return `${dayCount}일치 / ${paperCount}장 (${layoutLabel})`
})
const markedDateKeys = computed(() =>
Object.entries(plannerRecords)
.filter(([, record]) => hasPlannerContent(record))
@@ -801,6 +855,12 @@ function closeCarryoverCheckPrompt() {
}
function handleGlobalKeydown(event) {
if (event.key === 'Escape' && printDialogOpen.value) {
event.preventDefault()
closePrintDialog()
return
}
if (event.key === 'Escape' && carryoverCheckPrompt.value) {
event.preventDefault()
closeCarryoverCheckPrompt()
@@ -971,6 +1031,56 @@ function createDateLabel(dateKey) {
return `${display.main} ${display.weekday}`
}
function findPlannerGoalForDate(dateKey) {
const activeGoals = goals.value
.filter((goal) => {
if (!goal.activeFrom || !goal.activeUntil) {
return false
}
return dateKey >= goal.activeFrom && dateKey <= goal.activeUntil
})
.sort((left, right) => {
const currentDate = startOfDay(toDateValue(dateKey))
const leftDistance = Math.abs(startOfDay(toDateValue(left.targetDate)).getTime() - currentDate.getTime())
const rightDistance = Math.abs(startOfDay(toDateValue(right.targetDate)).getTime() - currentDate.getTime())
return leftDistance - rightDistance
})
return activeGoals[0] ?? null
}
function createPlannerDdayForDate(dateKey) {
if (isDdayDisabledForDate(dateKey)) {
return ''
}
const goal = findPlannerGoalForDate(dateKey)
if (!goal) {
return ''
}
const targetDate = startOfDay(toDateValue(goal.targetDate))
const currentDate = startOfDay(toDateValue(dateKey))
const diffDays = Math.round((targetDate.getTime() - currentDate.getTime()) / (24 * 60 * 60 * 1000))
const badge =
diffDays === 0 ? 'D-DAY' : diffDays > 0 ? `D-${diffDays}` : `D+${Math.abs(diffDays)}`
return `${badge} ${goal.title}`
}
function createPrintPage(dateKey) {
const date = toDateValue(dateKey)
return {
key: dateKey,
display: getDateDisplay(date),
record: getPlannerRecord(date),
dday: createPlannerDdayForDate(dateKey),
}
}
const weeklyRecords = computed(() => {
const entries = rangeEntries.value.map(([key, record]) => {
const date = toDateValue(key)
@@ -1211,6 +1321,19 @@ function closeRightPanel() {
rightPanelOpen.value = false
}
function openPrintDialog() {
const selectedKey = toKey(selectedDate.value)
printRangeStart.value = selectedKey
printRangeEnd.value = selectedKey
printRangeLayout.value = viewMode.value === 'spread' ? 'double' : 'single'
printDialogOpen.value = true
closeLeftPanel()
}
function closePrintDialog() {
printDialogOpen.value = false
}
function applyStatsQuickRange(days) {
const endDate = new Date()
const startDate = new Date(endDate)
@@ -1845,6 +1968,13 @@ async function printSelectedPlanner(layout = 'single') {
window.print()
}
async function printPlannerRange() {
printLayout.value = printRangeLayout.value
applyPrintPageStyle(printRangeLayout.value)
await nextTick()
window.print()
}
onMounted(() => {
resetGoalForm()
setSyncFeedback('local', '로그인 후 클라우드 저장을 사용할 수 있습니다.', {
@@ -2058,16 +2188,9 @@ onBeforeUnmount(() => {
<button
type="button"
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')"
@click="openPrintDialog"
>
1 인쇄
</button>
<button
type="button"
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')"
>
2 인쇄
PRINT
</button>
</div>
</section>
@@ -2226,16 +2349,9 @@ onBeforeUnmount(() => {
<button
type="button"
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')"
@click="openPrintDialog"
>
1 인쇄
</button>
<button
type="button"
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')"
>
2 인쇄
PRINT
</button>
</div>
</section>
@@ -2832,79 +2948,35 @@ onBeforeUnmount(() => {
/>
<section v-if="isAuthenticated" class="print-only">
<div v-if="printLayout === 'single'" class="print-paper print-paper--single">
<div class="print-sheet-frame">
<div
v-for="(paper, paperIndex) in printPapers"
:key="`${printLayout}-${paperIndex}`"
class="print-paper"
:class="printLayout === 'single' ? 'print-paper--single' : 'print-paper--double'"
>
<div
v-for="page in paper"
:key="page.key"
class="print-sheet-frame"
>
<PlannerPage
:date-main="selectedDateDisplay.main"
:date-weekday="selectedDateDisplay.weekday"
:date-weekday-tone="selectedDateDisplay.weekdayTone"
:dday="plannerDday"
:show-dday="showPlannerDday"
:comment="planner.comment"
:total-time="formatTotalTimeKorean(planner)"
:tasks="planner.tasks"
:memo="planner.memo"
:date-main="page.display.main"
:date-weekday="page.display.weekday"
:date-weekday-tone="page.display.weekdayTone"
:dday="page.dday"
:show-dday="Boolean(page.dday)"
:comment="page.record.comment"
:total-time="formatTotalTimeKorean(page.record)"
:tasks="page.record.tasks"
:memo="page.record.memo"
:hours="hours"
:timetable="planner.timetable"
@update:comment="updateComment(planner, $event)"
@update:task-label="updateTaskLabel(planner, $event)"
@update:task-title="updateTaskTitle(planner, $event)"
@toggle:task="toggleTask(planner, $event)"
@clear:tasks="clearTasks(planner, $event)"
@update:memo-label="updateMemoLabel(planner, $event)"
@update:memo="updateMemo(planner, $event)"
@update:timetable="updateTimetable(planner, $event)"
/>
</div>
</div>
<div v-else class="print-paper print-paper--double">
<div class="print-sheet-frame">
<PlannerPage
:date-main="selectedDateDisplay.main"
:date-weekday="selectedDateDisplay.weekday"
:date-weekday-tone="selectedDateDisplay.weekdayTone"
:dday="plannerDday"
:show-dday="showPlannerDday"
:comment="planner.comment"
:total-time="formatTotalTimeKorean(planner)"
:tasks="planner.tasks"
:memo="planner.memo"
:hours="hours"
:timetable="planner.timetable"
@update:comment="updateComment(planner, $event)"
@update:task-label="updateTaskLabel(planner, $event)"
@update:task-title="updateTaskTitle(planner, $event)"
@toggle:task="toggleTask(planner, $event)"
@clear:tasks="clearTasks(planner, $event)"
@update:memo-label="updateMemoLabel(planner, $event)"
@update:memo="updateMemo(planner, $event)"
@update:timetable="updateTimetable(planner, $event)"
/>
</div>
<div class="print-sheet-frame">
<PlannerPage
:date-main="secondaryDateDisplay.main"
:date-weekday="secondaryDateDisplay.weekday"
:date-weekday-tone="secondaryDateDisplay.weekdayTone"
:dday="''"
:show-dday="false"
:comment="secondaryPlanner.comment"
:total-time="formatTotalTimeKorean(secondaryPlanner)"
:tasks="secondaryPlanner.tasks"
:memo="secondaryPlanner.memo"
:hours="hours"
:timetable="secondaryPlanner.timetable"
@update:comment="updateComment(secondaryPlanner, $event)"
@update:task-label="updateTaskLabel(secondaryPlanner, $event)"
@update:task-title="updateTaskTitle(secondaryPlanner, $event)"
@toggle:task="toggleTask(secondaryPlanner, $event)"
@clear:tasks="clearTasks(secondaryPlanner, $event)"
@update:memo-label="updateMemoLabel(secondaryPlanner, $event)"
@update:memo="updateMemo(secondaryPlanner, $event)"
@update:timetable="updateTimetable(secondaryPlanner, $event)"
:timetable="page.record.timetable"
/>
</div>
<div
v-if="printLayout === 'double' && paper.length === 1"
class="print-sheet-frame print-sheet-frame--blank"
/>
</div>
</section>
</div>
@@ -2922,6 +2994,93 @@ onBeforeUnmount(() => {
@update:field="updateAuthField"
/>
<div
v-if="printDialogOpen"
class="fixed inset-0 z-50 flex items-center justify-center bg-stone-900/45 px-4 py-6 backdrop-blur-sm"
@click.self="closePrintDialog"
>
<section class="w-full max-w-lg rounded-[30px] border border-white/70 bg-[#f7f2ea] p-5 shadow-[0_24px_80px_rgba(28,25,23,0.2)] sm:p-6">
<div class="flex items-start justify-between gap-4">
<div>
<p class="text-[10px] font-bold uppercase tracking-[0.24em] text-stone-500">Print Planner</p>
<h2 class="mt-3 text-2xl font-semibold tracking-[-0.05em] text-stone-900">
출력할 날짜 범위 선택
</h2>
<p class="mt-3 text-sm font-semibold leading-6 text-stone-600">
선택한 기간을 1페이지씩 또는 2페이지씩 묶어서 바로 출력합니다.
</p>
</div>
<button
type="button"
class="rounded-full border border-stone-200 bg-white px-3 py-2 text-[10px] font-bold tracking-[0.14em] text-stone-500 transition hover:border-stone-400 hover:text-stone-900"
@click="closePrintDialog"
>
CLOSE
</button>
</div>
<div class="mt-6 grid gap-4 sm:grid-cols-2">
<label class="flex flex-col gap-2 text-[11px] font-bold tracking-[0.14em] text-stone-500">
시작일
<input
v-model="printRangeStart"
type="date"
class="rounded-2xl border border-stone-200 bg-white px-4 py-3 text-sm font-semibold text-stone-800 outline-none transition focus:border-stone-400"
/>
</label>
<label class="flex flex-col gap-2 text-[11px] font-bold tracking-[0.14em] text-stone-500">
종료일
<input
v-model="printRangeEnd"
type="date"
class="rounded-2xl border border-stone-200 bg-white px-4 py-3 text-sm font-semibold text-stone-800 outline-none transition focus:border-stone-400"
/>
</label>
</div>
<div class="mt-5 grid gap-2 sm:grid-cols-2">
<button
type="button"
class="rounded-2xl px-4 py-3 text-xs font-bold tracking-[0.14em] transition"
:class="printRangeLayout === 'single' ? 'bg-stone-900 text-white' : 'border border-stone-200 bg-white text-stone-500'"
@click="printRangeLayout = 'single'"
>
1페이지씩
</button>
<button
type="button"
class="rounded-2xl px-4 py-3 text-xs font-bold tracking-[0.14em] transition"
:class="printRangeLayout === 'double' ? 'bg-stone-900 text-white' : 'border border-stone-200 bg-white text-stone-500'"
@click="printRangeLayout = 'double'"
>
2페이지씩
</button>
</div>
<div class="mt-5 rounded-2xl border border-stone-200 bg-white/78 px-4 py-3">
<p class="text-[11px] font-bold tracking-[0.12em] text-stone-500">출력 예정</p>
<p class="mt-1 text-sm font-semibold text-stone-900">{{ printPageCountLabel }}</p>
</div>
<div class="mt-6 grid gap-2 sm:grid-cols-[1fr_auto]">
<button
type="button"
class="rounded-full border border-stone-900 bg-stone-900 px-5 py-3 text-xs font-bold tracking-[0.16em] text-white transition hover:bg-stone-700"
@click="printPlannerRange"
>
PRINT
</button>
<button
type="button"
class="rounded-full border border-stone-300 bg-white px-5 py-3 text-xs font-bold tracking-[0.16em] text-stone-700 transition hover:border-stone-500 hover:text-stone-900"
@click="closePrintDialog"
>
취소
</button>
</div>
</section>
</div>
<div
v-if="carryoverCheckPrompt"
class="fixed inset-0 z-50 flex items-center justify-center bg-stone-900/45 px-4 py-6 backdrop-blur-sm"

View File

@@ -31,7 +31,7 @@
background: #ffffff !important;
width: auto !important;
height: auto !important;
overflow: hidden !important;
overflow: visible !important;
}
body {
@@ -50,17 +50,11 @@
}
.print-only {
display: flex !important;
display: block !important;
width: 100% !important;
height: 100% !important;
height: auto !important;
margin: 0 !important;
padding: 0 !important;
align-items: center;
justify-content: center;
break-inside: avoid-page;
page-break-inside: avoid;
break-after: avoid-page;
page-break-after: avoid;
}
.print-root {
@@ -79,7 +73,17 @@
justify-content: center;
background: #ffffff !important;
padding: 0;
margin: 0 auto;
overflow: hidden;
break-after: page;
page-break-after: always;
break-inside: avoid-page;
page-break-inside: avoid;
}
.print-paper:last-child {
break-after: avoid-page;
page-break-after: avoid;
}
body[data-print-layout='single'] .print-paper {
@@ -116,6 +120,10 @@
background: #ffffff !important;
}
.print-sheet-frame--blank {
background: #ffffff !important;
}
body[data-print-layout='double'] .print-paper--double .print-sheet-frame {
width: 139mm;
height: 196mm;