Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions 01-planning/_registry/policies/POL-0006-timezone.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@
- **실제 사용자 사이트의 모집 목록·상세는 이번 변경에서 기존 표시를 유지한다.** 현재 응답은 자유 일정 문구와 KST/PST/BOTH 분류를 주므로 기준 지역을 추정해 자동 변환하지 않는다. Playground의 별도 확정 일정 예시는 검토용이며 실제 사이트에 적용하지 않는다. 모집 화면에는 시간대 전환 메뉴를 추가하지 않는다
- 출석 판정·하루 한 회차 중복 판정·킥오프 이후 여부는 해당 반의 시간대를 유지한다. 입력 날짜가 전날·다음 날이어도 반의 날짜로 환산해 검사한다. 표시 시간대가 판정·집계 기준을 바꾸지 않는다. 반복 생성은 입력자의 지역에서 선택한 요일·시각을 유지하므로 서머타임 경계에서는 반에서 보는 시각이 달라질 수 있다

### 백오피스

- **백오피스의 날짜·시각은 운영자 프로필 시간대 하나로 읽고 쓴다** — 알림 발송 이력 · 템플릿 · 공지 · 문의 · 회원 가입일 · 스터디 목록과 모집 마감일 · 진행 시작일 입력이 모두 같다. 프로필 시간대가 없으면 서울이다. 브라우저 시간대는 쓰지 않는다: 화면마다 기준이 달라 같은 마감일이 화면마다 다른 날로 보였다(2026-11-18)
- 프로필 시간대는 로그인 응답의 `account.timeZone` 을 세션에 둔 값이다. 백오피스를 열 때 `GET /api/me` 를 한 번 읽어 바뀌었으면 세션 값을 고친다 — 프로필을 바꾸면 다시 로그인하지 않아도 다음에 열 때 반영된다 (2026-11-19 결정)
- 반 시간대가 본질인 화면(일정 표 · 출석)은 반 시간대 또는 표에서 고른 시간대를 그대로 쓴다. 운영 대시보드는 [dashboard 스펙](../../../specs/dashboard/spec.md) 2.2 의 순서를 따른다
- 화면마다 어느 시간대 기준인지 한 줄로 밝힌다 — `표의 시각은 내 프로필 시간대 기준입니다 (북미 서부 · 밴쿠버 · PCT)`

## 시간 표기 규칙

| 무엇 | 규칙 | 예 |
Expand Down
3 changes: 3 additions & 0 deletions frontend/apps/back-office-front/src/app/feedbacks/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
type FeedbackStatus,
type FeedbackType,
} from '@/features/feedbacks/types';
import { TimezoneNote } from '@/features/notifications/components/TimezoneNote';
import { useDebouncedValue } from '@/lib/use-debounced-value';
import { pageOf, useUrlState } from '@/lib/use-url-state';

