diff --git a/apps/core-app/src/legos/form.ts b/apps/core-app/src/legos/form.ts index 11d7d63ff..7a386836e 100644 --- a/apps/core-app/src/legos/form.ts +++ b/apps/core-app/src/legos/form.ts @@ -6,14 +6,36 @@ import { TABULA_TX, TX } from './tx'; export const getFormLegoById = ( id: CustomFormLego['id'] ): CustomFormLego | undefined => { - const formKey = Object.keys(FORM).find((key) => { - return FORM[key].id === id; + const formKey = Object.keys(PROPOSAL_FORMS).find((key) => { + return PROPOSAL_FORMS[key].id === id; }); if (!formKey) return; - return FORM[formKey]; + return PROPOSAL_FORMS[formKey]; }; -export const FORM: Record = { +/* +Quick Reference for forms + +PROPOSAL_FORMS KEYS +- SHARE_SWAP +- SIGNAL +- ISSUE +- ADD_SHAMAN +- UPDATE_SHAMAN +- ISSUE_ERC20 +- ISSUE_NETWORK_TOKEN +- UPDATE_GOV_SETTINGS +- TOKEN_SETTINGS +- TOKENS_FOR_SHARES +- GUILDKICK +- CREATE_PUBLICATION +- CREATE_ARTICLE + +COMMON_FORMS KEYS +- METADATA_SETTINGS +*/ + +export const PROPOSAL_FORMS: Record = { SHARE_SWAP: { id: 'SHARE_SWAP', title: 'Swap Tokens for Shares', @@ -109,22 +131,6 @@ export const FORM: Record = { FIELD.SHAMAN_DELUXE, ], }, - TEST: { - id: 'TEST', - title: 'Test Form', - subtitle: 'Test Proposal', - description: - 'Test your proposal like a champ with this shiny new Test Form.', - requiredFields: { title: true, description: true }, - log: true, - tx: TX.POST_SIGNAL, - fields: [ - FIELD.TITLE, - FIELD.DESCRIPTION, - FIELD.LINK, - FIELD.REQUEST_NATIVE_TOKEN, - ], - }, ISSUE_ERC20: { id: 'ISSUE_ERC20', title: 'Issue Funding (ERC20)', @@ -179,31 +185,6 @@ export const FORM: Record = { FIELD.REQUEST_NATIVE_TOKEN, ], }, - METADATA_SETTINGS: { - id: 'METADATA_SETTINGS', - title: 'Update Metadata Settings', - subtitle: 'Settings', - requiredFields: { name: true }, - log: true, - tx: TX.UPDATE_METADATA_SETTINGS, - fields: [ - FIELD.NAME, - FIELD.DESCRIPTION, - { - ...FIELD.DESCRIPTION, - id: 'long_description', - label: 'Long Description', - }, - { ...FIELD.LINK, id: 'icon', label: 'Icon' }, - { ...FIELD.LINK, id: 'discord', label: 'Discord' }, - { ...FIELD.LINK, id: 'github', label: 'Github' }, - { ...FIELD.LINK, id: 'medium', label: 'Medium' }, - { ...FIELD.LINK, id: 'telegram', label: 'Telegram' }, - { ...FIELD.LINK, id: 'twitter', label: 'Twitter' }, - { ...FIELD.LINK, id: 'other', label: 'Other' }, - FIELD.TAGS, - ], - }, UPDATE_GOV_SETTINGS: { id: 'UPDATE_GOV_SETTINGS', title: 'Update Governance Settings', @@ -514,3 +495,31 @@ export const TABULA_FORMS: Record = { ], }, }; + +export const COMMON_FORMS = { + METADATA_SETTINGS: { + id: 'METADATA_SETTINGS', + title: 'Update Metadata Settings', + subtitle: 'Settings', + requiredFields: { name: true }, + log: true, + tx: TX.UPDATE_METADATA_SETTINGS, + fields: [ + FIELD.NAME, + FIELD.DESCRIPTION, + { + ...FIELD.DESCRIPTION, + id: 'long_description', + label: 'Long Description', + }, + { ...FIELD.LINK, id: 'icon', label: 'Icon' }, + { ...FIELD.LINK, id: 'discord', label: 'Discord' }, + { ...FIELD.LINK, id: 'github', label: 'Github' }, + { ...FIELD.LINK, id: 'medium', label: 'Medium' }, + { ...FIELD.LINK, id: 'telegram', label: 'Telegram' }, + { ...FIELD.LINK, id: 'twitter', label: 'Twitter' }, + { ...FIELD.LINK, id: 'other', label: 'Other' }, + FIELD.TAGS, + ], + }, +}; diff --git a/apps/core-app/src/pages/Proposals.tsx b/apps/core-app/src/pages/Proposals.tsx index 092f31ee2..d5b658cd5 100644 --- a/apps/core-app/src/pages/Proposals.tsx +++ b/apps/core-app/src/pages/Proposals.tsx @@ -12,7 +12,7 @@ import { BsPlusLg } from 'react-icons/bs'; import { defaultDaoData, useDao, useProposals } from '../contexts/DaoContext'; import { NewProposalList } from '../components/NewProposalList'; -import { FORM } from '../legos/form'; +import { PROPOSAL_FORMS } from '../legos/form'; import SearchInput from '../components/SearchInput'; import FilterDropdown from '../components/FilterDropdown'; import { BaseProposalCard } from '../components/BaseProposalCard'; @@ -30,7 +30,10 @@ const SearchFilterContainer = styled.div` gap: 2.1rem; `; -export const VALID_NEW_PROPOSALS = [FORM.SIGNAL, FORM.SHARE_SWAP]; +export const VALID_NEW_PROPOSALS = [ + PROPOSAL_FORMS.SIGNAL, + PROPOSAL_FORMS.SHARE_SWAP, +]; export function Proposals() { const { @@ -45,7 +48,7 @@ export function Proposals() { const [filter, setFilter] = useState(''); const newProposals = useMemo(() => { - return Object.keys(FORM).map((key) => FORM[key]); + return Object.keys(PROPOSAL_FORMS).map((key) => PROPOSAL_FORMS[key]); }, []); const handleSearchFilter = (term: string) => { diff --git a/apps/core-app/src/pages/UpdateSettings.tsx b/apps/core-app/src/pages/UpdateSettings.tsx index 3f40c01c2..9bbc696ba 100644 --- a/apps/core-app/src/pages/UpdateSettings.tsx +++ b/apps/core-app/src/pages/UpdateSettings.tsx @@ -2,7 +2,7 @@ import { FormBuilder } from '@daohaus/haus-form-builder'; import { useMemo } from 'react'; import { useDao } from '../contexts/DaoContext'; import { CustomFields } from '../legos/config'; -import { FORM } from '../legos/form'; +import { COMMON_FORMS } from '../legos/form'; export function UpdateSettings() { const { dao } = useDao(); @@ -27,7 +27,7 @@ export function UpdateSettings() { return ( );