Skip to content

Commit

Permalink
Feature/697 prop lifecycle (#776)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
Co-authored-by: Jonathan Prozzi <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

Co-authored-by: Sam Kuhlmann <[email protected]>
Co-authored-by: Rowdy <[email protected]>

* fixing doc display name from <[object Object]> to displayName (#402)

Co-authored-by: Sam Kuhlmann <[email protected]>

* 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 <[email protected]>

Co-authored-by: Sam Kuhlmann <[email protected]>
Co-authored-by: Rowdy <[email protected]>

* fixing doc display name from <[object Object]> to displayName (#402)

Co-authored-by: Sam Kuhlmann <[email protected]>

* conflicts

* correctly types the onChange for the input

* cleans up unsed imports

* naming

* fix build error

Co-authored-by: Alexander Keating <[email protected]>
Co-authored-by: Rowdy <[email protected]>
Co-authored-by: Brian Rossetti <[email protected]>

* 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 <[email protected]>
Co-authored-by: Rowdy <[email protected]>
Co-authored-by: Jord <[email protected]>
Co-authored-by: Spencer Graham <[email protected]>
Co-authored-by: Brian Rossetti <[email protected]>
Co-authored-by: Alexander Keating <[email protected]>

* Revert "Publish new lib versions. (#412)"

This reverts commit bab7077.

* 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 <[email protected]>
Co-authored-by: Jord <[email protected]>

* 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 <[email protected]>
Co-authored-by: Jonathan Prozzi <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

Co-authored-by: Sam Kuhlmann <[email protected]>
Co-authored-by: Rowdy <[email protected]>

* fixing doc display name from <[object Object]> to displayName (#402)

Co-authored-by: Sam Kuhlmann <[email protected]>

* 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 <[email protected]>

Co-authored-by: Sam Kuhlmann <[email protected]>
Co-authored-by: Rowdy <[email protected]>

* fixing doc display name from <[object Object]> to displayName (#402)

Co-authored-by: Sam Kuhlmann <[email protected]>

* conflicts

* correctly types the onChange for the input

* cleans up unsed imports

* naming

* fix build error

Co-authored-by: Alexander Keating <[email protected]>
Co-authored-by: Rowdy <[email protected]>
Co-authored-by: Brian Rossetti <[email protected]>

* 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 <[email protected]>
Co-authored-by: Rowdy <[email protected]>
Co-authored-by: Jord <[email protected]>
Co-authored-by: Spencer Graham <[email protected]>
Co-authored-by: Brian Rossetti <[email protected]>
Co-authored-by: Alexander Keating <[email protected]>

* Revert "Publish new lib versions. (#412)"

This reverts commit bab7077.

* 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 <[email protected]>
Co-authored-by: Alexander Keating <[email protected]>
Co-authored-by: Sam Kuhlmann <[email protected]>
Co-authored-by: Rowdy <[email protected]>
Co-authored-by: Spencer Graham <[email protected]>
Co-authored-by: Brian Rossetti <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

Co-authored-by: Jord <[email protected]>
Co-authored-by: Alexander Keating <[email protected]>
Co-authored-by: jordan <[email protected]>
Co-authored-by: Jonathan Prozzi <[email protected]>
Co-authored-by: Sam Kuhlmann <[email protected]>
Co-authored-by: Rowdy <[email protected]>
Co-authored-by: Spencer Graham <[email protected]>

* Revert "develop to master (#482)" (#492)

This reverts commit 5f7d121.

Co-authored-by: Sam Kuhlmann <[email protected]>

* 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 <[email protected]>
Co-authored-by: Jonathan Prozzi <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

Co-authored-by: Sam Kuhlmann <[email protected]>
Co-authored-by: Rowdy <[email protected]>

* fixing doc display name from <[object Object]> to displayName (#402)

Co-authored-by: Sam Kuhlmann <[email protected]>

* 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 <[email protected]>

Co-authored-by: Sam Kuhlmann <[email protected]>
Co-authored-by: Rowdy <[email protected]>

* fixing doc display name from <[object Object]> to displayName (#402)

Co-authored-by: Sam Kuhlmann <[email protected]>

* conflicts

* correctly types the onChange for the input

* cleans up unsed imports

* naming

* fix build error

Co-authored-by: Alexander Keating <[email protected]>
Co-authored-by: Rowdy <[email protected]>
Co-authored-by: Brian Rossetti <[email protected]>

* 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 <[email protected]>
Co-authored-by: Rowdy <[email protected]>
Co-authored-by: Jord <[email protected]>
Co-authored-by: Spencer Graham <[email protected]>
Co-authored-by: Brian Rossetti <[email protected]>
Co-authored-by: Alexander Keating <[email protected]>

* Revert "Publish new lib versions. (#412)"

This reverts commit bab7077.

* 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 <[email protected]>
Co-authored-by: Alexander Keating <[email protected]>
Co-authored-by: Sam Kuhlmann <[email protected]>
Co-authored-by: Rowdy <[email protected]>
Co-authored-by: Spencer Graham <[email protected]>
Co-authored-by: Brian Rossetti <[email protected]>

* Fix build (#563)

* Fix build

* Almost

* More changes

Co-authored-by: Jord <[email protected]>
Co-authored-by: Jonathan Prozzi <[email protected]>
Co-authored-by: Sam Kuhlmann <[email protected]>
Co-authored-by: Rowdy <[email protected]>
Co-authored-by: Spencer Graham <[email protected]>
Co-authored-by: Brian Rossetti <[email protected]>

* Revert "Develop into master (#577)"

This reverts commit b8644d3.

* connectedAddress votes wip

* adds vote queries

* prevents double list items on dao change

* debugging

* address previous pr feedback

* type issue

* gets proposal loaded

* updates some tx s with prop detail schema

* adds proposal details overview

* cleanup

* fixes unsponsored state

* fixes list sort

* fixes test

* cleanup

* starts types

* adds enums

* fixes build

* styles the warning state

* gets first history card working

* finishes the unsponsored section

* adds proposal history

* fix build

* fixes uuid key

Co-authored-by: Jonathan Prozzi <[email protected]>
Co-authored-by: Alexander Keating <[email protected]>
Co-authored-by: Rowdy <[email protected]>
Co-authored-by: Jord <[email protected]>
Co-authored-by: Spencer Graham <[email protected]>
Co-authored-by: Brian Rossetti <[email protected]>
Co-authored-by: jordan <[email protected]>
  • Loading branch information
8 people authored Sep 2, 2022
1 parent 7772f91 commit 8ea42a1
Show file tree
Hide file tree
Showing 9 changed files with 563 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,11 @@ const Spacer = styled.div`
margin-bottom: 2rem;
`;

type ProposalDetailsOverviewProps = {
type ProposalDetailsGutsProps = {
proposal: TProposals[number];
};

export const ProposalDetailsOverview = ({
proposal,
}: ProposalDetailsOverviewProps) => {
export const ProposalDetailsGuts = ({ proposal }: ProposalDetailsGutsProps) => {
const { daochain } = useParams();

return (
Expand All @@ -72,7 +70,7 @@ export const ProposalDetailsOverview = ({
<DataIndicator
label="Expiration Date"
data={
+proposal.expiration
Number(proposal.expiration)
? formatShortDateTimeFromSeconds(proposal.expiration)
: '--'
}
Expand Down
46 changes: 46 additions & 0 deletions apps/core-app/src/components/ProposalHistory.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { useMemo } from 'react';
import { useParams } from 'react-router-dom';
import styled from 'styled-components';
import { getNetwork } from '@daohaus/common-utilities';

import { TProposals } from '../contexts/DaoContext';
import { ProposalHistoryCard } from './ProposalHistoryCard';
import {
buildProposalHistory,
ProposalHistoryElement,
} from '../utils/historyHelpers';

const HistoryContainer = styled.div`
margin-top: 3rem;
`;

type ProposalHistoryProps = {
proposal?: TProposals[number];
};

export const ProposalHistory = ({ proposal }: ProposalHistoryProps) => {
const { daochain } = useParams();
const historyData: ProposalHistoryElement[] | null = useMemo(() => {
if (!proposal || !daochain) return null;
return buildProposalHistory({
proposal,
networkData: getNetwork(daochain),
});
}, [proposal, daochain]);

if (!historyData) return null;

return (
<HistoryContainer>
{historyData.map((element) => {
return (
<ProposalHistoryCard
proposal={proposal}
element={element}
key={element.title}
/>
);
})}
</HistoryContainer>
);
};
172 changes: 172 additions & 0 deletions apps/core-app/src/components/ProposalHistoryCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
import { useParams } from 'react-router-dom';
import { MouseEvent, useState } from 'react';
import { RiArrowUpSLine, RiArrowDownSLine } from 'react-icons/ri';
import styled from 'styled-components';

import {
ParXl,
Bold,
Theme,
ParMd,
AddressDisplay,
DataIndicator,
Button,
} from '@daohaus/ui';
import { Keychain } from '@daohaus/common-utilities';
import { ExplorerLink } from '@daohaus/daohaus-connect-feature';

import {
ProposalHistoryElement,
ProposalHistoryElementData,
} from '../utils/historyHelpers';
import { TProposals } from '../contexts/DaoContext';

const ElementContainer = styled.div`
display: flex;
flex-direction: column;
justify-content: flex-start;
padding: 2rem 0;
border-bottom: 1px solid #ffffff16;
`;

const VisibleContainer = styled.div`
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
`;

const ContentContainer = styled.div`
display: flex;
flex-direction: column;
justify-content: flex-start;
gap: 1rem;
`;

const StyledTitle = styled(Bold)`
color: ${({ theme, active }: { theme: Theme; active: boolean }) =>
active && theme.link.color};
`;

const StyledUpArrow = styled(RiArrowUpSLine)`
font-size: 4.8rem;
font-weight: 900;
color: ${({ theme }: { theme: Theme }) => theme.link.color};
`;

const StyledDownArrow = styled(RiArrowDownSLine)`
font-size: 4.8rem;
font-weight: 900;
color: ${({ theme }: { theme: Theme }) => theme.link.color};
`;

const DataGrid = styled.div`
display: flex;
flex-direction: row;
justify-content: space-between;
margin-top: 2.4rem;
`;

const SpacedAddressDisplay = styled(AddressDisplay)`
margin-top: 1rem;
`;

const LinkContainer = styled.div`
display: flex;
justify-content: flex-end;
width: 100%;
margin-top: 2.5rem;
`;

const DataPoint = ({
data,
daochain,
}: {
data: ProposalHistoryElementData;
daochain?: string;
}) => {
if (data.dataType === 'member') {
return (
<div>
<ParMd>{data.label}</ParMd>
<SpacedAddressDisplay
truncate
address={data.data}
copy
explorerNetworkId={daochain as keyof Keychain}
/>
</div>
);
}

if (data.dataType === 'dataIndicator') {
return <DataIndicator label={data.label} data={data.data} />;
}

return null;
};

type ProposalHistoryCardProps = {
element: ProposalHistoryElement;
proposal?: TProposals[number];
};

export const ProposalHistoryCard = ({
element,
proposal,
}: ProposalHistoryCardProps) => {
const { daochain } = useParams();
const [open, setOpen] = useState<boolean>(false);

const handleToggle = (event: MouseEvent<HTMLDivElement>) => {
setOpen((prevState) => !prevState);
};

return (
<ElementContainer>
<VisibleContainer>
<ContentContainer>
<ParXl>
<StyledTitle active={element.active}>{element.title}</StyledTitle>
</ParXl>
{element.text && <ParMd>{element.text}</ParMd>}
</ContentContainer>
{element.canExpand && open && (
<div onClick={handleToggle}>
<StyledUpArrow />
</div>
)}
{element.canExpand && !open && (
<div onClick={handleToggle}>
<StyledDownArrow />
</div>
)}
{element.showVotesButton && (
<Button sm secondary>
Show Votes{' '}
{proposal &&
`(${Number(proposal?.yesVotes) + Number(proposal?.noVotes)})`}
</Button>
)}
</VisibleContainer>
{element.canExpand && open && (
<>
<DataGrid>
{element.dataElements &&
element.dataElements.map((data) => (
<DataPoint data={data} daochain={daochain} key={data.label} />
))}
</DataGrid>

{element.txHash && (
<LinkContainer>
<ExplorerLink address={element.txHash} type="tx">
View Transaction
</ExplorerLink>
</LinkContainer>
)}
</>
)}
</ElementContainer>
);
};
9 changes: 7 additions & 2 deletions apps/core-app/src/contexts/DaoContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ export const DaoContextProvider = ({ children }: DaoContextProviderProps) => {

const refreshDao = async () => {
if (daochain && daoid) {
setDao(undefined);
loadDao({
daoid,
daochain: daochain as keyof Keychain,
Expand All @@ -377,6 +378,7 @@ export const DaoContextProvider = ({ children }: DaoContextProviderProps) => {
};
const refreshConnectedMembership = async () => {
if (daochain && daoid && address) {
setConnectedMembership(undefined);
loadMember({
daoid,
daochain: daochain as keyof Keychain,
Expand All @@ -389,6 +391,7 @@ export const DaoContextProvider = ({ children }: DaoContextProviderProps) => {
};
const refreshMembers = async () => {
if (daochain && daoid) {
setMembers(undefined);
loadMembersList({
filter: { dao: daoid, ...membersFilter },
ordering: membersSort,
Expand All @@ -403,6 +406,7 @@ export const DaoContextProvider = ({ children }: DaoContextProviderProps) => {
};
const refreshProposals = async () => {
if (daochain && daoid) {
setProposals(undefined);
loadProposalsList({
filter: { dao: daoid, ...proposalsFilter },
ordering: proposalsSort,
Expand All @@ -411,20 +415,21 @@ export const DaoContextProvider = ({ children }: DaoContextProviderProps) => {
setData: setProposals,
setLoading: setProposalsLoading,
setNextPaging: setProposalsNextPaging,
shouldUpdate: false,
shouldUpdate: true,
});
}
};
const refreshConnectedMembershipProposalVotes = async () => {
if (daochain && daoid && address) {
setConnectedMembershipProposalVotes(undefined);
loadConnectedMemberVotesList({
filter: { dao: daoid, ...proposalsFilter },
ordering: proposalsSort,
paging: proposalsPaging,
daochain: daochain as keyof Keychain,
setData: setConnectedMembershipProposalVotes,
setLoading: setConnectedMembershipProposalVotesLoading,
shouldUpdate: false,
shouldUpdate: true,
memberAddress: address,
});
}
Expand Down
12 changes: 9 additions & 3 deletions apps/core-app/src/pages/ProposalDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import { Keychain } from '@daohaus/common-utilities';
import { useHausConnect } from '@daohaus/daohaus-connect-feature';

import { loadProposal } from '../utils/dataFetchHelpers';
import { ProposalDetailsOverview } from '../components/ProposalDetailsOverview';
import { ProposalDetailsGuts } from '../components/ProposalDetailsGuts';
import { ProposalHistory } from '../components/ProposalHistory';
import { getProposalTypeLabel } from '../utils/general';

const OverviewCard = styled(Card)`
Expand Down Expand Up @@ -80,10 +81,15 @@ export function ProposalDetails() {
subtitle={getProposalTypeLabel(proposal?.proposalType)}
left={
<OverviewCard>
{proposal && <ProposalDetailsOverview proposal={proposal} />}
{proposal && <ProposalDetailsGuts proposal={proposal} />}
</OverviewCard>
}
right={<RightCard>actions</RightCard>}
right={
<RightCard>
<Card>I am actions </Card>
<ProposalHistory proposal={proposal} />
</RightCard>
}
/>
);
}
Expand Down
3 changes: 2 additions & 1 deletion apps/core-app/src/pages/Proposals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function Proposals() {
setProposalsFilter,
setProposals,
} = useProposals();
const { dao } = useDao();
const { dao, refreshAll } = useDao();
const [searchTerm, setSearchTerm] = useState<string>('');
const [filter, setFilter] = useState<string>('');

Expand Down Expand Up @@ -105,6 +105,7 @@ export function Proposals() {

return (
<SingleColumnLayout title="Proposals">
<Button onClick={refreshAll}>fresh</Button>
<ActionsContainer>
<SearchFilterContainer>
<SearchInput
Expand Down
1 change: 1 addition & 0 deletions apps/core-app/src/utils/dataFetchHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ export const loadProposalsList = async ({
ordering,
paging,
});

if (shouldUpdate) {
setNextPaging(res.nextPaging);

Expand Down
Loading

0 comments on commit 8ea42a1

Please sign in to comment.