From f8bfd745b5d9a623688570c1e1df233e63b77d0d Mon Sep 17 00:00:00 2001 From: Sam Kuhlmann Date: Fri, 2 Sep 2022 16:15:45 -0600 Subject: [PATCH] Feature/dao context pkg (#804) * Publish new lib versions. (#412) * fix/fix-table-types (#354) * removed the any types from hub * renamed Table to DaoTable and DataTable to DaoTable to be more consistent with DaoCard * removed commented out DaoData type * one more comment -- thought i got both before * Fix/355 summon params mixup (#356) * more ignore * fixes bad init params order in summon tx * Feature/tag component (#349) * Created basic tag component * Added dynamic color selections for tags * Bumped versions fixed filer * Added icon support to tag component Co-authored-by: Jord <53406838+jordanlesich@users.noreply.github.com> Co-authored-by: Jonathan Prozzi * Feature/delegate play (#357) * more ignore * fixes bad init params order in summon tx * delegate testing and subgraph field updates * finishes mapping * update dao-data query and transformer * adds delegate tag to list view and hooks up delegate filtering * refactors filter into query helper * Spencer's Summon tooltip suggestions (#370) * Spencer's Summon tooltip suggestions - Summon portion of #365 * Delimiter references #368 For now, just referencing spaces. But if tabs, commas, or other delimiters are also supported, those should be references in the tooltips as well. * Address Jord's comments Co-authored-by: Sam Kuhlmann * Fix/summon poll (#375) * more ignore * fixes bad init params order in summon tx * delegate testing and subgraph field updates * finishes mapping * update dao-data query and transformer * adds delegate tag to list view and hooks up delegate filtering * adds schema field to tx entity * updates poll for tx entity made before dao entity * Feature/alpha baal update (#376) * new abis * updates summoner tx logic and contract addresses * fixes transaction entity creation location; * fixes some test * Feature/unit utils (#380) * create custom d.ts for human-format * type and convert unit fn from V2 * readableNumber util accepts number strings, throws error if string but number string * fix 0 to 1 utils, extend MaxDecimals to shorten decimal places * refine spacer and unit symbol placement * update new card to handle new params * update table * corrections * alter d.ts file * potential solutions to ts bug * implement keating's d.ts fix * fix comment * Fix/network switcher (#381) * better error handling * fix bug * remove log * get react-table TS to stop yelling (#382) Co-authored-by: Sam Kuhlmann * Feature/hub sort (#383) * wip * gets query working on dao entity after lots of subgraph updates * updates front end for sort * fixes type issue * fixes build issue * reviewing v3 monorepo and saw some networks missing (#399) * Feature/public profile (#384) * Add some stuff * Add public profile * Add ens * Get build to pass * Update apps/hub-app/src/pages/PublicProfilePage.tsx Co-authored-by: Rowdy Co-authored-by: Sam Kuhlmann Co-authored-by: Rowdy * fixing doc display name from <[object Object]> to displayName (#402) Co-authored-by: Sam Kuhlmann * adds search (#401) * adds search wip * correctly types the onChange for the input * cleans up unsed imports * naming * Feature/public profile (#384) * Add some stuff * Add public profile * Add ens * Get build to pass * Update apps/hub-app/src/pages/PublicProfilePage.tsx Co-authored-by: Rowdy Co-authored-by: Sam Kuhlmann Co-authored-by: Rowdy * fixing doc display name from <[object Object]> to displayName (#402) Co-authored-by: Sam Kuhlmann * conflicts * correctly types the onChange for the input * cleans up unsed imports * naming * fix build error Co-authored-by: Alexander Keating Co-authored-by: Rowdy Co-authored-by: Brian Rossetti * Release/12072022 (#411) * adds search wip * correctly types the onChange for the input * cleans up unsed imports * naming * conflicts * correctly types the onChange for the input * cleans up unsed imports * naming * fix build error * feature bump Co-authored-by: Jonathan Prozzi Co-authored-by: Rowdy Co-authored-by: Jord <53406838+jordanlesich@users.noreply.github.com> Co-authored-by: Spencer Graham Co-authored-by: Brian Rossetti Co-authored-by: Alexander Keating * Revert "Publish new lib versions. (#412)" This reverts commit bab7077ded01a2e5e0e4cd8ef59c4fd0fb9e4b96. * develop to master (#482) * UI/layout cleanup (#438) * run generator * import connect, theme libs. Add eindow.global. Ensure main.tsx uses React 17 API. * deletes app test * updates favicon and title * remove nx defaults * rough in layout box, target DH connect nav with class * remove even more css. World's dubest layout component * switches to connect class padding for mobile * extract base layout component to storybook * hook export chain, change name to outerlayout * extract formSegment from summon-app; replace in all instances in summon * extract split-column, replace all instances in summon * document future changes in comments * fix exports * switch core-app to nx default project * fix spacing * Fix/split column bug (#444) - fix bug * Layouts/subnav (#447) * clear out extra app.t.tsx * build sub-nav * style sub-nav * test subnav * extract subNavLink into component * subnavlink story * build subnavlink story * fix broken as prop * add mobile view, icon button trigger * add tsc command to core-app * adds human-format, removes profanity * Fix summon (#446) * Fix summon * clear out extra app.t.tsx * build sub-nav * style sub-nav * test subnav * extract subNavLink into component * subnavlink story * build subnavlink story * fix broken as prop * Fix summon * add mobile view, icon button trigger * add tsc command to core-app * adds human-format, removes profanity * add human-format to dao-data * move dts file Co-authored-by: jordan Co-authored-by: Jord <53406838+jordanlesich@users.noreply.github.com> * Haus layout (#451) * Publish new lib versions. (#412) * fix/fix-table-types (#354) * removed the any types from hub * renamed Table to DaoTable and DataTable to DaoTable to be more consistent with DaoCard * removed commented out DaoData type * one more comment -- thought i got both before * Fix/355 summon params mixup (#356) * more ignore * fixes bad init params order in summon tx * Feature/tag component (#349) * Created basic tag component * Added dynamic color selections for tags * Bumped versions fixed filer * Added icon support to tag component Co-authored-by: Jord <53406838+jordanlesich@users.noreply.github.com> Co-authored-by: Jonathan Prozzi * Feature/delegate play (#357) * more ignore * fixes bad init params order in summon tx * delegate testing and subgraph field updates * finishes mapping * update dao-data query and transformer * adds delegate tag to list view and hooks up delegate filtering * refactors filter into query helper * Spencer's Summon tooltip suggestions (#370) * Spencer's Summon tooltip suggestions - Summon portion of #365 * Delimiter references #368 For now, just referencing spaces. But if tabs, commas, or other delimiters are also supported, those should be references in the tooltips as well. * Address Jord's comments Co-authored-by: Sam Kuhlmann * Fix/summon poll (#375) * more ignore * fixes bad init params order in summon tx * delegate testing and subgraph field updates * finishes mapping * update dao-data query and transformer * adds delegate tag to list view and hooks up delegate filtering * adds schema field to tx entity * updates poll for tx entity made before dao entity * Feature/alpha baal update (#376) * new abis * updates summoner tx logic and contract addresses * fixes transaction entity creation location; * fixes some test * Feature/unit utils (#380) * create custom d.ts for human-format * type and convert unit fn from V2 * readableNumber util accepts number strings, throws error if string but number string * fix 0 to 1 utils, extend MaxDecimals to shorten decimal places * refine spacer and unit symbol placement * update new card to handle new params * update table * corrections * alter d.ts file * potential solutions to ts bug * implement keating's d.ts fix * fix comment * Fix/network switcher (#381) * better error handling * fix bug * remove log * get react-table TS to stop yelling (#382) Co-authored-by: Sam Kuhlmann * Feature/hub sort (#383) * wip * gets query working on dao entity after lots of subgraph updates * updates front end for sort * fixes type issue * fixes build issue * reviewing v3 monorepo and saw some networks missing (#399) * Feature/public profile (#384) * Add some stuff * Add public profile * Add ens * Get build to pass * Update apps/hub-app/src/pages/PublicProfilePage.tsx Co-authored-by: Rowdy Co-authored-by: Sam Kuhlmann Co-authored-by: Rowdy * fixing doc display name from <[object Object]> to displayName (#402) Co-authored-by: Sam Kuhlmann * adds search (#401) * adds search wip * correctly types the onChange for the input * cleans up unsed imports * naming * Feature/public profile (#384) * Add some stuff * Add public profile * Add ens * Get build to pass * Update apps/hub-app/src/pages/PublicProfilePage.tsx Co-authored-by: Rowdy Co-authored-by: Sam Kuhlmann Co-authored-by: Rowdy * fixing doc display name from <[object Object]> to displayName (#402) Co-authored-by: Sam Kuhlmann * conflicts * correctly types the onChange for the input * cleans up unsed imports * naming * fix build error Co-authored-by: Alexander Keating Co-authored-by: Rowdy Co-authored-by: Brian Rossetti * Release/12072022 (#411) * adds search wip * correctly types the onChange for the input * cleans up unsed imports * naming * conflicts * correctly types the onChange for the input * cleans up unsed imports * naming * fix build error * feature bump Co-authored-by: Jonathan Prozzi Co-authored-by: Rowdy Co-authored-by: Jord <53406838+jordanlesich@users.noreply.github.com> Co-authored-by: Spencer Graham Co-authored-by: Brian Rossetti Co-authored-by: Alexander Keating * Revert "Publish new lib versions. (#412)" This reverts commit bab7077ded01a2e5e0e4cd8ef59c4fd0fb9e4b96. * build formLayout Component * type correction * build formLayout story * rough in bicolumn layout * handle bicolumn mobile switch, finish bicolumn * fix mainlayout naming * build story for bi-column layout * build dh layout one shot? * yes, one shot * fix import * change prop name Co-authored-by: Jonathan Prozzi Co-authored-by: Alexander Keating Co-authored-by: Sam Kuhlmann Co-authored-by: Rowdy Co-authored-by: Spencer Graham Co-authored-by: Brian Rossetti * bumping packages that were published pre revert last week - causing fialures with package publishing (#460) * removing period from info content which casues confusing tooltip (#453) Co-authored-by: Sam Kuhlmann * Feature/hub profile menu fix (#480) * fixes profile link and layout * dao list style * adds toast to share link * Readme tables preferred (#483) * adjusting breakdown of apps and libs to tables * adding additoonal app references and libs * adding timestamp and address fields to many events (#468) * adding timestamps and address fields to many events * addressing code review * shortening naming convention on proposals, top level txHash defined as txHash going forward * update version * deploy subgraph and generate query types Co-authored-by: skuhlmann Co-authored-by: Jord <53406838+jordanlesich@users.noreply.github.com> Co-authored-by: Alexander Keating Co-authored-by: jordan Co-authored-by: Jonathan Prozzi Co-authored-by: Sam Kuhlmann Co-authored-by: Rowdy Co-authored-by: Spencer Graham * Revert "develop to master (#482)" (#492) This reverts commit 5f7d121f9c49b9559d352bb17fce3c1ec598dfbe. Co-authored-by: Sam Kuhlmann * Develop into master (#577) * Feature/form builder (#553) * Publish new lib versions. (#412) * fix/fix-table-types (#354) * removed the any types from hub * renamed Table to DaoTable and DataTable to DaoTable to be more consistent with DaoCard * removed commented out DaoData type * one more comment -- thought i got both before * Fix/355 summon params mixup (#356) * more ignore * fixes bad init params order in summon tx * Feature/tag component (#349) * Created basic tag component * Added dynamic color selections for tags * Bumped versions fixed filer * Added icon support to tag component Co-authored-by: Jord <53406838+jordanlesich@users.noreply.github.com> Co-authored-by: Jonathan Prozzi * Feature/delegate play (#357) * more ignore * fixes bad init params order in summon tx * delegate testing and subgraph field updates * finishes mapping * update dao-data query and transformer * adds delegate tag to list view and hooks up delegate filtering * refactors filter into query helper * Spencer's Summon tooltip suggestions (#370) * Spencer's Summon tooltip suggestions - Summon portion of #365 * Delimiter references #368 For now, just referencing spaces. But if tabs, commas, or other delimiters are also supported, those should be references in the tooltips as well. * Address Jord's comments Co-authored-by: Sam Kuhlmann * Fix/summon poll (#375) * more ignore * fixes bad init params order in summon tx * delegate testing and subgraph field updates * finishes mapping * update dao-data query and transformer * adds delegate tag to list view and hooks up delegate filtering * adds schema field to tx entity * updates poll for tx entity made before dao entity * Feature/alpha baal update (#376) * new abis * updates summoner tx logic and contract addresses * fixes transaction entity creation location; * fixes some test * Feature/unit utils (#380) * create custom d.ts for human-format * type and convert unit fn from V2 * readableNumber util accepts number strings, throws error if string but number string * fix 0 to 1 utils, extend MaxDecimals to shorten decimal places * refine spacer and unit symbol placement * update new card to handle new params * update table * corrections * alter d.ts file * potential solutions to ts bug * implement keating's d.ts fix * fix comment * Fix/network switcher (#381) * better error handling * fix bug * remove log * get react-table TS to stop yelling (#382) Co-authored-by: Sam Kuhlmann * Feature/hub sort (#383) * wip * gets query working on dao entity after lots of subgraph updates * updates front end for sort * fixes type issue * fixes build issue * reviewing v3 monorepo and saw some networks missing (#399) * Feature/public profile (#384) * Add some stuff * Add public profile * Add ens * Get build to pass * Update apps/hub-app/src/pages/PublicProfilePage.tsx Co-authored-by: Rowdy Co-authored-by: Sam Kuhlmann Co-authored-by: Rowdy * fixing doc display name from <[object Object]> to displayName (#402) Co-authored-by: Sam Kuhlmann * adds search (#401) * adds search wip * correctly types the onChange for the input * cleans up unsed imports * naming * Feature/public profile (#384) * Add some stuff * Add public profile * Add ens * Get build to pass * Update apps/hub-app/src/pages/PublicProfilePage.tsx Co-authored-by: Rowdy Co-authored-by: Sam Kuhlmann Co-authored-by: Rowdy * fixing doc display name from <[object Object]> to displayName (#402) Co-authored-by: Sam Kuhlmann * conflicts * correctly types the onChange for the input * cleans up unsed imports * naming * fix build error Co-authored-by: Alexander Keating Co-authored-by: Rowdy Co-authored-by: Brian Rossetti * Release/12072022 (#411) * adds search wip * correctly types the onChange for the input * cleans up unsed imports * naming * conflicts * correctly types the onChange for the input * cleans up unsed imports * naming * fix build error * feature bump Co-authored-by: Jonathan Prozzi Co-authored-by: Rowdy Co-authored-by: Jord <53406838+jordanlesich@users.noreply.github.com> Co-authored-by: Spencer Graham Co-authored-by: Brian Rossetti Co-authored-by: Alexander Keating * Revert "Publish new lib versions. (#412)" This reverts commit bab7077ded01a2e5e0e4cd8ef59c4fd0fb9e4b96. * build formLayout Component * type correction * build formLayout story * rough in bicolumn layout * handle bicolumn mobile switch, finish bicolumn * fix mainlayout naming * build story for bi-column layout * scaffold formBuilder library * rough in formBuilder * restructure types * refactor component structure * test render inputs * add core fields to builder enum * add row layout to builder * built logger, fix logger bug * add disable all functionality * handle asynchronous callback as props to form builder * remove some comments * put submit button in form footer * fix code based on review * build validation pipeline * clean form and field types * revise types again, simplify rules API * commit after refactor carnage * roll back to react-hook-form v6, finally get some traction * found source of bug, trying new rhf version * ...and the bug was slain, returned to that cold, miserable shit heap from whence it came. * reintroduce devtool and logger * build metadata form, form segment subForm component * clean, add custom submit btn text * clean * build string validations * derive validation type from function obj * wrestled types into validation system * rebuild form builder as context * build formBuilder hook, use it in the factory * create sample test * update form placement * more post merge corrections * write validation updaters and add to pipeline, test required updaters, test validation, test pipeline * try jest testing * ensure field state updates on formState change * more cleaning * reorg files * build metadata form * tweak button styles, add defaultValues to formBuilder * good place to stop * remove comments * fix Jest errors * fix field wrapper stories, update lock * may have fixed jest errors Co-authored-by: Jonathan Prozzi Co-authored-by: Alexander Keating Co-authored-by: Sam Kuhlmann Co-authored-by: Rowdy Co-authored-by: Spencer Graham Co-authored-by: Brian Rossetti * Fix build (#563) * Fix build * Almost * More changes Co-authored-by: Jord <53406838+jordanlesich@users.noreply.github.com> Co-authored-by: Jonathan Prozzi Co-authored-by: Sam Kuhlmann Co-authored-by: Rowdy Co-authored-by: Spencer Graham Co-authored-by: Brian Rossetti * Revert "Develop into master (#577)" This reverts commit b8644d3afa3204e0e4275b62a8e360109aac11cd. * pending proposal status * fixes the mapping for self sponsor * adds token type labels to token settings form * removes nft count * pull dao context out of core-app and updates core app * fixes build * adds daocontainer * Update DaoContext.tsx Co-authored-by: Jonathan Prozzi Co-authored-by: Alexander Keating Co-authored-by: Rowdy Co-authored-by: Jord <53406838+jordanlesich@users.noreply.github.com> Co-authored-by: Spencer Graham Co-authored-by: Brian Rossetti Co-authored-by: jordan --- apps/core-app/src/Routes.tsx | 14 +- apps/core-app/src/components/DaoProfile.tsx | 2 +- apps/core-app/src/components/FakeMarkdown.tsx | 2 +- .../src/components/GovernanceSettings.tsx | 2 +- .../src/components/MembersOverview.tsx | 2 +- .../src/components/MetadataSettings.tsx | 2 +- apps/core-app/src/components/Profile.tsx | 2 +- .../src/components/ProposalCardOverview.tsx | 2 +- .../src/components/ProposalDetailsGuts.tsx | 2 +- .../src/components/ProposalHistory.tsx | 2 +- .../src/components/ProposalHistoryCard.tsx | 2 +- apps/core-app/src/components/ShamanList.tsx | 2 +- .../src/components/ShamanSettings.tsx | 2 +- .../core-app/src/components/VaultOverview.tsx | 3 +- apps/core-app/src/components/VoteList.tsx | 2 +- .../components/customFields/RequestERC20.tsx | 2 +- .../customFields/RequestNativeToken.tsx | 2 +- .../customFields/SelectApplicant.tsx | 83 +++-- .../components/customFields/ShamanDeluxe.tsx | 2 +- .../customFields/proposalExpiry.tsx | 35 +- .../components/proposalCards/HasNotVoted.tsx | 2 +- .../proposalCards/ReadyForProcessing.tsx | 2 +- .../components/proposalCards/Unsponsored.tsx | 2 +- apps/core-app/src/legos/form.ts | 11 +- apps/core-app/src/pages/Dao.tsx | 7 +- apps/core-app/src/pages/DaoContainer.tsx | 17 + apps/core-app/src/pages/DaoOverview.tsx | 2 +- apps/core-app/src/pages/Member.tsx | 2 +- apps/core-app/src/pages/Members.tsx | 3 +- apps/core-app/src/pages/NewProposal.tsx | 2 +- apps/core-app/src/pages/Proposals.tsx | 2 +- apps/core-app/src/pages/Settings.tsx | 2 +- apps/core-app/src/pages/UpdateSettings.tsx | 2 +- apps/core-app/src/pages/Vaults.tsx | 3 +- apps/core-app/src/utils/constants.ts | 7 - apps/core-app/src/utils/general.ts | 2 +- apps/core-app/src/utils/historyHelpers.ts | 2 +- libs/dao-context/.babelrc | 12 + libs/dao-context/.eslintrc.json | 18 + libs/dao-context/.gitkeep | 0 libs/dao-context/README.md | 7 + libs/dao-context/jest.config.ts | 15 + libs/dao-context/package.json | 12 + libs/dao-context/project.json | 65 ++++ .../dao-context/src}/DaoContext.tsx | 21 +- libs/dao-context/src/index.ts | 2 + libs/dao-context/src/utils/constants.ts | 8 + libs/dao-context/src/utils/fetchHelpers.ts | 340 ++++++++++++++++++ libs/dao-context/src/utils/index.ts | 2 + libs/dao-context/tsconfig.json | 28 ++ libs/dao-context/tsconfig.lib.json | 22 ++ libs/dao-context/tsconfig.spec.json | 20 ++ libs/dao-context/vite-env.d.ts | 1 + libs/dao-context/vite.config.ts | 19 + nx.json | 3 + package.json | 2 +- tsconfig.base.json | 3 +- workspace.json | 1 + yarn.lock | 19 +- 59 files changed, 740 insertions(+), 117 deletions(-) create mode 100644 apps/core-app/src/pages/DaoContainer.tsx create mode 100644 libs/dao-context/.babelrc create mode 100644 libs/dao-context/.eslintrc.json create mode 100644 libs/dao-context/.gitkeep create mode 100644 libs/dao-context/README.md create mode 100644 libs/dao-context/jest.config.ts create mode 100644 libs/dao-context/package.json create mode 100644 libs/dao-context/project.json rename {apps/core-app/src/contexts => libs/dao-context/src}/DaoContext.tsx (97%) create mode 100644 libs/dao-context/src/index.ts create mode 100644 libs/dao-context/src/utils/constants.ts create mode 100644 libs/dao-context/src/utils/fetchHelpers.ts create mode 100644 libs/dao-context/src/utils/index.ts create mode 100644 libs/dao-context/tsconfig.json create mode 100644 libs/dao-context/tsconfig.lib.json create mode 100644 libs/dao-context/tsconfig.spec.json create mode 100644 libs/dao-context/vite-env.d.ts create mode 100644 libs/dao-context/vite.config.ts 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