"use client";
import * as React from "react";
import { SlidersHorizontalIcon } from "lucide-react";
import { useSiteAdmin } from "../context";
import { fill } from "../lib/fill";
import { WIDGET_TOUR_ANCHORS } from "../tour";
import { Badge } from "../ui/badge";
import { Card } from "../ui/card";
import { Switch } from "../ui/switch";
import { TextField } from "../ui/text-field";
import { TOOL_GROUPS, type ToolGroupId } from "./widget-tool-groups";
import { useWidgetSettings } from "./WidgetSettingsProvider";
type ToolGroup = (typeof TOOL_GROUPS)[number];
// Two columns of nearly the same height: text, content and advanced (11
// tools), then colours and navigation (10). On one column the groups of the
// first come before those of the second, as on the phone's board.
const COLUMNS: ToolGroupId[][] = [
["text", "content", "advanced"],
["colors", "navigation"],
];
function ToolGroupCard({ group }: { group: ToolGroup }) {
const t = useSiteAdmin().messages.widget.advanced;
const { canEdit, config, patchTool } = useWidgetSettings();
const id = React.useId();
const groupDict = t.toolGroups[group.id];
// Every locale gives the same { label, description } for each tool key.
const tools = groupDict.tools as Record<
string,
{ label: string; description: string }
>;
const active = group.toolKeys.filter((key) => config.enabledTools[key]);
return (
{groupDict.description}
{groupDict.title}
{group.toolKeys.map((key, index) => (
{t.advanced.subtitle}
{t.security.description}