feat: 채널 아이콘/링크 통합 + 리포트·플랜 디자인 개선
shared 채널 아이콘 유틸: - src/shared/icons/channelIcons.ts (resolveChannelIcon — 한글/영문 이름 모두 매핑) - src/shared/ui/platform-icon.tsx - channel-link-buttons.tsx 정리 리포트: - ClinicSnapshot: 외부 채널/플랫폼 링크 버튼(ExternalLinkButtons) 노출 - ReportHeader: 기존 ChannelLinkButtons 제거 (ClinicSnapshot 으로 이관) - ReportBody: ClinicSnapshot 에 targetUrl·socialHandles 전달, KPIDashboard 에 report 전달 - ChannelOverview: 채널 이름 정규화로 한글 채널도 아이콘/색 매칭 - TransformationProposal: 디자인 다듬기 - GuestReportPage: 하단 '도입 문의' CTA 섹션 제거 플랜: - BrandingGuide / ChannelStrategy: 공용 resolveChannelIcon 사용으로 중복 제거 - PlanPage: PlanCTA 에 plan 전달 (CSV 내보내기용) 기타: - MultiChannelInput: 공용 platform-icon 사용
This commit is contained in:
1 parent
317cd61519
commit
47fed51efc
14 files changed
+339
-127
No files matched your search
@@ -6,16 +6,7 @@
|
||||
* - 비어있는 플랫폼은 자동 생략
|
||||
* - 디자인: white/60 backdrop-blur + 호버 시 더 진해짐 (ReportHeader 의 메타 칩과 동일 톤)
|
||||
*/
|
||||
import { ExternalLink, Heart, MapPin } from 'lucide-react';
|
||||
import type { CSSProperties } from 'react';
|
||||
import {
|
||||
InstagramFilled,
|
||||
YoutubeFilled,
|
||||
FacebookFilled,
|
||||
GlobeFilled,
|
||||
TiktokFilled,
|
||||
FileTextFilled,
|
||||
} from '@/shared/icons/FilledIcons';
|
||||
import { ExternalLink, Heart, MapPin, Globe, Instagram, Youtube, Facebook, Music, FileText, type LucideIcon } from 'lucide-react';
|
||||
|
||||
export interface ChannelHandles {
|
||||
website?: string | null;
|
||||
@@ -33,7 +24,7 @@ type PlatformKey = keyof ChannelHandles;
|
||||
interface PlatformMeta {
|
||||
label: string;
|
||||
color: string;
|
||||
Icon: (props: { size?: number; className?: string; style?: CSSProperties }) => React.ReactElement;
|
||||
Icon: LucideIcon;
|
||||
buildUrl: (handle: string) => string;
|
||||
}
|
||||
|
||||
@@ -41,31 +32,31 @@ const META: Record<PlatformKey, PlatformMeta> = {
|
||||
website: {
|
||||
label: '홈페이지',
|
||||
color: '#6C5CE7',
|
||||
Icon: GlobeFilled,
|
||||
Icon: Globe,
|
||||
buildUrl: (h) => (/^https?:\/\//.test(h) ? h : `https://${h}`),
|
||||
},
|
||||
instagram: {
|
||||
label: 'Instagram',
|
||||
color: '#833AB4',
|
||||
Icon: InstagramFilled,
|
||||
Icon: Instagram,
|
||||
buildUrl: (h) => `https://instagram.com/${h.replace(/^@/, '')}`,
|
||||
},
|
||||
youtube: {
|
||||
label: 'YouTube',
|
||||
color: '#FF3D3D',
|
||||
Icon: YoutubeFilled,
|
||||
Icon: Youtube,
|
||||
buildUrl: (h) => `https://youtube.com/${h.startsWith('@') ? h : `@${h}`}`,
|
||||
},
|
||||
facebook: {
|
||||
label: 'Facebook',
|
||||
color: '#1877F2',
|
||||
Icon: FacebookFilled,
|
||||
Icon: Facebook,
|
||||
buildUrl: (h) => (/^https?:\/\//.test(h) ? h : `https://facebook.com/${h}`),
|
||||
},
|
||||
tiktok: {
|
||||
label: 'TikTok',
|
||||
color: '#0A1128',
|
||||
Icon: TiktokFilled,
|
||||
Icon: Music,
|
||||
buildUrl: (h) => `https://tiktok.com/${h.startsWith('@') ? h : `@${h}`}`,
|
||||
},
|
||||
gangnamUnni: {
|
||||
@@ -91,7 +82,7 @@ const META: Record<PlatformKey, PlatformMeta> = {
|
||||
naverBlog: {
|
||||
label: '네이버 블로그',
|
||||
color: '#03C75A',
|
||||
Icon: FileTextFilled,
|
||||
Icon: FileText,
|
||||
buildUrl: (h) => {
|
||||
if (/^https?:\/\//.test(h)) return h;
|
||||
if (/blog\.naver\.com\//.test(h)) return `https://${h.replace(/^\/+/, '')}`;
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
/**
|
||||
* PlatformIcon — 플랫폼 식별자 (string variant) 로 lucide line icon 을 반환.
|
||||
*
|
||||
* 입력은 'youtube', 'YouTube', 'naver-blog', '네이버 블로그' 같이 다양한 형태가
|
||||
* 들어올 수 있어 normalize 후 부분 일치까지 시도합니다. 매칭 실패 시 Globe.
|
||||
*/
|
||||
import {
|
||||
Globe,
|
||||
Instagram,
|
||||
Youtube,
|
||||
Facebook,
|
||||
Music,
|
||||
FileText,
|
||||
Heart,
|
||||
MapPin,
|
||||
Search,
|
||||
type LucideIcon,
|
||||
} from 'lucide-react';
|
||||
|
||||
export type PlatformVariant =
|
||||
| 'website'
|
||||
| 'instagram'
|
||||
| 'youtube'
|
||||
| 'facebook'
|
||||
| 'tiktok'
|
||||
| 'naverPlace'
|
||||
| 'naverBlog'
|
||||
| 'naver'
|
||||
| 'gangnamUnni'
|
||||
| 'blog';
|
||||
|
||||
export const PLATFORM_ICONS: Record<PlatformVariant, LucideIcon> = {
|
||||
website: Globe,
|
||||
instagram: Instagram,
|
||||
youtube: Youtube,
|
||||
facebook: Facebook,
|
||||
tiktok: Music,
|
||||
naverPlace: MapPin,
|
||||
naverBlog: FileText,
|
||||
naver: Search,
|
||||
gangnamUnni: Heart,
|
||||
blog: FileText,
|
||||
};
|
||||
|
||||
export const PLATFORM_COLORS: Record<PlatformVariant, string> = {
|
||||
website: '#6C5CE7',
|
||||
instagram: '#833AB4',
|
||||
youtube: '#FF3D3D',
|
||||
facebook: '#1877F2',
|
||||
tiktok: '#0A1128',
|
||||
naverPlace: '#03C75A',
|
||||
naverBlog: '#03C75A',
|
||||
naver: '#03C75A',
|
||||
gangnamUnni: '#FF6B8A',
|
||||
blog: '#03C75A',
|
||||
};
|
||||
|
||||
/** 별칭 → canonical key. lowercase / 한글 / 공백·하이픈 변형을 흡수. */
|
||||
const ALIAS: Record<string, PlatformVariant> = {
|
||||
website: 'website',
|
||||
homepage: 'website',
|
||||
web: 'website',
|
||||
site: 'website',
|
||||
홈페이지: 'website',
|
||||
instagram: 'instagram',
|
||||
ig: 'instagram',
|
||||
인스타: 'instagram',
|
||||
인스타그램: 'instagram',
|
||||
youtube: 'youtube',
|
||||
yt: 'youtube',
|
||||
유튜브: 'youtube',
|
||||
facebook: 'facebook',
|
||||
fb: 'facebook',
|
||||
페이스북: 'facebook',
|
||||
tiktok: 'tiktok',
|
||||
틱톡: 'tiktok',
|
||||
naverplace: 'naverPlace',
|
||||
네이버플레이스: 'naverPlace',
|
||||
네이버플레이스지도: 'naverPlace',
|
||||
place: 'naverPlace',
|
||||
naverblog: 'naverBlog',
|
||||
네이버블로그: 'naverBlog',
|
||||
naver: 'naver',
|
||||
네이버: 'naver',
|
||||
blog: 'blog',
|
||||
블로그: 'blog',
|
||||
gangnamunni: 'gangnamUnni',
|
||||
강남언니: 'gangnamUnni',
|
||||
};
|
||||
|
||||
/** 자유 문자열 → PlatformVariant. 못 찾으면 undefined. */
|
||||
export function resolvePlatformVariant(raw: string | null | undefined): PlatformVariant | undefined {
|
||||
if (!raw) return undefined;
|
||||
const norm = raw.toLowerCase().replace(/[\s\-_]+/g, '');
|
||||
if (norm in ALIAS) return ALIAS[norm];
|
||||
// 부분 일치 (예: "naver blog" → "naverblog" → naverBlog)
|
||||
for (const key of Object.keys(ALIAS)) {
|
||||
if (norm.includes(key)) return ALIAS[key];
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
interface PlatformIconProps {
|
||||
/** 플랫폼 식별 문자열. 'youtube' / 'Instagram' / '네이버 블로그' 등 자유 형식 */
|
||||
variant: string | null | undefined;
|
||||
size?: number;
|
||||
className?: string;
|
||||
/** 색상을 자동으로 플랫폼 컬러로 채울지 (false 면 현재 텍스트 색 상속) */
|
||||
colored?: boolean;
|
||||
/** 매칭 실패 시 사용할 fallback icon. 기본 Globe. */
|
||||
fallback?: LucideIcon;
|
||||
}
|
||||
|
||||
export function PlatformIcon({
|
||||
variant,
|
||||
size = 16,
|
||||
className,
|
||||
colored = false,
|
||||
fallback = Globe,
|
||||
}: PlatformIconProps) {
|
||||
const key = resolvePlatformVariant(variant);
|
||||
const Icon = key ? PLATFORM_ICONS[key] : fallback;
|
||||
const color = colored && key ? PLATFORM_COLORS[key] : undefined;
|
||||
return <Icon size={size} className={className} style={color ? { color } : undefined} />;
|
||||
}
|
||||
Reference in new issue
Block a user