forked from StellarSend/frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSidebar.tsx
More file actions
147 lines (140 loc) · 4.71 KB
/
Copy pathSidebar.tsx
File metadata and controls
147 lines (140 loc) · 4.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
import React from 'react'
import { NavLink } from 'react-router-dom'
import {
LayoutDashboard,
Send,
History,
Settings,
HelpCircle,
ExternalLink,
TrendingUp,
ChevronRight,
Repeat,
Layers,
FileText,
Lock,
} from 'lucide-react'
import { cn } from '@/lib/utils'
import { useWallet } from '@/hooks/useWallet'
import { NetworkBadge } from '@/components/ui/Badge'
import { truncateAddress, formatXLM } from '@/lib/stellar'
const primaryLinks = [
{ to: '/dashboard', label: 'Dashboard', icon: LayoutDashboard },
{ to: '/send', label: 'Send Money', icon: Send },
{ to: '/batch', label: 'Batch Payments', icon: Layers },
{ to: '/subscriptions', label: 'Subscriptions', icon: Repeat },
{ to: '/requests', label: 'Payment Requests', icon: FileText },
{ to: '/escrow', label: 'Escrow', icon: Lock },
{ to: '/history', label: 'History', icon: History },
{ to: '/settings', label: 'Settings', icon: Settings },
]
const externalLinks = [
{
href: 'https://stellar.org',
label: 'Stellar Network',
icon: ExternalLink,
},
{
href: 'https://stellar.expert',
label: 'Explorer',
icon: TrendingUp,
},
{
href: 'https://www.freighter.app',
label: 'Freighter Wallet',
icon: ExternalLink,
},
]
export function Sidebar() {
const { isConnected, publicKey, network, xlmBalance } = useWallet()
return (
<aside className="hidden lg:flex flex-col w-60 shrink-0 min-h-screen bg-navy-900 border-r border-navy-700/50">
{/* Primary nav */}
<nav className="flex-1 p-4 pt-6 space-y-1">
<p className="text-[10px] font-semibold uppercase tracking-widest text-slate-500 px-3 mb-2">
Navigation
</p>
{primaryLinks.map(({ to, label, icon: Icon }) => (
<NavLink
key={to}
to={to}
className={({ isActive }) =>
cn(
'group flex items-center gap-3 px-3 py-2.5 rounded-xl text-sm font-medium transition-all duration-150',
isActive
? 'bg-stellar-500/15 text-stellar-400 shadow-inner-glow'
: 'text-slate-400 hover:text-slate-200 hover:bg-white/5',
)
}
>
{({ isActive }) => (
<>
<Icon
size={17}
className={cn(
'shrink-0 transition-colors',
isActive ? 'text-stellar-400' : 'text-slate-500 group-hover:text-slate-300',
)}
/>
<span className="flex-1">{label}</span>
{isActive && (
<ChevronRight size={13} className="text-stellar-500 opacity-60" />
)}
</>
)}
</NavLink>
))}
{/* External links */}
<div className="pt-6">
<p className="text-[10px] font-semibold uppercase tracking-widest text-slate-500 px-3 mb-2">
Resources
</p>
{externalLinks.map(({ href, label, icon: Icon }) => (
<a
key={href}
href={href}
target="_blank"
rel="noopener noreferrer"
className="group flex items-center gap-3 px-3 py-2.5 rounded-xl text-sm font-medium text-slate-500 hover:text-slate-300 hover:bg-white/5 transition-all"
>
<Icon size={15} className="shrink-0" />
{label}
<ExternalLink size={11} className="ml-auto opacity-0 group-hover:opacity-50" />
</a>
))}
</div>
</nav>
{/* Wallet summary at bottom */}
{isConnected && publicKey && (
<div className="p-4 border-t border-navy-700/50">
<div className="rounded-xl bg-navy-800/60 border border-navy-600/40 p-3 space-y-2">
<div className="flex items-center justify-between">
<span className="text-xs font-medium text-slate-400">Wallet</span>
<NetworkBadge network={network} />
</div>
<p className="text-xs font-mono text-slate-300 truncate">
{truncateAddress(publicKey, 6)}
</p>
{xlmBalance && (
<p className="text-sm font-semibold text-white">
{formatXLM(xlmBalance)}
</p>
)}
</div>
</div>
)}
{/* Help */}
<div className="p-4 pt-0">
<a
href="https://stellar.org/learn"
target="_blank"
rel="noopener noreferrer"
className="flex items-center gap-2.5 px-3 py-2.5 rounded-xl text-xs text-slate-500 hover:text-slate-300 hover:bg-white/5 transition-all"
>
<HelpCircle size={14} />
Help & Documentation
</a>
</div>
</aside>
)
}