Skip to content

Commit

Permalink
Rearranged types
Browse files Browse the repository at this point in the history
  • Loading branch information
ashutoshpw committed Jan 21, 2025
1 parent 7bc9dd8 commit 2410ab7
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 45 deletions.
16 changes: 16 additions & 0 deletions src/components/ui/StatusButton.tsx
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -70,6 +71,7 @@ export const EvmProposalsPage = () => {
<MenuItem value="changeConfig">Change Config</MenuItem>
</Select>
</Grid>

<Grid item xs={12} sm={3}>
<Typography variant="body2" color="textPrimary" gutterBottom>
Status
Expand Down
2 changes: 1 addition & 1 deletion src/modules/explorer/components/FiltersDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
38 changes: 3 additions & 35 deletions src/modules/explorer/components/FiltersUserDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<Props> = ({ open, handleClose, saveFilters }) => {
const [filters, setFilters] = useState<StatusOption[]>([])
const [onchainStatus, setOnchainStatus] = useState<StatusOption[]>([])
Expand Down
2 changes: 1 addition & 1 deletion src/modules/explorer/components/ProposalsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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%"
Expand Down
2 changes: 1 addition & 1 deletion src/modules/explorer/pages/Treasury/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
9 changes: 2 additions & 7 deletions src/modules/explorer/pages/User/components/UserMovements.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
23 changes: 23 additions & 0 deletions src/modules/explorer/types.d.ts
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit 2410ab7

Please sign in to comment.