Skip to content

Commit 0b36337

Browse files
committed
nit daico
1 parent cbc3db7 commit 0b36337

4 files changed

Lines changed: 24 additions & 19 deletions

File tree

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"@metamask/sdk-communication-layer": "0.33.1",
2525
"debug": "4.3.4",
2626
"mdast-util-to-hast": ">=13.2.1",
27-
"viem": "2.29.0"
27+
"viem": "2.29.0",
28+
"preact@>=10.27.0 <10.27.3": ">=10.27.3"
2829
}
2930
},
3031
"dependencies": {

pnpm-lock.yaml

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/dao/DAICOOrgHeader.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ interface DAICOOrgHeaderProps {
1515
explorerUrl: string;
1616
shortenAddress: (addr: string) => string;
1717
tokenAddress?: string; // Share or Loot token address
18+
chainId: number; // Chain ID for Majeur DAO link
1819
}
1920

20-
export function DAICOOrgHeader({ org, chainName, explorerUrl, shortenAddress, tokenAddress }: DAICOOrgHeaderProps) {
21+
export function DAICOOrgHeader({ org, chainName, explorerUrl, shortenAddress, tokenAddress, chainId }: DAICOOrgHeaderProps) {
2122
return (
2223
<Card className="p-8 bg-gradient-to-br from-primary/5 via-purple-500/5 to-background border-primary/20">
2324
<div className="flex items-start gap-6">
@@ -40,7 +41,7 @@ export function DAICOOrgHeader({ org, chainName, explorerUrl, shortenAddress, to
4041
</Badge>
4142
<span></span>
4243
<a
43-
href={`${explorerUrl}/address/${org.id}`}
44+
href={`https://majeurdao.eth.limo/#/dao/${chainId}/${org.id}`}
4445
target="_blank"
4546
rel="noopener noreferrer"
4647
className="hover:text-foreground transition-colors inline-flex items-center gap-1"

src/routes/orgs.$chainId.$daoAddress.tsx

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,19 @@ function OrgPage() {
5555
chainId,
5656
});
5757

58+
// Prepare poolId for the query - extract it before early returns to prevent hook order issues
59+
const poolId = org?.lps && org.lps.length > 0 && org.lps[0]?.poolId ? org.lps[0].poolId : undefined;
60+
61+
// Check if any swaps have occurred by fetching price points
62+
// IMPORTANT: This hook must be called before any early returns to maintain consistent hook order
63+
const { data: pricePoints } = useQuery({
64+
queryKey: ["poolPricePoints", poolId],
65+
queryFn: () => fetchPoolPricePoints(poolId!, undefined, undefined, 1),
66+
enabled: !!poolId,
67+
staleTime: 60_000,
68+
retry: false,
69+
});
70+
5871
const chainName = chainId === 1 ? "Mainnet" : chainId === 11155111 ? "Sepolia" : `Chain ${chainId}`;
5972
const explorerUrl = chainId === 11155111 ? "https://sepolia.etherscan.io" : "https://etherscan.io";
6073

@@ -87,24 +100,12 @@ function OrgPage() {
87100
console.log("LPs:", org.lps);
88101
console.log("Pool ID:", org.lps && org.lps.length > 0 ? org.lps[0].poolId : "No LP");
89102

90-
const hasPool = org.lps && org.lps.length > 0 && org.lps[0]?.poolId;
91-
const poolId = hasPool ? org.lps[0].poolId : undefined;
92-
93103
// Get token address from the first sale (this is the DAO's Share or Loot token being sold)
94104
const tokenAddress = org.sales && org.sales.length > 0 ? org.sales[0].forTkn : undefined;
95105

96106
// Create swap link with pre-filled token
97107
const swapLink = tokenAddress ? `/swap?buyToken=${tokenAddress}` : undefined;
98108

99-
// Check if any swaps have occurred by fetching price points
100-
const { data: pricePoints } = useQuery({
101-
queryKey: ["poolPricePoints", poolId],
102-
queryFn: () => fetchPoolPricePoints(poolId!, undefined, undefined, 1),
103-
enabled: !!poolId,
104-
staleTime: 60_000,
105-
retry: false,
106-
});
107-
108109
const hasSwaps = pricePoints && pricePoints.length > 0;
109110

110111
return (
@@ -122,6 +123,7 @@ function OrgPage() {
122123
explorerUrl={explorerUrl}
123124
shortenAddress={shortenAddress}
124125
tokenAddress={tokenAddress}
126+
chainId={chainId}
125127
/>
126128

127129
{/* Stats Overview */}

0 commit comments

Comments
 (0)