Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR Review: Ralph/account pageGood overall structure — the account page is well-organized with clear separation of concerns across components. A few issues worth addressing before merge. Bugs / Correctness1. const { data, isLoading } = useInfoUserFillsByTime({
user: address,
startTime: startTime ?? 0, // "all" range → startTime is undefined → sends 0
aggregateByTime: true,
});When 2. <PositionTableRow key={...} isEven={i % 2 === 1} ... />
3. return <ConnectedAccountView address={address as string} />;The Token / Design System Inconsistency
Tokens that need updating:
Examples in
4. Hyperliquid Data Principle5. Floating-point arithmetic on financial values ( Per availableValue += b.coin === DEFAULT_QUOTE_TOKEN ? available : (available / total) * usdValue;These are display-only values so the precision loss is minor, but for consistency with the codebase principles, financial calculations should use Minor6. Duplicate 7. const totalFunding = entries.reduce((acc, f) => acc + toNumberOrZero(f.delta.usdc), 0);Same float accumulation note as above; low severity for a summary display value. Overall this is solid work — the component structure is clean, mobile/desktop branching is consistent, and i18n coverage is thorough. Main asks: fix the |
Code Review — Account PageSolid feature addition — the account page covers a lot of ground (positions, balances, history, leverage settings) and the overall structure is clean. A few issues to address: Bugs / Correctness1. This PR adds // ❌ account-balances.tsx, account-page.tsx, account-positions.tsx
import { Skeleton } from "boneyard-js/react";
// ✓ account-history.tsx, account-leverage-settings.tsx
import { Skeleton } from "@/components/ui/skeleton";Use the local wrapper everywhere for consistency. 2. return <ConnectedAccountView address={address as string} />;The if (!address) return null;
return <ConnectedAccountView address={address} />;Hyperliquid Data Principle Violations3. Floating-point multiplication on API strings ( const total = toNumberOrZero(b.total); // string → number
const midPx = toNumberOrZero(mids?.[b.coin]); // string → number
usdValue = midPx > 0 ? total * midPx : ...; // raw JS multiplicationPer the project rules, use import Big from "big.js";
usdValue = Big(b.total).times(mids[b.coin]).toNumber();4. Premature Both const size = toBig(p.szi)?.toNumber() ?? Number.NaN;
const markPx = toBig(markPxRaw)?.toNumber() ?? Number.NaN;
const entryPx = toBig(p.entryPx)?.toNumber() ?? Number.NaN;
const unrealizedPnl = toBig(p.unrealizedPnl)?.toNumber() ?? Number.NaN;The formatters ( Code Style Violations5. Nested ternary in const colorClass =
status === "filled"
? "text-market-up bg-fill-success-weak"
: status === "open" || status === "triggered"
? "text-text-brand bg-fill-brand-weak" // ← nested ternary
: "text-text-weak bg-bg-alternate/50";Per code style rules, use a helper with early returns or an object map: function getStatusColorClass(status: string): string {
if (status === "filled") return "text-market-up bg-fill-success-weak";
if (status === "open" || status === "triggered") return "text-text-brand bg-fill-brand-weak";
return "text-text-weak bg-bg-alternate/50";
}6. Non-token decoration class in className="... decoration-dashed decoration-text-500/30"
Design Concerns7. Duplicate
Minor8. Service worker cache version — 9. Error toast + inline error state duplication ( |
No description provided.