From 2410ab7a177575c5f428b1bee22905a6f7b330dd Mon Sep 17 00:00:00 2001 From: Ashutosh Kumar Date: Tue, 21 Jan 2025 15:00:57 +0530 Subject: [PATCH] Rearranged types --- src/components/ui/StatusButton.tsx | 16 ++++++++ .../EtherlinkDAO/EvmProposalsPage.tsx | 2 + .../explorer/components/FiltersDialog.tsx | 2 +- .../explorer/components/FiltersUserDialog.tsx | 38 ++----------------- .../explorer/components/ProposalsList.tsx | 2 +- src/modules/explorer/pages/Treasury/index.tsx | 2 +- .../pages/User/components/UserMovements.tsx | 9 +---- src/modules/explorer/types.d.ts | 23 +++++++++++ 8 files changed, 49 insertions(+), 45 deletions(-) create mode 100644 src/components/ui/StatusButton.tsx create mode 100644 src/modules/explorer/types.d.ts diff --git a/src/components/ui/StatusButton.tsx b/src/components/ui/StatusButton.tsx new file mode 100644 index 00000000..6ba56a65 --- /dev/null +++ b/src/components/ui/StatusButton.tsx @@ -0,0 +1,16 @@ +import { Grid, styled } from "@material-ui/core" + +const StatusButton = styled(Grid)(({ theme }) => ({ + "background": theme.palette.primary.main, + "padding": "8px 16px", + "borderRadius": 50, + "marginRight": 16, + "marginBottom": 16, + "cursor": "pointer", + "textTransform": "capitalize", + "&:hover": { + background: "rgba(129, 254, 183, .4)" + } +})) + +export default StatusButton diff --git a/src/modules/etherlink/explorer/EtherlinkDAO/EvmProposalsPage.tsx b/src/modules/etherlink/explorer/EtherlinkDAO/EvmProposalsPage.tsx index d5222c21..6e9c617a 100644 --- a/src/modules/etherlink/explorer/EtherlinkDAO/EvmProposalsPage.tsx +++ b/src/modules/etherlink/explorer/EtherlinkDAO/EvmProposalsPage.tsx @@ -10,6 +10,7 @@ import { EvmDaoProposalList } from "modules/etherlink/components/EvmDaoProposalL import { ProposalActionsDialog } from "modules/explorer/components/ProposalActionsDialog" import Select, { SelectChangeEvent } from "@mui/material/Select" import { useQueryParam } from "modules/home/hooks/useQueryParam" +import StatusButton from "components/ui/StatusButton" export const EvmProposalsPage = () => { // const daoId = useEtherlinkDAOID() @@ -70,6 +71,7 @@ export const EvmProposalsPage = () => { Change Config + Status diff --git a/src/modules/explorer/components/FiltersDialog.tsx b/src/modules/explorer/components/FiltersDialog.tsx index f626cb5d..4fa311db 100644 --- a/src/modules/explorer/components/FiltersDialog.tsx +++ b/src/modules/explorer/components/FiltersDialog.tsx @@ -4,7 +4,7 @@ import { Grid, styled } from "@material-ui/core" import { Typography } from "@mui/material" import { ProposalStatus } from "services/services/dao/mappers/proposal/types" import { SmallButton } from "modules/common/SmallButton" -import { Order, ProposalType } from "./FiltersUserDialog" +import { Order, ProposalType } from "../types.d" import { Filters } from "../pages/User/components/UserMovements" interface Props { diff --git a/src/modules/explorer/components/FiltersUserDialog.tsx b/src/modules/explorer/components/FiltersUserDialog.tsx index b4a512cb..ac995425 100644 --- a/src/modules/explorer/components/FiltersUserDialog.tsx +++ b/src/modules/explorer/components/FiltersUserDialog.tsx @@ -6,25 +6,10 @@ import { Dropdown } from "./Dropdown" import { ProposalStatus } from "services/services/dao/mappers/proposal/types" import { SmallButton } from "modules/common/SmallButton" import { Filters } from "../pages/User/components/UserMovements" +import StatusButton from "components/ui/StatusButton" +import { ProposalType, OffchainStatus, Order, StatusOption } from "../types.d" -export enum ProposalType { - ON_CHAIN = "on-chain", - OFF_CHAIN = "off-chain", - ALL = "all" -} - -export enum OffchainStatus { - ACTIVE = "active", - CLOSED = "closed", - ALL = "all" -} - -export enum Order { - RECENT = "recent", - POPULAR = "popular" -} - -interface Props { +export interface Props { open: boolean handleClose: () => void saveFilters: (filters: Filters) => void @@ -40,23 +25,6 @@ const Container = styled(Grid)({ gap: 24 }) -const StatusButton = styled(Grid)(({ theme }) => ({ - "background": theme.palette.primary.main, - "padding": "8px 16px", - "borderRadius": 50, - "marginRight": 16, - "marginBottom": 16, - "cursor": "pointer", - "textTransform": "capitalize", - "&:hover": { - background: "rgba(129, 254, 183, .4)" - } -})) - -export interface StatusOption { - label: string -} - export const FilterUserProposalsDialog: React.FC = ({ open, handleClose, saveFilters }) => { const [filters, setFilters] = useState([]) const [onchainStatus, setOnchainStatus] = useState([]) diff --git a/src/modules/explorer/components/ProposalsList.tsx b/src/modules/explorer/components/ProposalsList.tsx index c9049ff9..b01b2ef4 100644 --- a/src/modules/explorer/components/ProposalsList.tsx +++ b/src/modules/explorer/components/ProposalsList.tsx @@ -9,7 +9,7 @@ import { Poll } from "models/Polls" import ReactPaginate from "react-paginate" import "../pages/DAOList/styles.css" import { Filters } from "../pages/User/components/UserMovements" -import { Order, ProposalType, StatusOption } from "./FiltersUserDialog" +import { Order, ProposalType, StatusOption } from "../types.d" const TableContainer = styled(Grid)({ width: "100%" diff --git a/src/modules/explorer/pages/Treasury/index.tsx b/src/modules/explorer/pages/Treasury/index.tsx index 55a92428..4562571e 100644 --- a/src/modules/explorer/pages/Treasury/index.tsx +++ b/src/modules/explorer/pages/Treasury/index.tsx @@ -20,7 +20,7 @@ import { TreasuryDialog } from "./components/TreasuryDialog" import { SearchInput } from "../DAOList/components/Searchbar" import FilterAltIcon from "@mui/icons-material/FilterAlt" import { FilterTransactionsDialog } from "modules/explorer/components/FiltersTransactionsDialog" -import { StatusOption } from "modules/explorer/components/FiltersUserDialog" +import { StatusOption } from "../../types" const FiltersContainer = styled(Grid)({ cursor: "pointer" diff --git a/src/modules/explorer/pages/User/components/UserMovements.tsx b/src/modules/explorer/pages/User/components/UserMovements.tsx index 27d30e07..89ecc158 100644 --- a/src/modules/explorer/pages/User/components/UserMovements.tsx +++ b/src/modules/explorer/pages/User/components/UserMovements.tsx @@ -19,16 +19,11 @@ import "../../DAOList/styles.css" import { ReactComponent as TabsSelectedIcon } from "assets/img/tabs-icon-selected.svg" import FilterAltIcon from "@mui/icons-material/FilterAlt" import { ArrowBackIos } from "@material-ui/icons" -import { - FilterUserProposalsDialog, - OffchainStatus, - Order, - ProposalType, - StatusOption -} from "modules/explorer/components/FiltersUserDialog" +import { FilterUserProposalsDialog } from "modules/explorer/components/FiltersUserDialog" import { useUserVotes } from "modules/lite/explorer/hooks/useUserVotes" import { usePolls } from "modules/lite/explorer/hooks/usePolls" import { useDAO } from "services/services/dao/hooks/useDAO" +import { ProposalType, OffchainStatus, Order, StatusOption } from "../../../types" const TabsContainer = styled(Grid)(({ theme }) => ({ borderRadius: 8, diff --git a/src/modules/explorer/types.d.ts b/src/modules/explorer/types.d.ts new file mode 100644 index 00000000..8fecfe13 --- /dev/null +++ b/src/modules/explorer/types.d.ts @@ -0,0 +1,23 @@ +import React, { useState } from "react" +import { Props } from "./components/FiltersUserDialog" + +export enum ProposalType { + ON_CHAIN = "on-chain", + OFF_CHAIN = "off-chain", + ALL = "all" +} + +export enum OffchainStatus { + ACTIVE = "active", + CLOSED = "closed", + ALL = "all" +} + +export enum Order { + RECENT = "recent", + POPULAR = "popular" +} + +export interface StatusOption { + label: string +}