diff --git a/app/components/_shared/progress-bar/progress-bar.component.tsx b/src/components/_shared/progress-bar/progress-bar.component.tsx
similarity index 93%
rename from app/components/_shared/progress-bar/progress-bar.component.tsx
rename to src/components/_shared/progress-bar/progress-bar.component.tsx
index fc09812d..08da5e18 100644
--- a/app/components/_shared/progress-bar/progress-bar.component.tsx
+++ b/src/components/_shared/progress-bar/progress-bar.component.tsx
@@ -1,8 +1,8 @@
-import BaseComponentProps from "@interfaces/base-component-props.interface";
-import styles from "./progress-bar.module.scss";
+import BaseComponentProps from "@/lib/interfaces/base-component-props.interface";
import classNames from "classnames";
-import { useEffect, useMemo } from "react";
-import NumbersService from "@/app/helpers/numbers.service";
+import { useMemo } from "react";
+import styles from "./progress-bar.module.scss";
+import NumbersService from "@/lib/helpers/numbers.service";
type Type = "success" | "info" | "warning" | "danger";
@@ -37,7 +37,7 @@ const barColor = (type: Type) => {
case "danger":
return "#FF848A";
default:
- "#D2FCBD";
+ return "#D2FCBD";
}
};
@@ -56,7 +56,6 @@ export const ProgressBar = ({
const barColorString = type ? barColor(type) : "";
- console.log("progress", progress);
const progressStyles: ProgressStyle = useMemo(() => {
if (progress < 3) {
return {
diff --git a/app/components/_shared/progress-bar/progress-bar.module.scss b/src/components/_shared/progress-bar/progress-bar.module.scss
similarity index 96%
rename from app/components/_shared/progress-bar/progress-bar.module.scss
rename to src/components/_shared/progress-bar/progress-bar.module.scss
index ca5b4b90..0c779318 100644
--- a/app/components/_shared/progress-bar/progress-bar.module.scss
+++ b/src/components/_shared/progress-bar/progress-bar.module.scss
@@ -1,4 +1,4 @@
-@import "@/app/brand";
+@import "@/styles/brand";
.progress_bar_wrapper {
display: flex;
diff --git a/app/components/_shared/see-all/see-all.component.tsx b/src/components/_shared/see-all/see-all.component.tsx
similarity index 100%
rename from app/components/_shared/see-all/see-all.component.tsx
rename to src/components/_shared/see-all/see-all.component.tsx
index e893f1b1..d2fc05d3 100644
--- a/app/components/_shared/see-all/see-all.component.tsx
+++ b/src/components/_shared/see-all/see-all.component.tsx
@@ -1,6 +1,6 @@
+import { ReactNode } from "react";
import classNames from "classnames";
import styles from "./see-all.module.scss";
-import { ReactNode } from "react";
interface SeeAllProps {
isOpen: boolean;
diff --git a/app/components/_shared/see-all/see-all.module.scss b/src/components/_shared/see-all/see-all.module.scss
similarity index 91%
rename from app/components/_shared/see-all/see-all.module.scss
rename to src/components/_shared/see-all/see-all.module.scss
index 23bea82a..24e0525c 100644
--- a/app/components/_shared/see-all/see-all.module.scss
+++ b/src/components/_shared/see-all/see-all.module.scss
@@ -1,4 +1,4 @@
-@import "@/app/brand";
+@import "@/styles/brand";
.container {
position: relative;
diff --git a/app/components/_shared/slider/slider.component.tsx b/src/components/_shared/slider/slider.component.tsx
similarity index 92%
rename from app/components/_shared/slider/slider.component.tsx
rename to src/components/_shared/slider/slider.component.tsx
index a17103d3..ebf135bd 100644
--- a/app/components/_shared/slider/slider.component.tsx
+++ b/src/components/_shared/slider/slider.component.tsx
@@ -1,10 +1,10 @@
"use client";
-import styles from "./slider.module.scss";
-import exports from "@styles/exports.module.scss";
-import BaseComponentProps from "@interfaces/base-component-props.interface";
-import classNames from "classnames";
import { ReactNode, useEffect, useMemo, useState } from "react";
-import BaseInputProps from "@interfaces/base-input-props.interface";
+import classNames from "classnames";
+import BaseComponentProps from "@/interfaces/base-component-props.interface";
+import BaseInputProps from "@/interfaces/base-input-props.interface";
+import exports from "@/styles/exports.module.scss";
+import styles from "./slider.module.scss";
interface SliderProps extends BaseComponentProps, BaseInputProps {
compact?: boolean;
diff --git a/app/components/_shared/slider/slider.module.scss b/src/components/_shared/slider/slider.module.scss
similarity index 98%
rename from app/components/_shared/slider/slider.module.scss
rename to src/components/_shared/slider/slider.module.scss
index 670bafb9..87fe0749 100644
--- a/app/components/_shared/slider/slider.module.scss
+++ b/src/components/_shared/slider/slider.module.scss
@@ -1,5 +1,4 @@
-@import "@/app/brand";
-
+@import "@/styles/brand";
.sliderWrapper {
margin-top: 6 * $theme-unit;
diff --git a/app/components/_shared/status/status.component.tsx b/src/components/_shared/status/status.component.tsx
similarity index 87%
rename from app/components/_shared/status/status.component.tsx
rename to src/components/_shared/status/status.component.tsx
index 377d341b..c02b3be4 100644
--- a/app/components/_shared/status/status.component.tsx
+++ b/src/components/_shared/status/status.component.tsx
@@ -1,6 +1,6 @@
import classNames from "classnames";
import styles from "./status.module.scss";
-import { BadgeType } from "@/app/types";
+import { BadgeType } from "@/lib/types";
interface StatusProps {
text: string;
diff --git a/app/components/_shared/status/status.module.scss b/src/components/_shared/status/status.module.scss
similarity index 96%
rename from app/components/_shared/status/status.module.scss
rename to src/components/_shared/status/status.module.scss
index 683bc1c1..a0710550 100644
--- a/app/components/_shared/status/status.module.scss
+++ b/src/components/_shared/status/status.module.scss
@@ -1,4 +1,4 @@
-@import "@/app/brand";
+@import "@/styles/brand";
@mixin branded-badge($border-color, $background-color) {
border: 1px solid $border-color;
diff --git a/app/components/_shared/step-counter/step-counter.component.tsx b/src/components/_shared/step-counter/step-counter.component.tsx
similarity index 81%
rename from app/components/_shared/step-counter/step-counter.component.tsx
rename to src/components/_shared/step-counter/step-counter.component.tsx
index 659d29b1..e17d6008 100644
--- a/app/components/_shared/step-counter/step-counter.component.tsx
+++ b/src/components/_shared/step-counter/step-counter.component.tsx
@@ -1,5 +1,5 @@
-import BaseComponentProps from "@interfaces/base-component-props.interface";
import classNames from "classnames";
+import BaseComponentProps from "@/interfaces/base-component-props.interface";
import styles from "./step-counter.module.scss";
interface StepCounterProps extends BaseComponentProps {}
diff --git a/app/components/_shared/step-counter/step-counter.module.scss b/src/components/_shared/step-counter/step-counter.module.scss
similarity index 96%
rename from app/components/_shared/step-counter/step-counter.module.scss
rename to src/components/_shared/step-counter/step-counter.module.scss
index 769a2e2e..0c6cac78 100644
--- a/app/components/_shared/step-counter/step-counter.module.scss
+++ b/src/components/_shared/step-counter/step-counter.module.scss
@@ -1,4 +1,4 @@
-@import "@/app/brand";
+@import "@/styles/brand";
$box-size: 4px;
diff --git a/app/components/_shared/tabs/tab-list.component.tsx b/src/components/_shared/tabs/tab-list.component.tsx
similarity index 94%
rename from app/components/_shared/tabs/tab-list.component.tsx
rename to src/components/_shared/tabs/tab-list.component.tsx
index 1cd12ae4..fdabec2c 100644
--- a/app/components/_shared/tabs/tab-list.component.tsx
+++ b/src/components/_shared/tabs/tab-list.component.tsx
@@ -1,8 +1,8 @@
"use strict";
-import styles from "./tabs.module.scss";
-import BaseComponentProps from "@interfaces/base-component-props.interface";
-import classNames from "classnames";
import { Children, useState } from "react";
+import classNames from "classnames";
+import BaseComponentProps from "@/interfaces/base-component-props.interface";
+import styles from "./tabs.module.scss";
export interface TabListProps extends BaseComponentProps {
tabs: string[];
diff --git a/app/components/_shared/tabs/tab.component.tsx b/src/components/_shared/tabs/tab.component.tsx
similarity index 68%
rename from app/components/_shared/tabs/tab.component.tsx
rename to src/components/_shared/tabs/tab.component.tsx
index 6b6be1e1..ce31d278 100644
--- a/app/components/_shared/tabs/tab.component.tsx
+++ b/src/components/_shared/tabs/tab.component.tsx
@@ -1,6 +1,5 @@
-import styles from "./tabs.module.scss";
-import BaseComponentProps from "@interfaces/base-component-props.interface";
import classNames from "classnames";
+import BaseComponentProps from "@/interfaces/base-component-props.interface";
interface TabProps extends BaseComponentProps {}
diff --git a/app/components/_shared/tabs/tabs.module.scss b/src/components/_shared/tabs/tabs.module.scss
similarity index 97%
rename from app/components/_shared/tabs/tabs.module.scss
rename to src/components/_shared/tabs/tabs.module.scss
index 803d471e..a73800e6 100644
--- a/app/components/_shared/tabs/tabs.module.scss
+++ b/src/components/_shared/tabs/tabs.module.scss
@@ -1,4 +1,4 @@
-@import '@/app/brand';
+@import '@/styles/brand';
.tabView {
diff --git a/app/components/_shared/textarea/textarea.component.tsx b/src/components/_shared/textarea/textarea.component.tsx
similarity index 84%
rename from app/components/_shared/textarea/textarea.component.tsx
rename to src/components/_shared/textarea/textarea.component.tsx
index 96245f97..11e6da93 100644
--- a/app/components/_shared/textarea/textarea.component.tsx
+++ b/src/components/_shared/textarea/textarea.component.tsx
@@ -1,7 +1,7 @@
-import BaseComponentProps from "@interfaces/base-component-props.interface";
-import BaseInputProps from "@interfaces/base-input-props.interface";
-import classNames from "classnames";
import { ReactNode } from "react";
+import classNames from "classnames";
+import BaseComponentProps from "@/interfaces/base-component-props.interface";
+import BaseInputProps from "@/interfaces/base-input-props.interface";
import styles from "./textarea.module.scss";
interface TextAreaProps extends BaseComponentProps, BaseInputProps {
diff --git a/app/components/_shared/textarea/textarea.module.scss b/src/components/_shared/textarea/textarea.module.scss
similarity index 93%
rename from app/components/_shared/textarea/textarea.module.scss
rename to src/components/_shared/textarea/textarea.module.scss
index 694dd0f2..8f9c2ce9 100644
--- a/app/components/_shared/textarea/textarea.module.scss
+++ b/src/components/_shared/textarea/textarea.module.scss
@@ -1,4 +1,4 @@
-@import "@/app/brand";
+@import "@/styles/brand";
.wrapper {
width: 100%;
diff --git a/app/components/_shared/vote-loading-state/vote-loading-state.tsx b/src/components/_shared/vote-loading-state/vote-loading-state.tsx
similarity index 64%
rename from app/components/_shared/vote-loading-state/vote-loading-state.tsx
rename to src/components/_shared/vote-loading-state/vote-loading-state.tsx
index 153a14ac..46515f38 100644
--- a/app/components/_shared/vote-loading-state/vote-loading-state.tsx
+++ b/src/components/_shared/vote-loading-state/vote-loading-state.tsx
@@ -1,5 +1,5 @@
-import { Card, Loader } from "..";
-import VotingCardTitle from "../vote-voting-card-title/voting-card-title";
+import { Card, Loader } from "@/components/_shared";
+import VotingCardTitle from "@/components/_shared/vote-voting-card-title/voting-card-title";
const LoadingState = () => {
return (
diff --git a/app/components/_shared/vote-voting-card-title/voting-card-title.tsx b/src/components/_shared/vote-voting-card-title/voting-card-title.tsx
similarity index 87%
rename from app/components/_shared/vote-voting-card-title/voting-card-title.tsx
rename to src/components/_shared/vote-voting-card-title/voting-card-title.tsx
index 189e8bcd..ff160e7d 100644
--- a/app/components/_shared/vote-voting-card-title/voting-card-title.tsx
+++ b/src/components/_shared/vote-voting-card-title/voting-card-title.tsx
@@ -1,5 +1,6 @@
import React from "react";
-import { Card } from "@/app/components/_shared";
+import { Card } from "@/components/_shared";
+
const VotingCardTitle = ({
children = "Cast Votes",
}: React.PropsWithChildren) => {
diff --git a/app/components/_shared/wallet-address-with-copy/wallet-address-with-copy.component.tsx b/src/components/_shared/wallet-address-with-copy/wallet-address-with-copy.component.tsx
similarity index 73%
rename from app/components/_shared/wallet-address-with-copy/wallet-address-with-copy.component.tsx
rename to src/components/_shared/wallet-address-with-copy/wallet-address-with-copy.component.tsx
index 6add0768..96c2ccff 100644
--- a/app/components/_shared/wallet-address-with-copy/wallet-address-with-copy.component.tsx
+++ b/src/components/_shared/wallet-address-with-copy/wallet-address-with-copy.component.tsx
@@ -1,8 +1,8 @@
-import BaseComponentProps from "@interfaces/base-component-props.interface";
import classNames from "classnames";
import CopyToClipboard from "react-copy-to-clipboard";
-import { CopyIcon } from "../../_icons/copy.icon";
-import { WalletAddress } from "../../wallet-address/wallet-address.component";
+import BaseComponentProps from "@/interfaces/base-component-props.interface";
+import { CopyIcon } from "@/components/_icons/copy.icon";
+import { WalletAddress } from "@/components/wallet-address/wallet-address.component";
interface WalletAddressWithCopyProps extends BaseComponentProps {
address: string;
diff --git a/app/components/contract-params/contract-params.component.tsx b/src/components/contract-params/contract-params.component.tsx
similarity index 93%
rename from app/components/contract-params/contract-params.component.tsx
rename to src/components/contract-params/contract-params.component.tsx
index f53625d9..0ce22e19 100644
--- a/app/components/contract-params/contract-params.component.tsx
+++ b/src/components/contract-params/contract-params.component.tsx
@@ -6,13 +6,13 @@ import CopyToClipboard from "react-copy-to-clipboard";
import { formatUnits } from "viem";
import { useAccount, useReadContracts } from "wagmi";
-import { Card } from "@components/_shared";
-import WalletHelper from "@/app/helpers/wallet.helper";
-import { CopyIcon } from "../_icons/copy.icon";
-import { TimelockControllerABI } from "@/app/abis/TimelockController";
-import { GovernorABI } from "@/app/abis/Governor";
-import { Celo } from "@/app/helpers/chains";
-import { useContracts } from "@/app/hooks/useContracts";
+import { Card } from "@/components/_shared";
+import WalletHelper from "@/lib/helpers/wallet.helper";
+import { CopyIcon } from "@/components/_icons/copy.icon";
+import { TimelockControllerABI } from "@/lib/abi/TimelockController";
+import { GovernorABI } from "@/lib/abi/Governor";
+import { Celo } from "@/config/chains";
+import { useContracts } from "@/lib/contracts/useContracts";
export const ContractParams = () => {
const governanceDetails = useGovernanceDetails();
@@ -160,10 +160,11 @@ const ContractAddressLinkWithCopy = ({
function useGovernanceDetails() {
const governanceContractAddresses = useGovernanceContractAddresses();
- const govenorContact = {
+ const governorContact = {
address: governanceContractAddresses.governor,
abi: GovernorABI,
} as const;
+
const timeLockContract = {
address: governanceContractAddresses.timelock,
abi: TimelockControllerABI,
@@ -172,15 +173,15 @@ function useGovernanceDetails() {
const result = useReadContracts({
contracts: [
{
- ...govenorContact,
+ ...governorContact,
functionName: "votingPeriod",
},
{
- ...govenorContact,
+ ...governorContact,
functionName: "proposalThreshold",
},
{
- ...govenorContact,
+ ...governorContact,
functionName: "quorumVotes",
},
{
diff --git a/app/components/countdown/countdown.component.tsx b/src/components/countdown/countdown.component.tsx
similarity index 96%
rename from app/components/countdown/countdown.component.tsx
rename to src/components/countdown/countdown.component.tsx
index 1cf9f8b6..5e99b755 100644
--- a/app/components/countdown/countdown.component.tsx
+++ b/src/components/countdown/countdown.component.tsx
@@ -1,7 +1,7 @@
"use client";
-import BaseComponentProps from "@interfaces/base-component-props.interface";
-import classNames from "classnames";
import { useEffect, useState } from "react";
+import classNames from "classnames";
+import BaseComponentProps from "@/interfaces/base-component-props.interface";
import styles from "./countdown.module.scss";
const getTimeLeftValues = (countDown: number) => {
diff --git a/app/components/countdown/countdown.module.scss b/src/components/countdown/countdown.module.scss
similarity index 93%
rename from app/components/countdown/countdown.module.scss
rename to src/components/countdown/countdown.module.scss
index 8ae27e8b..d7e21667 100644
--- a/app/components/countdown/countdown.module.scss
+++ b/src/components/countdown/countdown.module.scss
@@ -1,4 +1,4 @@
-@import "@/app/brand";
+@import "@/styles/brand";
.countdown {
display: flex;
diff --git a/app/components/create-proposal/create-proposal-content-step/create-proposal-content-step.component.tsx b/src/components/create-proposal/create-proposal-content-step/create-proposal-content-step.component.tsx
similarity index 61%
rename from app/components/create-proposal/create-proposal-content-step/create-proposal-content-step.component.tsx
rename to src/components/create-proposal/create-proposal-content-step/create-proposal-content-step.component.tsx
index 5a443cb8..b74ac40f 100644
--- a/app/components/create-proposal/create-proposal-content-step/create-proposal-content-step.component.tsx
+++ b/src/components/create-proposal/create-proposal-content-step/create-proposal-content-step.component.tsx
@@ -1,33 +1,29 @@
"use client";
-import { Input, MarkdownEditor } from "@components/_shared";
-import { InferType, object, setLocale, string } from "yup";
+import { useEffect } from "react";
+import { object, setLocale, string } from "yup";
import { useForm } from "react-hook-form";
import { yupResolver } from "@hookform/resolvers/yup";
-import Wrapper from "@components/create-proposal/wrapper/wrapper.component";
-import { CreateProposalFormStepEnum } from "@interfaces/create-proposal.interface";
-import { useCreateProposalStore } from "@/app/store";
-import { useEffect } from "react";
+import { Input, MarkdownEditor } from "@/components/_shared";
+import CreateProposalWrapper from "@/components/create-proposal/create-proposal-wrapper/create-proposal-wrapper.component";
+import {
+ CreateProposalStep,
+ useCreateProposal,
+} from "@/components/create-proposal/create-proposal-provider";
-const validationSchema = object({
+const validationSchema = object().shape({
title: string().required().typeError("Invalid title"),
content: string().required().typeError("Invalid description"),
});
-type FormData = InferType;
-
-const formStep = CreateProposalFormStepEnum.content;
-
export const CreateProposalContentStep = () => {
- const { patchContentStep } = useCreateProposalStore();
+ const { setStep, updateProposal, newProposal } = useCreateProposal();
const {
register,
watch,
setValue,
- getValues,
- handleSubmit,
formState: { errors, isValid },
- } = useForm({
+ } = useForm({
resolver: yupResolver(validationSchema),
mode: "onChange",
});
@@ -40,16 +36,22 @@ export const CreateProposalContentStep = () => {
useEffect(() => {
const subscription = watch((value) => {
- patchContentStep({
+ updateProposal({
title: value.title || "",
description: value.content || "",
+ code: newProposal.code,
});
});
return () => subscription.unsubscribe();
- }, [watch, patchContentStep]);
+ }, [watch, updateProposal, newProposal.code, isValid]);
return (
-
+ setStep(CreateProposalStep.wallet)}
+ onNext={isValid ? () => setStep(CreateProposalStep.execution) : undefined}
+ >
Give your proposal a title and a description. They will be public when
@@ -69,6 +71,6 @@ export const CreateProposalContentStep = () => {
markdownChanged={(value) => setValue("content", value)}
/>