Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
10c99e8
docs: comlog 설계와 구현 계획
akodm Dec 1, 2026
7b27c83
feat(comlog): 회차 고정 옵션과 트리거 단어 post·log
akodm Dec 1, 2026
6e99071
feat(comlog): 공개 범위와 기술 스택 규칙
akodm Dec 1, 2026
3a7eff6
feat(comlog): comlog 프로젝트 테이블과 초안 종류 컬럼
akodm Dec 1, 2026
88c085c
feat(comlog): 프로젝트 저장 계층과 GitHub 저장소 정보
akodm Dec 1, 2026
718b04b
feat(comlog): 초안 작업에 종류를 싣고 회차 옵션 고정
akodm Dec 1, 2026
2302e84
feat(comlog): 트리거가 회차·일반 글을 만들고 막히면 밀린 커밋으로 남김
akodm Dec 1, 2026
527ff39
fix(posts): 게시글 목록·사이트맵·상세·관리자 집계에서 comlog 회차 제외
akodm Dec 1, 2026
99fc586
fix(comlog): 밀린 커밋 기록 순서와 경계 되돌림 정리
akodm Dec 1, 2026
f44e558
fix(report): 일일 리포트 게시글 수에서 comlog 회차 제외
akodm Dec 1, 2026
1fea068
feat(comlog): 회차 사용됨 규칙과 시작 뒤 실패한 회차의 밀린 커밋
akodm Dec 1, 2026
cfca9dd
feat(comlog): 회차 게시와 비공개 공개 범위
akodm Dec 1, 2026
14fcf02
fix(comlog): 밀린 커밋을 제외 메뉴로 치울 수 있게
akodm Dec 1, 2026
f8cefcf
fix(comlog): 제외 덮어쓰기 규칙을 한 곳으로 모으고 중복 SHA 정리
akodm Dec 1, 2026
a405548
feat(comlog): 저장소 설정의 comlog 토글
akodm Dec 1, 2026
e242f60
feat(comlog): 프로젝트 대표 이미지
akodm Dec 1, 2026
047b346
feat(admin): comlog 프로젝트 숨기기
akodm Dec 1, 2026
b8f5c86
feat(comlog): /comlog 목록·프로젝트·회차 공개 페이지
akodm Dec 1, 2026
35ef616
feat(comlog): 스튜디오 게시 뒤 회차 공개 주소로 이동하고 글 보기 연결
akodm Dec 1, 2026
76aad30
fix(comlog): 일부 공개 회차는 프로젝트 회차 목록에서 빼기
akodm Dec 1, 2026
0aa7693
fix(comlog): 종류 없이 온 작성 요청은 일반 글로 받기
akodm Dec 1, 2026
332fb26
feat(comlog): 스튜디오 회차 사이드바와 프로젝트 소개 편집
akodm Dec 1, 2026
4d958a7
fix(comlog): 회차 화면의 커밋 요약·사용됨 표시·고정 옵션
akodm Dec 1, 2026
02e4236
chore(comlog): 번역 추가
akodm Dec 1, 2026
7d33f33
fix(comlog): 밀린 커밋 기록이 기준점을 되돌리지 않게
akodm Dec 1, 2026
415fef3
fix(comlog): 회차가 없는 프로젝트는 검색에 노출하지 않음
akodm Dec 1, 2026
b5a7d3c
fix(comlog): 최종 검토 정리
akodm Dec 1, 2026
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
156 changes: 156 additions & 0 deletions app/[lang]/admin/[adminKey]/(console)/comlog/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
import { msg } from '@lingui/core/macro';
import { Trans } from '@lingui/react/macro';
import {
ADMIN_INPUT_CLASS,
ADMIN_TITLE_CLASS,
} from '@/components/admin/admin-styles';
import AdminPagination from '@/components/admin/admin-pagination';
import AdminTable from '@/components/admin/admin-table';
import ConfirmActionButton from '@/components/admin/confirm-action-button';
import VisibilityLabel from '@/components/admin/visibility-label';
import { BRAND_BUTTON_CLASS } from '@/components/studio/studio-styles';
import {
banComlogProject,
unbanComlogProject,
} from '@/lib/actions/admin/comlog';
import { listComlogProjects } from '@/lib/admin/comlog-queries';
import { requireAdmin, requireAdminKey } from '@/lib/admin/guard';
import { ADMIN_PAGE_SIZE } from '@/lib/admin/pagination';
import { adminPath } from '@/lib/admin/path-key';
import { canPerform } from '@/lib/admin/roles';
import { getLocale, initLingui } from '@/lib/i18n/server';
import { parsePageParam } from '@/lib/posts/post-list';

