feat: platform update

This commit is contained in:
ivannoskov
2026-02-09 13:10:08 +03:00
parent f7597270e5
commit 1826483750
15 changed files with 907 additions and 2796 deletions

View File

@@ -26,9 +26,10 @@ import {
Grid,
List,
FileText,
Image,
Image as ImageIcon,
Video,
} from "lucide-react";
import Image from "next/image";
import { DashboardHeader } from "@/components/layout/dashboard-header";
import { useWorkspace } from "@/components/providers/workspace-provider";
import { creativesApi } from "@/lib/api";
@@ -126,7 +127,7 @@ const getCreativeWord = (count: number): string => {
const getMediaIcon = (mediaType: string) => {
switch (mediaType) {
case "photo":
return Image;
return ImageIcon;
case "video":
return Video;
case "animation":
@@ -236,11 +237,7 @@ export default function CreativesPage() {
);
const handleCreateCreativeClick = () => {
if (currentProject) {
router.push(`/dashboard/${workspaceId}/creatives/new?project_id=${currentProject.id}`);
} else {
setShowCreateDialog(true);
}
setShowCreateDialog(true);
};
const handleOpenBotClick = () => {
@@ -251,12 +248,6 @@ export default function CreativesPage() {
setShowCreateDialog(false);
};
const handleCreateOnPlatformClick = () => {
if (!currentProject) return;
router.push(`/dashboard/${workspaceId}/creatives/new?project_id=${currentProject.id}`);
setShowCreateDialog(false);
};
const handleCopyText = (text: string) => {
navigator.clipboard.writeText(text);
};
@@ -502,14 +493,14 @@ export default function CreativesPage() {
size="icon"
className="h-8 w-8"
asChild
>
<Link
href={`/dashboard/${workspaceId}/placements/new?creative_id=${creative.id}`}
title="Создать размещение"
>
<Plus className="h-3.5 w-3.5" />
</Link>
</Button>
<Link
href={`/dashboard/${workspaceId}/purchase-plans/${creative.project_id}?openPlacement=true&creative_id=${creative.id}`}
title="Создать размещение"
>
<Plus className="h-3.5 w-3.5" />
</Link>
</Button>
)}
<DropdownMenu>
<DropdownMenuTrigger asChild>
@@ -673,47 +664,45 @@ export default function CreativesPage() {
<DialogHeader>
<DialogTitle>Создание креатива</DialogTitle>
<DialogDescription>
Создание креатива через Telegram бота или на платформе
Креативы создаются через Telegram бота
</DialogDescription>
</DialogHeader>
<div className="space-y-4 py-4">
<div className="space-y-2">
<p className="text-sm text-muted-foreground">
Выберите способ создания креатива:
</p>
<div className="space-y-3">
<Button
variant="outline"
className="w-full justify-start"
onClick={handleOpenBotClick}
>
<div className="flex items-center justify-between w-full">
<div className="text-left">
<p className="font-medium">Через Telegram бота</p>
<p className="text-xs text-muted-foreground">
Перешлите сообщение боту
</p>
</div>
</div>
</Button>
{currentProject && (
<Button
variant="outline"
className="w-full justify-start"
onClick={handleCreateOnPlatformClick}
>
<div className="flex items-center justify-between w-full">
<div className="text-left">
<p className="font-medium">На платформе</p>
<p className="text-xs text-muted-foreground">
Для проекта: {currentProject.title}
</p>
</div>
</div>
</Button>
)}
<div className="space-y-3">
<div className="flex items-start gap-3 p-3 bg-muted rounded-lg">
<div>
<p className="text-sm font-medium">Перешлите пост боту</p>
<p className="text-xs text-muted-foreground mt-1">
Перешлите готовый пост с медиа и оформлением. Кнопки можно будет добавить через бота.
</p>
<p className="text-xs text-muted-foreground mt-1">
В тексте должна быть одна invite-ссылка формата: <code className="text-xs">https://t.me/+xxx</code>
</p>
</div>
</div>
<div className="flex items-start gap-3 p-3 bg-muted rounded-lg">
<div>
<p className="text-sm font-medium">Бот создаст креатив</p>
<p className="text-xs text-muted-foreground mt-1">
При создании размещения ссылка автоматически заменится на уникальную для отслеживания
</p>
</div>
</div>
</div>
<Button
variant="default"
className="w-full"
onClick={handleOpenBotClick}
disabled={!currentProject}
>
<Image src="/icons/telegram.svg" alt="Telegram" width={20} height={20} className="w-5 h-5 mr-2" />
Перейти в бота
</Button>
{!currentProject && (
<p className="text-xs text-muted-foreground text-center">
Выберите проект в верхнем меню
</p>
)}
</div>
</DialogContent>
</Dialog>