76 lines
2.9 KiB
TypeScript
76 lines
2.9 KiB
TypeScript
import type { AssetSource, AssetStatus, AssetType } from "@/features/plan/types/marketingPlan";
|
|
|
|
export function assetSourceBadgeClass(source: AssetSource): string {
|
|
switch (source) {
|
|
case "homepage":
|
|
return "bg-neutral-10 text-neutral-80 border border-neutral-20";
|
|
case "naver_place":
|
|
return "bg-[var(--color-status-good-bg)] text-[var(--color-status-good-text)] border border-[var(--color-status-good-border)]";
|
|
case "blog":
|
|
return "bg-[var(--color-status-info-bg)] text-[var(--color-status-info-text)] border border-[var(--color-status-info-border)]";
|
|
case "social":
|
|
return "bg-[var(--color-marketing-blush)]/50 text-navy-800 border border-neutral-30";
|
|
case "youtube":
|
|
return "bg-[var(--color-status-critical-bg)] text-[var(--color-status-critical-text)] border border-[var(--color-status-critical-border)]";
|
|
default:
|
|
return "bg-neutral-10 text-neutral-70 border border-neutral-20";
|
|
}
|
|
}
|
|
|
|
export function assetTypeDisplayLabel(type: AssetType): string {
|
|
switch (type) {
|
|
case "photo":
|
|
return "사진";
|
|
case "video":
|
|
return "영상";
|
|
case "text":
|
|
return "텍스트";
|
|
default:
|
|
return type;
|
|
}
|
|
}
|
|
|
|
export function assetTypeBadgeClass(type: AssetType): string {
|
|
switch (type) {
|
|
case "photo":
|
|
return "bg-[var(--color-status-info-bg)] text-[var(--color-status-info-text)] border border-[var(--color-status-info-border)]";
|
|
case "video":
|
|
return "bg-lavender-100 text-violet-700 border border-lavender-300";
|
|
case "text":
|
|
return "bg-[var(--color-status-warning-bg)] text-[var(--color-status-warning-text)] border border-[var(--color-status-warning-border)]";
|
|
default:
|
|
return "bg-neutral-10 text-neutral-70 border border-neutral-20";
|
|
}
|
|
}
|
|
|
|
export function assetStatusConfig(status: AssetStatus): { className: string; label: string } {
|
|
switch (status) {
|
|
case "collected":
|
|
return {
|
|
className:
|
|
"bg-[var(--color-status-good-bg)] text-[var(--color-status-good-text)] border border-[var(--color-status-good-border)]",
|
|
label: "수집완료",
|
|
};
|
|
case "pending":
|
|
return {
|
|
className:
|
|
"bg-[var(--color-status-warning-bg)] text-[var(--color-status-warning-text)] border border-[var(--color-status-warning-border)]",
|
|
label: "수집 대기",
|
|
};
|
|
case "needs_creation":
|
|
return {
|
|
className:
|
|
"bg-[var(--color-status-critical-bg)] text-[var(--color-status-critical-text)] border border-[var(--color-status-critical-border)]",
|
|
label: "제작 필요",
|
|
};
|
|
default:
|
|
return { className: "bg-neutral-10 text-neutral-70 border border-neutral-20", label: status };
|
|
}
|
|
}
|
|
|
|
export function formatYoutubeViews(views: number): string {
|
|
if (views >= 1_000_000) return `${(views / 1_000_000).toFixed(1)}M`;
|
|
if (views >= 1_000) return `${Math.round(views / 1_000)}K`;
|
|
return String(views);
|
|
}
|