refactor(renderer): route all Phosphor icon imports through ui/icons barrel

Create src/renderer/components/ui/icons.ts as the single re-export point
for every Phosphor icon the renderer touches, then rewrite the 95 files
that previously imported directly from "@phosphor-icons/react" to pull
from the relative-path-to-barrel instead. The TitleBar commit earlier
in this series already used ui/icons; this commit extends the pattern
to the rest of the renderer.

Benefits now wired in:
  - one location where bundle tree-shaking can be reasoned about,
  - typos like Briefcase vs BriefCase show up against a finite list,
  - re-theming or swapping icon sets is a one-file edit,
  - a lint rule that flags raw @phosphor-icons/react imports can be
    added later without mass-rewriting call sites.

The barrel also re-exports the `Icon` type so call sites that type
icon props against the Phosphor component type work unchanged.

Test count stays at 363 passing; typecheck stays at 156 errors.
This commit is contained in:
ZacharyZhang-NY committed 2026-04-16 23:37:35 -04:00
1 parent 364f1683e3
commit 75022f82c5
95 files changed
+424 -94

No files matched your search

@@ -1,6 +1,6 @@
import { useMemo, useRef, useState } from "react"
import { useVirtualizer } from "@tanstack/react-virtual"
import { Lightning, MagnifyingGlass } from "@phosphor-icons/react"
import { Lightning, MagnifyingGlass } from "../ui/icons"
import type { ActivityRecord } from "@shared/types"
import { useT } from "../../i18n"
import { formatTime } from "../../lib/formatters"
@@ -1,5 +1,5 @@
import { useEffect, useState } from "react"
import { Warning } from "@phosphor-icons/react"
import { Warning } from "../ui/icons"
import type { BudgetStatusSummary, ProfileSnapshot } from "@shared/types"
import { formatMoney } from "../../lib/formatters"
import { ListFrame, ListRow } from "../ui"
@@ -1,5 +1,5 @@
import { useCallback, useEffect, useState } from "react";
import { ArrowSquareOut, FloppyDisk, Plus, Trash } from "@phosphor-icons/react";
import { ArrowSquareOut, FloppyDisk, Plus, Trash } from "../ui/icons";
import type { ConnectorRecord } from "@shared/types";
import { unwrap } from "../../lib/desktop";
import {
@@ -1,5 +1,5 @@
import { useCallback, useEffect, useState } from "react";
import { CheckCircle, Warning } from "@phosphor-icons/react";
import { CheckCircle, Warning } from "../ui/icons";
import type { BudgetIncidentRecord } from "@shared/types";
import { ActionButton, EmptyState, ListFrame, ListRow } from "../ui";
import { formatTime } from "../../lib/formatters";
@@ -1,4 +1,4 @@
import { CaretDown, CaretRight } from "@phosphor-icons/react";
import { CaretDown, CaretRight } from "../ui/icons";
import type { ProfileSnapshot } from "@shared/types";
import { COMPATIBLE_PROVIDERS } from "../company-onboarding/ProvidersStepShared";
@@ -138,7 +138,7 @@ export function ToggleSwitch({ checked, onChange, label }: { checked: boolean; o
/* Model toggle list */
/* ------------------------------------------------------------------ */
import { X as XIcon } from "@phosphor-icons/react";
import { X as XIcon } from "../ui/icons";
export function ModelToggleList({
models,
@@ -1,5 +1,5 @@
import { useCallback, useEffect, useState } from "react";
import { FloppyDisk, SignIn } from "@phosphor-icons/react";
import { FloppyDisk, SignIn } from "../ui/icons";
import type { ConnectorRecord } from "@shared/types";
import { unwrap } from "../../lib/desktop";
import {
@@ -1,4 +1,4 @@
import { Robot } from "@phosphor-icons/react"
import { Robot } from "../ui/icons"
import type { AgentRecord, TaskRecord } from "@shared/types"
import { useT } from "../../i18n"
import { EmptyState, ListFrame } from "../ui"
@@ -1,5 +1,5 @@
import { useCallback, useEffect, useState } from "react";
import { Plus, ShieldCheck, Trash, Warning } from "@phosphor-icons/react";
import { Plus, ShieldCheck, Trash, Warning } from "../ui/icons";
import type { BudgetPolicyRecord, BudgetStatusSummary } from "@shared/types";
import { ActionButton, EmptyState, ListFrame, ListRow } from "../ui";
import { PolicyFormModal } from "./PolicyFormModal";
@@ -1,5 +1,5 @@
import { useEffect, useState } from "react"
import { ArrowClockwise, CheckCircle, ClockCounterClockwise, Download, Trash } from "@phosphor-icons/react"
import { ArrowClockwise, CheckCircle, ClockCounterClockwise, Download, Trash } from "../ui/icons"
import type { ProfileSnapshot, SecretRecord } from "@shared/types"
import type { AppLocale } from "@shared/locale"
import { APP_LOCALES, LOCALE_LABELS } from "@shared/locale"
@@ -1,4 +1,4 @@
import { Clock, Link as LinkIcon } from "@phosphor-icons/react"
import { Clock, Link as LinkIcon } from "../ui/icons"
import { platformConfig } from "../social/social-config"
import type { SocialPlatform } from "@shared/types"
import { safeJson } from "../../lib/safe-json"
@@ -1,5 +1,5 @@
import { useEffect, useState } from "react"
import { Robot, ArrowRight } from "@phosphor-icons/react"
import { Robot, ArrowRight } from "../ui/icons"
import type { CommentRecord, ProfileSnapshot } from "@shared/types"
import { useT } from "../../i18n"
import { formatTime } from "../../lib/formatters"
@@ -1,6 +1,6 @@
import { useState } from "react"
import { AnimatePresence, motion } from "framer-motion"
import { ListChecks } from "@phosphor-icons/react"
import { ListChecks } from "../ui/icons"
import type { GoalRecord, ProfileSnapshot, ProjectRecord, WorkspaceRecord, TaskRecord } from "@shared/types"
import { useT } from "../../i18n"
import { unwrap } from "../../lib/desktop"
@@ -1,5 +1,5 @@
import { useState, useMemo } from "react"
import { CheckCircle, ListChecks, Pencil, Play, ShieldCheck, Trash, XCircle, Warning, Robot, ArrowRight } from "@phosphor-icons/react"
import { CheckCircle, ListChecks, Pencil, Play, ShieldCheck, Trash, XCircle, Warning, Robot, ArrowRight } from "../ui/icons"
import type { CommentRecord, GoalRecord, ProfileSnapshot, ProjectRecord, RunRecord, TaskRecord, TaskStatus, WorkspaceRecord } from "@shared/types"
import { useT } from "../../i18n"
import { formatMoney, formatTime } from "../../lib/formatters"
@@ -1,5 +1,5 @@
import { useState } from "react"
import { FolderOpen } from "@phosphor-icons/react"
import { FolderOpen } from "../ui/icons"
import type { ProjectRecord } from "@shared/types"
import { useT } from "../../i18n"
import { unwrap } from "../../lib/desktop"
@@ -1,4 +1,4 @@
import { ArrowSquareOut } from "@phosphor-icons/react"
import { ArrowSquareOut } from "../ui/icons"
import type { AgentRecord, DocumentRecord, ProjectRecord, RunRecord, TaskRecord, WorkspaceRecord } from "@shared/types"
import { useT } from "../../i18n"
import { formatTime } from "../../lib/formatters"
@@ -1,5 +1,5 @@
import { useState } from "react"
import { ArrowSquareOut, FolderOpen, Trash } from "@phosphor-icons/react"
import { ArrowSquareOut, FolderOpen, Trash } from "../ui/icons"
import type { ProjectRecord, WorkspaceRecord } from "@shared/types"
import { useT } from "../../i18n"
import { unwrap } from "../../lib/desktop"
@@ -1,5 +1,5 @@
import { useMemo, useState } from "react"
import { CheckCircle } from "@phosphor-icons/react"
import { CheckCircle } from "../../ui/icons"
import type { ApprovalRecord, DocumentRecord } from "@shared/types"
import { extractApprovalDocumentReferences, type ApprovalDocumentReference } from "@shared/approval-documents"
import { unwrap } from "../../../lib/desktop"
@@ -1,4 +1,4 @@
import { Briefcase, Robot } from "@phosphor-icons/react"
import { Briefcase, Robot } from "../../ui/icons"
import type { AgentRecord, ApprovalRecord, TaskRecord } from "@shared/types"
import { formatTime } from "../../../lib/formatters"
import { StatusPill } from "../../ui"
@@ -1,4 +1,4 @@
import { CheckCircle, ClockCounterClockwise, Trash, XCircle } from "@phosphor-icons/react"
import { CheckCircle, ClockCounterClockwise, Trash, XCircle } from "../../ui/icons"
import { ActionButton, TextArea } from "../../ui"
import { useT } from "../../../i18n"
@@ -1,5 +1,5 @@
import { useMemo, useState } from "react"
import { CaretDown, CaretUp } from "@phosphor-icons/react"
import { CaretDown, CaretUp } from "../../ui/icons"
import type { AgentRecord, ApprovalRecord, DocumentRecord } from "@shared/types"
import { useApprovalPayload } from "./useApprovalPayload"
@@ -1,5 +1,5 @@
import { useMemo } from "react"
import { Clock } from "@phosphor-icons/react"
import { Clock } from "../../ui/icons"
import { InlineNotice } from "../../ui"
export type ScheduleMode = "immediate" | "scheduled"
@@ -1,7 +1,7 @@
import type { ApprovalRecord } from "@shared/types"
import {
Robot, CheckSquare, Play, ShieldCheck, Gear, FolderOpen, Key, Target, Briefcase, Buildings,
} from "@phosphor-icons/react"
} from "../ui/icons"
import { safeJson } from "../../lib/safe-json"
export function describeActionError(error: unknown) {