Skip to content

Commit

Permalink
Merge pull request #31 from HausDAO/daos-list
Browse files Browse the repository at this point in the history
Daos list
  • Loading branch information
earth2travis authored Feb 13, 2025
2 parents b5aee75 + bed268e commit d5e744e
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 29 deletions.
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@farcaster/frame-wagmi-connector": "^0.0.14",
"@hookform/resolvers": "^3.10.0",
"@opennextjs/cloudflare": "^0.2.1",
"@radix-ui/react-avatar": "^1.1.1",
"@radix-ui/react-avatar": "^1.1.3",
"@radix-ui/react-checkbox": "^1.1.3",
"@radix-ui/react-dialog": "^1.1.2",
"@radix-ui/react-label": "^2.1.1",
Expand Down
3 changes: 3 additions & 0 deletions public/moonstone-gate.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 4 additions & 3 deletions src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
body {
@apply bg-background text-foreground;
font-family:
'Mulish',
"Mulish",
ui-sans-serif,
system-ui,
sans-serif,
Expand Down Expand Up @@ -87,9 +87,10 @@
}

@font-face {
font-family: 'FetteUNZFraktur';
src: url('/fonts/FetteUNZFraktur.woff') format('woff');
font-family: "FetteUNZFraktur";
src: url("/fonts/FetteUNZFraktur.woff") format("woff");
font-weight: normal;
font-style: normal;
font-display: swap;
text-rendering: optimizeLegibility;
}
7 changes: 7 additions & 0 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ export default function RootLayout({
href="https://fonts.googleapis.com/css2?family=VT323&display=swap"
rel="stylesheet"
/>
<link
rel="preload"
href="/fonts/FetteUNZFraktur.woff"
as="font"
type="font/woff"
crossOrigin="anonymous"
/>
</head>
<body className="antialiased scrollbar-vert">
<Providers>
Expand Down
2 changes: 1 addition & 1 deletion src/components/app/DaoList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const DaoList = () => {
if (isLoading) return <LoadingSpinner />;

return (
<div className="flex flex-col flex-wrap items-center justify-center gap-2 w-96">
<div className="flex flex-col flex-wrap items-center justify-center gap-2 w-full">
{isFetched &&
daos?.map((dao: DaoItem) => {
return (
Expand Down
55 changes: 31 additions & 24 deletions src/components/app/DaoListCard.tsx
Original file line number Diff line number Diff line change
@@ -1,43 +1,50 @@
import Link from "next/link";
import Image from "next/image";
"use client";

import { Button } from "../ui/button";
import { useDao } from "@/hooks/useDao";
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
import { Card } from "@/components/ui/card";
import { useActiveDaoProposals } from "@/hooks/useActiveDaoProposals";
import { useDao } from "@/hooks/useDao";
import Link from "next/link";

export const DaoListCard = ({
daoid,
chainid,
}: {
interface DaoListCardProps {
daoid: string;
chainid: string;
}) => {
const { dao, isLoading } = useDao({
}

export const DaoListCard = ({ daoid, chainid }: DaoListCardProps) => {
const { dao, isLoading: daoLoading } = useDao({
chainid,
daoid,
});
const { proposals } = useActiveDaoProposals({
const { proposals, isLoading: proposalsLoading } = useActiveDaoProposals({
chainid,
daoid,
});

if (isLoading || !dao) return;
if (daoLoading || !dao || proposalsLoading) return null;

console.log("dao", dao);
const imgSrc = dao.profile?.avatarImg || "/castle.svg";
const proposalCount = proposals?.length || 0;

return (
<Link key={daoid} href={`/dao/${chainid}/${daoid}`}>
<div>
<Image src={imgSrc} width={45} height={45} alt="dao logo" priority />

<Button size="sm" variant="secondary">
{dao.name}
</Button>
{proposals && proposals.length > 0 && (
<p>active proposals: {proposals.length}</p>
)}
</div>
<Link href={`/dao/${chainid}/${daoid}`} className="w-full">
<Card className="w-full bg-background border hover:bg-card transition-colors rounded-none">
<div className="flex items-center gap-3 p-4">
<Avatar className="h-10 w-10">
<AvatarImage src={imgSrc} alt={dao.name} />
<AvatarFallback>{dao.name[0]}</AvatarFallback>
</Avatar>
<div className="flex flex-col">
<span className="text-foreground font-medium truncate">
{dao.name.length > 25 ? `${dao.name.slice(0, 25)}...` : dao.name}
</span>
<span className="text-muted text-sm">
{proposalCount} Active Proposal
{proposalCount !== 1 && "s"}
</span>
</div>
</div>
</Card>
</Link>
);
};
50 changes: 50 additions & 0 deletions src/components/ui/avatar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
"use client";

import * as AvatarPrimitive from "@radix-ui/react-avatar";
import * as React from "react";

import { cn } from "@/lib/cn";

const Avatar = React.forwardRef<
React.ElementRef<typeof AvatarPrimitive.Root>,
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>
>(({ className, ...props }, ref) => (
<AvatarPrimitive.Root
ref={ref}
className={cn(
"relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
className
)}
{...props}
/>
));
Avatar.displayName = AvatarPrimitive.Root.displayName;

const AvatarImage = React.forwardRef<
React.ElementRef<typeof AvatarPrimitive.Image>,
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
>(({ className, ...props }, ref) => (
<AvatarPrimitive.Image
ref={ref}
className={cn("aspect-square h-full w-full", className)}
{...props}
/>
));
AvatarImage.displayName = AvatarPrimitive.Image.displayName;

const AvatarFallback = React.forwardRef<
React.ElementRef<typeof AvatarPrimitive.Fallback>,
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
>(({ className, ...props }, ref) => (
<AvatarPrimitive.Fallback
ref={ref}
className={cn(
"flex h-full w-full items-center justify-center rounded-full bg-muted",
className
)}
{...props}
/>
));
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;

export { Avatar, AvatarFallback, AvatarImage };

0 comments on commit d5e744e

Please sign in to comment.