interface AdminComlogPageProps {
searchParams: Promise<Record<string, string | string[] | undefined>>;
}

// 쿼리 값 (여러 번 들어오면 첫 값만, 너무 긴 값은 자름)
const readParam = (value: string | string[] | undefined): string => {
const first = Array.isArray(value) ? value[0] : value;

return (first ?? '').trim().slice(0, 100);
};

// 어드민 comlog 프로젝트 목록: 이름·소유자 검색, 숨기기·해제, 50개씩
export default async function AdminComlogPage({
searchParams,
}: AdminComlogPageProps) {
const i18n = await initLingui();
const admin = await requireAdmin('view');

const params = await searchParams;
const q = readParam(params.q);
const page = parsePageParam(params.page);
const locale = await getLocale();
const basePath = adminPath(locale, requireAdminKey(), 'comlog');
const canModerate = canPerform(admin.role, 'comlog.ban');
const { rows, total } = await listComlogProjects({ q, page });

return (
<div className="flex flex-col gap-6">
<h1 className={ADMIN_TITLE_CLASS}>comlog</h1>

<form
method="get"
action={basePath}
className="flex max-w-2xl flex-wrap gap-2"
>
<input
type="search"
name="q"
defaultValue={q}
maxLength={100}
aria-label={i18n._(msg`프로젝트 이름 또는 소유자 검색`)}
placeholder={i18n._(msg`프로젝트 이름 또는 소유자`)}
className={`${ADMIN_INPUT_CLASS} min-w-48 flex-1`}
/>
<button type="submit" className={`h-10 shrink-0 ${BRAND_BUTTON_CLASS}`}>
<Trans>검색</Trans>
</button>
</form>

<AdminTable
columns={[
{ key: 'name', label: <Trans>프로젝트</Trans> },
{ key: 'owner', label: <Trans>소유자</Trans> },
{
key: 'entries',
label: <Trans>회차 수</Trans>,
className: 'text-right',
},
{ key: 'progress', label: <Trans>진행 상태</Trans> },
{ key: 'visibility', label: <Trans>공개 범위</Trans> },
{ key: 'status', label: <Trans>상태</Trans> },
...(canModerate
? [{ key: 'action', label: <Trans>조치</Trans> }]
: []),
]}
rows={rows.map((row) => ({
id: row.id,
cells: {
name: <span className="font-medium">{row.name}</span>,
owner: row.ownerGithubLogin ?? row.ownerEmail,
entries: row.entryCount,
progress:
row.status === 'completed' ? (
<Trans>완료</Trans>
) : (
<Trans>진행 중</Trans>
),
visibility: <VisibilityLabel visibility={row.visibility} />,
status: (
<span className="flex flex-wrap gap-1">
{row.bannedAt ? (
<span
title={row.banReason ?? undefined}
className="border border-danger px-1.5 py-0.5 text-[11px] text-danger"
>
<Trans>숨김</Trans>
</span>
) : null}
{row.enabled ? null : (
<span className="border border-line px-1.5 py-0.5 text-[11px] text-ink-muted">
<Trans>꺼짐</Trans>
</span>
)}
{row.bannedAt || !row.enabled ? null : '-'}
</span>
),
action: row.bannedAt ? (
<ConfirmActionButton
action={unbanComlogProject}
label={i18n._(msg`숨김 해제`)}
confirmLabel={i18n._(msg`해제`)}
hidden={{ projectId: row.id }}
/>
) : (
<ConfirmActionButton
action={banComlogProject}
label={i18n._(msg`숨기기`)}
confirmLabel={i18n._(msg`숨기기`)}
description={
<Trans>
프로젝트와 모든 회차가 공개 목록, 상세, 사이트맵에서 빠져요.
</Trans>
}
danger
reasonField
hidden={{ projectId: row.id }}
/>
),
},
}))}
empty={<Trans>조건에 맞는 프로젝트가 없어요</Trans>}
/>

<AdminPagination
page={page}
pageSize={ADMIN_PAGE_SIZE}
total={total}
basePath={basePath}
query={{ q }}
/>
</div>
);
}
4 changes: 1 addition & 3 deletions app/[lang]/admin/[adminKey]/(console)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import VisibilityLabel from '@/components/admin/visibility-label';
import type { ReactNode } from 'react';
import { msg } from '@lingui/core/macro';
import { Trans } from '@lingui/react/macro';
Expand Down Expand Up @@ -77,9 +78,6 @@ const StatusLabel = ({ status }: { status: string }) => {
return <Trans>답변 대기</Trans>;
};

