Open platform to collect and prioritize feedback
Bringing back the old voting buttons
Matt Roberts7543450233c7
diff --git a/e2e/step_definitions/show_post.steps.ts b/e2e/step_definitions/show_post.steps.tsindex e13c2bf8d..73b28f35a 100644--- a/e2e/step_definitions/show_post.steps.ts+++ b/e2e/step_definitions/show_post.steps.ts@@ -13,7 +13,6 @@ Then("I should see {string} as the post title", async function (this: FiderWorld})Then("I should see {int} vote\\(s)", async function (this: FiderWorld, voteCount: number) {- // The vote counter now shows just the number, look for it in the vote button- const voteButton = this.page.locator(".c-vote-counter__button .c-vote-counter__count")- await expect(voteButton).toHaveText(voteCount.toString())+ // Look for the vote count number with the specific styling+ await expect(this.page.locator(".text-2xl").filter({ hasText: voteCount.toString() })).toBeVisible()})diff --git a/public/pages/ShowPost/ShowPost.page.scss b/public/pages/ShowPost/ShowPost.page.scssindex fbb8b7a89..3ec0f2e62 100644--- a/public/pages/ShowPost/ShowPost.page.scss+++ b/public/pages/ShowPost/ShowPost.page.scss@@ -33,10 +33,6 @@transition: box-shadow 0.2s ease-in-out;}- &__vote-counter-large {- flex-shrink: 0;- }-&__title {font-size: 20px;font-weight: get("font.weight.xbold");@@ -57,21 +53,10 @@align-items: center;flex-wrap: wrap;row-gap: spacing(2);+ }- &--desktop {- @include media("sm") {- display: none;- }- }-- &--mobile {- display: none;- margin-top: spacing(4);-- @include media("sm") {- display: flex;- }- }+ &__vote-section {+ margin-top: spacing(6);}&__description-section {@@ -122,7 +107,7 @@margin-top: spacing(6);}- > * {+ > .card {background-color: var(--colors-white);@include dark-mode {background-color: var(--colors-gray-200);diff --git a/public/pages/ShowPost/ShowPost.page.tsx b/public/pages/ShowPost/ShowPost.page.tsxindex f34d7b369..aa85601b6 100644--- a/public/pages/ShowPost/ShowPost.page.tsx+++ b/public/pages/ShowPost/ShowPost.page.tsx@@ -23,11 +23,11 @@ import {PoweredByFider,Avatar,RSSModal,- VoteCounter,ResponseLozenge,} from "@fider/components"import { CommentInput } from "./components/CommentInput"import { ShowComment } from "./components/ShowComment"+import { VoteSection } from "./components/VoteSection"import CommentEditor from "@fider/components/common/form/CommentEditor"import IconX from "@fider/assets/images/heroicons-x.svg"@@ -191,44 +191,27 @@ export default function ShowPostPage(props: ShowPostPageProps) {<div className="p-show-post__main-col">{/* Post Card */}<div className="p-show-post__post-card">- {/* Top section: Vote counter + Title/Meta */}- <HStack spacing={6} align="start">- {/* Large Vote Counter */}- {!editMode && (- <div className="p-show-post__vote-counter-large">- <VoteCounter post={props.post} size="large" />- </div>+ {/* Title and Meta */}+ <VStack spacing={4}>+ {/* Title */}+ {editMode ? (+ <Form error={error}>+ <Input field="title" maxLength={100} value={newTitle} onChange={setNewTitle} />+ </Form>+ ) : (+ <h1 className="p-show-post__title">{props.post.title}</h1>)}- {/* Title and Meta */}- <VStack className="flex-grow" spacing={4}>- {/* Title */}- {editMode ? (- <Form error={error}>- <Input field="title" maxLength={100} value={newTitle} onChange={setNewTitle} />- </Form>- ) : (- <h1 className="p-show-post__title">{props.post.title}</h1>- )}-- {/* Posted by info with status - Desktop only */}- {!editMode && (- <>- <div className="p-show-post__meta p-show-post__meta--desktop">- <PostMetaInfo post={props.post} locale={fider.currentLocale} />- </div>- <ResponseDetails status={props.post.status} response={props.post.response} />- </>- )}- </VStack>- </HStack>-- {/* Posted by info with status - Mobile only (full width) */}- {!editMode && (- <div className="p-show-post__meta p-show-post__meta--mobile">- <PostMetaInfo post={props.post} locale={fider.currentLocale} />- </div>- )}+ {/* Posted by info with status */}+ {!editMode && (+ <>+ <div className="p-show-post__meta">+ <PostMetaInfo post={props.post} locale={fider.currentLocale} />+ </div>+ <ResponseDetails status={props.post.status} response={props.post.response} />+ </>+ )}+ </VStack>{/* Description - Full width */}{!editMode ? (@@ -261,6 +244,13 @@ export default function ShowPostPage(props: ShowPostPageProps) {</div>)}+ {/* Vote Section */}+ {!editMode && (+ <div className="p-show-post__vote-section">+ <VoteSection post={props.post} votes={props.post.votesCount} />+ </div>+ )}+{/* Tags inline */}<div className="pt-7"><TagsPanel post={props.post} tags={props.tags} />@@ -350,7 +340,7 @@ export default function ShowPostPage(props: ShowPostPageProps) {{/* Right Sidebar */}<div className="p-show-post__action-col">- {!editMode && <StayUpdatedCard post={props.post} subscribed={props.subscribed} />}+ <StayUpdatedCard post={props.post} subscribed={props.subscribed} /><VotesPanel post={props.post} votes={props.votes} />diff --git a/public/pages/ShowPost/components/StayUpdatedCard.tsx b/public/pages/ShowPost/components/StayUpdatedCard.tsxindex a0619f052..809d0a773 100644--- a/public/pages/ShowPost/components/StayUpdatedCard.tsx+++ b/public/pages/ShowPost/components/StayUpdatedCard.tsx@@ -47,12 +47,12 @@ export const StayUpdatedCard = (props: StayUpdatedCardProps) => {)return (- <VStack spacing={2}>+ <VStack spacing={2} className="card"><h3 className="text-bold text-gray-900"><Trans id="showpost.stayupdated.title">Stay Updated</Trans></h3><p className="text-sm text-gray-600">- <Trans id="showpost.stayupdated.description">Get notified when this post receives updates</Trans>+ <Trans id="showpost.stayupdated.description">Get notified about updates to this idea</Trans></p>{button}</VStack>diff --git a/public/pages/ShowPost/components/VoteSection.tsx b/public/pages/ShowPost/components/VoteSection.tsxindex b517ab492..480f1086b 100644--- a/public/pages/ShowPost/components/VoteSection.tsx+++ b/public/pages/ShowPost/components/VoteSection.tsx@@ -5,7 +5,7 @@ import { Button, Icon, SignInModal } from "@fider/components"import { useFider } from "@fider/hooks"import IconThumbsUp from "@fider/assets/images/heroicons-thumbsup.svg"import IconCheck from "@fider/assets/images/heroicons-check.svg"-import { Trans } from "@lingui/macro"+import { Trans } from "@lingui/react/macro"import { HStack, VStack } from "@fider/components/layout"interface VoteSectionProps {@@ -25,10 +25,11 @@ export const VoteSection = (props: VoteSectionProps) => {return}- const response = await actions.toggleVote(props.post.number)+ const action = hasVoted ? actions.removeVote : actions.addVote+ const response = await action(props.post.number)if (response.ok) {- setVotes(response.data.voted ? votes + 1 : votes - 1)- setHasVoted(response.data.voted)+ setVotes(hasVoted ? votes - 1 : votes + 1)+ setHasVoted(!hasVoted)}}@@ -41,21 +42,23 @@ export const VoteSection = (props: VoteSectionProps) => {const icon = hasVoted ? IconCheck : IconThumbsUpreturn (- <VStack spacing={4}>+ <><SignInModal isOpen={isSignInModalOpen} onClose={hideModal} />- <div className="align-self-start">- <Button variant="primary" onClick={voteOrUndo} disabled={isDisabled} style={{ minWidth: "180px" }}>- <HStack spacing={2} justify="center" className="w-full">- <Icon sprite={icon} /> <span>{buttonText}</span>- </HStack>- </Button>- </div>- <HStack align="center">- <span className="text-semibold text-2xl" style={{ fontSize: "32px", minHeight: "48px" }}>- {votes}- </span>- <span className="text-semibold text-lg">{votes === 1 ? "Vote" : "Votes"}</span>- </HStack>- </VStack>+ <VStack spacing={4}>+ <div className="align-self-start">+ <Button variant={hasVoted ? "primary" : "secondary"} onClick={voteOrUndo} disabled={isDisabled} style={{ minWidth: "180px" }}>+ <HStack spacing={2} justify="center" className="w-full">+ <Icon sprite={icon} /> <span>{buttonText}</span>+ </HStack>+ </Button>+ </div>+ <HStack align="center" spacing={2}>+ <span className="text-semibold text-2xl" style={{ fontSize: "32px", minHeight: "48px" }}>+ {votes}+ </span>+ <span className="text-semibold text-lg">{votes === 1 ? <Trans id="label.vote">Vote</Trans> : <Trans id="label.votes">Votes</Trans>}</span>+ </HStack>+ </VStack>+ </>)}diff --git a/public/pages/ShowPost/components/VotesPanel.tsx b/public/pages/ShowPost/components/VotesPanel.tsxindex c47058867..11d88606c 100644--- a/public/pages/ShowPost/components/VotesPanel.tsx+++ b/public/pages/ShowPost/components/VotesPanel.tsx@@ -36,7 +36,7 @@ export const VotesPanel = (props: VotesPanelProps) => {const remainingCount = totalVotesCount - MAX_AVATARS_SHOWNreturn (- <VStack spacing={4} className="c-votes-panel">+ <VStack spacing={4} className="c-votes-panel card"><VotesModal post={props.post} isOpen={isVotesModalOpen} onClose={closeModal} /><div className="c-votes-panel__header">