Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

2.2 KB
Raw Blame
import {
  AstroidIcon,
  BookOpenIcon,
  BriefcaseIcon,
  CameraIcon,
  ChartNoAxesCombinedIcon,
  CheckCheckIcon,
  CodeIcon,
  CoffeeIcon,
  CompassIcon,
  EarthIcon,
  FeatherIcon,
  FlaskConicalIcon,
  Flower2Icon,
  FolderIcon,
  GemIcon,
  GraduationCapIcon,
  HeartIcon,
  HouseIcon,
  LeafIcon,
  LightbulbIcon,
  type LucideIcon,
  MapPinIcon,
  MountainIcon,
  MusicIcon,
  NotebookPenIcon,
  PaletteIcon,
  PencilIcon,
  PlaneIcon,
  RocketIcon,
  SproutIcon,
  StarIcon,
  SunIcon,
  TargetIcon,
  TentIcon,
  TrophyIcon,
  UsersIcon,
  UtensilsIcon,
  WrenchIcon,
  ZapIcon,
} from "lucide-react";
// Shared display shape; each resource retains its own protobuf message type.
export interface CustomIconValue {
  value: { case: "emoji" | "lucide"; value: string } | { case: undefined; value?: undefined };
}

// Keep the catalog explicit so adding a picker does not bundle the entire icon library.
export const CUSTOM_SYMBOLS = {
  astroid: AstroidIcon,
  "book-open": BookOpenIcon,
  briefcase: BriefcaseIcon,
  camera: CameraIcon,
  "chart-no-axes-combined": ChartNoAxesCombinedIcon,
  "check-check": CheckCheckIcon,
  code: CodeIcon,
  coffee: CoffeeIcon,
  compass: CompassIcon,
  earth: EarthIcon,
  feather: FeatherIcon,
  "flask-conical": FlaskConicalIcon,
  "flower-2": Flower2Icon,
  folder: FolderIcon,
  gem: GemIcon,
  "graduation-cap": GraduationCapIcon,
  heart: HeartIcon,
  house: HouseIcon,
  leaf: LeafIcon,
  lightbulb: LightbulbIcon,
  "map-pin": MapPinIcon,
  mountain: MountainIcon,
  music: MusicIcon,
  "notebook-pen": NotebookPenIcon,
  palette: PaletteIcon,
  pencil: PencilIcon,
  plane: PlaneIcon,
  rocket: RocketIcon,
  sprout: SproutIcon,
  star: StarIcon,
  sun: SunIcon,
  target: TargetIcon,
  tent: TentIcon,
  trophy: TrophyIcon,
  users: UsersIcon,
  utensils: UtensilsIcon,
  wrench: WrenchIcon,
  zap: ZapIcon,
};

export const getCustomSymbol = (name: string, fallback: LucideIcon = AstroidIcon) =>
  Object.hasOwn(CUSTOM_SYMBOLS, name) ? CUSTOM_SYMBOLS[name as keyof typeof CUSTOM_SYMBOLS] : fallback;

export const customIconsEqual = (a?: CustomIconValue, b?: CustomIconValue) =>
  a?.value.case === b?.value.case && a?.value.value === b?.value.value;