Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
c3c0a80
feature: key value for address disable banner
vsevolod-zhuravlov Jan 13, 2026
59cb88e
fix: show wrap only for deposit & mint
vsevolod-zhuravlov Jan 13, 2026
aa24f44
fix: hide wrap preview on warning or erorr
vsevolod-zhuravlov Jan 13, 2026
1b19549
fix: window between input and preview
vsevolod-zhuravlov Jan 15, 2026
c6bbf72
fix: build error
vsevolod-zhuravlov Jan 15, 2026
9428014
fix: button blick issue
vsevolod-zhuravlov Jan 15, 2026
877c6f9
fix: insufficient balance blick
vsevolod-zhuravlov Jan 16, 2026
e1cfb2a
fix: remove unnecessary bool var
vsevolod-zhuravlov Jan 30, 2026
9bba083
fix: simplify reset logic
vsevolod-zhuravlov Jan 30, 2026
61a4bf0
fix: rewrite boolean logic
vsevolod-zhuravlov Jan 30, 2026
3719baf
fix: alternative fix
Cycxyz Feb 2, 2026
1e32866
Revert "fix: insufficient balance blick"
vsevolod-zhuravlov Feb 3, 2026
4e0c072
Merge branch 'alternative_insufficient_balance_blick' into fix/insuff…
vsevolod-zhuravlov Feb 3, 2026
4e613ae
fix: insufficient balance blick issue
vsevolod-zhuravlov Feb 3, 2026
97e19f3
Merge branch 'fix/hide-wrap-preview-on-error' into integration/order-…
vsevolod-zhuravlov Feb 11, 2026
dfed75e
Merge branch 'fix/window-between-input-and-preview' into integration/…
vsevolod-zhuravlov Feb 11, 2026
c7a9c20
Merge branch 'fix/insufficient-balance-blick' into integration/order-…
vsevolod-zhuravlov Feb 11, 2026
c013f26
Merge branch 'fix/button-blick-issue' into integration/order-test
vsevolod-zhuravlov Feb 11, 2026
d052675
Merge branch 'feature/key-value-disable-for-banner' into integration/…
vsevolod-zhuravlov Feb 11, 2026
31876b5
feature: disallow switching tabs while processing
vsevolod-zhuravlov Jan 13, 2026
59a1574
fix: refreshBalances try catch
vsevolod-zhuravlov Jan 30, 2026
263492f
fix: rewrite tabs component to more simple props
vsevolod-zhuravlov Feb 10, 2026
cf23e58
fix: is input zero or nan
vsevolod-zhuravlov Jan 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/components/actions/ActionHandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export default function ActionHandler({ actionType, tokenType }: ActionHandlerPr
const displayTokenSymbol = config.usesShares ? sharesSymbol : formatTokenSymbol(tokenSymbol);
const displayDecimals = config.usesShares ? sharesDecimals : tokenDecimals;

const { isLoadingPreview, previewData, receive, provide } = useActionPreview({
const { previewData, receive, provide } = useActionPreview({
amount,
actionType,
tokenType,
Expand Down Expand Up @@ -314,7 +314,6 @@ export default function ActionHandler({ actionType, tokenType }: ActionHandlerPr
<PreviewBox
receive={receive}
provide={provide}
isLoading={isLoadingPreview}
title="Transaction Preview"
/>
) : undefined
Expand Down
3 changes: 1 addition & 2 deletions src/components/actions/SafeActionHandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export default function SafeActionHandler({ actionType, tokenType }: SafeActionH
const displayTokenSymbol = config.usesShares ? sharesSymbol : formatTokenSymbol(tokenSymbol);
const displayDecimals = config.usesShares ? sharesDecimals : tokenDecimals;

const { isLoadingPreview, previewData, receive, provide } = useActionPreview({
const { previewData, receive, provide } = useActionPreview({
amount,
actionType,
tokenType,
Expand Down Expand Up @@ -458,7 +458,6 @@ export default function SafeActionHandler({ actionType, tokenType }: SafeActionH
<PreviewBox
receive={receive}
provide={provide}
isLoading={isLoadingPreview}
title="Transaction Preview"
/>
) : undefined
Expand Down
3 changes: 0 additions & 3 deletions src/components/ui/PreviewBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@ export interface PreviewItem {
interface PreviewBoxProps {
receive: PreviewItem[];
provide: PreviewItem[];
isLoading: boolean;
title?: string;
}

export const PreviewBox: React.FC<PreviewBoxProps> = ({
receive,
provide,
isLoading,
title = 'Preview'
}) => {
const {
Expand Down Expand Up @@ -61,7 +59,6 @@ export const PreviewBox: React.FC<PreviewBoxProps> = ({
<div className="flex items-center space-x-2">
<div className="w-2 h-2 bg-blue-500 rounded-full"></div>
<h4 className="text-sm font-semibold text-gray-900">{title}</h4>
<span className="text-sm text-gray-500">{isLoading && " (Loading...)"}</span>
</div>
<div className="space-y-4">
{provide.length > 0 && (
Expand Down
88 changes: 30 additions & 58 deletions src/components/ui/Tabs.tsx
Original file line number Diff line number Diff line change
@@ -1,77 +1,49 @@
import { ActionType } from '@/types/actions';

interface TabItem<T> {
value: T;
label: string;
}

interface TabsPropsGeneric<T extends string> {
interface TabsProps<T extends string> {
activeTab: T;
setActiveTab: React.Dispatch<React.SetStateAction<T>>;
setActiveTab: React.Dispatch<React.SetStateAction<T>> | ((tab: T) => void);
tabs: TabItem<T>[];
isProcessing?: boolean;
className?: string;
}

interface TabsPropsAction {
activeTab: ActionType;
setActiveTab: React.Dispatch<React.SetStateAction<ActionType>>;
tabs?: never;
className?: string;
}

type TabsProps<T extends string = ActionType> = T extends ActionType
? TabsPropsAction
: TabsPropsGeneric<T>;

export default function Tabs<T extends string = ActionType>({
activeTab,
setActiveTab,
export default function Tabs<T extends string>({
activeTab,
setActiveTab,
tabs,
className
}: TabsProps<T> | TabsPropsGeneric<T>) {
isProcessing,
className,
}: TabsProps<T>) {
const safeSetActiveTab = (tab: T) => {
if (isProcessing && tab !== activeTab) return;
setActiveTab(tab);
};

const tabClass = (tab: T) =>
`flex-1 py-2 px-4 rounded-lg font-medium transition-colors focus:outline-none focus:ring-0 ${activeTab === tab
? 'bg-indigo-600 text-white'
: 'bg-gray-100 text-gray-700 hover:bg-gray-200'
`flex-1 py-2 px-4 rounded-lg font-medium transition-colors focus:outline-none focus:ring-0 ${isProcessing && tab !== activeTab
? 'bg-gray-200 text-gray-400 cursor-not-allowed opacity-60 border-0'
: activeTab === tab
? 'bg-indigo-600 text-white'
: 'bg-gray-100 text-gray-700 hover:bg-gray-200'
}`;

// If custom tabs are provided, use them
if (tabs) {
return (
<div className={`${className ?? ''}`}>
<div className="flex space-x-2">
{tabs.map((tab) => (
<button
key={tab.value}
onClick={() => setActiveTab(tab.value as any)}
className={tabClass(tab.value as T)}
>
{tab.label}
</button>
))}
</div>
</div>
);
}

// Default action tabs layout
return (
<div className={`${className ?? ''}`}>
<div className="flex space-x-4 mb-3">
<button onClick={() => setActiveTab('deposit' as any)} className={tabClass('deposit' as T)}>
Deposit
</button>
<button onClick={() => setActiveTab('redeem' as any)} className={tabClass('redeem' as T)}>
Redeem
</button>
</div>
<div className="flex space-x-4">
<button onClick={() => setActiveTab('mint' as any)} className={tabClass('mint' as T)}>
Mint
</button>
<button onClick={() => setActiveTab('withdraw' as any)} className={tabClass('withdraw' as T)}>
Withdraw
</button>
<div className={tabs.length === 4 ? "grid grid-cols-2 gap-2" : "flex space-x-2"}>
{tabs.map((tab) => (
<button
key={tab.value}
onClick={() => safeSetActiveTab(tab.value)}
className={tabClass(tab.value)}
disabled={isProcessing && tab.value !== activeTab}
>
{tab.label}
</button>
))}
</div>
</div>
);
Expand Down
7 changes: 6 additions & 1 deletion src/components/vault/Actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Tabs from '@/components/ui/Tabs';
import ActionWrapper from '@/components/actions/ActionWrapper';
import { ActionType } from '@/types/actions';
import DexLink from './DexLink';
import { ACTIONS_TABS } from '@/constants';

interface ActionsProps {
isSafe?: boolean;
Expand All @@ -13,7 +14,11 @@ export default function Actions({ isSafe = false }: ActionsProps) {

return (
<div className="bg-gray-50 rounded-lg p-4">
<Tabs activeTab={activeTab} setActiveTab={setActiveTab} />
<Tabs
activeTab={activeTab}
setActiveTab={setActiveTab}
tabs={ACTIONS_TABS}
/>
<ActionWrapper actionType={activeTab} isSafe={isSafe} />
<DexLink />
</div>
Expand Down
17 changes: 3 additions & 14 deletions src/components/vault/ActionsDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ import Tabs from '@/components/ui/Tabs';
import ActionWrapper from '@/components/actions/ActionWrapper';
import { ActionType } from '@/types/actions';
import DexLink from './DexLink';
import { ACTIONS_TABS } from '@/constants';

interface ActionsProps {
isSafe?: boolean;
}

export default function ActionsDropdown({ isSafe = false } : ActionsProps ) {
export default function ActionsDropdown({ isSafe = false }: ActionsProps) {
const [isOpen, setIsOpen] = useState(false);
const [activeTab, setActiveTab] = useState<ActionType>('deposit');

Expand All @@ -33,22 +34,10 @@ export default function ActionsDropdown({ isSafe = false } : ActionsProps ) {
className={`transition-all duration-200 overflow-hidden ${isOpen ? 'max-h-[2000px] opacity-100 p-3' : 'max-h-0 opacity-0 pb-0'
}`}
>
<Tabs activeTab={activeTab} setActiveTab={setActiveTab} />
<Tabs activeTab={activeTab} setActiveTab={setActiveTab} tabs={ACTIONS_TABS} />
<ActionWrapper actionType={activeTab} isSafe={isSafe} />
<DexLink />
</div>
</div>
);
}

export function Actions({ isSafe = false }: ActionsProps) {
const [activeTab, setActiveTab] = useState<ActionType>('deposit');

return (
<div className="bg-gray-50 rounded-lg p-4">
<Tabs activeTab={activeTab} setActiveTab={setActiveTab} />
<ActionWrapper actionType={activeTab} isSafe={isSafe} />
<DexLink />
</div>
);
}
6 changes: 0 additions & 6 deletions src/components/vault/AuctionHandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export default function AuctionHandler({ futureBorrowAssets, futureCollateralAss
const [loading, setLoading] = useState(false);
const [error, setError] = useState<string | null>(null);
const [success, setSuccess] = useState<string | null>(null);
const [isLoadingPreview, setIsLoadingPreview] = useState(false);
const [isLoadingMax, setIsLoadingMax] = useState(false);

const [previewData, setPreviewData] = useState<{
Expand Down Expand Up @@ -148,8 +147,6 @@ export default function AuctionHandler({ futureBorrowAssets, futureCollateralAss
return;
}

setIsLoadingPreview(true);

try {
let result: bigint;

Expand All @@ -169,8 +166,6 @@ export default function AuctionHandler({ futureBorrowAssets, futureCollateralAss
} catch (err) {
console.error('Error loading preview:', err);
setPreviewData(null);
} finally {
setIsLoadingPreview(false);
}
};

Expand Down Expand Up @@ -345,7 +340,6 @@ export default function AuctionHandler({ futureBorrowAssets, futureCollateralAss
<PreviewBox
receive={receive}
provide={provide}
isLoading={isLoadingPreview}
title="Auction Preview"
/>
);
Expand Down
13 changes: 11 additions & 2 deletions src/components/vault/FlashLoanDepositWithdraw.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export default function FlashLoanDepositWithdraw() {

const [isOpen, setIsOpen] = useState(false);
const [activeTab, setActiveTab] = useState<ActionType>(availableTabs[0]?.value || 'deposit');
const [isProcessing, setIsProcessing] = useState(false);

if (availableTabs.length === 0) {
return null;
Expand Down Expand Up @@ -52,10 +53,18 @@ export default function FlashLoanDepositWithdraw() {
>
{availableTabs.length > 1 && (
<div className="mb-3">
<Tabs activeTab={activeTab} setActiveTab={setActiveTab} tabs={availableTabs} />
<Tabs
activeTab={activeTab}
setActiveTab={setActiveTab}
tabs={availableTabs}
isProcessing={isProcessing}
/>
</div>
)}
<FlashLoanDepositWithdrawHandler actionType={activeTab} />
<FlashLoanDepositWithdrawHandler
actionType={activeTab}
setIsProcessing={setIsProcessing}
/>
</div>
</div>
);
Expand Down
13 changes: 11 additions & 2 deletions src/components/vault/FlashLoanDepositWithdrawForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default function FlashLoanDepositWithdrawForm() {
]

const [activeTab, setActiveTab] = useState<ActionType>(tabs[0]?.value || 'deposit');
const [isProcessing, setIsProcessing] = useState(false);

return (
<div className="relative rounded-lg bg-gray-50 mb-4">
Expand All @@ -19,10 +20,18 @@ export default function FlashLoanDepositWithdrawForm() {
>
{tabs.length > 1 && (
<div className="mb-3">
<Tabs activeTab={activeTab} setActiveTab={setActiveTab} tabs={tabs} />
<Tabs
activeTab={activeTab}
setActiveTab={setActiveTab}
tabs={tabs}
isProcessing={isProcessing}
/>
</div>
)}
<FlashLoanDepositWithdrawHandler actionType={activeTab} />
<FlashLoanDepositWithdrawHandler
actionType={activeTab}
setIsProcessing={setIsProcessing}
/>
</div>
</div>
);
Expand Down
Loading