refactor(frontend): simplify wallet navigation and remove emoji labels

- Keep only HD Wallet and Single Addresses in sidebar
- Route single addresses through internal tabs
- Replace emoji/button glyphs with plain text labels
This commit is contained in:
2026-03-09 14:43:36 +01:00
parent ca133132f6
commit 506741c559
6 changed files with 13 additions and 35 deletions

View File

@@ -2,17 +2,13 @@ import { useState } from 'react'
import Sidebar from './components/Sidebar'
import HDWallet from './components/HDWallet'
import SingleAddress from './components/SingleAddress'
import DecryptWallet from './components/DecryptWallet'
const SINGLE_ADDRESS_PAGES = ['p2pkh', 'p2wpkh', 'p2tr', 'p2pk', 'p2sh']
export default function App() {
const [page, setPage] = useState('hd')
const renderPage = () => {
if (page === 'hd') return <HDWallet />
if (SINGLE_ADDRESS_PAGES.includes(page)) return <SingleAddress initialTab={page} key={page} />
if (page === 'decrypt') return <DecryptWallet />
if (page === 'single') return <SingleAddress />
return null
}

View File

@@ -12,7 +12,7 @@ export default function CopyButton({ text, label = 'Copy' }) {
return (
<button className="btn btn-ghost btn-icon" onClick={handle} title="Copy to clipboard">
{copied ? '' : '⎘'}
{copied ? 'Done' : label}
</button>
)
}

View File

@@ -56,7 +56,7 @@ export default function DecryptWallet() {
<div style={{ display: 'flex', gap: 12, alignItems: 'center', marginBottom: 16 }}>
<button className="btn btn-secondary" onClick={() => fileRef.current.click()}>
📂 Choose file
Choose file...
</button>
{fileName && <span style={{ color: 'var(--text-dim)', fontSize: 13 }}>{fileName}</span>}
<input ref={fileRef} type="file" accept=".json" style={{ display: 'none' }} onChange={onFile} />
@@ -81,7 +81,7 @@ export default function DecryptWallet() {
</div>
<button className="btn btn-primary" onClick={decrypt} disabled={loading || !wallet}>
{loading ? <><span className="spinner" /> Decrypting</> : '🔓 Decrypt'}
{loading ? <><span className="spinner" /> Decrypting</> : 'Decrypt'}
</button>
</div>
@@ -95,7 +95,7 @@ export default function DecryptWallet() {
<div className="btn-row">
<CopyButton text={ks.seed} />
<button className="btn btn-ghost btn-icon" onClick={() => setSeedVisible(v => !v)}>
{seedVisible ? '🙈' : '👁'}
{seedVisible ? 'Hide' : 'Show'}
</button>
</div>
</div>

View File

@@ -112,7 +112,7 @@ export default function HDWallet() {
<input className="form-input" type="password" placeholder="Optional passphrase" value={form.passphrase} onChange={e => set('passphrase', e.target.value)} />
</div>
<button className="btn btn-primary" onClick={generate} disabled={loading}>
{loading ? <><span className="spinner" /> Generating</> : 'Generate Wallet'}
{loading ? <><span className="spinner" /> Generating</> : 'Generate Wallet'}
</button>
</div>
@@ -126,7 +126,7 @@ export default function HDWallet() {
<div className="btn-row">
<CopyButton text={ks.seed} />
<button className="btn btn-ghost btn-icon" onClick={() => setSeedVisible(v => !v)}>
{seedVisible ? '🙈' : '👁'}
{seedVisible ? 'Hide' : 'Show'}
</button>
</div>
</div>
@@ -205,7 +205,7 @@ export default function HDWallet() {
</div>
<div className="btn-row">
<button className="btn btn-secondary" onClick={saveWallet} disabled={saving}>
{saving ? <><span className="spinner" style={{borderTopColor:'var(--text)'}} /> Saving</> : '💾 Download JSON'}
{saving ? <><span className="spinner" style={{borderTopColor:'var(--text)'}} /> Saving</> : 'Download JSON'}
</button>
</div>
{saveMsg && (

View File

@@ -1,11 +1,6 @@
const PAGES = [
{ id: 'hd', label: 'HD Wallet', icon: '◈', badge: 'BIP-32/39' },
{ id: 'p2pkh', label: 'P2PKH', icon: '①', badge: 'Legacy' },
{ id: 'p2wpkh', label: 'P2WPKH', icon: '⚡', badge: 'SegWit v0' },
{ id: 'p2tr', label: 'P2TR', icon: '◆', badge: 'Taproot' },
{ id: 'p2pk', label: 'P2PK', icon: '🔑', badge: 'Legacy' },
{ id: 'p2sh', label: 'P2SH', icon: '③', badge: 'Multisig' },
{ id: 'decrypt',label: 'Decrypt', icon: '🔓', badge: null },
{ id: 'hd', label: 'HD Wallet' },
{ id: 'single', label: 'Single Addresses' },
]
export default function Sidebar({ active, onSelect }) {
@@ -21,18 +16,7 @@ export default function Sidebar({ active, onSelect }) {
</div>
<nav className="sidebar-nav">
<div className="sidebar-section">Wallet</div>
{PAGES.slice(0, 1).map(p => (
<NavItem key={p.id} page={p} active={active} onSelect={onSelect} />
))}
<div className="sidebar-section">Addresses</div>
{PAGES.slice(1, 6).map(p => (
<NavItem key={p.id} page={p} active={active} onSelect={onSelect} />
))}
<div className="sidebar-section">Tools</div>
{PAGES.slice(6).map(p => (
{PAGES.map(p => (
<NavItem key={p.id} page={p} active={active} onSelect={onSelect} />
))}
</nav>
@@ -46,9 +30,7 @@ function NavItem({ page, active, onSelect }) {
className={`nav-item${active === page.id ? ' active' : ''}`}
onClick={() => onSelect(page.id)}
>
<span>{page.icon}</span>
<span>{page.label}</span>
{page.badge && <span className="badge">{page.badge}</span>}
</button>
)
}

View File

@@ -109,7 +109,7 @@ export default function SingleAddress({ initialTab = 'p2pkh' }) {
)}
<button className="btn btn-primary" onClick={generate} disabled={loading}>
{loading ? <><span className="spinner" /> Generating</> : 'Generate'}
{loading ? <><span className="spinner" /> Generating</> : 'Generate'}
</button>
</div>
@@ -134,7 +134,7 @@ export default function SingleAddress({ initialTab = 'p2pkh' }) {
</div>
</div>
<button className="btn btn-secondary" onClick={save} disabled={saving}>
{saving ? <><span className="spinner" style={{borderTopColor:'var(--text)'}} /> Saving</> : '💾 Save JSON'}
{saving ? <><span className="spinner" style={{borderTopColor:'var(--text)'}} /> Saving</> : 'Save JSON'}
</button>
{saveMsg && (
<div className={`alert ${saveMsg.startsWith('Error') ? 'alert-error' : 'alert-success'}`} style={{ marginTop: 12, marginBottom: 0 }}>