From 0808ff261e83d4cc04cf95d8810e1cde10e3eabb Mon Sep 17 00:00:00 2001 From: Ed Castro Date: Fri, 4 Oct 2024 19:34:19 -0300 Subject: [PATCH] refactor(ui): update cards, dialog and fields on governance --- .../src/app/components/balance-section.tsx | 29 ++- .../src/app/components/dao/create-dao.tsx | 199 ++++++++---------- .../src/app/components/modal.tsx | 131 +++++------- .../app/components/proposal-list-header.tsx | 61 +++--- .../components/proposal/create-proposal.tsx | 165 +++++++-------- .../create-transfer-dao-treasury-proposal.tsx | 190 +++++++---------- .../commune-governance/src/styles/globals.css | 5 +- packages/ui/package.json | 1 + packages/ui/src/components/button.tsx | 6 +- packages/ui/src/components/dialog.tsx | 4 +- packages/ui/src/components/index.ts | 1 + packages/ui/src/components/input.tsx | 2 +- packages/ui/src/components/label.tsx | 2 +- packages/ui/src/components/select.tsx | 2 +- packages/ui/src/components/separator.tsx | 31 +++ packages/ui/src/components/tabs.tsx | 4 +- packages/ui/src/components/text-area.tsx | 2 +- pnpm-lock.yaml | 33 ++- tooling/tailwind/base.ts | 1 + 19 files changed, 415 insertions(+), 454 deletions(-) create mode 100644 packages/ui/src/components/separator.tsx diff --git a/apps/commune-governance/src/app/components/balance-section.tsx b/apps/commune-governance/src/app/components/balance-section.tsx index d80e1ed8..4e64787c 100644 --- a/apps/commune-governance/src/app/components/balance-section.tsx +++ b/apps/commune-governance/src/app/components/balance-section.tsx @@ -4,6 +4,7 @@ import Image from "next/image"; import { useBalance } from "@commune-ts/providers/hooks"; import { useCommune } from "@commune-ts/providers/use-commune"; +import { Card, Label, Separator } from "@commune-ts/ui"; import { formatToken } from "@commune-ts/utils"; export function BalanceSection({ @@ -37,9 +38,9 @@ export function BalanceSection({ className={`flex w-full flex-col items-center justify-center lg:mt-10 ${className ?? ""}`} >
-
+
{!daoTreasury && !isInitialized ? (

@@ -52,14 +53,12 @@ export function BalanceSection({ COMAI

)} - - DAO treasury funds - +
Dao Icon -
+ -
+
{!isInitialized && (

@@ -93,9 +92,7 @@ export function BalanceSection({

)} - - Your total free balance - +
Wallet Icon -
+ -
+
{!isInitialized || (selectedAccount?.meta.name && userStakeWeight == null) ? ( @@ -128,9 +125,7 @@ export function BalanceSection({ COMAI

)} - - Your total Staked balance - +
Globe Icon -
+
-
+
); } diff --git a/apps/commune-governance/src/app/components/dao/create-dao.tsx b/apps/commune-governance/src/app/components/dao/create-dao.tsx index a82adcd9..bb6fa312 100644 --- a/apps/commune-governance/src/app/components/dao/create-dao.tsx +++ b/apps/commune-governance/src/app/components/dao/create-dao.tsx @@ -8,7 +8,18 @@ import { z } from "zod"; import type { TransactionResult } from "@commune-ts/types"; import { useCommune } from "@commune-ts/providers/use-commune"; import { toast } from "@commune-ts/providers/use-toast"; -import { TransactionStatus } from "@commune-ts/ui"; +import { + Button, + Input, + Label, + Separator, + Tabs, + TabsContent, + TabsList, + TabsTrigger, + Textarea, + TransactionStatus, +} from "@commune-ts/ui"; import { cairo } from "~/utils/fonts"; @@ -30,11 +41,7 @@ export function CreateDao(): JSX.Element { const [body, setBody] = useState(""); const [uploading, setUploading] = useState(false); - - const [editMode, setEditMode] = useState(true); - function toggleEditMode(): void { - setEditMode(!editMode); - } + const [activeTab, setActiveTab] = useState("edit"); const [transactionStatus, setTransactionStatus] = useState( { @@ -134,111 +141,87 @@ export function CreateDao(): JSX.Element { } return ( -
-
-
- - -
-
- {editMode ? ( -
- { - setApplicationKey(e.target.value); - }} - placeholder="Application Key (ss58)" - type="text" - value={applicationKey} - /> - { - setDiscordId(e.target.value); - }} - placeholder="Discord ID" - type="text" - value={discordId} - /> - { - setTitle(e.target.value); - }} - placeholder="Application title" - type="text" - value={title} - /> -