Skip to content

Commit 6641ccf

Browse files
feat(web3): add view ledger button to view transactions history
1 parent aa9f69b commit 6641ccf

9 files changed

Lines changed: 640 additions & 174 deletions

File tree

services/frontend/app/dashboard/page.tsx

Lines changed: 66 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@ import AnimatedButton from "@/components/ui/AnimatedButton";
1212
import StatCard from "@/components/ui/StatCard";
1313
import TrustScoreRing from "@/components/ui/TrustScoreRing";
1414
import { useAuth } from "@/hooks/useAuth";
15+
import {
16+
BarChart3,
17+
CircleDollarSign,
18+
ShieldCheck,
19+
Wallet,
20+
Copy,
21+
Building2,
22+
ChevronRight,
23+
ExternalLink,
24+
} from "lucide-react";
1525
import {
1626
upsertProfile,
1727
getProfile,
@@ -376,15 +386,15 @@ function Overview() {
376386
label="Active Funds"
377387
value={funds.length}
378388
delay={0.05}
379-
icon={<span>📊</span>}
389+
icon={<BarChart3 size={16} />}
380390
accent="#60a5fa"
381391
/>
382392
<StatCard
383393
label="Contributions"
384394
value={contribs.length}
385395
suffix="paid"
386396
delay={0.1}
387-
icon={<span>💰</span>}
397+
icon={<CircleDollarSign size={16} />}
388398
accent="#f59e0b"
389399
/>
390400
{risk ? (
@@ -452,7 +462,7 @@ function Overview() {
452462
label="Trust Score"
453463
value="—"
454464
delay={0.15}
455-
icon={<span>🛡️</span>}
465+
icon={<ShieldCheck size={16} />}
456466
accent="#22c55e"
457467
/>
458468
)}
@@ -464,32 +474,63 @@ function Overview() {
464474
<div style={{ display: "flex", flexWrap: "wrap", justifyContent: "space-between", alignItems: "center", gap: 16 }}>
465475
<div style={{ flex: 1, minWidth: 200 }}>
466476
<div style={{ display: "flex", alignItems: "center", gap: 6, marginBottom: 8 }}>
467-
<span style={{ fontSize: 14 }}>👛</span>
477+
<Wallet size={14} />
468478
<span style={{ fontSize: 10, fontWeight: 700, color: "var(--color-text-muted)", textTransform: "uppercase", letterSpacing: 1 }}>Your Custodial Wallet</span>
469479
</div>
470480
<div style={{ display: "flex", alignItems: "center", gap: 8, background: "var(--color-bg-subtle)", padding: "8px 12px", borderRadius: 8, boxShadow: "inset 0 1px 3px rgba(0,0,0,0.2)" }}>
471481
<code style={{ fontSize: 12, color: "var(--color-text-secondary)", fontFamily: "monospace", overflow: "hidden", textOverflow: "ellipsis" }}>
472482
{wallet?.address || "Loading..."}
473483
</code>
474484
{wallet?.address && (
475-
<button
476-
onClick={() => {
477-
navigator.clipboard.writeText(wallet.address);
478-
alert("Address copied to clipboard!");
479-
}}
480-
style={{ background: "transparent", border: "none", cursor: "pointer", fontSize: 14, opacity: 0.6, padding: 4 }}
481-
title="Copy Address"
482-
>
483-
📋
484-
</button>
485+
<div style={{ display: "flex", alignItems: "center", gap: 4 }}>
486+
<button
487+
onClick={() => {
488+
navigator.clipboard.writeText(wallet.address);
489+
alert("Address copied to clipboard!");
490+
}}
491+
style={{ background: "transparent", border: "none", cursor: "pointer", fontSize: 14, opacity: 0.6, padding: 4, color: "var(--color-text)" }}
492+
title="Copy Address"
493+
>
494+
<Copy size={14} />
495+
</button>
496+
<a
497+
href={`https://amoy.polygonscan.com/address/${wallet.address}#tokentxns`}
498+
target="_blank"
499+
rel="noopener noreferrer"
500+
style={{
501+
fontSize: 10,
502+
fontWeight: 700,
503+
color: "var(--color-accent)",
504+
textDecoration: "none",
505+
padding: "6px 12px",
506+
borderRadius: 6,
507+
background: "rgba(249,115,22,0.1)",
508+
display: "inline-flex",
509+
alignItems: "center",
510+
gap: 6,
511+
transition: "all 0.2s",
512+
border: "1px solid rgba(249,115,22,0.2)"
513+
}}
514+
onMouseOver={(e) => {
515+
e.currentTarget.style.background = "rgba(249,115,22,0.2)";
516+
e.currentTarget.style.borderColor = "rgba(249,115,22,0.4)";
517+
}}
518+
onMouseOut={(e) => {
519+
e.currentTarget.style.background = "rgba(249,115,22,0.1)";
520+
e.currentTarget.style.borderColor = "rgba(249,115,22,0.2)";
521+
}}
522+
>
523+
View Ledger <ExternalLink size={10} />
524+
</a>
525+
</div>
485526
)}
486527
</div>
487528
</div>
488529

489530
<div style={{ textAlign: "right" }}>
490531
<span style={{ fontSize: 10, fontWeight: 700, color: "var(--color-text-muted)", textTransform: "uppercase", letterSpacing: 1 }}>Token Balance</span>
491532
<p style={{ fontSize: 28, fontWeight: 800, margin: "4px 0 0", color: "var(--color-text)", letterSpacing: -1 }}>
492-
{wallet ? wallet.balance.toLocaleString() : "—"}
533+
{wallet ? wallet.balance.toLocaleString() : "—"}
493534
<span style={{ fontSize: 14, color: "var(--color-accent)", marginLeft: 6, fontWeight: 700 }}>CHIT</span>
494535
</p>
495536
</div>
@@ -547,7 +588,7 @@ function Overview() {
547588
transition={{ repeat: Infinity, duration: 3, ease: "easeInOut" }}
548589
style={{ fontSize: 32, display: "inline-block" }}
549590
>
550-
🏦
591+
<Building2 size={32} />
551592
</motion.span>
552593
<p
553594
style={{
@@ -575,7 +616,9 @@ function Overview() {
575616
window.location.href = "/funds";
576617
}}
577618
>
578-
Browse Funds →
619+
<span style={{ display: "flex", alignItems: "center", gap: 4 }}>
620+
Browse Funds <ChevronRight size={14} />
621+
</span>
579622
</AnimatedButton>
580623
</motion.div>
581624
) : (
@@ -638,8 +681,8 @@ function Overview() {
638681
const blockchainStatus = contribution.blockchain_status;
639682
const status =
640683
c.status === "paid" &&
641-
blockchainStatus &&
642-
blockchainStatus !== "confirmed"
684+
blockchainStatus &&
685+
blockchainStatus !== "confirmed"
643686
? blockchainStatus
644687
: c.status;
645688
const style =
@@ -652,9 +695,9 @@ function Overview() {
652695
: status === "depositing to pool"
653696
? { color: "#f472b6", bg: "rgba(244,114,182,0.08)" }
654697
: {
655-
color: "var(--color-text-secondary)",
656-
bg: "var(--color-bg-subtle)",
657-
};
698+
color: "var(--color-text-secondary)",
699+
bg: "var(--color-bg-subtle)",
700+
};
658701

659702
return (
660703
<GlassCard
@@ -1135,6 +1178,7 @@ function Profile({ onUpdate }: { onUpdate: () => void }) {
11351178
onChange={up("phone_number")}
11361179
required
11371180
disabled={!edit}
1181+
11381182
placeholder="+91 9876543210"
11391183
/>
11401184
<Input

services/frontend/app/fund/[id]/page.tsx

Lines changed: 61 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ import StatCard from "@/components/ui/StatCard";
1010
import AuctionRulebook from "@/components/AuctionRulebook";
1111
import ChatPanel from "@/components/ChatPanel";
1212
import { useAuctionSocket } from "@/hooks/useAuctionSocket";
13+
import {
14+
CircleDollarSign,
15+
Calendar,
16+
Users,
17+
Timer,
18+
CheckCircle2,
19+
Wallet,
20+
ExternalLink,
21+
} from "lucide-react";
1322
import {
1423
applyToFund,
1524
getFundDetails,
@@ -491,7 +500,7 @@ export default function FundDetailPage() {
491500
boxShadow: "var(--shadow-card)",
492501
}}
493502
>
494-
{actionMessage}
503+
<span style={{ display: "flex", alignItems: "center", gap: 6 }}><CheckCircle2 size={14} /> {actionMessage}</span>
495504
</motion.div>
496505
)}
497506
</AnimatePresence>
@@ -571,6 +580,53 @@ export default function FundDetailPage() {
571580
>
572581
ID: {id}
573582
</motion.p>
583+
{fund?.contract_address && (
584+
<motion.div
585+
initial={{ opacity: 0 }}
586+
animate={{ opacity: 1 }}
587+
transition={{ delay: 0.35 }}
588+
style={{
589+
display: "flex",
590+
alignItems: "center",
591+
gap: 8,
592+
marginTop: 4,
593+
}}
594+
>
595+
<span style={{ fontSize: 10, color: "var(--color-text-muted)", fontWeight: 600 }}>CONTRACT:</span>
596+
<code style={{ fontSize: 11, color: "var(--color-text-secondary)", fontFamily: "monospace" }}>
597+
{fund.contract_address}
598+
</code>
599+
<a
600+
href={`https://amoy.polygonscan.com/address/${fund.contract_address}#internaltx`}
601+
target="_blank"
602+
rel="noopener noreferrer"
603+
style={{
604+
fontSize: 9,
605+
fontWeight: 700,
606+
color: "var(--color-accent)",
607+
textDecoration: "none",
608+
padding: "4px 10px",
609+
borderRadius: 6,
610+
background: "rgba(249,115,22,0.1)",
611+
display: "inline-flex",
612+
alignItems: "center",
613+
gap: 6,
614+
transition: "all 0.2s",
615+
border: "1px solid rgba(249,115,22,0.2)"
616+
}}
617+
onMouseOver={(e) => {
618+
e.currentTarget.style.background = "rgba(249,115,22,0.2)";
619+
e.currentTarget.style.borderColor = "rgba(249,115,22,0.4)";
620+
}}
621+
onMouseOut={(e) => {
622+
e.currentTarget.style.background = "rgba(249,115,22,0.1)";
623+
e.currentTarget.style.borderColor = "rgba(249,115,22,0.2)";
624+
}}
625+
>
626+
View Ledger <ExternalLink size={10} />
627+
</a>
628+
</motion.div>
629+
)}
574630
</div>
575631
<motion.span
576632
initial={{ opacity: 0, scale: 0.8 }}
@@ -632,21 +688,21 @@ export default function FundDetailPage() {
632688
label="Total Pool"
633689
value={fund?.total_amount || 0}
634690
delay={0.1}
635-
icon={<span>💰</span>}
691+
icon={<CircleDollarSign size={16} />}
636692
accent="#f97316"
637693
/>
638694
<StatCard
639695
label="Monthly"
640696
value={fund?.monthly_contribution || 0}
641697
delay={0.15}
642-
icon={<span>📅</span>}
698+
icon={<Calendar size={16} />}
643699
accent="#60a5fa"
644700
/>
645701
<StatCard
646702
label="Members"
647703
value={`${fund?.current_member_count || 0}/${fund?.max_members || 0}`}
648704
delay={0.2}
649-
icon={<span>👥</span>}
705+
icon={<Users size={16} />}
650706
accent="#2dd4bf"
651707
animate={false}
652708
/>
@@ -655,7 +711,7 @@ export default function FundDetailPage() {
655711
value={fund?.duration_months || 0}
656712
suffix="mo"
657713
delay={0.25}
658-
icon={<span>⏱️</span>}
714+
icon={<Timer size={16} />}
659715
accent="#a78bfa"
660716
/>
661717
</div>

services/frontend/app/funds/page.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import React, { useState, useEffect } from "react";
33
import { useRouter } from "next/navigation";
44
import { motion } from "framer-motion";
5+
import { Coins, ChevronRight } from "lucide-react";
56
import Navbar from "@/components/Navbar";
67
import ChitFundCard from "@/components/ChitFundCard";
78
import AnimatedButton from "@/components/ui/AnimatedButton";
@@ -94,10 +95,14 @@ export default function FundsPage() {
9495
<div style={{ fontSize: 13, color: "var(--color-danger)", background: "var(--color-danger-light)", border: "1px solid rgba(239,68,68,0.15)", borderRadius: 6, padding: "10px 14px" }}>{error}</div>
9596
) : funds.length === 0 ? (
9697
<div style={{ textAlign: "center", padding: "40px 0", background: "var(--color-bg-card)", border: "1px dashed var(--color-border)", borderRadius: 8 }}>
97-
<span style={{ fontSize: 28 }}>💰</span>
98+
<Coins size={48} style={{ color: "var(--color-accent)", opacity: 0.8, marginBottom: 16 }} />
9899
<p style={{ fontSize: 14, fontWeight: 600, color: "var(--color-text)", margin: "8px 0 4px" }}>No Funds</p>
99100
<p style={{ fontSize: 12, color: "var(--color-text-muted)", marginBottom: 14 }}>Be the first to create one</p>
100-
<AnimatedButton variant="primary" size="sm" onClick={() => { router.push("/dashboard?tab=create"); }}>Create Fund →</AnimatedButton>
101+
<AnimatedButton variant="primary" size="sm" onClick={() => { router.push("/dashboard?tab=create"); }}>
102+
<span style={{ display: "flex", alignItems: "center", gap: 6 }}>
103+
Create Fund <ChevronRight size={14} />
104+
</span>
105+
</AnimatedButton>
101106
</div>
102107
) : (
103108
<motion.div style={{ display: "grid", gridTemplateColumns: "repeat(auto-fill, minmax(260px, 1fr))", gap: 10 }} initial={{ opacity: 0 }} animate={{ opacity: 1 }}>

0 commit comments

Comments
 (0)