From 1d6aae49f49b83b6cb52eb81b45ad67bf850e850 Mon Sep 17 00:00:00 2001 From: yu-zhen Date: Tue, 2 Jul 2024 03:03:50 +0900 Subject: [PATCH] feat: integrate application page styling --- public/circle-check-blue-filled.svg | 3 + src/components/EligibilityDialog.tsx | 27 +- src/components/StatusBar.tsx | 31 ++ src/components/ui/Badge.tsx | 5 +- src/components/ui/Form.tsx | 35 +- src/components/ui/Input.tsx | 1 + .../components/AdminButtonsBar.tsx | 36 ++ .../components/ApplicationButtons.tsx | 136 ++++++++ .../components/ApplicationForm.tsx | 316 ++++++++---------- .../components/ApplicationSteps.tsx | 49 +++ .../components/ApplicationsToApprove.tsx | 155 +++++---- .../applications/components/ImpactTags.tsx | 53 +++ .../applications/components/LinkField.tsx | 89 +++++ .../components/ReviewApplicationDetails.tsx | 133 ++++++++ .../applications/components/ReviewBar.tsx | 45 +++ .../hooks/useApplicationByTxHash.ts | 8 + .../hooks/useCreateApplication.ts | 24 +- src/features/applications/types/index.ts | 14 +- src/features/filter/types/index.ts | 1 + .../projects/components/ProjectAvatar.tsx | 9 +- .../projects/components/ProjectBanner.tsx | 11 +- .../projects/components/ProjectDetails.tsx | 24 +- .../projects/components/ProjectItem.tsx | 17 +- src/features/projects/components/Projects.tsx | 17 +- src/features/projects/hooks/useProjects.ts | 14 +- src/features/voters/components/VotersList.tsx | 10 +- src/layouts/BaseLayout.tsx | 2 +- src/pages/applications/[projectId]/index.tsx | 25 -- src/pages/applications/confirmation.tsx | 51 +++ src/pages/applications/new.tsx | 44 ++- src/pages/projects/[projectId]/Project.tsx | 18 +- src/pages/signup/index.tsx | 15 +- src/server/api/routers/projects.ts | 47 ++- src/utils/fetchAttestations.ts | 4 +- 34 files changed, 1078 insertions(+), 391 deletions(-) create mode 100644 public/circle-check-blue-filled.svg create mode 100644 src/components/StatusBar.tsx create mode 100644 src/features/applications/components/AdminButtonsBar.tsx create mode 100644 src/features/applications/components/ApplicationButtons.tsx create mode 100644 src/features/applications/components/ApplicationSteps.tsx create mode 100644 src/features/applications/components/ImpactTags.tsx create mode 100644 src/features/applications/components/LinkField.tsx create mode 100644 src/features/applications/components/ReviewApplicationDetails.tsx create mode 100644 src/features/applications/components/ReviewBar.tsx create mode 100644 src/features/applications/hooks/useApplicationByTxHash.ts delete mode 100644 src/pages/applications/[projectId]/index.tsx create mode 100644 src/pages/applications/confirmation.tsx diff --git a/public/circle-check-blue-filled.svg b/public/circle-check-blue-filled.svg new file mode 100644 index 00000000..a3f650a7 --- /dev/null +++ b/public/circle-check-blue-filled.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/components/EligibilityDialog.tsx b/src/components/EligibilityDialog.tsx index 8776f85b..df26fcb5 100644 --- a/src/components/EligibilityDialog.tsx +++ b/src/components/EligibilityDialog.tsx @@ -4,6 +4,8 @@ import { toast } from "sonner"; import { useAccount, useDisconnect } from "wagmi"; import { useMaci } from "~/contexts/Maci"; +import { useAppState } from "~/utils/state"; +import { EAppState } from "~/utils/types"; import { Dialog } from "./ui/Dialog"; @@ -15,6 +17,8 @@ export const EligibilityDialog = (): JSX.Element | null => { const { onSignup, isEligibleToVote, isRegistered } = useMaci(); const router = useRouter(); + const appState = useAppState(); + const onError = useCallback(() => toast.error("Signup error"), []); const handleSignup = useCallback(async () => { @@ -38,9 +42,13 @@ export const EligibilityDialog = (): JSX.Element | null => { router.push("/projects"); }, [router]); + const handleGoToCreateApp = useCallback(() => { + router.push("/applications/new"); + }, [router]); + return (
- {isRegistered && ( + {isRegistered && appState === EAppState.VOTING && ( { /> )} + {isRegistered && appState === EAppState.APPLICATION && ( + +

Start creating your own application now!

+
+ } + isOpen={openDialog} + size="sm" + title="You're all set to apply" + onOpenChange={handleCloseDialog} + /> + )} + {!isRegistered && isEligibleToVote && ( ( + {content} +); diff --git a/src/components/ui/Badge.tsx b/src/components/ui/Badge.tsx index eb09e883..45352f1d 100644 --- a/src/components/ui/Badge.tsx +++ b/src/components/ui/Badge.tsx @@ -5,11 +5,12 @@ import { createComponent } from "."; export const Badge = createComponent( "div", tv({ - base: "inline-flex items-center rounded font-semibold text-gray-500 text-sm", + base: "inline-flex items-center rounded font-semibold text-sm p-2", variants: { variant: { default: "bg-gray-100 dark:bg-gray-800", - success: "dark:bg-green-300 dark:text-green-900", + success: "bg-[#BBF7D0] text-[#14532D]", + pending: "bg-[#FFEDD5] text-[#4E1D0D]", }, size: { md: "px-1 ", diff --git a/src/components/ui/Form.tsx b/src/components/ui/Form.tsx index dfd410f0..c5e010cd 100644 --- a/src/components/ui/Form.tsx +++ b/src/components/ui/Form.tsx @@ -43,7 +43,7 @@ export const Select = createComponent( export const Checkbox = createComponent( "input", tv({ - base: [...inputBase, "checked:focus:dark:bg-gray-700 checked:hover:dark:bg-gray-700"], + base: [...inputBase, "rounded-none checked:focus:dark:bg-gray-700 checked:hover:dark:bg-gray-700"], }), ); @@ -51,7 +51,12 @@ export const Label = createComponent( "label", tv({ base: "block tracking-wider dark:text-gray-300 font-semibold", - variants: { required: { true: "after:content-['*']" } }, + variants: { + required: { + true: "after:content-['*'] after:text-blue-400", + false: "after:content-['(optional)'] after:text-gray-300 after:text-sm after:font-semibold after:ml-1", + }, + }, }), ); @@ -98,7 +103,7 @@ export const FormControl = ({ const error = index && errors[index]; return ( -
+
{label && (