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:
1 parent
364f1683e3
commit
75022f82c5
95 files changed
+424
-94
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { ShieldCheck, SignIn, Trash } from "@phosphor-icons/react";
|
||||
import { ShieldCheck, SignIn, Trash } from "../ui/icons";
|
||||
import type { SocialAccountRecord } from "@shared/types";
|
||||
import { timeAgo } from "../../lib/formatters";
|
||||
import { platformConfig } from "./social-config";
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
ArrowSquareOut,
|
||||
ClockCounterClockwise,
|
||||
Robot,
|
||||
} from "@phosphor-icons/react";
|
||||
} from "../ui/icons";
|
||||
import type { BrowserActionRecord } from "@shared/types";
|
||||
import { timeAgo } from "../../lib/formatters";
|
||||
import { actionTypeLabels } from "./social-config";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useState } from "react";
|
||||
import { SignIn } from "@phosphor-icons/react";
|
||||
import { SignIn } from "../ui/icons";
|
||||
import type { SocialPlatform } from "@shared/types";
|
||||
import { ActionButton, Modal } from "../ui";
|
||||
import { platformConfig } from "./social-config";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useCallback, useState } from "react";
|
||||
import { AnimatePresence } from "framer-motion";
|
||||
import { Browser, Megaphone, Plus } from "@phosphor-icons/react";
|
||||
import { Browser, Megaphone, Plus } from "../ui/icons";
|
||||
import type { BrowserActionRecord, SocialAccountRecord, SocialPlatform } from "@shared/types";
|
||||
import { ActionButton } from "../ui";
|
||||
import { useT } from "../../i18n";
|
||||
|
||||
@@ -25,7 +25,7 @@ import {
|
||||
Notebook,
|
||||
MusicNote,
|
||||
Lightbulb,
|
||||
} from "@phosphor-icons/react";
|
||||
} from "../ui/icons";
|
||||
import type { SocialPlatform } from "@shared/types";
|
||||
|
||||
export const platformConfig: Record<SocialPlatform, { label: string; color: string; bgColor: string; icon: ElementType }> = {
|
||||
|
||||
Reference in new issue
Block a user