Skip to content

Commit 2f4e58d

Browse files
committed
refactor: remove unnecessary abstraction
1 parent 1fed853 commit 2f4e58d

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

governance/xc_admin/packages/xc_admin_frontend/components/ProgramSwitch.tsx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,6 @@ const Arrow = ({ className }: { className?: string }) => (
2222
</svg>
2323
)
2424

25-
/**
26-
* Format display name from enum name (e.g., "PYTH_CORE" -> "Pyth Core")
27-
*/
28-
const formatDisplayName = (value: ProgramType): string => {
29-
const enumName = PROGRAM_TYPE_NAMES[value]
30-
return enumName
31-
}
32-
3325
/**
3426
* Component that allows users to switch between different Pyth programs
3527
* (Core, Lazer, etc.)
@@ -42,7 +34,7 @@ const ProgramSwitch = ({ light = false }: { light?: boolean }) => {
4234
.filter((value): value is ProgramType => typeof value === 'number') // Filter out reverse mappings
4335
.map((value) => ({
4436
value,
45-
label: formatDisplayName(value),
37+
label: PROGRAM_TYPE_NAMES[value],
4638
}))
4739

4840
return (
@@ -56,7 +48,7 @@ const ProgramSwitch = ({ light = false }: { light?: boolean }) => {
5648
>
5749
<span className="mr-3">
5850
{programOptions.find((option) => option.value === programType)
59-
?.label || formatDisplayName(programType)}
51+
?.label || PROGRAM_TYPE_NAMES[programType]}
6052
</span>
6153
<Arrow className={`${open ? 'rotate-180' : ''}`} />
6254
</Menu.Button>

0 commit comments

Comments
 (0)