3fc7bf2b97
Build backend images / build content-svc (push) Failing after 3m39s
Build backend images / build file-svc (push) Failing after 52s
Build backend images / build gateway (push) Failing after 58s
Build backend images / build identity-svc (push) Failing after 1m21s
Build backend images / build notification-svc (push) Failing after 1m0s
Build backend images / build render-svc (push) Failing after 58s
Build backend images / build studio-svc (push) Failing after 55s
AI SEO content generator - content-svc: per-tenant OpenAI config (ai_settings) + /v1/ai endpoints (settings GET/PUT, seo-post) with SEO-expert prompt → structured article - admin UI to configure token/base-url/model and generate + save as blog - configurable base URL for restricted networks Full data-driven admin panel - generic /api/admin/resource proxy + reusable AdminResource component - categories/tags/fonts/blogs (CRUD), users (list + ban), plans/slides - AI content section; nav + i18n i18n localization sweep - localized 116 user-facing + studio/editor components to next-intl (fa+en) under the auto.* namespace; merge tooling in scripts/merge-i18n.js Branding + assets - Monoline F logo (LogoMark + favicon) - offline SVG placeholder generator (/api/placeholder), dropped picsum.photos Fixes - JWT issuer mismatch on content/studio (flatrender → flatrender-identity) - missing role claim → [Authorize(Roles="Admin")] now works (RBAC) - Secure cookies broke HTTP sessions → gated behind AUTH_COOKIE_SECURE - Radix RTL via DirectionProvider (right-aligned menus in fa) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
100 lines
2.9 KiB
TypeScript
100 lines
2.9 KiB
TypeScript
"use client";
|
|
|
|
import { useRouter } from "next/navigation";
|
|
import { useState } from "react";
|
|
import { ChevronDown, Clapperboard, ImageIcon, Plus, Scissors } from "lucide-react";
|
|
import { useTranslations } from "next-intl";
|
|
|
|
import { Button } from "@/components/ui/button";
|
|
import {
|
|
DropdownMenu,
|
|
DropdownMenuContent,
|
|
DropdownMenuItem,
|
|
DropdownMenuTrigger,
|
|
} from "@/components/ui/dropdown-menu";
|
|
import type { ProjectType } from "@/lib/projects";
|
|
|
|
interface NewProjectMenuProps {
|
|
triggerLabel?: string;
|
|
triggerClassName?: string;
|
|
align?: "start" | "center" | "end";
|
|
}
|
|
|
|
export function NewProjectMenu({
|
|
triggerLabel,
|
|
triggerClassName,
|
|
align = "end",
|
|
}: NewProjectMenuProps) {
|
|
const t = useTranslations("auto.componentsDashboardNewProjectMenu");
|
|
const router = useRouter();
|
|
const [isCreating, setIsCreating] = useState(false);
|
|
const label = triggerLabel ?? t("newProject");
|
|
|
|
const createProject = async (type: ProjectType) => {
|
|
setIsCreating(true);
|
|
try {
|
|
const response = await fetch("/api/projects", {
|
|
method: "POST",
|
|
headers: { "Content-Type": "application/json" },
|
|
body: JSON.stringify({ type }),
|
|
});
|
|
|
|
const data = (await response.json()) as {
|
|
project?: { id: string; type: ProjectType };
|
|
error?: string;
|
|
};
|
|
|
|
if (!response.ok || !data.project) {
|
|
return;
|
|
}
|
|
|
|
if (data.project.type === "video") {
|
|
router.push(`/studio/video/${data.project.id}`);
|
|
return;
|
|
}
|
|
if (data.project.type === "image") {
|
|
router.push(`/studio/image/${data.project.id}`);
|
|
return;
|
|
}
|
|
router.push("/studio/trimmer");
|
|
} finally {
|
|
setIsCreating(false);
|
|
}
|
|
};
|
|
|
|
return (
|
|
<DropdownMenu>
|
|
<DropdownMenuTrigger asChild>
|
|
<Button className={triggerClassName} disabled={isCreating}>
|
|
<Plus className="h-4 w-4" aria-hidden />
|
|
{isCreating ? t("creating") : label}
|
|
<ChevronDown className="h-4 w-4 opacity-80" aria-hidden />
|
|
</Button>
|
|
</DropdownMenuTrigger>
|
|
<DropdownMenuContent align={align} className="w-56">
|
|
<DropdownMenuItem
|
|
className="cursor-pointer gap-2"
|
|
onClick={() => router.push("/studio/video/new")}
|
|
>
|
|
<Clapperboard className="h-4 w-4 text-primary-600" />
|
|
{t("videoProject")}
|
|
</DropdownMenuItem>
|
|
<DropdownMenuItem
|
|
className="cursor-pointer gap-2"
|
|
onClick={() => createProject("image")}
|
|
>
|
|
<ImageIcon className="h-4 w-4 text-violet-600" />
|
|
{t("imageProject")}
|
|
</DropdownMenuItem>
|
|
<DropdownMenuItem
|
|
className="cursor-pointer gap-2"
|
|
onClick={() => createProject("trimmer")}
|
|
>
|
|
<Scissors className="h-4 w-4 text-amber-600" />
|
|
{t("trimCropVideo")}
|
|
</DropdownMenuItem>
|
|
</DropdownMenuContent>
|
|
</DropdownMenu>
|
|
);
|
|
}
|