[feat] solution/frontend,docs: 랜딩 · 요금 · 쇼케이스 — 로그인 전 화면이 없었다
`/` 가 곧장 위저드로 튀어서 이 제품이 무엇을 파는 물건인지 말할 자리가 없었다. 처음 온 사람이 업종 선택 화면부터 만난다. - router: `/` 는 비로그인 랜딩 · 로그인 /sites. /pricing · /showcase 추가 - MarketingShell: 사이드바 없는 문서형 껍데기. AppShell(작업 화면)과 나눴다 - 랜딩 상단은 상호명 한 칸. 문구는 SEO·AEO 축으로만 쓴다 — '쉽게·빠르게'로 말하면 홈페이지 빌더와 같은 자리에서 비교당한다(PRODUCT 1절) - ShowcaseGrid: 발행 썸네일을 그대로 건다. 예시 데이터로 채우지 않고, 없으면 섹션을 감춘다. ★ 생성 클라이언트를 안 쓴다 — 토큰 길목을 지나면 비로그인에서 못 부른다 - 요금은 플랜 하나(70만원/월) + 월 산출물. 비교표를 만들지 않는다 tsc·eslint·vite build 통과
This commit is contained in:
1 parent
a61f9724ea
commit
af391b4c56
9 files changed
+710
-8
No files matched your search
@@ -0,0 +1,102 @@
|
||||
import {useEffect, useState} from 'react';
|
||||
import {Building2, Coffee, ImageOff, Stethoscope, UtensilsCrossed} from 'lucide-react';
|
||||
import {PlaceCategory} from '@o2o/shared';
|
||||
import {fetchShowcase, type ShowcaseItem} from './showcaseApi';
|
||||
|
||||
const CATEGORY_ICON: Record<number, typeof Building2> = {
|
||||
[PlaceCategory.LODGING]: Building2,
|
||||
[PlaceCategory.CAFE]: Coffee,
|
||||
[PlaceCategory.RESTAURANT]: UtensilsCrossed,
|
||||
[PlaceCategory.CLINIC]: Stethoscope,
|
||||
};
|
||||
|
||||
const CATEGORY_LABEL: Record<number, string> = {
|
||||
[PlaceCategory.LODGING]: '숙박',
|
||||
[PlaceCategory.CAFE]: '카페',
|
||||
[PlaceCategory.RESTAURANT]: '음식점',
|
||||
[PlaceCategory.CLINIC]: '피부과 · 성형외과',
|
||||
};
|
||||
|
||||
/** 발행 사이트 주소는 루트 상대경로로 온다(`/s/<slug>`). 발행 호스트는 번들에 구워진 값이다. */
|
||||
const PUBLISH_HOST = import.meta.env.VITE_PUBLISH_HOST ?? window.location.host;
|
||||
|
||||
function siteHref(url: string): string {
|
||||
return `${window.location.protocol}//${PUBLISH_HOST}${url}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* 실제로 발행된 사이트를 그대로 건다.
|
||||
*
|
||||
* ★ 예시 데이터로 채우지 않는다. 이 섹션이 파는 건 "진짜로 나갔다"는 사실 하나이고,
|
||||
* 가짜를 걸면 그 자리에서 가치가 0 이 된다. 발행본이 없으면 섹션을 통째로 감춘다.
|
||||
*/
|
||||
export function ShowcaseGrid({limit = 6}: {limit?: number}) {
|
||||
const [items, setItems] = useState<ShowcaseItem[] | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
let alive = true;
|
||||
fetchShowcase(limit)
|
||||
.then((rows) => alive && setItems(rows))
|
||||
.catch(() => alive && setItems([]));
|
||||
return () => {
|
||||
alive = false;
|
||||
};
|
||||
}, [limit]);
|
||||
|
||||
if (items !== null && items.length === 0) return null;
|
||||
|
||||
return (
|
||||
<div className="grid gap-4 sm:grid-cols-2 lg:grid-cols-3">
|
||||
{(items ?? Array.from({length: Math.min(limit, 3)}, () => null)).map((item, index) =>
|
||||
item ? <ShowcaseCard key={item.url} item={item} /> : <SkeletonCard key={index} />,
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function ShowcaseCard({item}: {item: ShowcaseItem}) {
|
||||
const Icon = CATEGORY_ICON[item.category] ?? Building2;
|
||||
return (
|
||||
<a
|
||||
href={siteHref(item.url)}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="group overflow-hidden rounded-xl border border-border bg-card transition-colors hover:border-foreground/25"
|
||||
>
|
||||
<div className="flex aspect-[16/10] items-center justify-center overflow-hidden bg-muted">
|
||||
{item.thumbnailUrl ? (
|
||||
<img
|
||||
src={item.thumbnailUrl}
|
||||
alt={`${item.name} 홈페이지`}
|
||||
loading="lazy"
|
||||
className="size-full object-cover transition-transform duration-300 group-hover:scale-[1.02]"
|
||||
/>
|
||||
) : (
|
||||
// ★ 썸네일은 발행에 성공한 뒤에만 채워진다 — 없는 건 정상이다(사진 없는 가게).
|
||||
<ImageOff className="size-6 text-muted-foreground/50" aria-hidden />
|
||||
)}
|
||||
</div>
|
||||
<div className="flex items-center gap-2 px-4 py-3">
|
||||
<Icon className="size-4 shrink-0 text-muted-foreground" aria-hidden />
|
||||
<div className="min-w-0">
|
||||
<p className="truncate text-sm font-semibold tracking-tight">{item.name}</p>
|
||||
<p className="truncate text-xs text-muted-foreground">
|
||||
{[item.region, CATEGORY_LABEL[item.category]].filter(Boolean).join(' · ')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
);
|
||||
}
|
||||
|
||||
function SkeletonCard() {
|
||||
return (
|
||||
<div className="overflow-hidden rounded-xl border border-border bg-card">
|
||||
<div className="aspect-[16/10] animate-pulse bg-muted" />
|
||||
<div className="space-y-2 px-4 py-3">
|
||||
<div className="h-3.5 w-2/3 animate-pulse rounded bg-muted" />
|
||||
<div className="h-3 w-1/2 animate-pulse rounded bg-muted" />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
import type {IndustryType} from '@o2o/shared';
|
||||
import {PlaceCategory} from '@o2o/shared';
|
||||
|
||||
/**
|
||||
* 발행된 사이트 목록 — 랜딩의 "이렇게 나옵니다" 가 쓴다.
|
||||
*
|
||||
* ★ 생성 클라이언트(@/api)를 쓰지 않는다. 그쪽은 토큰을 꽂는 길목(api/mutator)을 지나는데
|
||||
* 이 엔드포인트는 **인증이 없고 비로그인 방문자가 부른다** — 토큰이 없어도, 만료됐어도
|
||||
* 똑같이 나와야 한다. 여기서 fetch 를 직접 쓰는 이유가 그거다.
|
||||
*/
|
||||
const BASE_URL = import.meta.env.VITE_API_BASE_URL ?? 'http://localhost:9800';
|
||||
|
||||
export type ShowcaseItem = {
|
||||
name: string;
|
||||
category: PlaceCategory;
|
||||
/** 없을 수 있다 — 서버가 null 필드를 지워서 보낸다(RemoveNoneResponse). */
|
||||
region?: string;
|
||||
/** 루트 상대경로(`/s/<slug>`). */
|
||||
url: string;
|
||||
thumbnailUrl?: string;
|
||||
};
|
||||
|
||||
const INDUSTRY_BY_CATEGORY: Record<number, IndustryType> = {
|
||||
[PlaceCategory.LODGING]: 'stay',
|
||||
[PlaceCategory.CAFE]: 'cafe',
|
||||
[PlaceCategory.RESTAURANT]: 'restaurant',
|
||||
[PlaceCategory.CLINIC]: 'clinic',
|
||||
};
|
||||
|
||||
export function industryOf(category: PlaceCategory): IndustryType | null {
|
||||
return INDUSTRY_BY_CATEGORY[category] ?? null;
|
||||
}
|
||||
|
||||
export async function fetchShowcase(limit = 6): Promise<ShowcaseItem[]> {
|
||||
const res = await fetch(`${BASE_URL}/v1/showcase?limit=${limit}`);
|
||||
if (!res.ok) return [];
|
||||
const body = await res.json();
|
||||
if (body?.result?.success === false) return [];
|
||||
return (body?.items ?? []).map((item: Record<string, unknown>) => ({
|
||||
name: String(item.name ?? ''),
|
||||
category: Number(item.category) as PlaceCategory,
|
||||
region: (item.region as string) ?? undefined,
|
||||
url: String(item.url ?? ''),
|
||||
thumbnailUrl: (item.thumbnail_url as string) ?? undefined,
|
||||
}));
|
||||
}
|
||||
Reference in new issue
Block a user