Skip to content

Commit

Permalink
Hide creator column and collaborators (#667)
Browse files Browse the repository at this point in the history
  • Loading branch information
camilovegag authored Jul 9, 2024
1 parent 4a36ef4 commit 705cc5e
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 36 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -13,9 +13,9 @@ function CycleColumns({ onColumnClick, showScore }: CycleColumnsProps) {
<Proposal>
<Body>Vote Items</Body>
</Proposal>
<Lead onClick={() => onColumnClick('lead')}>
{/* <Lead onClick={() => onColumnClick('lead')}>
<Body>Creator</Body>
</Lead>
</Lead> */}
<Hearts onClick={() => onColumnClick('numOfVotes')}>
<IconButton
$padding={0}
Expand Down
10 changes: 5 additions & 5 deletions packages/berlin/src/components/option-card/OptionCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import Link from '../link';
import {
ArrowDownIcon,
ArrowIcon,
Author,
// Author,
Card,
Container,
Field,
// Field,
Plurality,
PluralityIcon,
Proposal,
Expand Down Expand Up @@ -65,7 +65,7 @@ function OptionCard({

const [expanded, setExpanded] = useState(false);

const author = option.user ? `${option.user?.firstName} ${option.user?.lastName}` : 'Anonymous';
// const author = option.user ? `${option.user?.firstName} ${option.user?.lastName}` : 'Anonymous';

// const handleCommentsClick = () => {
// navigate(`/events/${eventId}/cycles/${cycleId}/options/${option.id}`);
Expand Down Expand Up @@ -93,10 +93,10 @@ function OptionCard({
</ArrowDownIcon>
<Body>{option.optionTitle}</Body>
</Proposal>
<Author>
{/* <Author>
<Field>Creator:</Field>
<Body>{author}</Body>
</Author>
</Author> */}
<Votes $showScore={showScore}>
<VotesIcon $gap="-4px">
<IconButton
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// React and third-party libraries
import { useQuery } from '@tanstack/react-query';
// import { useQuery } from '@tanstack/react-query';
import { useMemo } from 'react';
// import { useNavigate } from 'react-router-dom';

// API
import { fetchOptionUsers } from 'api';
// import { fetchOptionUsers } from 'api';

// Store
import { useAppStore } from '../../../store';
Expand Down Expand Up @@ -59,19 +59,19 @@ function ResultsTable({
return score % 1 === 0 ? score.toFixed(0) : score.toFixed(3);
}, [option.pluralityScore]);

const { data: optionUsers } = useQuery({
queryKey: ['option', option.id, 'users'],
queryFn: () => 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}`);
Expand Down Expand Up @@ -157,13 +157,13 @@ function ResultsTable({
{option.optionSubTitle}
</Markdown>
)}
<Body>
{/* <Body>
<Bold>Creator:</Bold> {optionUsers?.user?.firstName} {optionUsers?.user?.lastName}
</Body>
<Body>
<Bold>Collaborators:</Bold>{' '}
{collaborators && collaborators.length > 0 ? collaborators.join(', ') : 'None'}
</Body>
</Body> */}
<Body>
<Bold>Distinct voters:</Bold> {option.distinctUsers}
</Body>
Expand Down
27 changes: 16 additions & 11 deletions packages/berlin/src/pages/Comments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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'],
Expand Down Expand Up @@ -200,15 +205,15 @@ function Comments() {
</FlexRow> */}
<Subtitle>{option?.optionTitle}</Subtitle>
<Body>{option?.optionSubTitle}</Body>
<Body>
{/* <Body>
<Bold>Creator:</Bold> {optionUsers?.user?.firstName} {optionUsers?.user?.lastName}
{coauthors && coauthors.length > 0 && (
<Body>
<Bold>Co-authors:</Bold>{' '}
{coauthors.map((coauthor) => `${coauthor.firstName} ${coauthor.lastName}`).join(', ')}
</Body>
)}
</Body>
</Body> */}
</FlexColumn>
{/* <Button onClick={handleSaveVoteWrapper}>Save votes</Button> */}
<Form>
Expand Down
2 changes: 1 addition & 1 deletion packages/berlin/src/pages/Cycle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ function Cycle() {
content: (
<OnboardingCard>
<Subtitle>Information</Subtitle>
<Body>View vote item and creator.</Body>
<Body>View vote item.</Body>
<FlexRow>
<IconButton
$padding={0}
Expand Down

0 comments on commit 705cc5e

Please sign in to comment.