mirror of
https://github.com/labrinyang/lp-terminal.git
synced 2026-07-29 05:57:43 +00:00
bca538e7e3
One commit because the pieces do not compile apart: the shared copy, the tab shell and the data layer all changed together, and splitting them further would mean inventing intermediate states that never existed. SHEEP CHOICE — the terminal's own swap. Quotes come from a solver that splits one trade across several pools instead of forcing it down a single path, and returns a ready-to-sign Settler transaction; the UI draws the split leg by leg and scores every venue against one shared fee-free baseline, so the card that says it pays most actually does. The Kyber transaction path is gone — Kyber is read-only USD valuation now, and there is no Kyber calldata to sign. BRIDGE — deposits from other chains over Relay, Across and the native portal, priced side by side and sorted by what actually reaches you. No fee on any of them. In-flight transfers get a countdown and survive a reload. ZAP — add liquidity holding neither side of the pair; whatever needs swapping is done in the same flow, with an optional stake-after step. Uniswap V2 liquidity now shows up under POSITIONS. Swaps in flight are persisted, so a refresh mid-swap no longer loses the transaction. Pair labels copy their token and pool addresses, and jump to DexScreener. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
39 lines
1.5 KiB
TypeScript
39 lines
1.5 KiB
TypeScript
import { useState, useSyncExternalStore } from 'react'
|
|
import { useTranslation } from 'react-i18next'
|
|
import { txlog } from '../lib/txlog'
|
|
import { TxLogPanel } from './TxLogPanel'
|
|
|
|
// The terminal activity log lives here now — a header button, not a footer
|
|
// panel. Collapsed by default; the button still surfaces live tx state (count +
|
|
// a pulse while something is pending) so feedback isn't lost when it's closed.
|
|
export function HistoryButton() {
|
|
const { t } = useTranslation()
|
|
const [open, setOpen] = useState(false)
|
|
const lines = useSyncExternalStore(txlog.subscribe, txlog.get)
|
|
const pending = lines.some((l) => l.kind === 'pending')
|
|
// surface the latest failure even while collapsed — the always-on panel that
|
|
// used to show reverts inline is gone, so the button has to carry that signal
|
|
const failed = !pending && lines[lines.length - 1]?.kind === 'err'
|
|
|
|
return (
|
|
<div className="hist">
|
|
<button
|
|
className={`hist-btn ${open ? 'on' : ''} ${pending ? 'pending' : ''} ${failed ? 'failed' : ''}`}
|
|
onClick={() => setOpen(!open)}
|
|
title={t('hdr.historyTip')}
|
|
>
|
|
{pending ? '⧗' : failed ? '✗' : '≡'} <span className="hide-m">{t('hdr.history')}</span>
|
|
{lines.length > 0 && <span className="hist-n">{lines.length}</span>}
|
|
</button>
|
|
{open && (
|
|
<>
|
|
<div className="tsel-backdrop" onClick={() => setOpen(false)} />
|
|
<div className="hist-pop">
|
|
<TxLogPanel />
|
|
</div>
|
|
</>
|
|
)}
|
|
</div>
|
|
)
|
|
}
|