Skip to content

Commit b03bfc8

Browse files
committed
fix(reviews) fix code based on reviews from the PR
1 parent 11e5a4d commit b03bfc8

File tree

5 files changed

+213
-16
lines changed

5 files changed

+213
-16
lines changed

package-lock.json

Lines changed: 177 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@
130130
"eslint-plugin-react": "^7.37.2",
131131
"eslint-plugin-react-hooks": "^5.0.0",
132132
"eslint-plugin-react-refresh": "^0.4.20",
133+
"eslint-plugin-tailwindcss": "^4.0.0-beta.0",
133134
"fake-indexeddb": "^6.0.0",
134135
"happy-dom": "^20.0.8",
135136
"npm-run-all2": "^8.0.4",

src/features/common/components/button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Loader2 as Loader } from 'lucide-react'
77
import { Tooltip, TooltipContent, TooltipTrigger } from './tooltip'
88

99
const buttonVariants = cva(
10-
'relative inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',
10+
'relative cursor-pointer inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',
1111
{
1212
variants: {
1313
variant: {

src/features/layout/components/drawer-menu.tsx

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import { useCallback, useEffect, useMemo } from 'react'
1+
import { useCallback, useEffect } from 'react'
22
import { TemplatedNavLink } from '@/features/routing/components/templated-nav-link/templated-nav-link'
33
import { Urls } from '@/routes/urls'
4-
import { Telescope, FlaskConical, Coins, X, Settings } from 'lucide-react'
4+
import { X, Settings } from 'lucide-react'
55
import { Search } from '@/features/search/components/search'
6-
import SvgWizard from '@/features/common/components/icons/wizard'
76
import { cn } from '@/features/common/utils'
87
import { useSelectedNetwork } from '@/features/network/data'
98
import { useLayout } from '@/features/settings/data'
109
import SvgLoraDark from '@/features/common/components/svg/lora-dark'
1110
import SvgLoraLight from '@/features/common/components/svg/lora-light'
1211
import { NetworkSelect } from '@/features/network/components/network-select'
1312
import { ThemeToggle } from '@/features/settings/components/theme-toggle'
13+
import { menuItems } from '../constants/menu-items'
1414

1515
const itemBase =
1616
'flex items-center gap-3 rounded-md border border-transparent px-3 py-2 hover:bg-accent hover:text-primary transition-colors'
@@ -22,16 +22,6 @@ export default function DrawerMenu() {
2222
const [layout, setLayout] = useLayout()
2323
const isOpen = !!layout.isDrawerMenuExpanded
2424

25-
const menuItems = useMemo(
26-
() => [
27-
{ urlTemplate: Urls.Network.Explore, icon: <Telescope />, text: 'Explore' },
28-
{ urlTemplate: Urls.Network.AppLab, icon: <FlaskConical />, text: 'App Lab' },
29-
{ urlTemplate: Urls.Network.TransactionWizard, icon: <SvgWizard width={24} height={24} />, text: 'Txn Wizard' },
30-
{ urlTemplate: Urls.Network.Fund, icon: <Coins />, text: 'Fund' },
31-
],
32-
[]
33-
)
34-
3525
const navTextClassName = cn('visible transition-[visibility] duration-0 delay-100')
3626

3727
const navIconClassName = cn('border rounded-md p-2')
@@ -89,13 +79,13 @@ export default function DrawerMenu() {
8979
</button>
9080
</div>
9181

92-
<Search />
82+
<Search className="w-full" />
9383
</div>
9484

9585
{/* Items */}
9686
<nav className="p-3 space-y-1">
9787
{menuItems.map((item, idx) => (
98-
<div onClick={handleClose}>
88+
<div key={item.urlTemplate.toString()} onClick={handleClose}>
9989
<TemplatedNavLink
10090
key={idx}
10191
urlTemplate={item.urlTemplate}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// src/features/layout/config/menu-items.ts
2+
3+
import { Telescope, FlaskConical, Coins } from 'lucide-react'
4+
import SvgWizard from '@/features/common/components/icons/wizard'
5+
import { Urls } from '@/routes/urls'
6+
7+
// ✅ Use an array of objects so it can be iterated
8+
export const menuItems = [
9+
{
10+
urlTemplate: Urls.Network.Explore,
11+
icon: <Telescope />,
12+
text: 'Explore',
13+
},
14+
{
15+
urlTemplate: Urls.Network.AppLab,
16+
icon: <FlaskConical />,
17+
text: 'App Lab',
18+
},
19+
{
20+
urlTemplate: Urls.Network.TransactionWizard,
21+
icon: <SvgWizard width={24} height={24} />,
22+
text: 'Txn Wizard',
23+
},
24+
{
25+
urlTemplate: Urls.Network.Fund,
26+
icon: <Coins />,
27+
text: 'Fund',
28+
},
29+
]

0 commit comments

Comments
 (0)