Skip to content

Commit

Permalink
fix: address pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
vacekj committed Nov 9, 2024
1 parent bd65241 commit 4fb2bb3
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions src/pages/trade/ui/route-book.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,18 @@ import { Tabs } from '@penumbra-zone/ui/Tabs';

const SELL_BG_COLOR = 'rgba(175, 38, 38, 0.24)';
const BUY_BG_COLOR = 'rgba(28, 121, 63, 0.24)';
const BORDER_LIGHT = 'rgba(250,250,250,0.15)';
const BG_HOVER = 'rgba(250,250,250,0.05)';
const BORDER_DARK = '#262626';
const TEXT_SELL = '#F17878';
const TEXT_BUY = '#55D383';
const TEXT_WARNING = '#F49C43';
const TEXT_GRAY = 'text-gray-400';
const TEXT_RED = 'text-red-500';

const HopCount = ({ count }: { count: number }) => {
return (
<span className={count === 0 ? 'text-white' : 'text-[#F49C43]'}>
<span className={count === 0 ? 'text-white' : `text-[${TEXT_WARNING}]`}>
{count === 2 ? 'Direct' : `${count} Hops`}
</span>
);
Expand Down Expand Up @@ -46,8 +54,8 @@ const TradeRow = ({

return (
<tr
className={`group relative h-[33px] border-b border-[rgba(250,250,250,0.15)]
${showRoute ? 'bg-[rgba(250,250,250,0.05)]' : ''}`}
className={`group relative h-[33px] border-b border-[${BORDER_LIGHT}]
${showRoute ? `bg-[${BG_HOVER}]` : ''}`}
onClick={() => setShowRoute(prev => !prev)}
style={{
backgroundImage: `linear-gradient(to right, ${bgColor} ${relativeSize}%, transparent ${relativeSize}%)`,
Expand All @@ -61,7 +69,9 @@ const TradeRow = ({
<>
<td
className={
isSell ? 'text-[#F17878] text-xs relative' : 'text-[#55D383] text-xs relative'
isSell
? `text-[${TEXT_SELL}] text-xs relative`
: `text-[${TEXT_BUY}] text-xs relative`
}
>
{trace.price}
Expand Down Expand Up @@ -90,8 +100,8 @@ const RouteBookData = observer(({ bookData: { multiHops } }: { bookData: RouteBo
const buyRelativeSizes = calculateRelativeSizes(multiHops.buy);

return (
<div className='flex flex-col max-w-full border-y border-[#262626]'>
<div className='flex items-center gap-2 px-4 h-11 border-b border-[#262626]'>
<div className={`flex flex-col max-w-full border-y border-[${BORDER_DARK}]`}>
<div className={`flex items-center gap-2 px-4 h-11 border-b border-[${BORDER_DARK}]`}>
<Tabs
value={activeTab}
onChange={setActiveTab}
Expand Down Expand Up @@ -148,11 +158,11 @@ export const RouteBook = observer(() => {
const { data: bookData, isLoading: bookIsLoading, error: bookErr } = useBook();

if (bookIsLoading || !bookData) {
return <div className='text-gray-400'>Loading...</div>;
return <div className={TEXT_GRAY}>Loading...</div>;
}

if (bookErr) {
return <div className='text-red-500'>Error loading route book: {String(bookErr)}</div>;
return <div className={TEXT_RED}>Error loading route book: {String(bookErr)}</div>;
}

return <RouteBookData bookData={bookData} />;
Expand Down Expand Up @@ -193,9 +203,9 @@ const SpreadRow = ({ sellOrders, buyOrders }: { sellOrders: Trace[]; buyOrders:

return (
<tr>
<td colSpan={4} className='border-y border-[#262626]'>
<td colSpan={4} className={`border-y border-[${BORDER_DARK}]`}>
<div className='flex items-center justify-center gap-2 px-3 py-3 text-xs'>
<span className='text-[#55D383]'>{spreadInfo.midPrice}</span>
<span className={`text-[${TEXT_BUY}]`}>{spreadInfo.midPrice}</span>
<span className='text-gray-400'>Spread:</span>
<span className='text-white'>
{spreadInfo.amount} {pair.quoteSymbol}
Expand Down

0 comments on commit 4fb2bb3

Please sign in to comment.