Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

2.2 KB
Raw Blame
/* Copyright 2026 Marimo. All rights reserved. */

import AwsIcon from "@marimo-team/llm-info/icons/aws.svg?inline";
import AwsDarkIcon from "@marimo-team/llm-info/icons/aws-dark.svg?inline";
import AzureIcon from "@marimo-team/llm-info/icons/azure.svg?inline";
import CloudflareIcon from "@marimo-team/llm-info/icons/cloudflare.svg?inline";
import CoreweaveIcon from "@marimo-team/llm-info/icons/coreweave.svg?inline";
import CoreweaveDarkIcon from "@marimo-team/llm-info/icons/coreweave-dark.svg?inline";
import { DatabaseZapIcon, GlobeIcon, HardDriveIcon } from "lucide-react";
import GoogleCloudIcon from "@/components/databases/icons/google-cloud-storage.svg?inline";
import GoogleDriveIcon from "@/components/databases/icons/google-drive.svg?inline";
import HuggingfaceIcon from "@/components/databases/icons/huggingface.svg?inline";
import { GitHubIcon } from "@/components/icons/github";
import type { KnownStorageProtocol } from "@/core/storage/types";
import { useTheme } from "@/theme/useTheme";
import { cn } from "@/utils/cn";

type IconEntry =
  | { src: string; dark?: string }
  | React.ComponentType<{ className?: string }>;

const PROTOCOL_ICONS: Record<KnownStorageProtocol, IconEntry> = {
  s3: { src: AwsIcon, dark: AwsDarkIcon },
  coreweave: { src: CoreweaveIcon, dark: CoreweaveDarkIcon },
  cloudflare: { src: CloudflareIcon },
  azure: { src: AzureIcon },
  gcs: { src: GoogleCloudIcon },
  http: GlobeIcon,
  file: HardDriveIcon,
  "in-memory": DatabaseZapIcon,
  gdrive: { src: GoogleDriveIcon },
  hf: { src: HuggingfaceIcon },
  github: GitHubIcon,
};

export const ProtocolIcon: React.FC<{
  protocol: KnownStorageProtocol | (string & {});
  forceDark?: boolean;
  className?: string;
}> = ({ protocol, forceDark, className }) => {
  const { theme } = useTheme();
  const entry =
    PROTOCOL_ICONS[protocol.toLowerCase() as KnownStorageProtocol] ??
    HardDriveIcon;

  if ("src" in entry) {
    let src = entry.src;
    if (entry.dark && (forceDark || theme === "dark")) {
      src = entry.dark;
    }
    return (
      <img src={src} alt={protocol} className={cn("h-3.5 w-3.5", className)} />
    );
  }

  const Icon = entry;
  return <Icon className={cn("h-3.5 w-3.5", className)} />;
};