Skip to content

Commit

Permalink
My comments tab in proposal work (#5174)
Browse files Browse the repository at this point in the history
* My comments tab in proposal work

* Check only proposals
  • Loading branch information
valentinludu authored Feb 6, 2025
1 parent 4a17798 commit b66c5d1
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions components/proposals/ProposalsPage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import styled from '@emotion/styled';
import CommentIcon from '@mui/icons-material/Comment';
import InboxIcon from '@mui/icons-material/Inbox';
import PersonIcon from '@mui/icons-material/Person';
import VisibilityOffOutlinedIcon from '@mui/icons-material/VisibilityOffOutlined';
Expand All @@ -9,7 +10,6 @@ import { debounce } from 'lodash';
import { useCallback, useMemo, useState } from 'react';
import { FormattedMessage } from 'react-intl';

import charmClient from 'charmClient';
import { useTrashPages } from 'charmClient/hooks/pages';
import { Button } from 'components/common/Button';
import { CharmEditor } from 'components/common/CharmEditor';
Expand All @@ -31,6 +31,8 @@ import {
DatabaseStickyHeader,
DatabaseTitle
} from 'components/common/PageLayout/components/DatabasePageContent';
import { NotificationsPopover } from 'components/common/PageLayout/components/Sidebar/components/NotificationsPopover';
import { useNotifications } from 'components/nexus/hooks/useNotifications';
import { useCharmRouter } from 'hooks/useCharmRouter';
import { useCurrentSpace } from 'hooks/useCurrentSpace';
import { useHasMemberLevel } from 'hooks/useHasMemberLevel';
Expand Down Expand Up @@ -72,7 +74,15 @@ export function ProposalsPage({ title }: { title: string }) {
const [showSidebar, setShowSidebar] = useState(false);
const [checkedIds, setCheckedIds] = useState<string[]>([]);
const { router, updateURLQuery } = useCharmRouter();
const viewId = (router.query.viewId || 'my-work') as 'all' | 'my-work' | 'reviewers';
const {
currentSpaceNotifications,
isLoading: isLoadingNotifications,
mutate: mutateNotifications
} = useNotifications();
const notifications = currentSpaceNotifications.filter((n) => {
return n.group === 'proposal' && n.type.includes('comment');
});
const viewId = (router.query.viewId || 'my-work') as 'all' | 'my-work' | 'reviewers' | 'my-comments';
const onShowDescription = useCallback(() => {
const oldBlocks = [activeBoard];
const newBoard = createBoard({
Expand Down Expand Up @@ -257,6 +267,10 @@ export function ProposalsPage({ title }: { title: string }) {
id: 'all',
label: 'All'
},
{
id: 'my-comments',
label: 'My Comments'
},
...(isAdmin
? [
{
Expand All @@ -278,6 +292,8 @@ export function ProposalsPage({ title }: { title: string }) {
iconForViewType('table')
) : view.id === 'my-work' ? (
<InboxIcon fontSize='small' />
) : view.id === 'my-comments' ? (
<CommentIcon fontSize='small' />
) : (
<PersonIcon fontSize='small' />
)
Expand Down Expand Up @@ -382,6 +398,13 @@ export function ProposalsPage({ title }: { title: string }) {
</Stack>
) : viewId === 'my-work' ? (
<UserProposalsTables />
) : viewId === 'my-comments' ? (
<NotificationsPopover
notifications={notifications}
mutateNotifications={mutateNotifications}
isLoading={isLoadingNotifications}
close={() => {}}
/>
) : isAdmin && viewId === 'reviewers' ? (
<ProposalsReviewersTable />
) : null}
Expand Down

0 comments on commit b66c5d1

Please sign in to comment.