"use client";
import { Button } from "@app/components/ui/button";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger
} from "@app/components/ui/dropdown-menu";
import { useTranslations } from "next-intl";
import { ChevronDown } from "lucide-react";
import { cn } from "@app/lib/cn";
type LauncherViewTabsProps = {
activeViewId: number | "default";
savedViews: Array<{ viewId: number; name: string }>;
onSelectView: (viewId: number | "default") => void;
};
export function LauncherViewTabs({
activeViewId,
savedViews,
onSelectView
}: LauncherViewTabsProps) {
const t = useTranslations();
const viewOptions: Array<{
value: number | "default";
label: string;
}> = [
{ value: "default", label: t("resourceLauncherDefaultView") },
...savedViews.map((view) => ({
value: view.viewId,
label: view.name
}))
];
return (
{viewOptions.map((option) => {
const isSelected = activeViewId === option.value;
return (
);
})}
);
}
type LauncherSaveViewMenuProps = {
isDefaultView: boolean;
isAdmin: boolean;
isOrgWideView: boolean;
hasUnsavedChanges: boolean;
onSaveToCurrent: () => void;
onSaveAsNew: () => void;
onSaveForEveryone: () => void;
onMakePersonal: () => void;
};
export function LauncherSaveViewMenu({
isDefaultView,
isAdmin,
isOrgWideView,
hasUnsavedChanges,
onSaveToCurrent,
onSaveAsNew,
onSaveForEveryone,
onMakePersonal
}: LauncherSaveViewMenuProps) {
const t = useTranslations();
return (
{!isDefaultView ? (
{t("resourceLauncherSaveToCurrentView")}
) : null}
{t("resourceLauncherSaveAsNewView")}
{isAdmin && !isDefaultView && !isOrgWideView ? (
{t("resourceLauncherSaveForEveryone")}
) : null}
{isAdmin && !isDefaultView && isOrgWideView ? (
{t("resourceLauncherMakePersonal")}
) : null}
);
}