Skip to content
Merged

Tali #40

Show file tree
Hide file tree
Changes from all commits
Commits
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: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts

# Sentry Config File
.env.sentry-build-plugin
8 changes: 8 additions & 0 deletions .vscode/mcp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"servers": {
"Sentry": {
"url": "https://mcp.sentry.dev/mcp/velo-7b/javascript-nextjs",
"type": "http"
}
}
}
2 changes: 1 addition & 1 deletion components/dashboard/mobile-bottom-nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function MobileBottomNav({ activeTab, setActiveTab }: MobileBottomNavProp

return (
<div className="fixed bottom-0 left-0 right-0 z-50 bg-background/95 backdrop-blur-md border-t border-border/50 lg:hidden shadow-2xl">
<div className="flex items-center justify-around px-2 py-3 max-w-md mx-auto">
<div className="flex items-center justify-around px-2 py-3 max-w-md mx-auto overflow-auto">
{navItems.map((item, index) => (
<Button
key={index}
Expand Down
8 changes: 4 additions & 4 deletions components/dashboard/quick-actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ const actions = [

export function QuickActions({ setTab }: quickActionProps) {
return (
<Card className="border-border/50 mb-8 bg-card/50 backdrop-blur-sm">
<Card className="border-border/50 mb-8 p-2 md:p-4 bg-card/50 backdrop-blur-sm">
<CardHeader>
<CardTitle className="text-xl">Quick Actions</CardTitle>
</CardHeader>
<CardContent>
<div className="grid gap-4 sm:grid-cols-2 lg:grid-cols-4">
<CardContent className="p-0">
<div className="grid w-full sm:gap-4 grid-cols-2 gap-2 sm:grid-cols-2 md:grid-cols-4">
{actions.map((action) => {
const Icon = action.icon;
return (
Expand All @@ -63,7 +63,7 @@ export function QuickActions({ setTab }: quickActionProps) {
</div>
<div className="text-center">
<div className="font-semibold text-sm">{action.title}</div>
<div className="text-xs text-muted-foreground mt-1">
<div className="text-[10px] sm:text-xs text-muted-foreground mt-1">
{action.description}
</div>
</div>
Expand Down
10 changes: 5 additions & 5 deletions components/dashboard/stats-cards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,26 +110,26 @@ export function StatsCards({
});

return (
<div className="grid gap-6 mb-6 md:grid-cols-2 lg:grid-cols-4">
<div className="grid grid-cols-2 md:gap-6 gap-1 mb-6 md:grid-cols-4 lg:grid-cols-4">
{updatedStats.map((stat, index) => (
<Card
className="border-border/50 bg-card/50 relative backdrop-blur-sm"
className="border-border/50 bg-card/50 relative backdrop-blur-sm p-2"
key={index}
>
{stat.title === "Total Balance" && (
<Button
onClick={handleViewBalance}
variant="secondary"
size="sm"
className="mt-2 w-fit absolute top-0 right-2"
className="mt-2 w-fit absolute bottom-2 right-2"
>
{hideBalalance ? <EyeClosed size={14} /> : <Eye size={14} />}
</Button>
)}

<div className="relative rounded-lg overflow-hidden">
<div className={``} />
<div className="p-6 relative">
<div className="md:p-6 p-2 relative">
<div className="flex items-center justify-between">
<div className="space-y-2 w-full">
<div className="flex items-center justify-between w-full">
Expand All @@ -144,7 +144,7 @@ export function StatsCards({
-------
</div>
) : (
<p className="text-2xl font-bold text-balance">
<p className=" font-bold text-balance">
{stat.value}
</p>
)}
Expand Down
15 changes: 8 additions & 7 deletions components/dashboard/tabs/dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,20 @@ export default function DashboardHome({ activeTab }: DashboardProps) {
/>

{/* Quick Actions */}
<QuickActions setTab={activeTab} />
<div className="space-y-4 lg:col-span-2 lg:space-y-6">
<WalletOverview
handleViewBalance={handleViewBalance}
hideBalalance={hideBalalance}
/>{" "}
</div>

{/* Main Content Grid */}
<div className="grid gap-4 lg:gap-6 lg:grid-cols-5">
<QuickActions setTab={activeTab} />

<div className="lg:col-span-3 space-y-4 lg:space-y-6">
<RecentActivity activeTab={activeTab} />
</div>
<div className="space-y-4 lg:col-span-2 lg:space-y-6">
<WalletOverview
handleViewBalance={handleViewBalance}
hideBalalance={hideBalalance}
/>{" "}
</div>
</div>

{/* Bottom CTA */}
Expand Down
4 changes: 2 additions & 2 deletions components/dashboard/tabs/send-funds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ export default function SendFunds() {
}, [addresses, selectedToken]);

const currentNetwork = useMemo(() => {
if (!addresses) return "mainnet";
if (!addresses) return "testnet";
const addressInfo = addresses.find((addr) => addr.chain === selectedToken);
return addressInfo?.network || "mainnet";
return addressInfo?.network || "testnet";
}, [addresses, selectedToken]);

// Check if selected token has a wallet
Expand Down
52 changes: 7 additions & 45 deletions components/dashboard/wallet-overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export function WalletOverview({

return (
<Card className="border-border/50 mb-8 bg-card/50 w-full max-h-132 overflow-y-scroll backdrop-blur-sm">
<CardHeader className="flex flex-row items-center justify-between pb-4">
{/* <CardHeader className="flex flex-row items-center justify-between pb-4">
<CardTitle className="text-lg lg:text-xl font-semibold">
Wallet Overview
</CardTitle>
Expand All @@ -115,13 +115,13 @@ export function WalletOverview({
Manage
<ChevronRight size={16} className="ml-1" />
</Button>
</CardHeader>
</CardHeader> */}

<CardContent className="space-y-3 lg:space-y-4">
<CardContent className="space-y-3 lg:space-y-4 grid grid-cols-2 md:grid-cols-4 gap-2 lg-gap-6 p-4">
{walletData?.map((wallet, index) => (
<div
key={index}
className="flex items-center justify-between p-3 lg:p-4 rounded-lg bg-muted/30 hover:bg-muted/50 transition-colors"
className="flex items-start gap-3 justify-between p-3 flex-col lg:p-4 rounded-lg bg-muted/30 hover:bg-muted/50 transition-colors"
>
<div className="flex items-center gap-3 flex-1 min-w-0">
<div className="w-8 h-8 lg:w-10 lg:h-10 rounded-full bg-primary bg-opacity-10 flex items-center justify-center flex-shrink-0">
Expand All @@ -142,12 +142,12 @@ export function WalletOverview({
</span>
</div>
<div className="min-w-0 flex-1">
<p className="font-medium text-xs lg:text-sm capitalize truncate">
{/* <p className="font-medium text-xs lg:text-sm capitalize truncate">
{wallet.chain}
</p>
<p className="text-xs text-muted-foreground">
{shortenAddress(wallet.address as `0x${string}`, 6)}
</p>
</p> */}
{walletData.length === 0 ? (
<Skeleton className="h-4 w-20 mt-1 bg-gray-300" />
) : (
Expand All @@ -174,51 +174,13 @@ export function WalletOverview({
</p>
)}

<div className="flex items-center gap-2 ">
<Button
onClick={handleViewBalance}
variant="secondary"
size="sm"
className="mt-2"
>
{hideBalalance ? (
<EyeClosed size={14} />
) : (
<Eye size={14} />
)}
</Button>
<Button
onClick={() => handleCopyAddress(wallet.address as `0x${string}`)}
variant="secondary"
size="sm"
className="mt-2"
>
{copiedAddress === wallet.address ? (
<Check size={14} />
) : (
<Copy size={14} />
)}
</Button>
</div>
</>
)}
</div>
</div>
))}

{/* Total Balance Summary */}
{breakdown.length > 0 && (
<div className="mt-4 pt-4 border-t border-border/50">
<div className="flex justify-between items-center">
<span className="text-sm font-medium">Total Value:</span>
<span className="text-lg font-bold text-green-600">
{formatNGN(
breakdown.reduce((sum, item) => sum + item.ngnValue, 0)
)}
</span>
</div>
</div>
)}

</CardContent>
</Card>
);
Expand Down
8 changes: 4 additions & 4 deletions components/hooks/useTokenBalance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ export function useTokenBalance() {

const getWalletNetwork = useCallback(
(chain: string): string => {
if (!addresses || !Array.isArray(addresses)) return "mainnet";
if (!addresses || !Array.isArray(addresses)) return "testnet";
const key = normalizeChain(chain);
const addressInfo = addresses.find((addr) => normalizeChain(addr.chain) === key);
return addressInfo?.network || "mainnet";
return addressInfo?.network || "testnet";
},
[addresses, normalizeChain]
);
Expand Down Expand Up @@ -156,7 +156,7 @@ export function useTokenBalance() {
name: getTokenName(chainKey),
symbol: entry.symbol || getTokenSymbol(chainKey),
address: entry.address || "",
network: entry.network || "mainnet",
network: entry.network || "testnet",
balance: typeof entry.balance === "number" ? entry.balance : 0,
ngnValue: entry.ngnValue || 0,
hasWallet: !!entry.address,
Expand All @@ -176,7 +176,7 @@ export function useTokenBalance() {
name: getTokenName(chain),
symbol: match.symbol || getTokenSymbol(chain),
address: match.address || "",
network: match.network || "mainnet",
network: match.network || "testnet",
balance: parseFloat(match.balance || "0") || 0,
ngnValue: 0,
hasWallet: !!match.address,
Expand Down
8 changes: 4 additions & 4 deletions lib/api-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ class ApiClient {
// Wallet methods
async getWalletAddresses(): Promise<WalletAddress[]> {
return this.request<{ addresses: WalletAddress[] }>(
"/wallet/addresses/mainnet",
"/wallet/addresses/testnet",
{ method: "GET" },
{
// Increase TTL to reduce repeated slow calls - addresses rarely change
Expand All @@ -387,7 +387,7 @@ class ApiClient {

async getWalletBalances(): Promise<WalletBalance[]> {
return this.request<{ balances: WalletBalance[] }>(
"/wallet/balances/mainnet",
"/wallet/balances/testnet",
{ method: "GET" },
{
// Increase balance TTL so UI doesn't hammer slow backend; balances
Expand All @@ -405,7 +405,7 @@ class ApiClient {
});

// Invalidate balance cache after sending transaction
this.cache.invalidateCache(["/wallet/balances/mainnet"]);
this.cache.invalidateCache(["/wallet/balances/testnet"]);
return result;
}

Expand Down Expand Up @@ -668,7 +668,7 @@ class ApiClient {

async checkDeploy(): Promise<DepositCheckResponse> {
return this.request<DepositCheckResponse>(
"/checkdeploy/balances/mainnet/deploy",
"/checkdeploy/balances/testnet/deploy",
{
method: "GET",
},
Expand Down
1 change: 1 addition & 0 deletions next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ const nextConfig = {
}

module.exports = nextConfig

17 changes: 14 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.