Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explorer tabs upgrade #485

Merged
merged 26 commits into from
Feb 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
d069041
Squashed commit of the following:
fabiolalombardim Dec 21, 2022
740680c
Merge branch 'develop' of https://github.com/dOrgTech/homebase-app in…
fabiolalombardim Jan 3, 2023
cb8245d
Merge branch 'develop' of https://github.com/dOrgTech/homebase-app in…
fabiolalombardim Jan 8, 2023
8cbe0d7
Merge branch 'develop' of https://github.com/dOrgTech/homebase-app in…
fabiolalombardim Jan 10, 2023
8a1590f
Merge branch 'develop' of https://github.com/dOrgTech/homebase-app in…
fabiolalombardim Jan 10, 2023
435639f
Merge branch 'develop' of https://github.com/dOrgTech/homebase-app in…
fabiolalombardim Jan 11, 2023
a56b6e9
Merge branch 'develop' of https://github.com/dOrgTech/homebase-app in…
fabiolalombardim Jan 12, 2023
c66cef7
Merge branch 'develop' of https://github.com/dOrgTech/homebase-app in…
fabiolalombardim Jan 19, 2023
1830e65
Merge branch 'develop' of https://github.com/dOrgTech/homebase-app in…
fabiolalombardim Jan 25, 2023
e5bd629
title block updated & buttons removed
fabiolalombardim Jan 25, 2023
e11c8c7
table filter
fabiolalombardim Jan 25, 2023
b7e8e24
clean up
fabiolalombardim Jan 26, 2023
10436dd
Merge branch 'develop' of https://github.com/dOrgTech/homebase-app in…
fabiolalombardim Jan 26, 2023
a4081ff
Merge branch 'develop' into explorer-tabs-upgrade
fabiolalombardim Jan 26, 2023
145449b
dao info tables
fabiolalombardim Jan 28, 2023
890bd96
updated missing field
fabiolalombardim Jan 29, 2023
bbee78e
removed material ui styles
fabiolalombardim Jan 29, 2023
4674f11
clean up
fabiolalombardim Jan 29, 2023
dcd5e0e
removed view code button
fabiolalombardim Jan 29, 2023
c69f49c
responsive tables
fabiolalombardim Jan 31, 2023
d6a0e2c
Merge branch 'develop' of https://github.com/dOrgTech/homebase-app in…
fabiolalombardim Feb 7, 2023
9d8cb24
Merge branch 'develop' into explorer-tabs-upgrade
fabiolalombardim Feb 7, 2023
e3c3f17
requested changes
fabiolalombardim Feb 10, 2023
6384b3e
delete console.log
fabiolalombardim Feb 10, 2023
b5e0bf0
execute text updated
fabiolalombardim Feb 11, 2023
3a903de
formulas added
fabiolalombardim Feb 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19,891 changes: 0 additions & 19,891 deletions package-lock.json

