Description
The exact same TYPE_ICONS record mapping CitationType to Lucide icons is defined twice, in two files:
surfsense_web/components/tool-ui/citation/citation.tsx (lines 13–20)
surfsense_web/components/tool-ui/citation/citation-list.tsx (lines 12–19)
Both definitions are byte-for-byte identical:
const TYPE_ICONS: Record<CitationType, LucideIcon> = {
webpage: Globe,
document: FileText,
article: Newspaper,
api: Database,
code: Code2,
other: File,
};
Both files import the same 6 Lucide icons (Globe, FileText, Newspaper, Database, Code2, File) for this map.
What to do
- Create a new file, e.g.
surfsense_web/components/tool-ui/citation/type-icons.ts:
import type { LucideIcon } from "lucide-react";
import { Code2, Database, File, FileText, Globe, Newspaper } from "lucide-react";
import type { CitationType } from "./schema";
export const TYPE_ICONS: Record<CitationType, LucideIcon> = {
webpage: Globe,
document: FileText,
article: Newspaper,
api: Database,
code: Code2,
other: File,
};
- In both
citation.tsx and citation-list.tsx:
- Import
TYPE_ICONS from "./type-icons"
- Remove the local
TYPE_ICONS definition
- Remove the now-unused Lucide icon imports that were only used for
TYPE_ICONS (keep any that are still used elsewhere in the file)
Verify after changes:
- Both
Citation and CitationList components still render the correct type icons
citation-list.tsx's OverflowItem and StackedCitations components still show correct icons
next build succeeds
Acceptance criteria
TYPE_ICONS is defined in exactly ONE place
- Both
citation.tsx and citation-list.tsx import it from the shared module
- No duplicate Lucide icon imports remain
Description
The exact same
TYPE_ICONSrecord mappingCitationTypeto Lucide icons is defined twice, in two files:surfsense_web/components/tool-ui/citation/citation.tsx(lines 13–20)surfsense_web/components/tool-ui/citation/citation-list.tsx(lines 12–19)Both definitions are byte-for-byte identical:
Both files import the same 6 Lucide icons (
Globe,FileText,Newspaper,Database,Code2,File) for this map.What to do
surfsense_web/components/tool-ui/citation/type-icons.ts:citation.tsxandcitation-list.tsx:TYPE_ICONSfrom"./type-icons"TYPE_ICONSdefinitionTYPE_ICONS(keep any that are still used elsewhere in the file)Verify after changes:
CitationandCitationListcomponents still render the correct type iconscitation-list.tsx'sOverflowItemandStackedCitationscomponents still show correct iconsnext buildsucceedsAcceptance criteria
TYPE_ICONSis defined in exactly ONE placecitation.tsxandcitation-list.tsximport it from the shared module