diff --git a/apps/core-app/src/Routes.tsx b/apps/core-app/src/Routes.tsx index 26a7502b2..9271ed969 100644 --- a/apps/core-app/src/Routes.tsx +++ b/apps/core-app/src/Routes.tsx @@ -1,9 +1,8 @@ import React from 'react'; import { Routes as RoutesDom, Route } from 'react-router-dom'; +import { Banner } from '@daohaus/ui'; -import { DaoContextProvider } from './contexts/DaoContext'; import Home from './pages/Home'; -import Dao from './pages/Dao'; import DaoOverview from './pages/DaoOverview'; import Members from './pages/Members'; import Member from './pages/Member'; @@ -14,7 +13,7 @@ import Settings from './pages/Settings'; import NewProposal from './pages/NewProposal'; import UpdateSettings from './pages/UpdateSettings'; import ProposalDetails from './pages/ProposalDetails'; -import { Banner } from '@daohaus/ui'; +import { DaoContainer } from './pages/DaoContainer'; const Routes = () => { return ( @@ -22,14 +21,7 @@ const Routes = () => { } /> - - - - } - > + }> } /> } /> } /> diff --git a/apps/core-app/src/components/DaoProfile.tsx b/apps/core-app/src/components/DaoProfile.tsx index da29bc54b..db9c388d1 100644 --- a/apps/core-app/src/components/DaoProfile.tsx +++ b/apps/core-app/src/components/DaoProfile.tsx @@ -15,8 +15,8 @@ import { Button, Link, } from '@daohaus/ui'; +import { TDao } from '@daohaus/dao-context'; -import { TDao } from '../contexts/DaoContext'; import { TagList } from './TagList'; import { missingDaoProfileData } from '../utils/general'; diff --git a/apps/core-app/src/components/FakeMarkdown.tsx b/apps/core-app/src/components/FakeMarkdown.tsx index 9c030b3be..a435c559d 100644 --- a/apps/core-app/src/components/FakeMarkdown.tsx +++ b/apps/core-app/src/components/FakeMarkdown.tsx @@ -7,7 +7,7 @@ import { SuccessMessage, WrappedTextArea, } from '@daohaus/ui'; -import { useDao } from '../contexts/DaoContext'; +import { useDao } from '@daohaus/dao-context'; import { useParams } from 'react-router-dom'; import { ENDPOINTS, diff --git a/apps/core-app/src/components/GovernanceSettings.tsx b/apps/core-app/src/components/GovernanceSettings.tsx index d5599b365..7ee41cae4 100644 --- a/apps/core-app/src/components/GovernanceSettings.tsx +++ b/apps/core-app/src/components/GovernanceSettings.tsx @@ -1,7 +1,7 @@ import styled from 'styled-components'; import { H3, H4, DataIndicator, ParSm, widthQuery, Theme } from '@daohaus/ui'; -import { TDao } from '../contexts/DaoContext'; +import { TDao } from '@daohaus/dao-context'; import { charLimit, formatPeriods, diff --git a/apps/core-app/src/components/MembersOverview.tsx b/apps/core-app/src/components/MembersOverview.tsx index 16693d802..a5771f300 100644 --- a/apps/core-app/src/components/MembersOverview.tsx +++ b/apps/core-app/src/components/MembersOverview.tsx @@ -1,7 +1,7 @@ import styled from 'styled-components'; import { Card, Theme, DataIndicator, widthQuery } from '@daohaus/ui'; -import { TDao } from '../contexts/DaoContext'; +import { TDao } from '@daohaus/dao-context'; import { charLimit, formatValueTo, fromWei } from '@daohaus/common-utilities'; const MembersOverviewCard = styled(Card)` diff --git a/apps/core-app/src/components/MetadataSettings.tsx b/apps/core-app/src/components/MetadataSettings.tsx index a0521b47b..e4c9584e3 100644 --- a/apps/core-app/src/components/MetadataSettings.tsx +++ b/apps/core-app/src/components/MetadataSettings.tsx @@ -10,7 +10,7 @@ import { Link, } from '@daohaus/ui'; -import { TDao, useConnectedMembership } from '../contexts/DaoContext'; +import { TDao, useConnectedMembership } from '@daohaus/dao-context'; import { TagList } from '../components/TagList'; import { useParams } from 'react-router-dom'; import { charLimit, Keychain } from '@daohaus/common-utilities'; diff --git a/apps/core-app/src/components/Profile.tsx b/apps/core-app/src/components/Profile.tsx index 4f7a7c500..6139eae40 100644 --- a/apps/core-app/src/components/Profile.tsx +++ b/apps/core-app/src/components/Profile.tsx @@ -22,7 +22,7 @@ import { votingPowerPercentage, } from '@daohaus/common-utilities'; -import { TMembership, useDao } from '../contexts/DaoContext'; +import { TMembership, useDao } from '@daohaus/dao-context'; const AvatarLarge = styled(Avatar)` height: 12rem; diff --git a/apps/core-app/src/components/ProposalCardOverview.tsx b/apps/core-app/src/components/ProposalCardOverview.tsx index ae3493d69..eed8e515c 100644 --- a/apps/core-app/src/components/ProposalCardOverview.tsx +++ b/apps/core-app/src/components/ProposalCardOverview.tsx @@ -7,7 +7,7 @@ import { Keychain, } from '@daohaus/common-utilities'; -import { TProposals } from '../contexts/DaoContext'; +import { TProposals } from '@daohaus/dao-context'; import { getProposalTypeLabel } from '../utils/general'; const OverviewContainer = styled.div` diff --git a/apps/core-app/src/components/ProposalDetailsGuts.tsx b/apps/core-app/src/components/ProposalDetailsGuts.tsx index faad1c1e6..87a0aede4 100644 --- a/apps/core-app/src/components/ProposalDetailsGuts.tsx +++ b/apps/core-app/src/components/ProposalDetailsGuts.tsx @@ -13,7 +13,7 @@ import { Keychain, } from '@daohaus/common-utilities'; -import { TProposals } from '../contexts/DaoContext'; +import { TProposals } from '@daohaus/dao-context'; import { ProposalWarning } from './ProposalWarning'; const OverviewContainer = styled.div` diff --git a/apps/core-app/src/components/ProposalHistory.tsx b/apps/core-app/src/components/ProposalHistory.tsx index e0a01cff9..9edce551a 100644 --- a/apps/core-app/src/components/ProposalHistory.tsx +++ b/apps/core-app/src/components/ProposalHistory.tsx @@ -3,7 +3,7 @@ import { useParams } from 'react-router-dom'; import styled from 'styled-components'; import { getNetwork } from '@daohaus/common-utilities'; -import { TProposals } from '../contexts/DaoContext'; +import { TProposals } from '@daohaus/dao-context'; import { ProposalHistoryCard } from './ProposalHistoryCard'; import { buildProposalHistory, diff --git a/apps/core-app/src/components/ProposalHistoryCard.tsx b/apps/core-app/src/components/ProposalHistoryCard.tsx index dc4afe9af..881b47276 100644 --- a/apps/core-app/src/components/ProposalHistoryCard.tsx +++ b/apps/core-app/src/components/ProposalHistoryCard.tsx @@ -22,7 +22,7 @@ import { ProposalHistoryElement, ProposalHistoryElementData, } from '../utils/historyHelpers'; -import { TProposals } from '../contexts/DaoContext'; +import { TProposals } from '@daohaus/dao-context'; import { VoteList } from './VoteList'; const ElementContainer = styled.div` diff --git a/apps/core-app/src/components/ShamanList.tsx b/apps/core-app/src/components/ShamanList.tsx index a7e6d5571..4e81790f2 100644 --- a/apps/core-app/src/components/ShamanList.tsx +++ b/apps/core-app/src/components/ShamanList.tsx @@ -1,7 +1,7 @@ import styled from 'styled-components'; import { AddressDisplay, Button, DataSm, widthQuery } from '@daohaus/ui'; -import { TDao } from '../contexts/DaoContext'; +import { TDao } from '@daohaus/dao-context'; import { useParams } from 'react-router-dom'; import { Keychain } from '@daohaus/common-utilities'; diff --git a/apps/core-app/src/components/ShamanSettings.tsx b/apps/core-app/src/components/ShamanSettings.tsx index 91382967c..bad9c7aba 100644 --- a/apps/core-app/src/components/ShamanSettings.tsx +++ b/apps/core-app/src/components/ShamanSettings.tsx @@ -1,7 +1,7 @@ import styled from 'styled-components'; import { H3, ParSm } from '@daohaus/ui'; -import { TDao } from '../contexts/DaoContext'; +import { TDao } from '@daohaus/dao-context'; import { ShamanList } from './ShamanList'; const ShamanContainer = styled.div` diff --git a/apps/core-app/src/components/VaultOverview.tsx b/apps/core-app/src/components/VaultOverview.tsx index 7e2289f79..6f7e7cd2e 100644 --- a/apps/core-app/src/components/VaultOverview.tsx +++ b/apps/core-app/src/components/VaultOverview.tsx @@ -17,12 +17,13 @@ import { Keychain, } from '@daohaus/common-utilities'; -import { TDao } from '../contexts/DaoContext'; +import { TDao } from '@daohaus/dao-context'; const VaultOverviewCard = styled(Card)` background-color: ${({ theme }: { theme: Theme }) => theme.card.hoverBg}; border: none; padding: 3rem; + width: 100%; `; const VaultCardHeader = styled.div` diff --git a/apps/core-app/src/components/VoteList.tsx b/apps/core-app/src/components/VoteList.tsx index bed060a16..4adf5de1d 100644 --- a/apps/core-app/src/components/VoteList.tsx +++ b/apps/core-app/src/components/VoteList.tsx @@ -7,7 +7,7 @@ import { } from '@daohaus/common-utilities'; import { AddressDisplay, DataMd, ParMd } from '@daohaus/ui'; -import { TProposals } from '../contexts/DaoContext'; +import { TProposals } from '@daohaus/dao-context'; import { useParams } from 'react-router-dom'; const VotesContainer = styled.div` diff --git a/apps/core-app/src/components/customFields/RequestERC20.tsx b/apps/core-app/src/components/customFields/RequestERC20.tsx index d37cf67a7..06e3497aa 100644 --- a/apps/core-app/src/components/customFields/RequestERC20.tsx +++ b/apps/core-app/src/components/customFields/RequestERC20.tsx @@ -9,7 +9,7 @@ import { Buildable, Button, WrappedInputSelect } from '@daohaus/ui'; import { useMemo } from 'react'; import { RegisterOptions, useFormContext } from 'react-hook-form'; import { useParams } from 'react-router-dom'; -import { useDao } from '../../contexts/DaoContext'; +import { useDao } from '@daohaus/dao-context'; import { getErc20s } from '../../utils/tokenData'; export enum InputStates { diff --git a/apps/core-app/src/components/customFields/RequestNativeToken.tsx b/apps/core-app/src/components/customFields/RequestNativeToken.tsx index 7031a6f2e..35ceb183b 100644 --- a/apps/core-app/src/components/customFields/RequestNativeToken.tsx +++ b/apps/core-app/src/components/customFields/RequestNativeToken.tsx @@ -8,7 +8,7 @@ import { } from '@daohaus/common-utilities'; import { Buildable, Button, WrappedInput } from '@daohaus/ui'; -import { useDao } from '../../contexts/DaoContext'; +import { useDao } from '@daohaus/dao-context'; import { getNetworkToken } from '../../utils/tokenData'; // enum InputStates { diff --git a/apps/core-app/src/components/customFields/SelectApplicant.tsx b/apps/core-app/src/components/customFields/SelectApplicant.tsx index be96b2523..05d3ba924 100644 --- a/apps/core-app/src/components/customFields/SelectApplicant.tsx +++ b/apps/core-app/src/components/customFields/SelectApplicant.tsx @@ -1,17 +1,30 @@ import { useCallback, useEffect, useState } from 'react'; import { useFormContext } from 'react-hook-form'; import { useParams } from 'react-router-dom'; -import { useMembers } from '../../contexts/DaoContext'; +import { useMembers } from '@daohaus/dao-context'; import { Keychain } from '@daohaus/common-utilities'; -import { Buildable, Button, ErrorMessage, Field, OptionType, WrappedInput, WrappedSelect } from '@daohaus/ui'; +import { + Buildable, + Button, + ErrorMessage, + Field, + OptionType, + WrappedInput, + WrappedSelect, +} from '@daohaus/ui'; import { isActiveMember } from '../../utils/dataFetchHelpers'; -type SelectApplicantProps = Buildable; +type SelectApplicantProps = Buildable< + Field & { + daoMemberOnly?: boolean; + } +>; -export const SelectApplicant = ({ daoMemberOnly, ...props }: SelectApplicantProps) => { +export const SelectApplicant = ({ + daoMemberOnly, + ...props +}: SelectApplicantProps) => { const [textMode, toggleTextMode] = useState(false); const [memberList, setMemberList] = useState>([]); const [memberLoading, setMemberLoading] = useState(false); @@ -32,40 +45,49 @@ export const SelectApplicant = ({ daoMemberOnly, ...props }: SelectApplicantProp setValError(undefined); }, [setValue]); - const fetchMember = useCallback(async (memberAddress: string, validateMember: boolean) => { - if (daochain && daoid) { - const rs = await isActiveMember({ - daochain: daochain as keyof Keychain, - daoid, - address: memberAddress, - setMemberLoading, - }); - if (rs.member) { - setValue('memberShares', rs.member.shares); - setValue('memberLoot', rs.member.loot); + const fetchMember = useCallback( + async (memberAddress: string, validateMember: boolean) => { + if (daochain && daoid) { + const rs = await isActiveMember({ + daochain: daochain as keyof Keychain, + daoid, + address: memberAddress, + setMemberLoading, + }); + if (rs.member) { + setValue('memberShares', rs.member.shares); + setValue('memberLoot', rs.member.loot); + } + if (validateMember && rs.error) setValError(rs.error); } - if (validateMember && rs.error) setValError(rs.error); - } - }, [daochain, daoid, setValue]); + }, + [daochain, daoid, setValue] + ); const ToggeButton = () => { return ( - - ) + ); }; useEffect(() => { if (members) { // TODO: WHat about pagination? - setMemberList(members.map(m => ({ - name: m.memberAddress, - value: m.memberAddress, - }))) + setMemberList( + members.map((m) => ({ + name: m.memberAddress, + value: m.memberAddress, + })) + ); } }, [members]); @@ -87,6 +109,3 @@ export const SelectApplicant = ({ daoMemberOnly, ...props }: SelectApplicantProp /> ); }; - - - diff --git a/apps/core-app/src/components/customFields/ShamanDeluxe.tsx b/apps/core-app/src/components/customFields/ShamanDeluxe.tsx index a1448a580..a1b5df561 100644 --- a/apps/core-app/src/components/customFields/ShamanDeluxe.tsx +++ b/apps/core-app/src/components/customFields/ShamanDeluxe.tsx @@ -9,7 +9,7 @@ import { } from '@daohaus/common-utilities'; import { Buildable, DataSm, ShamanPermission } from '@daohaus/ui'; -import { useDao } from '../../contexts/DaoContext'; +import { useDao } from '@daohaus/dao-context'; const Secondary = styled.span` color: ${(props) => props.theme.secondary}; diff --git a/apps/core-app/src/components/customFields/proposalExpiry.tsx b/apps/core-app/src/components/customFields/proposalExpiry.tsx index 304b9c530..76876bcca 100644 --- a/apps/core-app/src/components/customFields/proposalExpiry.tsx +++ b/apps/core-app/src/components/customFields/proposalExpiry.tsx @@ -10,17 +10,24 @@ import { WrappedInput, InputSelect, } from '@daohaus/ui'; -import { useDao } from '../../contexts/DaoContext'; +import { useDao } from '@daohaus/dao-context'; const INPUT_ID = 'expiryValue'; -const SELECT_ID = 'expiryPeriod' +const SELECT_ID = 'expiryPeriod'; -type ProposalExpiryProps = Buildable; +type ProposalExpiryProps = Buildable< + Field & { + defaultValue?: string; + label: string; + } +>; -export const ProposalExpiry = ({ id, defaultValue, rules, ...props }: ProposalExpiryProps) => { +export const ProposalExpiry = ({ + id, + defaultValue, + rules, + ...props +}: ProposalExpiryProps) => { const { watch, register, setValue } = useFormContext(); const [periodValue, periodMultiplier] = watch([INPUT_ID, SELECT_ID]); const { dao } = useDao(); @@ -47,8 +54,8 @@ export const ProposalExpiry = ({ id, defaultValue, rules, ...props }: ProposalEx expiryDateString, format( addSeconds(new Date(), absoluteExtendedPeriod), - "MMM dd, yyyy 'at' hh:mmaaa OOO", - ), + "MMM dd, yyyy 'at' hh:mmaaa OOO" + ) ); } }, [dao, expiryDateString, id, periodValue, periodMultiplier, setValue]); @@ -69,15 +76,15 @@ export const ProposalExpiry = ({ id, defaultValue, rules, ...props }: ProposalEx