// @ts-check
import { defineConfig } from "astro/config";
import starlight from "@astrojs/starlight";

export default defineConfig({
  site: "https://docs.tangled.org",
  integrations: [
    starlight({
      title: "Tangled Docs",
      titleDelimiter: "·",
      description:
        "Documentation for Tangled — decentralized code collaboration built on the AT Protocol.",
      favicon: "/favicon.svg",
      head: [
        {
          tag: "link",
          attrs: { rel: "apple-touch-icon", href: "/apple-touch-icon.png" },
        },
      ],
      logo: {
        light: "./src/assets/logotype-light.svg",
        dark: "./src/assets/logotype-dark.svg",
        replacesTitle: true,
      },
      social: [
        {
          icon: "seti:git",
          label: "Source",
          href: "https://tangled.org/@tangled.org/core",
        },
      ],
      editLink: {
        baseUrl: "https://tangled.org/@tangled.org/core/blob/master/docs/",
      },
      customCss: [
        "./src/styles/tangled.css",
        "./src/styles/custom.css",
        "./src/styles/sidebar-icons.css",
      ],
      components: {
        SocialIcons: "./src/components/HeaderLinks.astro",
      },
      expressiveCode: {
        // same palettes as the appview's chroma stylesheet
        themes: ["catppuccin-macchiato", "catppuccin-latte"],
        styleOverrides: {
          borderRadius: "0.25rem",
          borderColor: "var(--sl-color-gray-5)",
        },
      },
      sidebar: [
        {
          label: "Getting started",
          items: [
            { slug: "quick-start", attrs: { "data-icon": "rocket" } },
            { slug: "why-atproto", attrs: { "data-icon": "at-sign" } },
            { slug: "sites", attrs: { "data-icon": "globe" } },
            { slug: "troubleshooting", attrs: { "data-icon": "life-buoy" } },
          ],
        },
        {
          label: "Knots",
          items: [
            {
              label: "What are knots?",
              slug: "knots",
              attrs: { "data-icon": "server" },
            },
            {
              label: "Self-hosting a knot",
              slug: "knots/self-hosting",
              attrs: { "data-icon": "hard-drive" },
            },
          ],
        },
        {
          label: "Spindles",
          items: [
            {
              label: "What are spindles?",
              slug: "spindles",
              attrs: { "data-icon": "workflow" },
            },
            { slug: "spindles/workflows", attrs: { "data-icon": "play" } },
            {
              slug: "spindles/self-hosting",
              attrs: { "data-icon": "hard-drive" },
            },
            { slug: "spindles/secrets", attrs: { "data-icon": "key-round" } },
            {
              slug: "spindles/architecture",
              attrs: { "data-icon": "network" },
            },
          ],
        },
        {
          label: "Reference",
          items: [
            { slug: "reference/webhooks", attrs: { "data-icon": "webhook" } },
            { slug: "reference/bobbin", attrs: { "data-icon": "cable" } },
            {
              slug: "reference/migrations",
              attrs: { "data-icon": "arrow-up-circle" },
            },
          ],
        },
        {
          label: "Contributing",
          items: [
            { slug: "contributing/hacking", attrs: { "data-icon": "hammer" } },
            {
              slug: "contributing/guide",
              attrs: { "data-icon": "git-pull-request" },
            },
          ],
        },
      ],
    }),
  ],
});
