From c94bd3d593ce387ac9c15501ab59932b849e3fca Mon Sep 17 00:00:00 2001 From: c0mrade Date: Wed, 27 May 2026 09:40:01 +0300 Subject: [PATCH] refactor(admin-traffic): extract TrafficIcons barrel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Second step in the AdminTrafficUsage decomp. Move the 15 inline SVG icons (Search/Chevron/Refresh/Download/Sort/Filter/Server/Calendar/X/ Status/Globe/Shield/ServerSmall) into a single barrel at src/components/admin/trafficUsage/TrafficIcons.tsx. Pure SVG, no behavioural change. AdminTrafficUsage.tsx: 1734 → 1593 lines (-141). --- .../admin/trafficUsage/TrafficIcons.tsx | 164 ++++++++++++++++ src/pages/AdminTrafficUsage.tsx | 177 ++---------------- 2 files changed, 182 insertions(+), 159 deletions(-) create mode 100644 src/components/admin/trafficUsage/TrafficIcons.tsx diff --git a/src/components/admin/trafficUsage/TrafficIcons.tsx b/src/components/admin/trafficUsage/TrafficIcons.tsx new file mode 100644 index 0000000..78bf843 --- /dev/null +++ b/src/components/admin/trafficUsage/TrafficIcons.tsx @@ -0,0 +1,164 @@ +// ────────────────────────────────────────────────────────────────── +// TrafficIcons — the inline SVG set used across AdminTrafficUsage +// (header controls, filter buttons, sort indicator, etc.). Page-local +// in spirit; co-located here so the parent page imports a single +// flat barrel rather than redefining 15 inline icons. +// ────────────────────────────────────────────────────────────────── + +export const SearchIcon = () => ( + + + +); + +export const ChevronLeftIcon = () => ( + + + +); + +export const ChevronRightIcon = () => ( + + + +); + +export const RefreshIcon = ({ className = 'w-5 h-5' }: { className?: string }) => ( + + + +); + +export const DownloadIcon = () => ( + + + +); + +export const SortIcon = ({ direction }: { direction: false | 'asc' | 'desc' }) => ( + + {direction === 'asc' ? ( + + ) : direction === 'desc' ? ( + + ) : ( + + )} + +); + +export const FilterIcon = () => ( + + + +); + +export const ChevronDownIcon = () => ( + + + +); + +export const ServerIcon = () => ( + + + +); + +export const CalendarIcon = () => ( + + + +); + +export const XIcon = () => ( + + + +); + +export const StatusIcon = () => ( + + + +); + +export const GlobeIcon = () => ( + + + +); + +export const ShieldIcon = () => ( + + + +); + +export const ServerSmallIcon = () => ( + + + +); diff --git a/src/pages/AdminTrafficUsage.tsx b/src/pages/AdminTrafficUsage.tsx index 18c1963..f82a31b 100644 --- a/src/pages/AdminTrafficUsage.tsx +++ b/src/pages/AdminTrafficUsage.tsx @@ -32,168 +32,27 @@ import { formatGbPerDay, } from '../components/admin/trafficUsage/trafficUsageHelpers'; import { RiskBadge } from '../components/admin/trafficUsage/RiskBadge'; +import { + SearchIcon, + ChevronLeftIcon, + ChevronRightIcon, + RefreshIcon, + DownloadIcon, + SortIcon, + FilterIcon, + ChevronDownIcon, + ServerIcon, + CalendarIcon, + XIcon, + StatusIcon, + GlobeIcon, + ShieldIcon, + ServerSmallIcon, +} from '../components/admin/trafficUsage/TrafficIcons'; // (TanStack Table augmentation + utils + risk helpers moved into ./trafficUsage/trafficUsageHelpers.ts) -// ============ Icons ============ - -const SearchIcon = () => ( - - - -); - -const ChevronLeftIcon = () => ( - - - -); - -const ChevronRightIcon = () => ( - - - -); - -const RefreshIcon = ({ className = 'w-5 h-5' }: { className?: string }) => ( - - - -); - -const DownloadIcon = () => ( - - - -); - -const SortIcon = ({ direction }: { direction: false | 'asc' | 'desc' }) => ( - - {direction === 'asc' ? ( - - ) : direction === 'desc' ? ( - - ) : ( - - )} - -); - -const FilterIcon = () => ( - - - -); - -const ChevronDownIcon = () => ( - - - -); - -const ServerIcon = () => ( - - - -); - -const CalendarIcon = () => ( - - - -); - -const XIcon = () => ( - - - -); - -const StatusIcon = () => ( - - - -); - -const GlobeIcon = () => ( - - - -); - -const ShieldIcon = () => ( - - - -); - -const ServerSmallIcon = () => ( - - - -); +// (Icons moved into ./trafficUsage/TrafficIcons.tsx) // ============ Progress Bar ============