[feat] solution: 미니 블로그·이용후기·예약요청 추가, /s/stay 목업·발행 사이트 UI 다수 수정
인앱 미니 블로그(AI 자동 포스트, 이메일 승인)·이용후기(즉시 게시)·예약 요청(메일 발송)을
새로 붙였고, 병행해서 /s/stay 목업과 발행 사이트 공통 렌더러(UnitsSection·FestivalSection·
LocalGuideSection·WeatherSection 등)의 UI 버그를 다수 고쳤다. 범위가 넓지만 한 주 분량
작업을 한 커밋으로 묶어 달라는 요청에 따라 하나로 묶는다.
- solution/backend: post/review/booking_request 라우터·서비스·CRUD 추가, 스케줄러에
블로그 초안 생성(새벽 4:10)·발송(아침 9:00) cron 등록, 마이그레이션 4건 추가
- solution/frontend, admin/frontend: 생성된 API 클라이언트 갱신, 리뷰 모더레이션·
블로그 글 관리 페이지 추가
- solution/site/src: 객실 상세+실시간예약(날짜선택·연락처 폼)을 모달로 통합, 축제·
주변안내 카드 클릭 시 모달 전환, 후기 목록 카드 UI, 공용 Modal 컴포넌트 신설,
날씨 문구 동기화 버그 수정(하늘줄·기온줄 한 타이머로), 시설·편의 가능/불가 아이콘
색상 하이라이트, 헤더 메뉴 순서를 실제 섹션 순서에 맞춤, 하단 탭바 아이콘 정렬 버그
(line-height) 수정, 추천일정 점선 연결+데스크톱 자동펼침/모바일 축소, 채널 라벨에
크롤링 원문("NOL")이 새던 것을 bookingLabel() 로 교체
- solution/site/scripts/mockup: /s/stay 패치 스크립트·주입 CSS·JS 다수 수정, stay4~6
빌드 스크립트 추가(다른 세션 작업)
테스트: solution/site `npx tsc --noEmit` 통과, `npx vitest run` 93 passed,
solution/backend `pytest tests/test_booking_request.py` 6 passed(로컬 DB 대상).
예약 요청 메일은 실제 발송까지 확인(place 66894a1b 소유자 이메일 누락을 DB에서 보정).
This commit is contained in:
1 parent
29af37f158
commit
872d00f3c4
338 files changed
+74988
-9283
No files matched your search
@@ -174,3 +174,161 @@ export function useHealthzHealthzGet<
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
/**
|
||||
* ★ healthz 와 다른 걸 본다 — healthz 는 "프로세스가 살아 있나"(항상 200),
|
||||
이건 "요청을 실제로 처리할 수 있나"(DB 에 붙는지 실제로 한 번 물어본다).
|
||||
|
||||
★ 왜 필요한가: 이 서버·DB 가 통째로 죽으면 우리 알림(alert_service, Teams webhook)도
|
||||
같이 죽는다 — 자기 장애를 자기가 알릴 수 없다. 외부 감시(uptime 모니터 등)가 이 경로를
|
||||
주기적으로 찔러야 전체 다운을 잡는다. DEPLOY.md·SERVERS.md 에 붙일 절차: 이 경로가
|
||||
2xx 가 아니면(또는 응답이 없으면) 그 감시 서비스 **자신의** 채널로 알린다 — Teams
|
||||
webhook 이 죽은 원인 그 자체일 수 있으므로 같은 경로로 알리면 안 된다.
|
||||
* @summary Readyz
|
||||
*/
|
||||
export const readyzReadyzGet = (
|
||||
options?: SecondParameter<typeof customFetch>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return customFetch<unknown>(
|
||||
{ url: `/readyz`, method: "GET", signal },
|
||||
options,
|
||||
);
|
||||
};
|
||||
|
||||
export const getReadyzReadyzGetQueryKey = () => {
|
||||
return [`/readyz`] as const;
|
||||
};
|
||||
|
||||
export const getReadyzReadyzGetQueryOptions = <
|
||||
TData = Awaited<ReturnType<typeof readyzReadyzGet>>,
|
||||
TError = void,
|
||||
>(options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<Awaited<ReturnType<typeof readyzReadyzGet>>, TError, TData>
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
}) => {
|
||||
const { query: queryOptions, request: requestOptions } = options ?? {};
|
||||
|
||||
const queryKey = queryOptions?.queryKey ?? getReadyzReadyzGetQueryKey();
|
||||
|
||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof readyzReadyzGet>>> = ({
|
||||
signal,
|
||||
}) => readyzReadyzGet(requestOptions, signal);
|
||||
|
||||
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||
Awaited<ReturnType<typeof readyzReadyzGet>>,
|
||||
TError,
|
||||
TData
|
||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
||||
};
|
||||
|
||||
export type ReadyzReadyzGetQueryResult = NonNullable<
|
||||
Awaited<ReturnType<typeof readyzReadyzGet>>
|
||||
>;
|
||||
export type ReadyzReadyzGetQueryError = void;
|
||||
|
||||
export function useReadyzReadyzGet<
|
||||
TData = Awaited<ReturnType<typeof readyzReadyzGet>>,
|
||||
TError = void,
|
||||
>(
|
||||
options: {
|
||||
query: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<ReturnType<typeof readyzReadyzGet>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
> &
|
||||
Pick<
|
||||
DefinedInitialDataOptions<
|
||||
Awaited<ReturnType<typeof readyzReadyzGet>>,
|
||||
TError,
|
||||
Awaited<ReturnType<typeof readyzReadyzGet>>
|
||||
>,
|
||||
"initialData"
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): DefinedUseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
export function useReadyzReadyzGet<
|
||||
TData = Awaited<ReturnType<typeof readyzReadyzGet>>,
|
||||
TError = void,
|
||||
>(
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<ReturnType<typeof readyzReadyzGet>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
> &
|
||||
Pick<
|
||||
UndefinedInitialDataOptions<
|
||||
Awaited<ReturnType<typeof readyzReadyzGet>>,
|
||||
TError,
|
||||
Awaited<ReturnType<typeof readyzReadyzGet>>
|
||||
>,
|
||||
"initialData"
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
export function useReadyzReadyzGet<
|
||||
TData = Awaited<ReturnType<typeof readyzReadyzGet>>,
|
||||
TError = void,
|
||||
>(
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<ReturnType<typeof readyzReadyzGet>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
/**
|
||||
* @summary Readyz
|
||||
*/
|
||||
|
||||
export function useReadyzReadyzGet<
|
||||
TData = Awaited<ReturnType<typeof readyzReadyzGet>>,
|
||||
TError = void,
|
||||
>(
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<ReturnType<typeof readyzReadyzGet>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
} {
|
||||
const queryOptions = getReadyzReadyzGetQueryOptions(options);
|
||||
|
||||
const query = useQuery(queryOptions, queryClient) as UseQueryResult<
|
||||
TData,
|
||||
TError
|
||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ApprovePageParams = {
|
||||
/**
|
||||
* @minLength 8
|
||||
* @maxLength 200
|
||||
*/
|
||||
t: string;
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type GenerateMyPostForDateParams = {
|
||||
date: string;
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type GenerateMyPostsParams = {
|
||||
/**
|
||||
* 구간 시작일
|
||||
*/
|
||||
start: string;
|
||||
/**
|
||||
* 구간 끝일
|
||||
*/
|
||||
end: string;
|
||||
};
|
||||
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { GenerationBatchModel } from "./generationBatchModel";
|
||||
|
||||
/**
|
||||
* 생성 회차 하나 — 같은 스윕에서 한 번에 만들어진 글 묶음(post_crud.generation_batches).
|
||||
*/
|
||||
export interface GenerationBatch {
|
||||
created_at: string;
|
||||
count: number;
|
||||
model?: GenerationBatchModel;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type GenerationBatchModel = string | null;
|
||||
@@ -5,6 +5,7 @@
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export * from "./approvePageParams";
|
||||
export * from "./auditCheckData";
|
||||
export * from "./auditCheckDataRecommendation";
|
||||
export * from "./authProvider";
|
||||
@@ -33,17 +34,27 @@ export * from "./faqDataSourceFactIds";
|
||||
export * from "./faqDataUpdatedAt";
|
||||
export * from "./fieldSpecData";
|
||||
export * from "./fieldSpecDataUnit";
|
||||
export * from "./generateMyPostForDateParams";
|
||||
export * from "./generateMyPostsParams";
|
||||
export * from "./generationBatch";
|
||||
export * from "./generationBatchModel";
|
||||
export * from "./getGuideParams";
|
||||
export * from "./getWeatherParams";
|
||||
export * from "./hTTPValidationError";
|
||||
export * from "./jobData";
|
||||
export * from "./jobDataCreatedAt";
|
||||
export * from "./jobDataLastError";
|
||||
export * from "./jobDataPlaceId";
|
||||
export * from "./jobDataProgress";
|
||||
export * from "./jobDataResult";
|
||||
export * from "./jobDataRunAfter";
|
||||
export * from "./jobDataRunStartedAt";
|
||||
export * from "./jobDataUpdatedAt";
|
||||
export * from "./jobProgress";
|
||||
export * from "./jobStatus";
|
||||
export * from "./jobStep";
|
||||
export * from "./jobStepReason";
|
||||
export * from "./jobStepStatus";
|
||||
export * from "./jobType";
|
||||
export * from "./linkChannel";
|
||||
export * from "./linkData";
|
||||
@@ -55,9 +66,12 @@ export * from "./listFactsParams";
|
||||
export * from "./listFaqsParams";
|
||||
export * from "./listLinksParams";
|
||||
export * from "./listMediaParams";
|
||||
export * from "./listMyPostsParams";
|
||||
export * from "./listMySitesParams";
|
||||
export * from "./listPlacesParams";
|
||||
export * from "./listReviewsParams";
|
||||
export * from "./listShowcaseParams";
|
||||
export * from "./listUpcomingPostsParams";
|
||||
export * from "./localContentData";
|
||||
export * from "./localContentDataBody";
|
||||
export * from "./localContentDataCollectedAt";
|
||||
@@ -123,6 +137,13 @@ export * from "./placeSearchItemCategoryName";
|
||||
export * from "./placeSearchItemNaverPlaceUrl";
|
||||
export * from "./placeSearchItemRoadAddress";
|
||||
export * from "./placeStatus";
|
||||
export * from "./postData";
|
||||
export * from "./postDataApprovedAt";
|
||||
export * from "./postDataCreatedAt";
|
||||
export * from "./postDataPublishedAt";
|
||||
export * from "./postDataScheduledDate";
|
||||
export * from "./postDataSentAt";
|
||||
export * from "./publicReview";
|
||||
export * from "./publishAction";
|
||||
export * from "./publishLogData";
|
||||
export * from "./publishLogDataCreatedAt";
|
||||
@@ -135,17 +156,28 @@ export * from "./renderStatusData";
|
||||
export * from "./renderStatusDataError";
|
||||
export * from "./renderStatusDataRenderedAt";
|
||||
export * from "./renderStatusDataRenderedVersion";
|
||||
export * from "./reqBookingRequest";
|
||||
export * from "./reqBookingRequestCompany";
|
||||
export * from "./reqBookingRequestEmail";
|
||||
export * from "./reqBookingRequestGuests";
|
||||
export * from "./reqBookingRequestMessage";
|
||||
export * from "./reqBookingRequestStay";
|
||||
export * from "./reqCreateFaq";
|
||||
export * from "./reqCreateFaqSortOrder";
|
||||
export * from "./reqCreateLink";
|
||||
export * from "./reqCreateLinkTitle";
|
||||
export * from "./reqCreatePlace";
|
||||
export * from "./reqCreateUnit";
|
||||
export * from "./reqEditPost";
|
||||
export * from "./reqExtractFacts";
|
||||
export * from "./reqGoogleLogin";
|
||||
export * from "./reqHidePlaceContent";
|
||||
export * from "./reqLogin";
|
||||
export * from "./reqPublishLocalContent";
|
||||
export * from "./reqReview";
|
||||
export * from "./reqReviewClientIp";
|
||||
export * from "./reqReviewCompany";
|
||||
export * from "./reqReviewNickname";
|
||||
export * from "./reqRollback";
|
||||
export * from "./reqSignup";
|
||||
export * from "./reqSignupName";
|
||||
@@ -192,6 +224,7 @@ export * from "./reqVerifyPlacePhone";
|
||||
export * from "./reqVerifyPlacePlaceUrl";
|
||||
export * from "./reqVerifyPlaceRegionCode";
|
||||
export * from "./reqVerifyPlaceRoadAddress";
|
||||
export * from "./resBookingRequest";
|
||||
export * from "./resCategorySchema";
|
||||
export * from "./resCategorySchemaCategory";
|
||||
export * from "./resCategorySchemaLabel";
|
||||
@@ -212,6 +245,13 @@ export * from "./resFaqFaq";
|
||||
export * from "./resFaqList";
|
||||
export * from "./resFaqListMsg";
|
||||
export * from "./resFaqMsg";
|
||||
export * from "./resGenerateNow";
|
||||
export * from "./resGenerateNowMsg";
|
||||
export * from "./resGenerateOne";
|
||||
export * from "./resGenerateOneMsg";
|
||||
export * from "./resGenerateOnePost";
|
||||
export * from "./resGenerationHistory";
|
||||
export * from "./resGenerationHistoryMsg";
|
||||
export * from "./resJob";
|
||||
export * from "./resJobJob";
|
||||
export * from "./resJobMsg";
|
||||
@@ -241,6 +281,8 @@ export * from "./resMeMsg";
|
||||
export * from "./resMeName";
|
||||
export * from "./resMediaList";
|
||||
export * from "./resMediaListMsg";
|
||||
export * from "./resMyPosts";
|
||||
export * from "./resMyPostsMsg";
|
||||
export * from "./resMySites";
|
||||
export * from "./resMySitesMsg";
|
||||
export * from "./resPlace";
|
||||
@@ -253,10 +295,12 @@ export * from "./resPlacePlace";
|
||||
export * from "./resPlaceSearch";
|
||||
export * from "./resPlaceSearchMsg";
|
||||
export * from "./resPlaceSearchSource";
|
||||
export * from "./resPublicReviews";
|
||||
export * from "./resPublishLogs";
|
||||
export * from "./resPublishLogsMsg";
|
||||
export * from "./resRefreshToken";
|
||||
export * from "./resRefreshTokenMsg";
|
||||
export * from "./resReview";
|
||||
export * from "./resSeoAudit";
|
||||
export * from "./resSeoAuditMsg";
|
||||
export * from "./resSeoAuditSummary";
|
||||
@@ -308,6 +352,8 @@ export * from "./resVerifyCandidatesSource";
|
||||
export * from "./resWeather";
|
||||
export * from "./resWeatherMsg";
|
||||
export * from "./resWeatherWeather";
|
||||
export * from "./resWebPacketProtocol";
|
||||
export * from "./resWebPacketProtocolMsg";
|
||||
export * from "./searchPlacesPublicParams";
|
||||
export * from "./showcaseItem";
|
||||
export * from "./showcaseItemRegion";
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ListMyPostsParams = {
|
||||
/**
|
||||
* YYYY-MM, 기본값 이번 달
|
||||
*/
|
||||
month?: string | null;
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ListReviewsParams = {
|
||||
place_id: string;
|
||||
};
|
||||
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ListUpcomingPostsParams = {
|
||||
/**
|
||||
* @minimum 1
|
||||
* @maximum 30
|
||||
*/
|
||||
days?: number;
|
||||
};
|
||||
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { PostDataScheduledDate } from "./postDataScheduledDate";
|
||||
import type { PostDataCreatedAt } from "./postDataCreatedAt";
|
||||
import type { PostDataSentAt } from "./postDataSentAt";
|
||||
import type { PostDataApprovedAt } from "./postDataApprovedAt";
|
||||
import type { PostDataPublishedAt } from "./postDataPublishedAt";
|
||||
|
||||
/**
|
||||
* 미니 블로그 글 하나 — 빌더 앱 '이번 달 생성된 글' 목록 카드.
|
||||
*/
|
||||
export interface PostData {
|
||||
post_id: string;
|
||||
body: string;
|
||||
topic_kind: number;
|
||||
status: number;
|
||||
scheduled_date?: PostDataScheduledDate;
|
||||
created_at?: PostDataCreatedAt;
|
||||
sent_at?: PostDataSentAt;
|
||||
approved_at?: PostDataApprovedAt;
|
||||
published_at?: PostDataPublishedAt;
|
||||
build_failed?: boolean;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type PostDataApprovedAt = string | null;
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type PostDataCreatedAt = string | null;
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type PostDataPublishedAt = string | null;
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type PostDataScheduledDate = string | null;
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type PostDataSentAt = string | null;
|
||||
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export interface PublicReview {
|
||||
reviewId: string;
|
||||
body: string;
|
||||
nickname: string;
|
||||
publishedAt: string;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { ReqBookingRequestEmail } from "./reqBookingRequestEmail";
|
||||
import type { ReqBookingRequestStay } from "./reqBookingRequestStay";
|
||||
import type { ReqBookingRequestGuests } from "./reqBookingRequestGuests";
|
||||
import type { ReqBookingRequestMessage } from "./reqBookingRequestMessage";
|
||||
import type { ReqBookingRequestCompany } from "./reqBookingRequestCompany";
|
||||
|
||||
export interface ReqBookingRequest {
|
||||
place_id: string;
|
||||
/**
|
||||
* @minLength 1
|
||||
* @maxLength 40
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* @minLength 6
|
||||
* @maxLength 30
|
||||
*/
|
||||
phone: string;
|
||||
email?: ReqBookingRequestEmail;
|
||||
stay?: ReqBookingRequestStay;
|
||||
guests?: ReqBookingRequestGuests;
|
||||
message?: ReqBookingRequestMessage;
|
||||
consent: boolean;
|
||||
company?: ReqBookingRequestCompany;
|
||||
elapsed_ms?: number;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ReqBookingRequestCompany = string | null;
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ReqBookingRequestEmail = string | null;
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ReqBookingRequestGuests = string | null;
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ReqBookingRequestMessage = string | null;
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ReqBookingRequestStay = string | null;
|
||||
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* 수정하고 그대로 승인 — 로그인 세션 버전(메일 없이 목록에서 바로 고칠 때).
|
||||
*/
|
||||
export interface ReqEditPost {
|
||||
body: string;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { ReqReviewNickname } from "./reqReviewNickname";
|
||||
import type { ReqReviewCompany } from "./reqReviewCompany";
|
||||
import type { ReqReviewClientIp } from "./reqReviewClientIp";
|
||||
|
||||
export interface ReqReview {
|
||||
place_id: string;
|
||||
/**
|
||||
* @minLength 1
|
||||
* @maxLength 1000
|
||||
*/
|
||||
body: string;
|
||||
nickname?: ReqReviewNickname;
|
||||
consent: boolean;
|
||||
company?: ReqReviewCompany;
|
||||
elapsed_ms?: number;
|
||||
client_ip?: ReqReviewClientIp;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ReqReviewClientIp = string | null;
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ReqReviewCompany = string | null;
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ReqReviewNickname = string | null;
|
||||
@@ -9,7 +9,12 @@ import type { PublishAction } from "./publishAction";
|
||||
/**
|
||||
* 발행 상태 전이. ★ 해지는 삭제가 아니라 상태 전이다 —
|
||||
색인된 페이지를 갑자기 404 로 만들면 그 자리를 다시 OTA 가 가져간다.
|
||||
|
||||
★ 기본값을 두지 않는다. SUSPEND 가 기본이던 동안에는 필드 이름을 틀리게 보내도
|
||||
(`{"status": 5}` 처럼) 422 가 아니라 **발행 중지가 실행됐다** — 파괴적인 전이가
|
||||
'아무것도 안 적었을 때' 의 자리에 있었다(실측 2026-09-15).
|
||||
무엇을 할지는 부르는 쪽이 적는다.
|
||||
*/
|
||||
export interface ReqSiteStatus {
|
||||
action?: PublishAction;
|
||||
action: PublishAction;
|
||||
}
|
||||
@@ -19,6 +19,5 @@
|
||||
*/
|
||||
export interface ReqVerifyPlaceByUrl {
|
||||
url?: string;
|
||||
/** 같은 가게를 이미 갖고 있을 때 그 사업장으로 이어붙일지. 기본 true. */
|
||||
reuse_existing?: boolean;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export interface ResBookingRequest {
|
||||
success: boolean;
|
||||
message: string;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { ErrorInfo } from "./errorInfo";
|
||||
import type { ResGenerateNowMsg } from "./resGenerateNowMsg";
|
||||
|
||||
/**
|
||||
* 즉시 생성 결과 — 사장님이 고른 구간(시작~끝) 중 몇 일을 채웠는지.
|
||||
*/
|
||||
export interface ResGenerateNow {
|
||||
result?: ErrorInfo;
|
||||
msg?: ResGenerateNowMsg;
|
||||
requested?: number;
|
||||
created?: number;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ResGenerateNowMsg = string | null;
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { ErrorInfo } from "./errorInfo";
|
||||
import type { ResGenerateOneMsg } from "./resGenerateOneMsg";
|
||||
import type { ResGenerateOnePost } from "./resGenerateOnePost";
|
||||
|
||||
/**
|
||||
* 개별 생성 결과 — 달력에서 빈 날짜 하나를 콕 집어 만들었을 때(2026-09-17, 사장님
|
||||
지시: "개별적으로 새로 만들수있게 해줘"). 실패하면 post 가 없다(그 날짜가 이미 찼거나
|
||||
소재가 바닥났다).
|
||||
*/
|
||||
export interface ResGenerateOne {
|
||||
result?: ErrorInfo;
|
||||
msg?: ResGenerateOneMsg;
|
||||
post?: ResGenerateOnePost;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ResGenerateOneMsg = string | null;
|
||||
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { PostData } from "./postData";
|
||||
|
||||
export type ResGenerateOnePost = PostData | null;
|
||||
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { ErrorInfo } from "./errorInfo";
|
||||
import type { ResGenerationHistoryMsg } from "./resGenerationHistoryMsg";
|
||||
import type { GenerationBatch } from "./generationBatch";
|
||||
|
||||
export interface ResGenerationHistory {
|
||||
result?: ErrorInfo;
|
||||
msg?: ResGenerationHistoryMsg;
|
||||
batches?: GenerationBatch[];
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ResGenerationHistoryMsg = string | null;
|
||||
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { ErrorInfo } from "./errorInfo";
|
||||
import type { ResMyPostsMsg } from "./resMyPostsMsg";
|
||||
import type { PostData } from "./postData";
|
||||
|
||||
export interface ResMyPosts {
|
||||
result?: ErrorInfo;
|
||||
msg?: ResMyPostsMsg;
|
||||
posts?: PostData[];
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ResMyPostsMsg = string | null;
|
||||
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { PublicReview } from "./publicReview";
|
||||
|
||||
export interface ResPublicReviews {
|
||||
items?: PublicReview[];
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export interface ResReview {
|
||||
success: boolean;
|
||||
message: string;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { ErrorInfo } from "./errorInfo";
|
||||
import type { ResWebPacketProtocolMsg } from "./resWebPacketProtocolMsg";
|
||||
|
||||
export interface ResWebPacketProtocol {
|
||||
result?: ErrorInfo;
|
||||
msg?: ResWebPacketProtocolMsg;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ResWebPacketProtocolMsg = string | null;
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,7 +1,8 @@
|
||||
import {QueryClientProvider} from '@tanstack/react-query';
|
||||
import {useEffect, type ReactNode} from 'react';
|
||||
import {Toaster} from 'sonner';
|
||||
import {getAccessToken, me} from '@/api';
|
||||
import {getAccessToken, me, setTokens} from '@/api';
|
||||
import {decodeJwtSubject} from '@/lib/jwt';
|
||||
import {queryClient} from '@/lib/query-client';
|
||||
import {toAuthUser, useAuthStore} from '@/stores/auth';
|
||||
|
||||
@@ -9,6 +10,11 @@ import {toAuthUser, useAuthStore} from '@/stores/auth';
|
||||
* 저장된 액세스 토큰으로 세션을 복구한다.
|
||||
* 실패해도 앱은 뜬다 — 빌더는 로그인 없이도 도는 화면이라, 인증 실패가
|
||||
* 전체를 막으면 데모조차 못 본다. 백엔드가 필요한 화면만 가드가 막는다.
|
||||
*
|
||||
* ★ 미니 블로그 메일의 "수정하기" 링크(`?auto=<그날짜리 토큰>`)도 여기서 받는다 —
|
||||
* `RequireAuth` 가 라우트 단에서 로그인 여부를 판단하므로, 그보다 늦게(예: BlogPostsPage
|
||||
* 안에서) 로그인 처리를 하면 판단이 이미 끝나 `/login` 으로 튕긴 뒤다(2026-09-17 실측:
|
||||
* "메일온거 클릭했더니 로그인하라고 뜨는데?"). 세션 복구보다 먼저 처리해야 한다.
|
||||
*/
|
||||
function useRestoreSession() {
|
||||
const setUser = useAuthStore((s) => s.setUser);
|
||||
@@ -16,6 +22,16 @@ function useRestoreSession() {
|
||||
|
||||
useEffect(() => {
|
||||
let alive = true;
|
||||
|
||||
const autoToken = new URLSearchParams(window.location.search).get('auto');
|
||||
const claims = autoToken ? decodeJwtSubject(autoToken) : null;
|
||||
if (autoToken && claims) {
|
||||
setTokens(autoToken);
|
||||
setUser({userId: claims.user_id, id: claims.id, role: claims.role});
|
||||
finishRestore();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!getAccessToken()) {
|
||||
finishRestore();
|
||||
return;
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* JWT 의 sub 클레임만 읽는다 — 서명 검증은 서버가 이미 했다(이 토큰은 우리 백엔드가 방금
|
||||
* 발급해 URL 에 실어 보낸 것). 여기서는 화면 상태(useAuthStore)를 채우는 데 필요한
|
||||
* user_id/id/role 만 꺼낸다.
|
||||
*/
|
||||
export function decodeJwtSubject(token: string): {user_id: string; id: string; role: number} | null {
|
||||
try {
|
||||
const payloadB64 = token.split('.')[1];
|
||||
const payload = JSON.parse(atob(payloadB64.replace(/-/g, '+').replace(/_/g, '/')));
|
||||
return JSON.parse(payload.sub);
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,723 @@
|
||||
import {useEffect, useMemo, useState} from 'react';
|
||||
import {useNavigate, useSearchParams} from 'react-router';
|
||||
import {Loader2, Pencil, Plus, Save, Send, Sparkles, X} from 'lucide-react';
|
||||
import {
|
||||
useApproveMyPost,
|
||||
useEditMyPost,
|
||||
useGenerateMyPostForDate,
|
||||
useGenerateMyPosts,
|
||||
useGetGenerationHistory,
|
||||
useGetMyPost,
|
||||
useListMyPosts,
|
||||
useListUpcomingPosts,
|
||||
type PostData,
|
||||
} from '@/api';
|
||||
import {AppShell, EmptyState, PageContainer} from '@/components/layout/AppShell';
|
||||
import {Badge} from '@/components/ui/badge';
|
||||
import {Button} from '@/components/ui/button';
|
||||
import {Dialog} from '@/components/ui/dialog';
|
||||
import {notify, notifyApiError} from '@/lib/notify';
|
||||
import {cn} from '@/lib/utils';
|
||||
|
||||
type BadgeVariant = 'default' | 'outline' | 'warning' | 'success';
|
||||
|
||||
// common/enums.py PostStatus 와 값이 같아야 한다. DB 는 숫자만 준다 — 라벨은 화면 몫이다.
|
||||
// 카드(카로셀 · 달력 모달) 안에서만 쓴다 — 달력 칸 자체는 발행완료/발행실패만 보여준다.
|
||||
const STATUS_LABEL: Record<number, {label: string; variant: BadgeVariant}> = {
|
||||
1: {label: '생성됨', variant: 'default'},
|
||||
2: {label: '발송 대기', variant: 'default'},
|
||||
3: {label: '메일 보냄 · 승인 대기', variant: 'warning'},
|
||||
4: {label: '승인됨 · 반영 중', variant: 'success'},
|
||||
5: {label: '게재됨', variant: 'success'},
|
||||
6: {label: '건너뜀', variant: 'outline'},
|
||||
};
|
||||
|
||||
// common/enums.py PostTopicKind.
|
||||
const TOPIC_LABEL: Record<number, string> = {
|
||||
1: '날씨',
|
||||
2: '축제',
|
||||
3: '계절',
|
||||
4: '주변',
|
||||
5: '이용 안내',
|
||||
};
|
||||
|
||||
// crud/post_crud.py PostCRUD._EDITABLE 과 같아야 한다 — 승인·게재·건너뜀은 되돌릴 수 없다.
|
||||
const EDITABLE_STATUSES = new Set([2, 3]);
|
||||
const SENT_STATUS = 3;
|
||||
const PUBLISHED_STATUS = 5;
|
||||
|
||||
const WEEKDAYS = ['일', '월', '화', '수', '목', '금', '토'];
|
||||
const UPCOMING_DAYS = 7;
|
||||
|
||||
function currentMonth(): string {
|
||||
const now = new Date();
|
||||
return `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}`;
|
||||
}
|
||||
|
||||
function monthLabel(month: string): string {
|
||||
const [year, mon] = month.split('-').map(Number);
|
||||
return `${year}년 ${mon}월`;
|
||||
}
|
||||
|
||||
function shiftMonth(month: string, delta: number): string {
|
||||
const [year, mon] = month.split('-').map(Number);
|
||||
const date = new Date(year, mon - 1 + delta, 1);
|
||||
return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}`;
|
||||
}
|
||||
|
||||
type YMD = {year: number; month: number; day: number};
|
||||
|
||||
/** scheduled_date("YYYY-MM-DD")를 파싱한다 — 타임존 없는 순수 날짜라 문자열만 자르면 된다. */
|
||||
function parseScheduled(scheduledDate: string): YMD {
|
||||
const [year, month, day] = scheduledDate.split('-').map(Number);
|
||||
return {year, month, day};
|
||||
}
|
||||
|
||||
function dayOf(scheduledDate: string): number {
|
||||
return parseScheduled(scheduledDate).day;
|
||||
}
|
||||
|
||||
function todayKst(): YMD {
|
||||
const kst = new Date(Date.now() + 9 * 60 * 60 * 1000);
|
||||
return {year: kst.getUTCFullYear(), month: kst.getUTCMonth() + 1, day: kst.getUTCDate()};
|
||||
}
|
||||
|
||||
function addDays(base: YMD, days: number): YMD {
|
||||
const d = new Date(Date.UTC(base.year, base.month - 1, base.day + days));
|
||||
return {year: d.getUTCFullYear(), month: d.getUTCMonth() + 1, day: d.getUTCDate()};
|
||||
}
|
||||
|
||||
function sameDate(a: YMD, b: YMD): boolean {
|
||||
return a.year === b.year && a.month === b.month && a.day === b.day;
|
||||
}
|
||||
|
||||
function isBeforeToday(year: number, month: number, day: number, today: YMD): boolean {
|
||||
if (year !== today.year) return year < today.year;
|
||||
if (month !== today.month) return month < today.month;
|
||||
return day < today.day;
|
||||
}
|
||||
|
||||
function isoDate(year: number, month: number, day: number): string {
|
||||
return `${year}-${String(month).padStart(2, '0')}-${String(day).padStart(2, '0')}`;
|
||||
}
|
||||
|
||||
function todayIso(): string {
|
||||
const t = todayKst();
|
||||
return isoDate(t.year, t.month, t.day);
|
||||
}
|
||||
|
||||
function addDaysIso(iso: string, days: number): string {
|
||||
const [y, m, d] = iso.split('-').map(Number);
|
||||
const next = new Date(Date.UTC(y, m - 1, d + days));
|
||||
return isoDate(next.getUTCFullYear(), next.getUTCMonth() + 1, next.getUTCDate());
|
||||
}
|
||||
|
||||
function lastDayOfMonthIso(month: string): string {
|
||||
const [year, mon] = month.split('-').map(Number);
|
||||
const lastDay = new Date(Date.UTC(year, mon, 0)).getUTCDate();
|
||||
return isoDate(year, mon, lastDay);
|
||||
}
|
||||
|
||||
/** 카드에 다는 날짜 표시 — 날짜는 전부 쓰고, 오늘·내일만 chip 을 더 단다(사장님 지시). */
|
||||
function dateLabel(scheduledDate: string): {text: string; chip: '오늘' | '내일' | null} {
|
||||
const d = parseScheduled(scheduledDate);
|
||||
const today = todayKst();
|
||||
const text = `${d.month}월 ${d.day}일`;
|
||||
if (sameDate(d, today)) return {text, chip: '오늘'};
|
||||
if (sameDate(d, addDays(today, 1))) return {text, chip: '내일'};
|
||||
return {text, chip: null};
|
||||
}
|
||||
|
||||
/**
|
||||
* 달력 칸에 다는 배지. 검수 대기(REVIEWED)처럼 아직 메일도 안 나간 상태는 아무것도
|
||||
* 보여주지 않는다(사장님 지시: "발행전인건 표시하지 말고") — 메일 발송 여부는 그 자체가
|
||||
* 크론잡이 실제로 돌았다는 확인이라 별도로 보여준다(사장님 지시: "완료되었는지 여부도
|
||||
* 출력해야할꺼같아").
|
||||
*/
|
||||
function publishBadge(post: PostData): {label: string; className: string} | null {
|
||||
if (post.status === PUBLISHED_STATUS) return {label: '발행완료', className: 'bg-success/15 text-success'};
|
||||
if (post.build_failed) return {label: '발행실패', className: 'bg-destructive/10 text-destructive'};
|
||||
if (post.status === SENT_STATUS) return {label: '발송완료', className: 'bg-primary/10 text-primary'};
|
||||
return null;
|
||||
}
|
||||
|
||||
/** 수정 폼 — 저장하면 그대로 승인된다(메일의 "수정해서 올리기"와 같은 규칙). */
|
||||
function PostEditor({placeId, post, onDone}: {placeId: string; post: PostData; onDone: () => void}) {
|
||||
const [body, setBody] = useState(post.body);
|
||||
const editMutation = useEditMyPost();
|
||||
|
||||
const handleSave = async () => {
|
||||
try {
|
||||
const res = await editMutation.mutateAsync({placeId, postId: post.post_id, data: {body}});
|
||||
if (!res.result?.success) {
|
||||
notify.error(res.msg || '저장하지 못했습니다. 요금·시간·전화번호처럼 확인되지 않은 내용은 빼 주세요.');
|
||||
return;
|
||||
}
|
||||
notify.success('저장하고 승인했습니다. 사이트에 반영되기까지 몇 분 걸립니다.');
|
||||
onDone();
|
||||
} catch (error) {
|
||||
notifyApiError(error, '저장하지 못했습니다.');
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="mt-3 space-y-2">
|
||||
<textarea
|
||||
value={body}
|
||||
onChange={(event) => setBody(event.target.value)}
|
||||
rows={5}
|
||||
className="w-full rounded-md border border-border bg-muted/50 px-3 py-2 text-sm text-foreground outline-none transition-colors focus:border-ring focus:bg-card focus:ring-1 focus:ring-ring"
|
||||
/>
|
||||
<div className="flex items-center gap-2">
|
||||
<Button size="sm" variant="primary" isLoading={editMutation.isPending} onClick={handleSave}>
|
||||
<Save />
|
||||
저장하고 승인
|
||||
</Button>
|
||||
<Button size="sm" variant="ghost" onClick={onDone} disabled={editMutation.isPending}>
|
||||
<X />
|
||||
취소
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function PostCard({placeId, post, onChanged}: {placeId: string; post: PostData; onChanged: () => void}) {
|
||||
const [isEditing, setIsEditing] = useState(false);
|
||||
const status = STATUS_LABEL[post.status] ?? STATUS_LABEL[1];
|
||||
const editable = EDITABLE_STATUSES.has(post.status);
|
||||
const approveMutation = useApproveMyPost();
|
||||
const {text, chip} = post.scheduled_date ? dateLabel(post.scheduled_date) : {text: '', chip: null};
|
||||
|
||||
const handlePublish = async () => {
|
||||
try {
|
||||
const res = await approveMutation.mutateAsync({placeId, postId: post.post_id});
|
||||
if (!res.result?.success) {
|
||||
notify.error(res.msg || '발행하지 못했습니다.');
|
||||
return;
|
||||
}
|
||||
notify.success('발행했습니다. 사이트에 반영되기까지 몇 분 걸립니다.');
|
||||
onChanged();
|
||||
} catch (error) {
|
||||
notifyApiError(error, '발행하지 못했습니다.');
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex h-full flex-col rounded-lg border border-border bg-card p-3.5 shadow-lg">
|
||||
<div className="flex items-center justify-between gap-2">
|
||||
<div className="flex items-center gap-1.5">
|
||||
{chip && (
|
||||
<span className="rounded-full bg-primary px-2 py-0.5 text-[11px] font-bold text-primary-foreground">
|
||||
{chip}
|
||||
</span>
|
||||
)}
|
||||
{text && <span className="text-xs font-medium text-muted-foreground">{text}</span>}
|
||||
</div>
|
||||
<Badge variant={status.variant}>{status.label}</Badge>
|
||||
</div>
|
||||
<p className="mt-1 text-xs text-muted-foreground">{TOPIC_LABEL[post.topic_kind] ?? '기타'}</p>
|
||||
{!isEditing && <p className="mt-2 line-clamp-6 flex-1 text-sm leading-relaxed">{post.body}</p>}
|
||||
{isEditing && (
|
||||
<PostEditor
|
||||
placeId={placeId}
|
||||
post={post}
|
||||
onDone={() => {
|
||||
setIsEditing(false);
|
||||
onChanged();
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{editable && !isEditing && (
|
||||
<div className="mt-3 flex items-center gap-1.5 border-t border-border pt-3">
|
||||
<Button size="sm" variant="ghost" className="flex-1" onClick={() => setIsEditing(true)}>
|
||||
<Pencil />
|
||||
수정
|
||||
</Button>
|
||||
<Button size="sm" variant="primary" className="flex-1" isLoading={approveMutation.isPending} onClick={handlePublish}>
|
||||
<Send />
|
||||
바로 발행
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** 카로셀용 미리보기 카드 — 누르면 모달이 뜬다. 수정·발행은 모달 안에서만 한다. */
|
||||
function PostPreviewCard({post, onClick}: {post: PostData; onClick: () => void}) {
|
||||
const status = STATUS_LABEL[post.status] ?? STATUS_LABEL[1];
|
||||
const {text, chip} = post.scheduled_date ? dateLabel(post.scheduled_date) : {text: '', chip: null};
|
||||
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={onClick}
|
||||
className="flex h-full w-full flex-col rounded-lg border border-border bg-card p-3.5 text-left shadow-lg transition-colors hover:bg-muted"
|
||||
>
|
||||
<div className="flex items-center justify-between gap-2">
|
||||
<div className="flex items-center gap-1.5">
|
||||
{chip && (
|
||||
<span className="rounded-full bg-primary px-2 py-0.5 text-[11px] font-bold text-primary-foreground">
|
||||
{chip}
|
||||
</span>
|
||||
)}
|
||||
{text && <span className="text-xs font-medium text-muted-foreground">{text}</span>}
|
||||
</div>
|
||||
<Badge variant={status.variant}>{status.label}</Badge>
|
||||
</div>
|
||||
<p className="mt-1 text-xs text-muted-foreground">{TOPIC_LABEL[post.topic_kind] ?? '기타'}</p>
|
||||
<p className="mt-2 line-clamp-6 flex-1 text-sm leading-relaxed">{post.body}</p>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 겹쳐 쌓은 글 카드 카로셀 — 오늘부터 일주일치만(당장 챙길 것). 가로로 스크롤하면 카드가
|
||||
* 하나씩 앞으로 나온다. 마우스를 올리면 그 카드가 가려지지 않고 맨 앞으로 온다.
|
||||
* ★ 카드를 눌러도 그 자리에서 고치지 않는다 — 달력 칸과 똑같이 모달을 연다(사장님 지시:
|
||||
* "카드클릭해도 모달나와서 수정가능하게 해야지").
|
||||
*/
|
||||
function PostCarousel({posts, onSelectPost}: {posts: PostData[]; onSelectPost: (post: PostData) => void}) {
|
||||
const [hoveredId, setHoveredId] = useState<string | null>(null);
|
||||
|
||||
return (
|
||||
<div className="flex snap-x snap-mandatory overflow-x-auto px-1 pt-1 pb-4">
|
||||
{posts.map((post, index) => {
|
||||
const hovered = hoveredId === post.post_id;
|
||||
return (
|
||||
<div
|
||||
key={post.post_id}
|
||||
onMouseEnter={() => setHoveredId(post.post_id)}
|
||||
onMouseLeave={() => setHoveredId(null)}
|
||||
className={cn(
|
||||
'w-72 shrink-0 snap-start transition-transform duration-150',
|
||||
index > 0 && '-ml-10',
|
||||
hovered && 'scale-105',
|
||||
)}
|
||||
style={{zIndex: hovered ? 999 : posts.length - index}}
|
||||
>
|
||||
<PostPreviewCard post={post} onClick={() => onSelectPost(post)} />
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 달력 한 장. **글이 0건이어도 항상 뜬다** — 그날그날 뭐가 있는지 훑어보는 게 목적이라
|
||||
* 목록이 비었다고 화면 자체가 사라지면 "이 달은 아무것도 없다"는 걸 확인할 방법이 없다.
|
||||
* ★ 여기서는 발행완료/발행실패만 표시한다(사장님 지시) — 칸을 누르면 모달로 전체 내용을 본다.
|
||||
* ★ 빈 날짜(오늘 이후)를 누르면 그 날짜 하나만 콕 집어 생성한다(사장님 지시: "개별적으로
|
||||
* 새로 만들수있게 해줘"). 지난 날짜는 이제 와서 만들 이유가 없어 클릭을 막는다.
|
||||
*/
|
||||
function Calendar({month, postsByDay, onSelectPost, onGenerateDay, generatingDay}: {
|
||||
month: string;
|
||||
postsByDay: Map<number, PostData>;
|
||||
onSelectPost: (post: PostData) => void;
|
||||
onGenerateDay: (date: string) => void;
|
||||
generatingDay: string | null;
|
||||
}) {
|
||||
const [year, mon] = month.split('-').map(Number);
|
||||
const daysInMonth = new Date(Date.UTC(year, mon, 0)).getUTCDate();
|
||||
const firstWeekday = new Date(Date.UTC(year, mon - 1, 1)).getUTCDay();
|
||||
const today = todayKst();
|
||||
const isCurrentMonth = today.year === year && today.month === mon;
|
||||
|
||||
const cells: (number | null)[] = [
|
||||
...Array.from({length: firstWeekday}, () => null),
|
||||
...Array.from({length: daysInMonth}, (_, i) => i + 1),
|
||||
];
|
||||
|
||||
return (
|
||||
<div className="overflow-hidden rounded-lg border border-border">
|
||||
<div className="grid grid-cols-7 border-b border-border bg-muted/40">
|
||||
{WEEKDAYS.map((label) => (
|
||||
<div key={label} className="py-2 text-center text-xs font-medium text-muted-foreground">
|
||||
{label}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
<div className="grid grid-cols-7">
|
||||
{cells.map((day, index) => {
|
||||
if (day === null) {
|
||||
return <div key={`blank-${index}`} className="aspect-square border-b border-r border-border/60 bg-muted/10" />;
|
||||
}
|
||||
const post = postsByDay.get(day);
|
||||
const badge = post ? publishBadge(post) : null;
|
||||
const isToday = isCurrentMonth && today.day === day;
|
||||
const isPast = isBeforeToday(year, mon, day, today);
|
||||
const cellDate = isoDate(year, mon, day);
|
||||
const isGenerating = generatingDay === cellDate;
|
||||
const clickable = !!post || (!isPast && !isGenerating);
|
||||
const handleClick = post
|
||||
? () => onSelectPost(post)
|
||||
: (!isPast && !isGenerating ? () => onGenerateDay(cellDate) : undefined);
|
||||
return (
|
||||
<div
|
||||
key={day}
|
||||
role={clickable ? 'button' : undefined}
|
||||
tabIndex={clickable ? 0 : undefined}
|
||||
onClick={handleClick}
|
||||
onKeyDown={handleClick ? (event) => event.key === 'Enter' && handleClick() : undefined}
|
||||
className={cn(
|
||||
'group flex aspect-square flex-col items-start gap-1 border-b border-r border-border/60 p-1.5 text-left sm:p-2',
|
||||
clickable && 'cursor-pointer transition-colors hover:bg-muted',
|
||||
isGenerating && 'cursor-wait',
|
||||
)}
|
||||
>
|
||||
<span
|
||||
className={cn(
|
||||
'flex size-5 items-center justify-center rounded-full text-xs tabular-nums',
|
||||
isToday ? 'bg-primary text-primary-foreground font-semibold' : 'text-foreground',
|
||||
)}
|
||||
>
|
||||
{day}
|
||||
</span>
|
||||
{post && (
|
||||
<p className="line-clamp-2 w-full text-[10px] leading-tight break-all text-muted-foreground">
|
||||
{post.body.slice(0, 20)}
|
||||
</p>
|
||||
)}
|
||||
{badge && (
|
||||
<span className={cn('mt-auto rounded px-1 py-0.5 text-[9px] font-medium', badge.className)}>
|
||||
{badge.label}
|
||||
</span>
|
||||
)}
|
||||
{!post && !isPast && (
|
||||
<span
|
||||
className={cn(
|
||||
'mt-auto flex items-center gap-0.5 text-[10px] text-muted-foreground transition-opacity',
|
||||
isGenerating ? 'opacity-100' : 'opacity-0 group-hover:opacity-100',
|
||||
)}
|
||||
>
|
||||
{isGenerating ? <Loader2 className="size-3 animate-spin" /> : <Plus className="size-3" />}
|
||||
{isGenerating ? '만드는 중' : '생성'}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
type Tab = 'main' | 'history';
|
||||
const TAB_LABEL: Record<Tab, string> = {main: '블로그', history: '생성 이력'};
|
||||
|
||||
/** 생성 이력 — 언제 몇 건 만들었는지(사장님 지시: "생성이력도 있어야해 몇개 생성했는지"). */
|
||||
function GenerationHistoryList({placeId}: {placeId: string}) {
|
||||
const {data, isLoading} = useGetGenerationHistory(placeId);
|
||||
const batches = data?.batches ?? [];
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
<div className="flex items-center justify-center py-16 text-muted-foreground">
|
||||
<Loader2 className="size-5 animate-spin" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (batches.length === 0) {
|
||||
return <p className="text-sm text-muted-foreground">아직 생성한 적이 없습니다.</p>;
|
||||
}
|
||||
|
||||
return (
|
||||
<ul className="divide-y divide-border rounded-lg border border-border">
|
||||
{batches.map((batch) => {
|
||||
const at = new Date(batch.created_at);
|
||||
const label = Number.isNaN(at.getTime())
|
||||
? batch.created_at
|
||||
: at.toLocaleString('ko-KR', {month: 'long', day: 'numeric', hour: '2-digit', minute: '2-digit'});
|
||||
return (
|
||||
<li key={batch.created_at} className="flex items-center justify-between px-4 py-3 text-sm">
|
||||
<span className="text-muted-foreground">{label}</span>
|
||||
<span className="font-semibold tabular-nums">{batch.count}건</span>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 이번 달(또는 고른 달) 생성된 미니 블로그 글. 기획: docs/MINI_BLOG.md
|
||||
*
|
||||
* ★ 사이트 하나를 고르고 들어온다 — `/sites` 카드의 관리 메뉴가 `?placeId=` 를 채운다.
|
||||
* 여러 사이트를 가진 사장님도 있어 전역 메뉴 하나로는 어느 사이트인지 알 수 없다.
|
||||
* ★ 화면이 둘로 나뉜다 — 위 카로셀은 "당장 챙길 것"(오늘부터 일주일)을 편집·발행하는 곳,
|
||||
* 아래 달력은 한 달 전체를 훑어보는 곳(칸을 누르면 모달로 본다).
|
||||
*/
|
||||
export function BlogPostsPage() {
|
||||
const [searchParams, setSearchParams] = useSearchParams();
|
||||
const navigate = useNavigate();
|
||||
const placeId = searchParams.get('placeId') ?? '';
|
||||
|
||||
// 메일 "수정하기" 링크 — 그날짜리 자동 로그인(auto) 은 provider.tsx 의 세션 복구에서
|
||||
// 이미 처리됐다(라우트 가드보다 먼저 처리해야 해서 여기가 아니라 거기다). 여기서는
|
||||
// postId 로 그 글을 찾아 모달만 연다.
|
||||
const linkedPostId = searchParams.get('postId');
|
||||
|
||||
useEffect(() => {
|
||||
if (!searchParams.has('auto')) return;
|
||||
const next = new URLSearchParams(searchParams);
|
||||
next.delete('auto');
|
||||
setSearchParams(next, {replace: true});
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
const {data: linkedPostData} = useGetMyPost(placeId, linkedPostId ?? '', {
|
||||
query: {enabled: !!placeId && !!linkedPostId},
|
||||
});
|
||||
|
||||
// 과거 달·너무 먼 미래는 볼 이유가 없다 — 이번 달부터 1년 뒤까지만 넘겨볼 수 있다.
|
||||
const minMonth = currentMonth();
|
||||
const maxMonth = shiftMonth(minMonth, 12);
|
||||
const [month, setMonth] = useState(minMonth);
|
||||
const [modalPost, setModalPost] = useState<PostData | null>(null);
|
||||
const [tab, setTab] = useState<Tab>('main');
|
||||
|
||||
useEffect(() => {
|
||||
const linkedPost = linkedPostData?.posts?.[0];
|
||||
if (!linkedPost) return;
|
||||
setModalPost(linkedPost);
|
||||
const next = new URLSearchParams(searchParams);
|
||||
next.delete('postId');
|
||||
setSearchParams(next, {replace: true});
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [linkedPostData]);
|
||||
|
||||
const {data, isLoading, isError, error, refetch} = useListMyPosts(placeId, {month});
|
||||
const posts = useMemo(() => data?.posts ?? [], [data]);
|
||||
const postsByDay = useMemo(() => {
|
||||
const map = new Map<number, PostData>();
|
||||
for (const post of posts) {
|
||||
if (!post.scheduled_date) continue;
|
||||
map.set(dayOf(post.scheduled_date), post);
|
||||
}
|
||||
return map;
|
||||
}, [posts]);
|
||||
|
||||
const {data: upcomingData, refetch: refetchUpcoming} = useListUpcomingPosts(placeId, {days: UPCOMING_DAYS});
|
||||
const upcomingPosts = useMemo(() => upcomingData?.posts ?? [], [upcomingData]);
|
||||
|
||||
const generateMutation = useGenerateMyPosts();
|
||||
const generateOneMutation = useGenerateMyPostForDate();
|
||||
const generatingDay = generateOneMutation.isPending ? (generateOneMutation.variables?.params.date ?? null) : null;
|
||||
|
||||
const [rangeDialogOpen, setRangeDialogOpen] = useState(false);
|
||||
const [rangeStart, setRangeStart] = useState(todayIso());
|
||||
const [rangeEnd, setRangeEnd] = useState(addDaysIso(todayIso(), 29));
|
||||
|
||||
const refetchAll = () => {
|
||||
void refetch();
|
||||
void refetchUpcoming();
|
||||
};
|
||||
|
||||
const handleGenerate = async () => {
|
||||
try {
|
||||
const res = await generateMutation.mutateAsync({placeId, params: {start: rangeStart, end: rangeEnd}});
|
||||
if (!res.result?.success) {
|
||||
notify.error(res.msg || '생성하지 못했습니다.');
|
||||
return;
|
||||
}
|
||||
notify.success(res.msg ?? `${res.created}건 만들었습니다.`);
|
||||
setRangeDialogOpen(false);
|
||||
refetchAll();
|
||||
} catch (generateError) {
|
||||
notifyApiError(generateError, '생성하지 못했습니다.');
|
||||
}
|
||||
};
|
||||
|
||||
const handleGenerateDay = async (date: string) => {
|
||||
try {
|
||||
const res = await generateOneMutation.mutateAsync({placeId, params: {date}});
|
||||
if (!res.result?.success) {
|
||||
notify.error(res.msg || '이 날짜엔 만들지 못했습니다.');
|
||||
return;
|
||||
}
|
||||
notify.success(res.msg ?? '만들었습니다.');
|
||||
refetchAll();
|
||||
if (res.post) setModalPost(res.post);
|
||||
} catch (generateOneError) {
|
||||
notifyApiError(generateOneError, '만들지 못했습니다.');
|
||||
}
|
||||
};
|
||||
|
||||
const generateButton = (
|
||||
<Button size="sm" variant="primary" onClick={() => setRangeDialogOpen(true)}>
|
||||
<Sparkles />
|
||||
지금 생성하기
|
||||
</Button>
|
||||
);
|
||||
|
||||
const maxGenerateDate = lastDayOfMonthIso(maxMonth);
|
||||
|
||||
if (!placeId) {
|
||||
return (
|
||||
<AppShell>
|
||||
<PageContainer title="블로그 글" description="어느 사이트의 글을 볼지 먼저 골라 주세요.">
|
||||
<EmptyState
|
||||
title="사이트를 먼저 선택하세요"
|
||||
description="내 사이트 목록에서 사이트를 고르면 그 사이트의 글이 보입니다."
|
||||
action={
|
||||
<Button size="sm" onClick={() => navigate('/sites')}>
|
||||
내 사이트로
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
</PageContainer>
|
||||
</AppShell>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<AppShell>
|
||||
<PageContainer title="블로그 글" description="AI 가 만든 글이 매일 조금씩 쌓입니다. 마음에 안 들면 고쳐서 올리세요." actions={generateButton}>
|
||||
{/* 탭은 생성 이력만 따로 뺀다 — 카로셀·달력은 계속 같이 보인다(사장님 지시: "탭으로
|
||||
나누지 말고 달력 위에 이번 주 카드들 보여주라고 했지"). */}
|
||||
<div className="mb-4 flex w-fit items-center gap-0.5 rounded-md border border-border p-0.5">
|
||||
{(Object.keys(TAB_LABEL) as Tab[]).map((key) => (
|
||||
<button
|
||||
key={key}
|
||||
type="button"
|
||||
aria-pressed={tab === key}
|
||||
onClick={() => setTab(key)}
|
||||
className={cn(
|
||||
'h-8 cursor-pointer rounded px-3 text-xs font-medium transition-colors',
|
||||
tab === key ? 'bg-muted text-foreground' : 'text-muted-foreground hover:text-foreground',
|
||||
)}
|
||||
>
|
||||
{TAB_LABEL[key]}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{tab === 'main' && (
|
||||
<>
|
||||
{upcomingPosts.length > 0 ? (
|
||||
<PostCarousel posts={upcomingPosts} onSelectPost={setModalPost} />
|
||||
) : (
|
||||
<p className="mb-3 text-sm text-muted-foreground">앞으로 일주일 안에 예정된 글이 없습니다.</p>
|
||||
)}
|
||||
|
||||
{/* 이전 달 · 월 · 다음 달 — 달력 바로 위(사장님 지시). */}
|
||||
<div className="mt-4 mb-3 flex items-center gap-1">
|
||||
<Button size="sm" variant="ghost" onClick={() => setMonth((m) => (m <= minMonth ? m : shiftMonth(m, -1)))}>
|
||||
이전 달
|
||||
</Button>
|
||||
<span className="px-2 text-sm font-medium tabular-nums">{monthLabel(month)}</span>
|
||||
<Button size="sm" variant="ghost" onClick={() => setMonth((m) => (m >= maxMonth ? m : shiftMonth(m, 1)))}>
|
||||
다음 달
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
{isLoading && (
|
||||
<div className="flex items-center justify-center py-20 text-muted-foreground">
|
||||
<Loader2 className="size-5 animate-spin" />
|
||||
</div>
|
||||
)}
|
||||
|
||||
{isError && (
|
||||
<EmptyState
|
||||
title="글을 불러오지 못했습니다"
|
||||
description={(error as Error)?.message ?? '잠시 후 다시 시도해 주세요.'}
|
||||
action={
|
||||
<Button size="sm" onClick={() => refetch()}>
|
||||
다시 시도
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
|
||||
{!isLoading && !isError && (
|
||||
<>
|
||||
{posts.length === 0 && (
|
||||
<p className="mb-3 text-sm text-muted-foreground">
|
||||
이 달엔 생성된 글이 없습니다. 새벽마다(04:10) 채워지거나, 지금 생성하기를 눌러 바로 만들 수 있습니다.
|
||||
</p>
|
||||
)}
|
||||
|
||||
<Calendar
|
||||
month={month}
|
||||
postsByDay={postsByDay}
|
||||
onSelectPost={setModalPost}
|
||||
onGenerateDay={handleGenerateDay}
|
||||
generatingDay={generatingDay}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
||||
{tab === 'history' && <GenerationHistoryList placeId={placeId} />}
|
||||
</PageContainer>
|
||||
|
||||
<Dialog
|
||||
open={!!modalPost}
|
||||
onClose={() => setModalPost(null)}
|
||||
title={modalPost?.scheduled_date ? `${dateLabel(modalPost.scheduled_date).text} 글` : '글'}
|
||||
>
|
||||
{modalPost && (
|
||||
<PostCard
|
||||
placeId={placeId}
|
||||
post={modalPost}
|
||||
onChanged={() => {
|
||||
refetchAll();
|
||||
setModalPost(null);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</Dialog>
|
||||
|
||||
<Dialog
|
||||
open={rangeDialogOpen}
|
||||
onClose={() => setRangeDialogOpen(false)}
|
||||
title="지금 생성하기"
|
||||
description="채울 구간을 고르세요. 이미 글이 있는 날짜는 건너뛰고, 새로 쓸 소재가 떨어지면 거기서 멈춥니다."
|
||||
footer={
|
||||
<div className="flex justify-end gap-2">
|
||||
<Button size="sm" variant="ghost" onClick={() => setRangeDialogOpen(false)} disabled={generateMutation.isPending}>
|
||||
취소
|
||||
</Button>
|
||||
<Button size="sm" variant="primary" isLoading={generateMutation.isPending} onClick={handleGenerate}>
|
||||
<Sparkles />
|
||||
생성
|
||||
</Button>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<div className="flex items-center gap-2">
|
||||
<label className="flex flex-1 flex-col gap-1 text-xs text-muted-foreground">
|
||||
시작일
|
||||
<input
|
||||
type="date"
|
||||
value={rangeStart}
|
||||
min={todayIso()}
|
||||
max={rangeEnd || maxGenerateDate}
|
||||
onChange={(event) => setRangeStart(event.target.value)}
|
||||
className="rounded-md border border-border bg-muted/50 px-2 py-1.5 text-sm text-foreground outline-none focus:border-ring focus:bg-card focus:ring-1 focus:ring-ring"
|
||||
/>
|
||||
</label>
|
||||
<span className="mt-5 text-muted-foreground">~</span>
|
||||
<label className="flex flex-1 flex-col gap-1 text-xs text-muted-foreground">
|
||||
끝일
|
||||
<input
|
||||
type="date"
|
||||
value={rangeEnd}
|
||||
min={rangeStart || todayIso()}
|
||||
max={maxGenerateDate}
|
||||
onChange={(event) => setRangeEnd(event.target.value)}
|
||||
className="rounded-md border border-border bg-muted/50 px-2 py-1.5 text-sm text-foreground outline-none focus:border-ring focus:bg-card focus:ring-1 focus:ring-ring"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
</Dialog>
|
||||
</AppShell>
|
||||
);
|
||||
}
|
||||
|
||||
// 라우트 모듈은 default export 를 요구한다(routes.ts 가 이 파일을 가리킨다).
|
||||
export default BlogPostsPage;
|
||||
@@ -2,10 +2,12 @@ import {useMemo, useState} from 'react';
|
||||
import {Link, useNavigate} from 'react-router';
|
||||
import {
|
||||
Building2,
|
||||
CalendarClock,
|
||||
Coffee,
|
||||
ExternalLink,
|
||||
Loader2,
|
||||
MoreHorizontal,
|
||||
Newspaper,
|
||||
Pencil,
|
||||
Plus,
|
||||
Search,
|
||||
@@ -415,7 +417,7 @@ export function SitesPage() {
|
||||
<Button
|
||||
size="icon"
|
||||
variant="ghost"
|
||||
aria-label="더보기"
|
||||
aria-label="관리 메뉴"
|
||||
isLoading={busyId === row.place_id}
|
||||
onClick={() => setMenuId(menuId === row.place_id ? null : row.place_id)}
|
||||
>
|
||||
@@ -426,19 +428,59 @@ export function SitesPage() {
|
||||
|
||||
{menuId === row.place_id && (
|
||||
<>
|
||||
{/* 바깥을 눌러 닫는다. 메뉴 하나짜리라 팝오버 라이브러리를 들이지 않는다. */}
|
||||
{/* 바깥을 눌러 닫는다. 메뉴가 몇 줄 안 돼 팝오버 라이브러리를 들이지 않는다. */}
|
||||
<button
|
||||
type="button"
|
||||
aria-label="닫기"
|
||||
className="fixed inset-0 z-10 cursor-default"
|
||||
onClick={() => setMenuId(null)}
|
||||
/>
|
||||
<div className="absolute right-3.5 bottom-12 z-20 w-44 rounded-md border border-border bg-card py-1 shadow-md">
|
||||
<div className="absolute right-3.5 bottom-12 z-20 w-52 rounded-md border border-border bg-card py-1 shadow-md">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
setMenuId(null);
|
||||
navigate(editHref);
|
||||
}}
|
||||
className="flex w-full cursor-pointer items-center gap-2 px-3 py-2 text-left text-xs transition-colors hover:bg-muted"
|
||||
>
|
||||
<Pencil className="size-3.5" />
|
||||
디자인·컨텐츠 관리
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
setMenuId(null);
|
||||
navigate(`/blog?placeId=${row.place_id}`);
|
||||
}}
|
||||
className="flex w-full cursor-pointer items-center gap-2 px-3 py-2 text-left text-xs transition-colors hover:bg-muted"
|
||||
>
|
||||
<Newspaper className="size-3.5" />
|
||||
미니블로그 관리
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
setMenuId(null);
|
||||
// ★ 예약 요청은 DB 에 안 남는다(2026-09-16 대표 지시, booking_request.py) —
|
||||
// 메일로만 가고 우리 쪽엔 로그 한 줄만 남는다. 목록 화면을 만들려면
|
||||
// 그 결정부터 뒤집어야 한다 — 지금은 안내만 한다.
|
||||
notify.info(
|
||||
'예약 요청은 메일로만 전달됩니다',
|
||||
'연락처를 따로 저장하지 않기로 했습니다(2026-09-16). 목록이 필요하면 먼저 이 방침을 바꿔야 합니다.',
|
||||
);
|
||||
}}
|
||||
className="flex w-full cursor-pointer items-center gap-2 px-3 py-2 text-left text-xs transition-colors hover:bg-muted"
|
||||
>
|
||||
<CalendarClock className="size-3.5" />
|
||||
예약요청 관리
|
||||
</button>
|
||||
<div className="my-1 border-t border-border" />
|
||||
<button
|
||||
type="button"
|
||||
disabled={row.status !== SiteStatus.PUBLISHED}
|
||||
onClick={() => handleUnpublish(row)}
|
||||
className="w-full cursor-pointer px-3 py-2 text-left text-xs transition-colors hover:bg-muted disabled:cursor-not-allowed disabled:opacity-40"
|
||||
className="w-full cursor-pointer px-3 py-2 text-left text-xs text-destructive transition-colors hover:bg-muted disabled:cursor-not-allowed disabled:opacity-40"
|
||||
>
|
||||
발행 내리기
|
||||
</button>
|
||||
|
||||
@@ -25,6 +25,9 @@ export default [
|
||||
layout('components/layout/RequireAuthLayout.tsx', [
|
||||
route('sites', 'pages/SitesPage.tsx'),
|
||||
route('account', 'pages/AccountPage.tsx'),
|
||||
// "내 사이트" 카드의 관리 메뉴에서 온다(?placeId= 로 어느 사이트인지 받는다) —
|
||||
// 사장님 여럿이 사이트 여럿을 가질 수 있어 전역 메뉴 하나로는 못 고른다.
|
||||
route('blog', 'pages/BlogPostsPage.tsx'),
|
||||
]),
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user