"use client"; import { useCallback, useEffect, useMemo, useState } from "react"; import { IconPlus, IconRefresh, IconTrash } from "@tabler/icons-react"; import { Button } from "@kandev/ui/button"; import { CardContent } from "@kandev/ui/card"; import { Input } from "@kandev/ui/input"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@kandev/ui/tabs"; import { Textarea } from "@kandev/ui/textarea"; import { SettingsCard } from "@/components/settings/settings-card"; import { SettingsSection } from "@/components/settings/settings-section"; import { useSettingsSaveContributor } from "@/components/settings/settings-save-provider"; import { useToast } from "@/components/toast-provider"; import { useGitLabActionPresets } from "@/hooks/domains/gitlab/use-gitlab-action-presets"; import type { GitLabActionPreset, GitLabActionPresets } from "@/lib/types/gitlab"; function newPreset(): GitLabActionPreset { return { id: `preset_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 7)}`, label: "New action", hint: "", icon: "sparkle", prompt_template: "", }; } function PresetList({ presets, onChange, addLabel, }: { presets: GitLabActionPreset[]; onChange: (next: GitLabActionPreset[]) => void; addLabel: string; }) { const patch = (index: number, change: Partial) => onChange( presets.map((preset, current) => (current === index ? { ...preset, ...change } : preset)), ); return (
{presets.map((preset, index) => (
patch(index, { label: event.target.value })} /> patch(index, { hint: event.target.value })} />