This file was deleted.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@
"source-map-explorer": "2.5.2",
"typescript": "^4.2.3"
},
"resolutions": {
"@types/react": "~17.0.3"
},
"eslintConfig": {
"extends": [
"react-app"
Expand Down
8 changes: 8 additions & 0 deletions src/assets/logos/config.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/models/Token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export const SUPPORTED_MIME_TYPES = [
] as const
export const SUPPORTED_MEDIA_TYPES = ["image", "audio", "video"] as const

export type NFTMimeType = typeof SUPPORTED_MIME_TYPES[number] | "unknown"
export type NFTMediaType = typeof SUPPORTED_MEDIA_TYPES[number] | "unknown"
export type NFTMimeType = (typeof SUPPORTED_MIME_TYPES)[number] | "unknown"
export type NFTMediaType = (typeof SUPPORTED_MEDIA_TYPES)[number] | "unknown"

interface NFTParams extends TokenParams {
description: string
Expand Down
3 changes: 1 addition & 2 deletions src/modules/common/WarningFooter.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Box, Grid, IconButton, Typography } from "@material-ui/core"
import { styled } from "@material-ui/styles"
import { Box, Grid, IconButton, Typography, styled } from "@material-ui/core"
import React, { useEffect, useState } from "react"
import { ReactComponent as WarningIcon } from "assets/logos/warning.svg"
import CloseIcon from "@material-ui/icons/Close"
Expand Down
140 changes: 140 additions & 0 deletions src/modules/explorer/components/AllProposalsList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
import { Collapse, Grid, IconButton, Typography } from "@material-ui/core"
import { styled } from "@material-ui/styles"
import { ProposalItem } from "modules/explorer/pages/User"
import React, { useCallback, useEffect, useMemo, useState } from "react"
import { Link } from "react-router-dom"
import { Proposal, ProposalStatus } from "services/indexer/dao/mappers/proposal/types"
import { ContentContainer } from "./ContentContainer"
import { Dropdown } from "./Dropdown"

const TableContainer = styled(ContentContainer)({
width: "100%"
})

const TableHeader = styled(Grid)({
padding: "16px 46px",
minHeight: 34
})

const ProposalsFooter = styled(Grid)({
padding: "16px 46px",
borderTop: ".6px solid rgba(125,140,139, 0.2)",
minHeight: 34
})

interface Props {
currentLevel: number
proposals: Proposal[]
title: string
showFooter?: boolean
rightItem?: (proposal: Proposal) => React.ReactElement
}

export const AllProposalsList: React.FC<Props> = ({ currentLevel, proposals, title, showFooter, rightItem }) => {
const [filteredProposal, setFilteredProposals] = useState(proposals)
const [filter, setFilter] = useState("All")

const filterProposals = useCallback(
(status?: any) => {
if (status === "All") {
return setFilteredProposals(proposals)
} else if (status !== "All" && status !== undefined) {
const filtered = proposals.filter(proposal => proposal["cachedStatus"]?.status === status)
setFilteredProposals(filtered)
} else {
return setFilteredProposals(proposals)
}
},
[proposals]
)

useEffect(() => {
filterProposals(filter)
}, [filter, filterProposals])

useEffect(() => {
setFilteredProposals(proposals)
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])

const filterProposalByStatus = (status: any) => {
setFilter(status)
}

return (
<TableContainer item>
<Grid container direction="column" wrap={"nowrap"}>
<TableHeader item container justifyContent="space-between" alignItems="center">
<Grid item>
<Typography variant="body1" style={{ fontWeight: "500" }} color="textPrimary">
{title}
</Typography>
</Grid>
{proposals.length ? (
<Grid item>
<IconButton aria-label="expand row" size="small">
<Dropdown
options={[
{ name: "All", value: "All" },
{ name: ProposalStatus.ACTIVE, value: ProposalStatus.ACTIVE },
{ name: ProposalStatus.DROPPED, value: ProposalStatus.DROPPED },
{ name: ProposalStatus.EXECUTABLE, value: ProposalStatus.EXECUTABLE },
{ name: ProposalStatus.EXECUTED, value: ProposalStatus.EXECUTED },
{ name: ProposalStatus.EXPIRED, value: ProposalStatus.EXPIRED },
{ name: ProposalStatus.NO_QUORUM, value: ProposalStatus.NO_QUORUM },
{ name: ProposalStatus.PASSED, value: ProposalStatus.PASSED },
{ name: ProposalStatus.PENDING, value: ProposalStatus.PENDING },
{ name: ProposalStatus.REJECTED, value: ProposalStatus.REJECTED }
]}
value={"All"}
onSelected={filterProposalByStatus}
/>{" "}
</IconButton>
</Grid>
) : null}
</TableHeader>
{filteredProposal.length ? (
<Grid
item
container
wrap={"nowrap"}
component={Collapse}
in={true}
timeout="auto"
unmountOnExit
direction="column"
>
{filteredProposal.map((p, i) => (
<Grid item key={`proposal-${i}`}>
<Link to={`proposal/${p.id}`}>
<ProposalItem proposal={p} status={p.getStatus(currentLevel).status}>
{rightItem ? rightItem(p) : null}
</ProposalItem>
</Link>
</Grid>
))}
</Grid>
) : (
<ProposalsFooter item container direction="column" justifyContent="center">
<Grid item>
<Typography color="textPrimary" align="center">
No items
</Typography>
</Grid>
</ProposalsFooter>
)}
{showFooter && (
<ProposalsFooter item container direction="column" justifyContent="center">
<Grid item>
<Link to="proposals">
<Typography color="secondary" variant="body2" align="center">
View All Proposals
</Typography>
</Link>
</Grid>
</ProposalsFooter>
)}
</Grid>
</TableContainer>
)
}
66 changes: 66 additions & 0 deletions src/modules/explorer/components/Dropdown.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import React, { useEffect, useState } from "react"
import { Select, SelectProps, MenuItem, makeStyles, Theme } from "@material-ui/core"
interface DropdownProps extends SelectProps {
options: { name: string; value: string | undefined }[]
value?: string | undefined
onSelected?: (item: string | undefined) => void
isFirst?: boolean
}

const useStyles = makeStyles((theme: Theme) => ({
icon: {
left: 0
},
iconOpen: {
transform: "none"
},
selectSelect: {
[theme.breakpoints.down("sm")]: {
fontSize: 16
},
paddingLeft: 10,
paddingTop: 0,
paddingBottom: 0,
minHeight: 24
},
option: {
"padding": 8,
"fontFamily": "Roboto Mono",
"cursor": "pointer",
"text-transform": "capitalize",
"&:hover": {
background: "rgba(129, 254, 183, .4)"
}
}
}))

export const Dropdown: React.FC<DropdownProps> = ({ options, value, onSelected }) => {
const classes = useStyles()
const [selected, setSelected] = useState<string | undefined>(value)

useEffect(() => {
setSelected(value)
}, [value])

const handleSelected = (event: any) => {
setSelected(event.target.value)
if (onSelected) onSelected(event.target.value)
}

return (
<Select
// native
value={selected}
onChange={handleSelected}
classes={{
select: classes.selectSelect
}}
>
{options.map(({ name, value }, index) => (
<option value={value} key={`${name}-${index}`} className={classes.option}>
{name}
</option>
))}
</Select>
)
}
16 changes: 12 additions & 4 deletions src/modules/explorer/components/NavigationMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ReactComponent as TreasuryIcon } from "assets/logos/treasury.svg"
import { ReactComponent as RegistryIcon } from "assets/logos/list.svg"
import { ReactComponent as UserIcon } from "assets/logos/user.svg"
import { ReactComponent as NFTIcon } from "assets/logos/nft.svg"
import { ReactComponent as ConfigIcon } from "assets/logos/config.svg"
import React, { useEffect, useState } from "react"
import { useDAOID } from "../pages/DAO/router"
import { useDAO } from "services/indexer/dao/hooks/useDAO"
Expand Down Expand Up @@ -81,7 +82,8 @@ const IconContainer = styled("span")(({ theme, isSelected }: { theme: Theme; isS
"justifyContent": "center",

"& > svg > *": {
fill: isSelected ? theme.palette.secondary.main : theme.palette.text.primary
fill: isSelected ? theme.palette.secondary.main : theme.palette.text.primary,
stroke: isSelected ? theme.palette.secondary.main : theme.palette.text.primary
}
}))

Expand Down Expand Up @@ -134,10 +136,16 @@ const getPages = (daoId: string): Page[] => [
name: "User",
icon: UserIcon,
href: `/explorer/dao/${daoId}/user`
},
{
pathId: "config",
name: "Config",
icon: ConfigIcon,
href: `/explorer/dao/${daoId}/config`
}
]

