Open platform to collect and prioritize feedback
Avatar list in show post page
Matt Robertsdb2d1419f9c8
diff --git a/app/handlers/post.go b/app/handlers/post.goindex 78d0052c6..2d629dcb8 100644--- a/app/handlers/post.go+++ b/app/handlers/post.go@@ -74,7 +74,7 @@ func PostDetails() web.HandlerFunc {isSubscribed := &query.UserSubscribedTo{PostID: getPost.Result.ID}getComments := &query.GetCommentsByPost{Post: getPost.Result}getAllTags := &query.GetAllTags{}- listVotes := &query.ListPostVotes{PostID: getPost.Result.ID, Limit: 6, IncludeEmail: false}+ listVotes := &query.ListPostVotes{PostID: getPost.Result.ID, Limit: 24, IncludeEmail: false}getAttachments := &query.GetAttachments{Post: getPost.Result}if err := bus.Dispatch(c, getAllTags, getComments, listVotes, isSubscribed, getAttachments); err != nil {return c.Failure(err)diff --git a/public/components/common/AvatarStack.scss b/public/components/common/AvatarStack.scssindex d89b65262..4829ec2f1 100644--- a/public/components/common/AvatarStack.scss+++ b/public/components/common/AvatarStack.scss@@ -5,7 +5,7 @@border: 2px solid white;}- > * + * {+ &--overlap & > * + * {margin-left: spacing(-3);}}diff --git a/public/components/common/AvatarStack.tsx b/public/components/common/AvatarStack.tsxindex 72eb75888..c7d475d61 100644--- a/public/components/common/AvatarStack.tsx+++ b/public/components/common/AvatarStack.tsx@@ -3,8 +3,10 @@ import "./AvatarStack.scss"import React from "react"import { UserRole } from "@fider/models"import { Avatar } from "./Avatar"+import { classSet } from "@fider/services"interface AvatarStackProps {+ overlap?: booleanusers: Array<{role?: UserRoleavatarURL: string@@ -13,8 +15,13 @@ interface AvatarStackProps {}export const AvatarStack = (props: AvatarStackProps) => {+ const classes = classSet({+ "c-avatar-stack": true,+ "c-avatar-stack--overlap": props.overlap ?? true,+ })+return (- <div className="c-avatar-stack">+ <div className={classes}>{props.users.map((x, i) => (<Avatar key={i} user={x} />))}diff --git a/public/pages/ShowPost/ShowPost.page.scss b/public/pages/ShowPost/ShowPost.page.scssindex 9e8cb4107..0f882b6ef 100644--- a/public/pages/ShowPost/ShowPost.page.scss+++ b/public/pages/ShowPost/ShowPost.page.scss@@ -15,9 +15,9 @@&__action-col {> :first-child {- background-color: get("colors.white");+ // background-color: get("colors.white");padding: spacing(4);- border-radius: get("border.radius.large");+ // border-radius: get("border.radius.large");}}}@@ -26,11 +26,11 @@.p-show-post {display: grid;gap: spacing(6);- grid-template-columns: 1fr 5fr 1fr;+ grid-template-columns: 2fr 6fr 1fr;grid-template-rows: auto;grid-template-areas:- "Action Main Nothing"- "Action Main Nothing";+ "Action Main"+ "Action Main";&__main-col {grid-area: Main;diff --git a/public/pages/ShowPost/ShowPost.page.tsx b/public/pages/ShowPost/ShowPost.page.tsxindex 8bc39223d..a840941cb 100644--- a/public/pages/ShowPost/ShowPost.page.tsx+++ b/public/pages/ShowPost/ShowPost.page.tsx@@ -40,6 +40,7 @@ import { FollowButton } from "./components/FollowButton"import { VoteSection } from "./components/VoteSection"import { DeletePostModal } from "./components/DeletePostModal"import { ResponseModal } from "./components/ResponseModal"+import { VotesPanel } from "./components/VotesPanel"// import { MostWanted } from "./components/MostWanted"interface ShowPostPageProps {@@ -308,6 +309,7 @@ export default class ShowPostPage extends React.Component<ShowPostPageProps, Sho</div></div><div className="p-show-post__action-col">+ <VotesPanel post={this.props.post} votes={this.props.votes} />{/* <MostWanted /> */}{/* <PoweredByFider slot="show-post" className="mt-3" /> */}</div>diff --git a/public/pages/ShowPost/components/VotesPanel.tsx b/public/pages/ShowPost/components/VotesPanel.tsxindex e27d367b8..70fcfffd2 100644--- a/public/pages/ShowPost/components/VotesPanel.tsx+++ b/public/pages/ShowPost/components/VotesPanel.tsx@@ -29,31 +29,33 @@ export const VotesPanel = (props: VotesPanelProps) => {const extraVotesCount = props.post.votesCount - props.votes.lengthreturn (- <VStack>+ <VStack spacing={4}><VotesModal post={props.post} isOpen={isVotesModalOpen} onClose={closeModal} />{!props.hideTitle && (<span className="text-category"><Trans id="label.voters">Voters</Trans></span>)}- <HStack>- {props.votes.length > 0 && <AvatarStack users={props.votes.map((x) => x.user)} />}- {extraVotesCount > 0 && (- <Button variant="tertiary" disabled={!canShowAll} size="small" onClick={openModal}>- <Trans id="showpost.votespanel.more">+{extraVotesCount} more</Trans>- </Button>- )}- {props.votes.length > 0 && extraVotesCount === 0 && canShowAll && (- <Button variant="tertiary" size="small" disabled={!canShowAll} onClick={openModal}>- <Trans id="showpost.votespanel.seedetails">see details</Trans>- </Button>- )}- {props.votes.length === 0 && (- <span className="text-muted">- <Trans id="label.none">None</Trans>- </span>- )}- </HStack>+ {props.votes.length > 0 && (+ <HStack spacing={0} className="gap-2">+ <AvatarStack users={props.votes.map((x) => x.user)} overlap={false} />+ </HStack>+ )}+ {extraVotesCount > 0 && (+ <Button variant="tertiary" disabled={!canShowAll} size="small" onClick={openModal}>+ <Trans id="showpost.votespanel.more">+{extraVotesCount} more</Trans>+ </Button>+ )}+ {props.votes.length > 0 && extraVotesCount === 0 && canShowAll && (+ <Button variant="tertiary" size="small" disabled={!canShowAll} onClick={openModal}>+ <Trans id="showpost.votespanel.seedetails">see details</Trans>+ </Button>+ )}+ {props.votes.length === 0 && (+ <span className="text-muted">+ <Trans id="label.none">None</Trans>+ </span>+ )}</VStack>)}