Expand Down Expand Up @@ -118,6 +119,8 @@ function FeedbacksList() {
</span>
</div>

<TimezoneNote />

{loading ? (
<FeedbacksSkeleton />
) : error ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ import { TemplateDialog } from '@/features/notification-templates/components/Tem
import { useNotificationTemplates } from '@/features/notification-templates/queries';
import type { NotificationTemplate } from '@/features/notification-templates/types';
import { NotificationTabs } from '@/features/notifications/components/NotificationTabs';
import { TimezoneNote } from '@/features/notifications/components/TimezoneNote';
import { channelLabel, eventLabel, formatStamp } from '@/features/notifications/labels';
import { useDisplayTimeZone } from '@/lib/use-display-timezone';

export default function NotificationTemplatesPage() {
const { data, error, isPending, isFetching, refetch } = useNotificationTemplates();
/** null = 닫힘, 'new' = 추가, 템플릿 = 그 템플릿 수정 */
const [target, setTarget] = useState<'new' | NotificationTemplate | null>(null);
const tz = useDisplayTimeZone();

// 새로 더한 것이 맨 위에 선다 — 서버가 준 순서에 기대지 않고 화면에서 id 내림차순으로 놓는다
const templates = useMemo(() => (data ? [...data].sort((a, b) => b.id - a.id) : undefined), [data]);
Expand Down Expand Up @@ -64,6 +67,8 @@ export default function NotificationTemplatesPage() {
</div>
)}

{templates && templates.length > 0 && <TimezoneNote />}

{templates && templates.length > 0 && (
<TableCard>
<thead>
Expand All @@ -85,7 +90,7 @@ export default function NotificationTemplatesPage() {
<td className='whitespace-nowrap text-fg-secondary'>{channelLabel(t.channel)}</td>
<td className='max-w-0 truncate text-fg-secondary'>{t.subject}</td>
<td className='tnum whitespace-nowrap text-fg-secondary'>
{t.updatedAt ? formatStamp(t.updatedAt) : '-'}
{t.updatedAt ? formatStamp(t.updatedAt, tz) : '-'}
</td>
</tr>
))}
Expand Down
13 changes: 12 additions & 1 deletion frontend/apps/back-office-front/src/app/providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,23 @@

import { USER_KEY } from '@/features/auth/auth';
import { trackHistoryNavigation } from '@/lib/history-guard';
import { ProfileTimeZoneSync } from '@/lib/use-display-timezone';

Check warning on line 12 in frontend/apps/back-office-front/src/app/providers.tsx

View workflow job for this annotation

GitHub Actions / static

`@/lib/use-display-timezone` import should occur after import of `@/lib/query-client`
import { isMockApiEnabled } from '@/lib/mock-api';
import { getQueryClient } from '@/lib/query-client';

const MSWProvider = dynamic(() => import('@studyclub/mock/msw').then((m) => m.MSWProvider), { ssr: false });

const loadWorker = () => import('msw/browser').then(({ setupWorker }) => setupWorker());

// 다른 탭이 시간대만 고친 것은 같은 세션이다 — 사람이 바뀌었을 때만 다시 접속을 묻는다
function sessionIdOf(raw: string | null): number | null {
try {
return raw ? (JSON.parse(raw)?.id ?? null) : null;
} catch {
return null;
}
}

function MswQueryInvalidator() {
useEffect(() => {
const handler = () => {
Expand All @@ -36,7 +46,7 @@
useEffect(() => {
function handleStorage(event: StorageEvent) {
if (event.storageArea !== window.localStorage || (event.key !== USER_KEY && event.key !== null)) return;
if (event.key !== null && event.oldValue === event.newValue) return;
if (event.key !== null && sessionIdOf(event.oldValue) === sessionIdOf(event.newValue)) return;
setSessionChanged(true);
queryClient.clear();
}
Expand All @@ -61,6 +71,7 @@
const content = (
<QueryClientProvider client={queryClient}>
{mockEnabled && <MswQueryInvalidator />}
<ProfileTimeZoneSync />
{children}
<Toaster position='bottom-center' />
</QueryClientProvider>
Expand Down
3 changes: 3 additions & 0 deletions frontend/apps/back-office-front/src/app/users/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { Input, Pagination, Segmented, IconButton } from '@studyclub/ui';
import { Info, Search } from 'lucide-react';

import { PageHeader } from '@/components/ui';
import { TimezoneNote } from '@/features/notifications/components/TimezoneNote';
import { PermissionMatrixDialog } from '@/features/users/components/PermissionMatrixDialog';
import { UsersTable } from '@/features/users/components/UsersTable';
import { TAB_OPTIONS } from '@/features/users/labels';
Expand Down Expand Up @@ -119,6 +120,8 @@ function UsersAdminContent() {
</div>
)}

<TimezoneNote subject='가입일은' />

{isPending && !error ? (
<p className='py-10 text-center type-body-sm text-fg-muted'>불러오는 중…</p>
) : (
Expand Down
9 changes: 9 additions & 0 deletions frontend/apps/back-office-front/src/features/auth/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export const sessionUserSchema = z.object({
nickname: z.string().nullable(),
picture: z.string().nullable(),
role: z.string(),
/** 운영자 프로필 시간대 (`ACCOUNT.TIME_ZONE`). 이 필드가 생기기 전에 로그인한 세션에는 없다. */
timeZone: z.string().nullable().optional(),
});
export type SessionUser = z.infer<typeof sessionUserSchema>;

Expand Down Expand Up @@ -70,6 +72,13 @@ export function setUser(user: SessionUser): void {
window.localStorage.setItem(USER_KEY, JSON.stringify(user));
}

/** 세션 user 의 시간대만 바꾼다. 같은 사람이라 조회 캐시는 비우지 않는다. */
export function setUserTimeZone(timeZone: string | null): void {
const user = getUser();
if (!user || typeof window === 'undefined') return;
window.localStorage.setItem(USER_KEY, JSON.stringify({ ...user, timeZone }));
}

export function clearSession(): void {
if (typeof window === 'undefined') return;
getQueryClient().clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const authAccountSchema = z.object({
email: z.string().optional(),
nickname: z.string().nullable().optional(),
picture: z.string().nullable().optional(),
timeZone: z.string().nullable().optional(),
onboardingCompletedAt: z.string().nullable().optional(),
});
export const loginResponseSchema = z.object({ account: authAccountSchema });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { StatusPicker } from '@/features/feedbacks/components/StatusPicker';
import { COPY, EMPTY_VALUE, formatStamp, personLabel, viewportLabel } from '@/features/feedbacks/labels';
import { useChangeFeedbackStatus, useReplyFeedback, useSaveFeedbackMemo } from '@/features/feedbacks/queries';
import { MEMO_MAX, REPLY_MAX, REPLY_MIN, type ApiAdminFeedbackDetail } from '@/features/feedbacks/types';
import { TimezoneNote } from '@/features/notifications/components/TimezoneNote';
import { useDisplayTimeZone } from '@/lib/use-display-timezone';

/** 목록으로 돌아가는 길 — 상세 머리 위와 「없는 건」 안내에서 같이 쓴다. */
export function BackToList() {
Expand All @@ -33,6 +35,7 @@ export function BackToList() {
*/
export function FeedbackDetail({ detail }: { detail: ApiAdminFeedbackDetail }) {
const status = useChangeFeedbackStatus(detail.id);
const tz = useDisplayTimeZone();
/** 크게 보고 있는 첨부 이미지 */
const [zoom, setZoom] = useState<number | null>(null);

Expand All @@ -43,6 +46,8 @@ export function FeedbackDetail({ detail }: { detail: ApiAdminFeedbackDetail }) {
<div className='flex flex-col gap-4'>
<BackToList />

<TimezoneNote subject='시각은' />

<article className='card divide-y divide-border overflow-hidden p-0'>
<header className='flex flex-wrap items-start justify-between gap-3 px-6 py-5'>
<div className='min-w-0'>
Expand All @@ -51,7 +56,7 @@ export function FeedbackDetail({ detail }: { detail: ApiAdminFeedbackDetail }) {
<h1 className='min-w-0 break-words text-xl font-extrabold tracking-tight'>{detail.title}</h1>
</div>
<p className='tnum mt-1.5 text-sm text-fg-muted'>
{personLabel(detail.submitter)} · {formatStamp(detail.createdAt)}
{personLabel(detail.submitter)} · {formatStamp(detail.createdAt, tz)}
</p>
</div>
<div className='flex shrink-0 items-center gap-2 text-sm text-fg-secondary'>
Expand Down Expand Up @@ -139,6 +144,7 @@ export function FeedbackDetail({ detail }: { detail: ApiAdminFeedbackDetail }) {
*/
function ReplySection({ detail }: { detail: ApiAdminFeedbackDetail }) {
const mutation = useReplyFeedback(detail.id);
const tz = useDisplayTimeZone();
const [draft, setDraft] = useState(detail.reply?.content ?? '');
/** 이미 회신한 건을 고치는 중 */
const [editing, setEditing] = useState(false);
Expand All @@ -157,7 +163,7 @@ function ReplySection({ detail }: { detail: ApiAdminFeedbackDetail }) {
<section className='px-6 py-5' aria-label='회신'>
<div className='flex items-baseline justify-between gap-3'>
<span className='text-sm font-medium text-neutral-800'>회신</span>
<span className='tnum text-xs text-fg-muted'>{formatStamp(detail.reply.repliedAt)} 보냄</span>
<span className='tnum text-xs text-fg-muted'>{formatStamp(detail.reply.repliedAt, tz)} 보냄</span>
</div>
<p
data-testid='feedback-reply'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { TableCard } from '@/components/ui';
import { FeedbackStatusBadge, FeedbackTypeBadge } from '@/features/feedbacks/components/FeedbackBadges';
import { EMPTY_VALUE, formatStamp, personLabel } from '@/features/feedbacks/labels';
import { FEEDBACK_PAGE_SIZE, type ApiAdminFeedback } from '@/features/feedbacks/types';
import { useDisplayTimeZone } from '@/lib/use-display-timezone';

const COLUMNS = 6;

Expand Down Expand Up @@ -39,6 +40,7 @@ function FeedbacksHead() {
* (접수 시각 내림차순 고정, 열 머리로 정렬하지 않는다). 줄 어디를 눌러도 상세로 간다.
*/
export function FeedbacksTable({ rows, onOpen }: { rows: ApiAdminFeedback[]; onOpen: (id: number) => void }) {
const tz = useDisplayTimeZone();
return (
<TableCard tableClassName='table-fixed'>
<FeedbacksHead />
Expand All @@ -53,7 +55,7 @@ export function FeedbacksTable({ rows, onOpen }: { rows: ApiAdminFeedback[]; onO
}}
className='cursor-pointer hover:bg-surface-2 focus-visible:bg-surface-2 focus-visible:outline-none'
>
<td className='tnum whitespace-nowrap text-fg-secondary'>{formatStamp(f.createdAt)}</td>
<td className='tnum whitespace-nowrap text-fg-secondary'>{formatStamp(f.createdAt, tz)}</td>
<td className='whitespace-nowrap'>
<FeedbackTypeBadge type={f.type} />
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import type { BadgeTone } from '@studyclub/ui';

import type { ApiFeedbackPerson, ApiAdminFeedbackDetail, FeedbackStatus, FeedbackType } from '@/features/feedbacks/types';
import { wallParts } from '@/features/schedule/time';

/** 고르는 순서 — 문의 · 개선 의견 · 오류 신고 (프로토 `FEEDBACK_TYPES`). */
export const TYPE_OPTIONS: { value: FeedbackType; label: string }[] = [
Expand Down Expand Up @@ -56,14 +57,14 @@ export function viewportLabel(viewport: ApiAdminFeedbackDetail['viewport']): str
}

/**
* 보는 사람의 시간대로, 24시간제 — 「26.10.18 14:02」 (프로토 `stamp`).
* `tz`(`useDisplayTimeZone()`)로, 24시간제 — 「26.10.18 14:02」 (프로토 `stamp`).
* 읽을 수 없는 값이면 원문을 그대로 둔다 — 비우면 값이 없는 것으로 읽힌다.
*/
export function formatStamp(iso: string): string {
export function formatStamp(iso: string, tz: string): string {
const at = new Date(iso);
if (Number.isNaN(at.getTime())) return iso;
const p = (n: number) => String(n).padStart(2, '0');
return `${String(at.getFullYear()).slice(2)}.${p(at.getMonth() + 1)}.${p(at.getDate())} ${p(at.getHours())}:${p(at.getMinutes())}`;
const { date, time } = wallParts(at, tz);
return `${date.slice(2).replaceAll('-', '.')} ${time}`;
}

// ── 안내 문구 (PRD 「상태별 화면」)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { RotateCw } from 'lucide-react';
import { TableCard } from '@/components/ui';
import { channelLabel, eventLabel, formatStamp, statusLabel, statusTone } from '@/features/notifications/labels';
import { NOTIFICATION_PAGE_SIZE, type ApiNotification } from '@/features/notifications/types';
import { useDisplayTimeZone } from '@/lib/use-display-timezone';

const COLUMNS = 6;

Expand All @@ -26,21 +27,22 @@ export function HistoryTable({
resending: ReadonlySet<number>;
onResend: (id: number) => void;
}) {
const tz = useDisplayTimeZone();
return (
<TableCard>
<HistoryHead />
<tbody>
{rows.map((row) => (
<tr key={row.id}>
<td className='tnum whitespace-nowrap text-fg-secondary'>{formatStamp(row.createdAt)}</td>
<td className='tnum whitespace-nowrap text-fg-secondary'>{formatStamp(row.createdAt, tz)}</td>
<td className='whitespace-nowrap'>{eventLabel(row.eventType)}</td>
<td className='whitespace-nowrap text-fg-secondary'>{channelLabel(row.recipientType)}</td>
<td className='max-w-0 truncate text-fg-secondary'>{row.recipientValue}</td>
<td>
<StatusCell row={row} spinning={resending.has(row.id)} onResend={onResend} />
</td>
<td className='tnum whitespace-nowrap text-fg-secondary'>
{row.sentAt ? formatStamp(row.sentAt) : <span className='text-fg-muted'>—</span>}
{row.sentAt ? formatStamp(row.sentAt, tz) : <span className='text-fg-muted'>—</span>}
</td>
</tr>
))}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,18 @@
'use client';

import { useEffect, useState } from 'react';
import { STUDY_TZS, tzAbbr } from '@/features/schedule/time';
import { useDisplayTimeZone } from '@/lib/use-display-timezone';

/**
* 표의 시각이 **어느 시간대 기준인지** 한 번만 밝힌다 (POL-0006). 줄마다 약칭을 달면 같은 말이 스무 번 반복된다 —
* 화면의 시각이 **어느 시간대 기준인지** 한 번만 밝힌다 (POL-0006). 줄마다 약칭을 달면 같은 말이 스무 번 반복된다 —
* 기준은 위에서 한 번 말하고 각 줄에는 시각만 적는다.
*
* 시간대는 브라우저만 안다. 서버에서 그린 화면과 달라 하이드레이션이 어긋나지 않도록 마운트 뒤에 채우고,
* 그 전에도 한 줄의 높이는 지켜 표가 아래로 밀리지 않게 한다.
*/
export function TimezoneNote() {
const [zone, setZone] = useState('');

useEffect(() => {
const id = Intl.DateTimeFormat().resolvedOptions().timeZone;
const offset = new Intl.DateTimeFormat('ko-KR', { timeZoneName: 'short' })
.formatToParts(new Date())
.find((part) => part.type === 'timeZoneName')?.value;
setZone(offset ? `${id} · ${offset}` : id);
}, []);

export function TimezoneNote({ subject = '표의 시각은' }: { subject?: string }) {
const zone = useDisplayTimeZone();
const label = STUDY_TZS.find((z) => z.key === zone)?.label ?? zone;
return (
<p className='mb-2 min-h-5 type-label-sm text-fg-muted' data-testid='timezone-note'>
{zone && `표의 시각은 내 시간대 기준입니다 (${zone})`}
{`${subject} 내 프로필 시간대 기준입니다 (${label} · ${tzAbbr(zone)})`}
</p>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,15 @@ export function channelLabel(recipientType: string): string {
}

/**
* 보는 사람의 시간대로 24시간제로 적는다. 서버는 UTC 로 주고 브라우저가 바꾼다.
* `tz`(`useDisplayTimeZone()`)로 24시간제로 적는다. 서버는 UTC 로 준다.
* **약칭은 줄마다 달지 않는다** — 어느 시간대 기준인지는 표 위에서 한 번 밝힌다(`TimezoneNote`, POL-0006).
* 읽을 수 없는 값이면 **원문을 그대로** 둔다 — 비우면 값이 없는 것으로 읽힌다.
*/
export function formatStamp(iso: string): string {
export function formatStamp(iso: string, tz: string): string {
const at = new Date(iso);
if (Number.isNaN(at.getTime())) return iso;
return at.toLocaleString('ko-KR', {
timeZone: tz,
year: '2-digit',
month: '2-digit',
day: '2-digit',
Expand Down
Loading
Loading