const VisibilityLabel = ({ visibility }: { visibility: string }) =>
visibility === 'public' ? <Trans>전체 공개</Trans> : <Trans>일부 공개</Trans>;

// 어드민 대시보드: 화면을 열 때 한 번 읽고, 새로고침 버튼을 눌렀을 때만 다시 읽음
export default async function AdminDashboardPage({
searchParams,
Expand Down
7 changes: 2 additions & 5 deletions app/[lang]/admin/[adminKey]/(console)/posts/[postId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { msg } from '@lingui/core/macro';
import { Trans } from '@lingui/react/macro';
import { ADMIN_TITLE_CLASS } from '@/components/admin/admin-styles';
import AdminTable from '@/components/admin/admin-table';
import VisibilityLabel from '@/components/admin/visibility-label';
import ConfirmActionButton from '@/components/admin/confirm-action-button';
import { banPost, deletePost, unbanPost } from '@/lib/actions/admin/posts';
import { requireAdmin, requireAdminKey } from '@/lib/admin/guard';
Expand Down Expand Up @@ -103,11 +104,7 @@ export default async function AdminPostDetailPage({
</LocalizedLink>
</InfoRow>
<InfoRow label={<Trans>공개 범위</Trans>}>
{post.visibility === 'public' ? (
<Trans>전체 공개</Trans>
) : (
<Trans>일부 공개</Trans>
)}
<VisibilityLabel visibility={post.visibility} />
</InfoRow>
<InfoRow label={<Trans>언어</Trans>}>{post.locale}</InfoRow>
<InfoRow label={<Trans>게시일</Trans>}>
Expand Down
27 changes: 21 additions & 6 deletions app/[lang]/admin/[adminKey]/(console)/posts/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
ADMIN_TITLE_CLASS,
} from '@/components/admin/admin-styles';
import AdminPagination from '@/components/admin/admin-pagination';
import VisibilityLabel from '@/components/admin/visibility-label';
import AdminTable from '@/components/admin/admin-table';
import LocalizedLink from '@/components/shared/localized-link';
import { BRAND_BUTTON_CLASS } from '@/components/studio/studio-styles';
Expand All @@ -18,6 +19,7 @@ import {
parseVisibility,
} from '@/lib/admin/post-queries';
import { getLocale, initLingui } from '@/lib/i18n/server';
import type { AdminPostKindFilter } from '@/lib/posts/kind';
import { parsePageParam } from '@/lib/posts/post-list';

interface AdminPostsPageProps {
Expand All @@ -31,6 +33,10 @@ const readParam = (value: string | string[] | undefined): string => {
return (first ?? '').trim().slice(0, 100);
};

// 종류 필터 (알 수 없는 값은 기본인 일반 글)
const parseKind = (value: string): AdminPostKindFilter =>
value === 'comlog' || value === 'all' ? value : 'post';

const formatDate = (date: Date, locale: string) =>
new Intl.DateTimeFormat(locale, {
timeZone: 'Asia/Seoul',
Expand All @@ -48,11 +54,13 @@ export default async function AdminPostsPage({
const q = readParam(params.q);
const visibility = parseVisibility(readParam(params.visibility));
const postLocale = parsePostLocale(readParam(params.language));
const kind = parseKind(readParam(params.kind));
const page = parsePageParam(params.page);
const locale = await getLocale();
const basePath = adminPath(locale, requireAdminKey(), 'posts');
const { rows, total } = await listPosts({
q,
kind,
visibility,
locale: postLocale,
page,
Expand All @@ -78,6 +86,16 @@ export default async function AdminPostsPage({
placeholder={i18n._(msg`제목 또는 작성자`)}
className={`${ADMIN_INPUT_CLASS} min-w-48 flex-1`}
/>
<select
name="kind"
defaultValue={kind}
aria-label={i18n._(msg`종류`)}
className={`${ADMIN_SELECT_CLASS} w-auto`}
>
<option value="post">{i18n._(msg`일반 글`)}</option>
<option value="comlog">{i18n._(msg`comlog 회차`)}</option>
<option value="all">{i18n._(msg`전체`)}</option>
</select>
<select
name="visibility"
defaultValue={visibility ?? ''}
Expand All @@ -87,6 +105,7 @@ export default async function AdminPostsPage({
<option value="">{i18n._(msg`공개 범위 전체`)}</option>
<option value="public">{i18n._(msg`전체 공개`)}</option>
<option value="unlisted">{i18n._(msg`일부 공개`)}</option>
<option value="private">{i18n._(msg`비공개`)}</option>
</select>
<select
name="language"
Expand Down Expand Up @@ -129,12 +148,7 @@ export default async function AdminPostsPage({
</LocalizedLink>
),
author: row.authorGithubLogin ?? row.authorEmail,
visibility:
row.visibility === 'public' ? (
<Trans>전체 공개</Trans>
) : (
<Trans>일부 공개</Trans>
),
visibility: <VisibilityLabel visibility={row.visibility} />,
language: row.locale,
publishedAt: formatDate(row.publishedAt, locale),
views: row.viewCount,
Expand All @@ -157,6 +171,7 @@ export default async function AdminPostsPage({
basePath={basePath}
query={{
q,
kind,
visibility: visibility ?? '',
language: postLocale ?? '',
}}
Expand Down
34 changes: 34 additions & 0 deletions app/[lang]/comlog/[projectPath]/[entryPath]/opengraph-image.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import {
parseComlogEntryParam,
parseComlogProjectParam,
} from '@/lib/comlog/paths';
import { getComlogEntryPage } from '@/lib/comlog/queries';
import { OG_IMAGE_SIZE, renderPostOgImage } from '@/lib/seo/og-image';

// 회차 오픈그래프 이미지 (게시글과 같은 생성기: 제목, 기술 태그, 작성자)
export const alt = 'comdraft';
export const size = OG_IMAGE_SIZE;
export const contentType = 'image/png';

export default async function Image({
params,
}: {
params: Promise<{ lang: string; projectPath: string; entryPath: string }>;
}) {
const { projectPath, entryPath } = await params;
const project = parseComlogProjectParam(projectPath);
const entry = parseComlogEntryParam(entryPath);
// 이미지 응답은 CDN 이 공유해 캐시하므로 보는 사람과 무관하게 비로그인 기준으로 판단 (비공개·꺼짐·밴이면 404)
const page =
project && entry
? await getComlogEntryPage(project.id, entry.id, null)
: null;

if (!page) return new Response(null, { status: 404 });

return renderPostOgImage({
title: page.entry.title,
tags: page.entry.tags,
authorName: page.entry.author.name,
});
}
Loading