{displayUI}
- {isMobile || (
+ {isMobile || hideQuorum || (
{
return (
diff --git a/apps/core-app/src/components/proposalCards/Expired.tsx b/apps/core-app/src/components/proposalCards/Expired.tsx
index d5bf75f81..e20b5f7e0 100644
--- a/apps/core-app/src/components/proposalCards/Expired.tsx
+++ b/apps/core-app/src/components/proposalCards/Expired.tsx
@@ -6,7 +6,7 @@ export const Expired = ({ proposal }: { proposal: ITransformedProposal }) => {
return (
diff --git a/apps/core-app/src/pages/Members.tsx b/apps/core-app/src/pages/Members.tsx
index 94b4576eb..201648f14 100644
--- a/apps/core-app/src/pages/Members.tsx
+++ b/apps/core-app/src/pages/Members.tsx
@@ -1,4 +1,4 @@
-import { MouseEvent, useMemo } from 'react';
+import { useMemo } from 'react';
import styled from 'styled-components';
import { Column, Row } from 'react-table';
import {
@@ -25,7 +25,6 @@ import {
useDao,
TMembers,
useConnectedMembership,
- defaultDaoData,
} from '@daohaus/dao-context';
import { MembersOverview } from '../components/MembersOverview';
import { ProfileLink } from '../components/ProfileLink';
@@ -33,6 +32,7 @@ import { DaoTable } from '../components/DaohausTable';
import { useParams } from 'react-router-dom';
import { MemberProfileMenu } from '../components/MemberProfileMenu';
import { ButtonLink } from '../components/ButtonLink';
+import { Member_OrderBy } from '@daohaus/dao-data';
const Actions = styled.div`
display: flex;
@@ -76,13 +76,8 @@ export type MembersTableType = TMembers[number];
export function Members() {
const { dao } = useDao();
- const {
- members,
- setMembersPaging,
- membersNextPaging,
- setMembersSort,
- setMembers,
- } = useMembers();
+ const { members, membersNextPaging, loadMoreMembers, sortMembers } =
+ useMembers();
const { connectedMembership } = useConnectedMembership();
const isMobile = useBreakpoint(widthQuery.sm);
const { daoid, daochain } = useParams();
@@ -222,24 +217,11 @@ export function Members() {
[dao]
);
- // TODO: Move these into the context as new hooks:
- // - loadMoreMembers (adds on to current members list - this is default)
- // - loadNextPageMembers (replaces current list)
- // - sort/filter (replaces current list)
- const handleLoadMore = (event: MouseEvent) => {
- setMembersPaging(membersNextPaging);
- };
-
const handleColumnSort = (
orderBy: string,
orderDirection: 'asc' | 'desc'
) => {
- // TODO: how can we dynamically pass the proper order by here
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
- // @ts-ignore
- setMembersSort({ orderBy, orderDirection });
- setMembersPaging(defaultDaoData.membersPaging);
- setMembers(undefined);
+ sortMembers(orderBy as Member_OrderBy, orderDirection);
};
return (
@@ -274,7 +256,7 @@ export function Members() {
tableData={tableData}
columns={columns}
hasNextPaging={membersNextPaging !== undefined}
- handleLoadMore={handleLoadMore}
+ handleLoadMore={loadMoreMembers}
handleColumnSort={handleColumnSort}
sortableColumns={
isMobile
diff --git a/apps/core-app/src/pages/NewProposal.tsx b/apps/core-app/src/pages/NewProposal.tsx
index 69ded665e..f81edbc4e 100644
--- a/apps/core-app/src/pages/NewProposal.tsx
+++ b/apps/core-app/src/pages/NewProposal.tsx
@@ -1,5 +1,5 @@
import { useMemo } from 'react';
-import { useLocation } from 'react-router-dom';
+import { useLocation, useNavigate, useParams } from 'react-router-dom';
import { FormBuilder } from '@daohaus/haus-form-builder';
import { getFormLegoById } from '../legos/form';
@@ -8,10 +8,13 @@ import { useDao } from '@daohaus/dao-context';
export function NewProposal() {
const location = useLocation();
+ const navigate = useNavigate();
+ const { daoid, daochain } = useParams();
const { refreshAll } = useDao();
const onFormComplete = () => {
refreshAll?.();
+ navigate(`/molochV3/${daochain}/${daoid}/proposals`);
};
const formLego = useMemo(() => {
diff --git a/apps/core-app/src/pages/Proposals.tsx b/apps/core-app/src/pages/Proposals.tsx
index 6454171a9..ae0dbfa5c 100644
--- a/apps/core-app/src/pages/Proposals.tsx
+++ b/apps/core-app/src/pages/Proposals.tsx
@@ -11,7 +11,7 @@ import {
import { statusFilter } from '@daohaus/dao-data';
import { BsPlusLg } from 'react-icons/bs';
-import { defaultDaoData, useDao, useProposals } from '@daohaus/dao-context';
+import { useDao, useProposals } from '@daohaus/dao-context';
import { NewProposalList } from '../components/NewProposalList';
import { PROPOSAL_FORMS } from '../legos/form';
import SearchInput from '../components/SearchInput';
@@ -39,13 +39,8 @@ const SearchFilterContainer = styled.div`
`;
export function Proposals() {
- const {
- proposals,
- setProposalsPaging,
- proposalsNextPaging,
- setProposalsFilter,
- setProposals,
- } = useProposals();
+ const { proposals, proposalsNextPaging, loadMoreProposals, filterProposals } =
+ useProposals();
const { dao } = useDao();
const [searchTerm, setSearchTerm] = useState('');
const [filter, setFilter] = useState('');
@@ -64,17 +59,13 @@ export function Proposals() {
)
: undefined;
- if (searchTerm && searchTerm.length > 0) {
- setProposals(undefined);
- setProposalsFilter({
+ if (term && term.length > 0) {
+ filterProposals({
...filterQuery,
- title_contains_nocase: searchTerm,
+ title_contains_nocase: term,
});
- setProposalsPaging(defaultDaoData.proposalsPaging);
} else {
- setProposals(undefined);
- setProposalsFilter(filterQuery);
- setProposalsPaging(defaultDaoData.proposalsPaging);
+ filterProposals(filterQuery);
}
};
@@ -83,9 +74,7 @@ export function Proposals() {
searchTerm !== '' ? { title_contains_nocase: searchTerm } : undefined;
setFilter((prevState) => {
if (prevState === event.currentTarget.value) {
- setProposalsFilter(searchQuery);
- setProposalsPaging(defaultDaoData.proposalsPaging);
- setProposals(undefined);
+ filterProposals(searchQuery);
return '';
} else {
const votingPlusGraceDuration =
@@ -94,18 +83,12 @@ export function Proposals() {
PROPOSAL_STATUS[event.currentTarget.value],
votingPlusGraceDuration
);
- setProposalsFilter({ ...filterQuery, ...searchQuery });
- setProposalsPaging(defaultDaoData.proposalsPaging);
- setProposals(undefined);
+ filterProposals({ ...filterQuery, ...searchQuery });
return event.currentTarget.value;
}
});
};
- const handleLoadMore = (event: MouseEvent) => {
- setProposalsPaging(proposalsNextPaging);
- };
-
return (
@@ -133,7 +116,7 @@ export function Proposals() {
))}
{proposalsNextPaging !== undefined && (
-