From 705cc5eb8427fce6b718765fad2244794660a71a Mon Sep 17 00:00:00 2001 From: Camilo Vega <59750365+camilovegag@users.noreply.github.com> Date: Tue, 9 Jul 2024 11:48:42 -0500 Subject: [PATCH] Hide creator column and collaborators (#667) --- .../columns/cycle-columns/CycleColumns.tsx | 6 ++-- .../src/components/option-card/OptionCard.tsx | 10 +++--- .../tables/results-table/ResultsTable.tsx | 32 +++++++++---------- packages/berlin/src/pages/Comments.tsx | 27 +++++++++------- packages/berlin/src/pages/Cycle.tsx | 2 +- 5 files changed, 41 insertions(+), 36 deletions(-) diff --git a/packages/berlin/src/components/columns/cycle-columns/CycleColumns.tsx b/packages/berlin/src/components/columns/cycle-columns/CycleColumns.tsx index 447e68b1..7e94d6d0 100644 --- a/packages/berlin/src/components/columns/cycle-columns/CycleColumns.tsx +++ b/packages/berlin/src/components/columns/cycle-columns/CycleColumns.tsx @@ -1,6 +1,6 @@ import IconButton from '../../icon-button'; import { Body } from '../../typography/Body.styled'; -import { Lead, Card, Hearts, Proposal, Plurality } from './CycleColumns.styled'; +import { Card, Hearts, Proposal, Plurality } from './CycleColumns.styled'; type CycleColumnsProps = { onColumnClick: (column: string) => void; @@ -13,9 +13,9 @@ function CycleColumns({ onColumnClick, showScore }: CycleColumnsProps) { Vote Items - onColumnClick('lead')}> + {/* onColumnClick('lead')}> Creator - + */} onColumnClick('numOfVotes')}> { // navigate(`/events/${eventId}/cycles/${cycleId}/options/${option.id}`); @@ -93,10 +93,10 @@ function OptionCard({ {option.optionTitle} - + {/* Creator: {author} - + */} fetchOptionUsers(option.id || ''), - enabled: !!option.id, - }); + // const { data: optionUsers } = useQuery({ + // queryKey: ['option', option.id, 'users'], + // queryFn: () => fetchOptionUsers(option.id || ''), + // enabled: !!option.id, + // }); - const collaborators = optionUsers?.group?.users - ?.filter( - (user) => - user.firstName !== optionUsers?.user?.firstName || - user.lastName !== optionUsers?.user?.lastName, - ) - .map((user) => `${user.firstName} ${user.lastName}`); + // const collaborators = optionUsers?.group?.users + // ?.filter( + // (user) => + // user.firstName !== optionUsers?.user?.firstName || + // user.lastName !== optionUsers?.user?.lastName, + // ) + // .map((user) => `${user.firstName} ${user.lastName}`); // const handleCommentsClick = () => { // navigate(`/events/${eventId}/cycles/${cycleId}/options/${option.id}`); @@ -157,13 +157,13 @@ function ResultsTable({ {option.optionSubTitle} )} - + {/* Creator: {optionUsers?.user?.firstName} {optionUsers?.user?.lastName} Collaborators:{' '} {collaborators && collaborators.length > 0 ? collaborators.join(', ') : 'None'} - + */} Distinct voters: {option.distinctUsers} diff --git a/packages/berlin/src/pages/Comments.tsx b/packages/berlin/src/pages/Comments.tsx index 4741e6a3..6bbffbfd 100644 --- a/packages/berlin/src/pages/Comments.tsx +++ b/packages/berlin/src/pages/Comments.tsx @@ -4,7 +4,12 @@ import { useParams } from 'react-router-dom'; import { useMemo, useState } from 'react'; // API -import { fetchOption, fetchComments, postComment, fetchOptionUsers } from 'api'; +import { + fetchOption, + fetchComments, + postComment, + // fetchOptionUsers +} from 'api'; // Hooks // import useUser from '../hooks/useUser'; @@ -64,15 +69,15 @@ function Comments() { // retry: false, // }); - const { data: optionUsers } = useQuery({ - queryKey: ['option', optionId, 'users'], - queryFn: () => fetchOptionUsers(optionId || ''), - enabled: !!optionId, - }); + // const { data: optionUsers } = useQuery({ + // queryKey: ['option', optionId, 'users'], + // queryFn: () => fetchOptionUsers(optionId || ''), + // enabled: !!optionId, + // }); - const coauthors = useMemo(() => { - return optionUsers?.group?.users?.filter((optionUser) => optionUser.id !== option?.userId); - }, [optionUsers, option]); + // const coauthors = useMemo(() => { + // return optionUsers?.group?.users?.filter((optionUser) => optionUser.id !== option?.userId); + // }, [optionUsers, option]); const { data: comments } = useQuery({ queryKey: ['option', optionId, 'comments'], @@ -200,7 +205,7 @@ function Comments() { */} {option?.optionTitle} {option?.optionSubTitle} - + {/* Creator: {optionUsers?.user?.firstName} {optionUsers?.user?.lastName} {coauthors && coauthors.length > 0 && ( @@ -208,7 +213,7 @@ function Comments() { {coauthors.map((coauthor) => `${coauthor.firstName} ${coauthor.lastName}`).join(', ')} )} - + */} {/* */}
diff --git a/packages/berlin/src/pages/Cycle.tsx b/packages/berlin/src/pages/Cycle.tsx index 2b02ac2e..a2392320 100644 --- a/packages/berlin/src/pages/Cycle.tsx +++ b/packages/berlin/src/pages/Cycle.tsx @@ -365,7 +365,7 @@ function Cycle() { content: ( Information - View vote item and creator. + View vote item.