-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from HausDAO/feature/prop-forms
Feature/prop forms
- Loading branch information
Showing
18 changed files
with
453 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import React, { ComponentProps } from 'react'; | ||
import { Link as RouterLink } from 'react-router-dom'; | ||
import styled from 'styled-components'; | ||
import { Button } from '@daohaus/ui'; | ||
|
||
type ProfileLinkProps = { | ||
href?: string; | ||
to: string; | ||
selected?: boolean; | ||
disabled?: boolean; | ||
linkType?: 'internal' | 'external' | 'no-icon-external'; | ||
hideIcon?: boolean; | ||
target?: string; | ||
rel?: string; | ||
} & Partial<ComponentProps<typeof Button>>; | ||
|
||
const StyledRouterLink = styled(RouterLink)` | ||
text-decoration: none; | ||
color: unset; | ||
&:hover { | ||
text-decoration: none; | ||
} | ||
`; | ||
|
||
export const ButtonRouterLink = ({ | ||
to, | ||
target, | ||
disabled, | ||
children, | ||
linkType, | ||
hideIcon, | ||
rel, | ||
...buttonProps | ||
}: ProfileLinkProps) => { | ||
return ( | ||
<StyledRouterLink to={to} target={target} className="button-link" rel={rel}> | ||
<Button disabled={disabled} {...buttonProps}> | ||
{children} | ||
</Button> | ||
</StyledRouterLink> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
import { Link as RouterLink } from "react-router-dom"; | ||
import { RiArrowRightSLine } from "react-icons/ri/index.js"; | ||
import styled from "styled-components"; | ||
|
||
import { Bold, DataSm, ParMd, Tabs } from "@daohaus/ui"; | ||
|
||
import { CustomFormLego } from "../legos/legoConfig"; | ||
import { useCurrentDao } from "@daohaus/moloch-v3-hooks"; | ||
|
||
const ListContainer = styled.div` | ||
margin-top: 2.5rem; | ||
`; | ||
|
||
const ListItemContainer = styled.div` | ||
width: 100%; | ||
padding: 1rem 0; | ||
border-top: 1px ${({ theme }) => theme.secondary.step6} solid; | ||
`; | ||
|
||
const ListItemLink = styled(RouterLink)` | ||
text-decoration: none; | ||
width: 100%; | ||
color: unset; | ||
&:hover { | ||
text-decoration: none; | ||
} | ||
`; | ||
|
||
const ListItemHoverContainer = styled.div` | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
width: 100%; | ||
padding: 1rem; | ||
border-radius: ${({ theme }) => theme.card.radius}; | ||
&:hover { | ||
background: 1px ${({ theme }) => theme.secondary.step3}; | ||
} | ||
`; | ||
|
||
const ListItem = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: flex-start; | ||
word-wrap: break-word; | ||
max-width: 39rem; | ||
`; | ||
|
||
const StyledIcon = styled(RiArrowRightSLine)` | ||
fill: ${({ theme }) => theme.primary.step9}; | ||
font-size: 3rem; | ||
`; | ||
|
||
type NewProposalListProps = { | ||
basicProposals: CustomFormLego[]; | ||
advancedProposals: CustomFormLego[]; | ||
}; | ||
|
||
const ProposalList = ({ proposals }: { proposals: CustomFormLego[] }) => { | ||
const { daoChain, daoId } = useCurrentDao(); | ||
|
||
return ( | ||
<div> | ||
{proposals.map((proposalLego: CustomFormLego) => ( | ||
<ListItemContainer key={proposalLego.id}> | ||
<ListItemLink | ||
to={`/molochv3/${daoChain}/${daoId}/new-proposal?formLego=${proposalLego.id}`} | ||
> | ||
<ListItemHoverContainer> | ||
<ListItem> | ||
<ParMd> | ||
<Bold>{proposalLego.title}</Bold> | ||
</ParMd> | ||
<DataSm>{proposalLego.description}</DataSm> | ||
</ListItem> | ||
<StyledIcon /> | ||
</ListItemHoverContainer> | ||
</ListItemLink> | ||
</ListItemContainer> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
export const NewProposalList = ({ | ||
basicProposals, | ||
advancedProposals, | ||
}: NewProposalListProps) => { | ||
return ( | ||
<ListContainer> | ||
<Tabs | ||
tabList={[ | ||
{ | ||
label: "Basics", | ||
Component: () => <ProposalList proposals={basicProposals} />, | ||
}, | ||
{ | ||
label: "Advanced", | ||
Component: () => <ProposalList proposals={advancedProposals} />, | ||
}, | ||
]} | ||
/> | ||
</ListContainer> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,10 @@ | ||
import { FieldLego } from "@daohaus/form-builder"; | ||
import { CustomFieldLego } from "./fieldConfig"; | ||
import { CustomFieldLego } from "./legoConfig"; | ||
|
||
export const APP_FIELD: Record<string, CustomFieldLego> = { | ||
TITLE: { | ||
id: "title", | ||
type: "input", | ||
label: "Proposal Title", | ||
placeholder: "Enter title", | ||
}, | ||
DESCRIPTION: { | ||
id: "description", | ||
type: "textarea", | ||
label: "Description", | ||
placeholder: "Enter description", | ||
}, | ||
LINK: { | ||
id: "link", | ||
type: "input", | ||
label: "Link", | ||
placeholder: "http://", | ||
expectType: "url", | ||
}, | ||
TEST_FIELD: { | ||
id: "testField", | ||
type: "testField", | ||
label: "Test Field", | ||
placeholder: "Enter something", | ||
label: "Enter Something Super", | ||
placeholder: "Super Duper", | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { MolochFields } from "@daohaus/moloch-v3-fields"; | ||
import { FieldLegoBase, FormLegoBase } from "@daohaus/utils"; | ||
import { COMMON_FORMS, PROPOSAL_FORMS } from "@daohaus/moloch-v3-legos"; | ||
|
||
import { APP_FORM } from "./forms"; | ||
import { TestField } from "../components/customFields/fieldTest"; | ||
|
||
export const AppFieldLookup = { | ||
...MolochFields, | ||
testField: TestField, | ||
}; | ||
|
||
export type CustomFieldLego = FieldLegoBase<typeof AppFieldLookup>; | ||
export type CustomFormLego = FormLegoBase<typeof AppFieldLookup>; | ||
|
||
export const BASIC_PROPOSAL_FORMS = { | ||
TEST_FORM: APP_FORM.TEST_FORM, | ||
SIGNAL: PROPOSAL_FORMS.SIGNAL, | ||
ISSUE: PROPOSAL_FORMS.ISSUE, | ||
TOKENS_FOR_SHARES: PROPOSAL_FORMS.TOKENS_FOR_SHARES, | ||
TRANSFER_ERC20: PROPOSAL_FORMS.TRANSFER_ERC20, | ||
TRANSFER_NETWORK_TOKEN: PROPOSAL_FORMS.TRANSFER_NETWORK_TOKEN, | ||
}; | ||
|
||
export const ADVANCED_PROPOSAL_FORMS = { | ||
WALLETCONNECT: PROPOSAL_FORMS.WALLETCONNECT, | ||
UPDATE_GOV_SETTINGS: PROPOSAL_FORMS.UPDATE_GOV_SETTINGS, | ||
TOKEN_SETTINGS: PROPOSAL_FORMS.TOKEN_SETTINGS, | ||
ADD_SHAMAN: PROPOSAL_FORMS.ADD_SHAMAN, | ||
GUILDKICK: PROPOSAL_FORMS.GUILDKICK, | ||
MULTICALL_BUILDER: PROPOSAL_FORMS.MULTICALL_BUILDER, | ||
}; | ||
|
||
export const ALL_APP_FORMS = { | ||
...APP_FORM, | ||
...PROPOSAL_FORMS, | ||
...COMMON_FORMS, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.