const StyledBottomBar = styled(Grid)(({ theme, visible }: { theme: Theme; visible: boolean }) => ({
const StyledBottomBar = styled(Grid)(({ theme }: { theme: Theme }) => ({
position: "fixed",
height: 55,
width: "100%",
Expand Down Expand Up @@ -173,7 +181,7 @@ const BottomNavBar: React.FC = ({ children }) => {
}, [prevScrollPos, visible])

return (
<StyledBottomBar container direction={"row"} visible={visible}>
<StyledBottomBar container direction={"row"}>
<BottomBarItems container>{children}</BottomBarItems>
</StyledBottomBar>
)
Expand Down Expand Up @@ -225,7 +233,7 @@ export const NavigationMenu: React.FC<{ disableMobileMenu?: boolean }> = ({ disa
) : (
<BottomNavBar>
{pages.map((page, i) => (
<PageItem key={`page-${i}`} isSelected={pathId === page.pathId} item alignItems="center">
<PageItem key={`page-${i}`} isSelected={pathId === page.pathId} container item alignItems="center">
<Link to={page.href}>
<Grid container alignItems="center" justifyContent="center">
<Grid item>
Expand Down
4 changes: 2 additions & 2 deletions src/modules/explorer/components/ResponsiveDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const ResponsiveDialog: React.FC<{
<BottomSheet open={open} onDismiss={onClose}>
<Content container direction="column" style={{ gap: 46 }}>
<Grid item container direction="row" wrap="nowrap" justifyContent="space-between">
<Grid item>{Boolean(onGoBack) ? <BackButton onGoBack={onGoBack} /> : null}</Grid>
<Grid item>{onGoBack ? <BackButton onGoBack={onGoBack} /> : null}</Grid>
<Grid item>
<TitleText>{title}</TitleText>
</Grid>
Expand All @@ -54,7 +54,7 @@ export const ResponsiveDialog: React.FC<{
<CustomDialog open={open} onClose={onClose} maxWidth={template ? "md" : "sm"}>
<Content container direction="column" style={{ gap: 30 }}>
<Grid item container direction="row" wrap="nowrap" justifyContent="space-between">
<Grid item>{Boolean(onGoBack) ? <BackButton onGoBack={onGoBack} /> : null}</Grid>
<Grid item>{onGoBack ? <BackButton onGoBack={onGoBack} /> : null}</Grid>
<Grid item>
<TitleText color="textPrimary">{title}</TitleText>
</Grid>
Expand Down
4 changes: 2 additions & 2 deletions src/modules/explorer/components/StatusBadge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ const statusColors = (status: ProposalStatus) => {
}

const Badge = styled(Grid)(({ status }: { status: ProposalStatus; theme: Theme }) => ({
borderRadius: 4,
borderRadius: 50,
textAlign: "center",
minHeight: 24,
minWidth: 105,
padding: "2px 5px",
padding: "2px 8px",
background: statusColors(status).background,
color: statusColors(status).color,
whiteSpace: "nowrap"
Expand Down
2 changes: 1 addition & 1 deletion src/modules/explorer/components/UsersTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const TableText = styled(Typography)({
}
})

const titleDataMatcher = (title: typeof titles[number], rowData: RowData) => {
const titleDataMatcher = (title: (typeof titles)[number], rowData: RowData) => {
switch (title) {
case "Rank":
return rowData.address
Expand Down
Loading