Open platform to collect and prioritize feedback
More ui for the post details
Matt Robertsf972ff1830ee
diff --git a/public/components/ShowPostResponse.tsx b/public/components/ShowPostResponse.tsxindex 2a77afeac..0ae864df3 100644--- a/public/components/ShowPostResponse.tsx+++ b/public/components/ShowPostResponse.tsx@@ -11,7 +11,7 @@ import { HStack, VStack } from "./layout"import { timeSince } from "@fider/services"import { Trans } from "@lingui/react/macro"-type Size = "micro" | "small" | "normal"+type Size = "micro" | "small" | "xsmall" | "normal"interface PostResponseProps {status: string@@ -28,7 +28,6 @@ export const ResponseDetails = (props: PostResponseProps): JSX.Element | null =>return (<VStack align="start" spacing={4} className="bg-blue-50 p-3 border border-blue-200 rounded">- <ResponseLozenge response={props.response} status={props.status} /><div className="text-semibold text-lg">{timeSince("en", new Date(), props.response.respondedAt, "date")}</div>{props.response?.text && status !== PostStatus.Duplicate && (<div className="content">@@ -94,6 +93,17 @@ export const ResponseLozenge = (props: PostResponseProps): JSX.Element | null =>return <span className={`${color} text-sm`}>{translatedStatus}</span>}+ if (props.size === "xsmall") {+ return (+ <div>+ <HStack align="center" className={`${color} ${bg} rounded-full p-0 px-3`}>+ <Icon sprite={icon} className={`h-4 c-status-col--${status.value}`} />+ <span className={`c-status-col--${status.value} text-xs uppercase`}>{translatedStatus}</span>+ </HStack>+ </div>+ )+ }+return (<div><HStack align="start" className={`${color} ${bg} border ${border} rounded-full p-1 px-3`}>diff --git a/public/components/VoteCounter.scss b/public/components/VoteCounter.scssindex 37a8be575..2d531215c 100644--- a/public/components/VoteCounter.scss+++ b/public/components/VoteCounter.scss@@ -8,20 +8,20 @@text-align: center;margin: 0 auto;padding: spacing(3) 0;- color: var(--colors-gray-500);+ color: var(--colors-primary-base);display: flex;flex-direction: column;align-items: center;justify-content: center;gap: spacing(2);- border-radius: 12px;- transition: all 0.15s ease;- background-color: var(--colors-gray-50);- border: 1px solid var(--colors-gray-200);+ border-radius: 16px;+ transition: all 0.2s ease;+ background-color: var(--colors-blue-50);+ border: 2px solid var(--colors-blue-100);&:hover {- background-color: var(--colors-white);- border-color: var(--colors-gray-300);+ background-color: var(--colors-blue-100);+ border-color: var(--colors-primary-base);color: var(--colors-primary-base);.c-vote-counter__icon {@@ -34,9 +34,9 @@padding: spacing(3) 0;gap: spacing(2);font-weight: get("font.weight.bold");- background-color: var(--colors-blue-50);+ background-color: var(--colors-blue-100);color: var(--colors-primary-base);- border-color: var(--colors-primary-light);+ border-color: var(--colors-primary-base);.c-vote-counter__icon {color: var(--colors-primary-base);@@ -47,7 +47,8 @@}&:hover {- background-color: var(--colors-blue-100);+ background-color: var(--colors-blue-200);+ border-color: var(--colors-primary-base);}}@@ -56,13 +57,33 @@gap: spacing(2);@include disabled();}++ &--large {+ width: sizing(18);+ height: sizing(20);+ padding: spacing(5) 0;+ gap: spacing(2);+ border-radius: 20px;++ .c-vote-counter__icon {+ width: 28px;+ height: 28px;+ stroke-width: 2.5;+ }++ .c-vote-counter__count {+ font-size: 24px;+ font-weight: get("font.weight.bold");+ line-height: 1;+ }+ }}&__icon {width: 18px;height: 18px;- color: var(--colors-gray-500);- transition: all 0.15s ease;+ color: var(--colors-primary-base);+ transition: all 0.2s ease;flex-shrink: 0;}diff --git a/public/components/VoteCounter.tsx b/public/components/VoteCounter.tsxindex 28f83bd1b..7f346675f 100644--- a/public/components/VoteCounter.tsx+++ b/public/components/VoteCounter.tsx@@ -9,10 +9,12 @@ import ChevronUp from "@fider/assets/images/chevron-up.svg"export interface VoteCounterProps {post: Post+ size?: "default" | "large"}export const VoteCounter = (props: VoteCounterProps) => {const fider = useFider()+ const { size = "default" } = propsconst [hasVoted, setHasVoted] = useState(props.post.hasVoted)const [votesCount, setVotesCount] = useState(props.post.votesCount)const [isSignInModalOpen, setIsSignInModalOpen] = useState(false)@@ -38,10 +40,10 @@ export const VoteCounter = (props: VoteCounterProps) => {const isDisabled = status.closed || fider.isReadOnlyconst className = classSet({- "border-gray-200 border rounded-md bg-gray-100": true,"c-vote-counter__button": true,"c-vote-counter__button--voted": !status.closed && hasVoted,"c-vote-counter__button--disabled": isDisabled,+ "c-vote-counter__button--large": size === "large",})const vote = (diff --git a/public/components/common/Avatar.tsx b/public/components/common/Avatar.tsxindex 7475b579c..bc98d93bd 100644--- a/public/components/common/Avatar.tsx+++ b/public/components/common/Avatar.tsx@@ -9,10 +9,10 @@ interface AvatarProps {avatarURL: stringname: string}- size?: "small" | "normal"+ size?: "small" | "normal" | "large"}export const Avatar = (props: AvatarProps) => {- const size = props.size === "small" ? "h-6 w-6" : "h-8 w-8"+ const size = props.size === "small" ? "h-6 w-6" : props.size === "large" ? "h-11 w-11" : "h-8 w-8"return <img className={`c-avatar ${size}`} alt={props.user.name} src={`${props.user.avatarURL}?size=50`} />}diff --git a/public/pages/ShowPost/ShowPost.page.scss b/public/pages/ShowPost/ShowPost.page.scssindex 969a00273..77c6a9b62 100644--- a/public/pages/ShowPost/ShowPost.page.scss+++ b/public/pages/ShowPost/ShowPost.page.scss@@ -1,40 +1,108 @@@use "~@fider/assets/styles/variables.scss" as *;#p-show-post {+ background-color: var(--colors-gray-50);+ padding-top: spacing(12);+ padding-bottom: spacing(12);+.post-header {flex-grow: 1;}.p-show-post {&__main-col {- // background-color: var(--colors-white);- padding: spacing(4);- border-radius: get("border.radius.large");- margin-bottom: spacing(4);+ display: flex;+ flex-direction: column;+ gap: spacing(6);+ }++ &__post-card {+ background-color: var(--colors-white);+ border-radius: get("border.radius.xlarge");+ padding: spacing(7);+ box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);+ transition: box-shadow 0.2s ease-in-out;+ }++ &__vote-counter-large {+ flex-shrink: 0;+ }++ &__title {+ font-size: 32px;+ font-weight: get("font.weight.xbold");+ line-height: 1.2;+ color: var(--colors-gray-900);++ @include media("lg") {+ font-size: 36px;+ }+ }++ &__meta {+ display: flex;+ align-items: center;+ }++ &__description-section {+ margin-top: spacing(7);+ }++ &__description {+ color: var(--colors-gray-800);+ line-height: 1.6;+ }++ &__actions {+ border-top: 1px solid var(--colors-gray-200);+ padding-top: spacing(4);+ margin-top: spacing(6);+ }++ &__discussion-section {+ display: flex;+ flex-direction: column;+ gap: spacing(6);+ }++ &__discussion-header {+ margin-bottom: spacing(2);}&__action-col {- > :first-child {- // background-color: var(--colors-white);- padding: spacing(4);- // border-radius: get("border.radius.large");+ display: flex;+ flex-direction: column;+ gap: spacing(4);++ > * {+ background-color: var(--colors-white);+ border-radius: get("border.radius.xlarge");+ padding: spacing(6);+ box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);}}}+ .c-comment-input-card {+ flex-grow: 1;+ background-color: var(--colors-white);+ border-radius: get("border.radius.xlarge");+ padding: spacing(6);+ box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);+ }+@include media("lg") {.p-show-post {display: grid;gap: spacing(6);- grid-template-columns: 2fr 6fr 1fr;+ grid-template-columns: 1fr 320px;grid-template-rows: auto;grid-template-areas:- "Action Main"- "Action Main";+ "Main Action"+ "Main Action";&__main-col {grid-area: Main;- overflow: auto;}&__action-col {diff --git a/public/pages/ShowPost/ShowPost.page.tsx b/public/pages/ShowPost/ShowPost.page.tsxindex 90cec7f30..785556af2 100644--- a/public/pages/ShowPost/ShowPost.page.tsx+++ b/public/pages/ShowPost/ShowPost.page.tsx@@ -4,27 +4,42 @@ import React, { useState, useEffect, useCallback } from "react"import { Comment, Post, Tag, Vote, CurrentUser, PostStatus } from "@fider/models"import { actions, cache, clearUrlHash, Failure, Fider, notify, timeAgo } from "@fider/services"-import IconDotsHorizontal from "@fider/assets/images/heroicons-dots-horizontal.svg"import IconDuplicate from "@fider/assets/images/heroicons-duplicate.svg"import { i18n } from "@lingui/core"import IconRSS from "@fider/assets/images/heroicons-rss.svg"import IconPencil from "@fider/assets/images/heroicons-pencil-alt.svg"import IconChat from "@fider/assets/images/heroicons-chat-alt-2.svg"-import { ResponseDetails, Button, UserName, Moment, Markdown, Input, Form, Icon, Header, PoweredByFider, Avatar, Dropdown, RSSModal } from "@fider/components"-import { DiscussionPanel } from "./components/DiscussionPanel"+import {+ ResponseDetails,+ Button,+ UserName,+ Moment,+ Markdown,+ Input,+ Form,+ Icon,+ Header,+ PoweredByFider,+ Avatar,+ RSSModal,+ VoteCounter,+ ResponseLozenge,+} from "@fider/components"+import { CommentInput } from "./components/CommentInput"+import { ShowComment } from "./components/ShowComment"import CommentEditor from "@fider/components/common/form/CommentEditor"import IconX from "@fider/assets/images/heroicons-x.svg"import IconThumbsUp from "@fider/assets/images/heroicons-thumbsup.svg"import { HStack, VStack } from "@fider/components/layout"import { Trans } from "@lingui/react/macro"-import { FollowButton } from "./components/FollowButton"-import { VoteSection } from "./components/VoteSection"+import { StayUpdatedCard } from "./components/StayUpdatedCard"import { DeletePostModal } from "./components/DeletePostModal"import { ResponseModal } from "./components/ResponseModal"import { VotesPanel } from "./components/VotesPanel"import { TagsPanel } from "@fider/pages/ShowPost/components/TagsPanel"+import { ActionButton } from "./components/ActionButton"import { t } from "@lingui/macro"import { useFider } from "@fider/hooks"import { useAttachments } from "@fider/hooks/useAttachments"@@ -161,143 +176,183 @@ export default function ShowPostPage(props: ShowPostPageProps) {<div id="p-show-post" className="page container"><div className="p-show-post"><div className="p-show-post__main-col">- <div className="p-show-post__header-col">- <VStack spacing={8}>- <HStack justify="between">- <VStack align="start">- {!editMode && (- <HStack>- <Avatar user={props.post.user} />- <VStack spacing={1}>- <UserName user={props.post.user} />- <Moment className="text-muted" locale={Fider.currentLocale} date={props.post.createdAt} />- </VStack>- </HStack>- )}- </VStack>- <RSSModal isOpen={isRSSModalOpen} onClose={hideRSSModal} url={`${fider.settings.baseURL}/feed/posts/${props.post.number}.atom`} />-- {!editMode && (- <HStack>- <Dropdown position="left" renderHandle={<Icon sprite={IconDotsHorizontal} width="24" height="24" />}>- <Dropdown.ListItem onClick={onActionSelected("copy")} icon={IconDuplicate}>- <Trans id="action.copylink">Copy link</Trans>- </Dropdown.ListItem>- {Fider.session.tenant.isFeedEnabled && (- <Dropdown.ListItem onClick={onActionSelected("feed")} icon={IconRSS}>- <Trans id="action.commentsfeed">Comment Feed</Trans>- </Dropdown.ListItem>- )}- {Fider.session.isAuthenticated && canEditPost(Fider.session.user, props.post) && (- <>- <Dropdown.ListItem onClick={onActionSelected("edit")} icon={IconPencil}>- <Trans id="action.edit">Edit</Trans>- </Dropdown.ListItem>- {Fider.session.user.isCollaborator && (- <Dropdown.ListItem onClick={onActionSelected("status")} icon={IconChat}>- <Trans id="action.respond">Respond</Trans>- </Dropdown.ListItem>- )}- </>- )}- {canDeletePost() && (- <Dropdown.ListItem onClick={onActionSelected("delete")} className="text-red-700" icon={IconX}>- <Trans id="action.delete">Delete</Trans>- </Dropdown.ListItem>- )}- </Dropdown>- </HStack>- )}- </HStack>+ {/* 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>+ )}- <div className="flex-grow">+ {/* 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="text-large text-break">{props.post.title}</h1>- </>+ <h1 className="p-show-post__title">{props.post.title}</h1>)}- </div>- <DeletePostModal onModalClose={() => setShowDeleteModal(false)} showModal={showDeleteModal} post={props.post} />- {Fider.session.isAuthenticated && Fider.session.user.isCollaborator && (- <ResponseModal onCloseModal={() => setShowResponseModal(false)} showModal={showResponseModal} post={props.post} />- )}- <VStack>- {editMode ? (- <Form error={error}>- <CommentEditor- field="description"- onChange={handleDescriptionChange}- initialValue={newDescription}- disabled={false}- maxAttachments={3}- maxImageSizeKB={5 * 1024}- placeholder={i18n._({- id: "newpost.modal.description.placeholder",- message: "Tell us about it. Explain it fully, don't hold back, the more information the better.",- })}- onImageUploaded={handleImageUploaded}- onGetImageSrc={getImageSrc}- />- </Form>- ) : (+ {/* Posted by info with status */}+ {!editMode && (<>- {props.post.description && <Markdown className="description" text={props.post.description} style="full" />}- {!props.post.description && (- <em className="text-muted">- <Trans id="showpost.message.nodescription">No description provided.</Trans>- </em>- )}+ <div className="p-show-post__meta">+ <HStack spacing={2} align="center">+ <Avatar user={props.post.user} size="small" />+ <span className="text-sm text-gray-600">+ <Trans id="showpost.postedby">Posted by</Trans> <UserName user={props.post.user} />+ </span>+ <span className="text-sm text-gray-400">•</span>+ <Moment className="text-sm text-gray-600" locale={Fider.currentLocale} date={props.post.createdAt} />+ <span className="text-sm text-gray-400">•</span>+ <ResponseLozenge status={props.post.status} response={props.post.response} size="xsmall" />+ </HStack>+ </div>+ <ResponseDetails status={props.post.status} response={props.post.response} /></>)}</VStack>- <div className="mt-2">- <TagsPanel post={props.post} tags={props.tags} />- </div>+ </HStack>- <VStack spacing={4}>- {!editMode ? (- <HStack justify="between" align="start">- <VoteSection post={props.post} votes={props.post.votesCount} />- <FollowButton post={props.post} subscribed={props.subscribed} />- </HStack>- ) : (- <HStack>- <Button variant="primary" onClick={saveChanges} disabled={Fider.isReadOnly}>- <Icon sprite={IconThumbsUp} />{" "}- <span>- <Trans id="action.save">Save</Trans>- </span>- </Button>- <Button onClick={cancelEdit} disabled={Fider.isReadOnly}>- <Icon sprite={IconX} />- <span>- <Trans id="action.cancel">Cancel</Trans>- </span>- </Button>- </HStack>+ {/* Description - Full width */}+ {!editMode ? (+ <div className="p-show-post__description-section">+ {props.post.description && <Markdown className="p-show-post__description" text={props.post.description} style="full" />}+ {!props.post.description && (+ <em className="text-muted">+ <Trans id="showpost.message.nodescription">No description provided.</Trans>+ </em>)}- <div className="border-4 border-blue-500" />- </VStack>+ </div>+ ) : (+ <div className="p-show-post__description-section">+ <Form error={error}>+ <CommentEditor+ field="description"+ onChange={handleDescriptionChange}+ initialValue={newDescription}+ disabled={false}+ maxAttachments={3}+ maxImageSizeKB={5 * 1024}+ placeholder={i18n._({+ id: "newpost.modal.description.placeholder",+ message: "Tell us about it. Explain it fully, don't hold back, the more information the better.",+ })}+ onImageUploaded={handleImageUploaded}+ onGetImageSrc={getImageSrc}+ />+ </Form>+ </div>+ )}- <ResponseDetails status={props.post.status} response={props.post.response} />- </VStack>+ {/* Tags inline */}+ <div className="pt-7">+ <TagsPanel post={props.post} tags={props.tags} />+ </div>++ {/* Edit Mode Actions */}+ {editMode && (+ <HStack>+ <Button variant="primary" onClick={saveChanges} disabled={Fider.isReadOnly}>+ <Icon sprite={IconThumbsUp} />{" "}+ <span>+ <Trans id="action.save">Save</Trans>+ </span>+ </Button>+ <Button onClick={cancelEdit} disabled={Fider.isReadOnly}>+ <Icon sprite={IconX} />+ <span>+ <Trans id="action.cancel">Cancel</Trans>+ </span>+ </Button>+ </HStack>+ )}++ {/* Bottom Action Bar */}+ {!editMode && (+ <div className="p-show-post__actions">+ <HStack spacing={4} align="center">+ <ActionButton icon={IconDuplicate} onClick={onActionSelected("copy")}>+ <Trans id="action.copylink">Copy link</Trans>+ </ActionButton>++ {Fider.session.isAuthenticated && canEditPost(Fider.session.user, props.post) && (+ <ActionButton icon={IconPencil} onClick={onActionSelected("edit")}>+ <Trans id="action.edit">Edit</Trans>+ </ActionButton>+ )}++ {Fider.session.isAuthenticated && Fider.session.user.isCollaborator && (+ <ActionButton icon={IconChat} onClick={onActionSelected("status")}>+ <Trans id="action.respond">Respond</Trans>+ </ActionButton>+ )}++ {Fider.session.tenant.isFeedEnabled && (+ <ActionButton icon={IconRSS} onClick={onActionSelected("feed")}>+ <Trans id="action.commentsfeed">Comment Feed</Trans>+ </ActionButton>+ )}++ {canDeletePost() && (+ <ActionButton icon={IconX} onClick={onActionSelected("delete")} variant="danger">+ <Trans id="action.delete">Delete</Trans>+ </ActionButton>+ )}++ <div className="flex-grow" />+ </HStack>+ </div>+ )}</div>- <div className="p-show-post__discussion_col">- <DiscussionPanel post={props.post} comments={props.comments} highlightedComment={highlightedComment} />+ {/* Discussion Section */}+ <div className="p-show-post__discussion-section">+ {/* Discussion Header */}+ <div className="p-show-post__discussion-header">+ <h2 className="text-xl font-semibold text-gray-900">+ <Trans id="label.discussion">Discussion</Trans> <span className="text-gray-500">{props.comments.length}</span>+ </h2>+ </div>++ {/* Comment Input at top */}+ <CommentInput post={props.post} />++ {/* Comments List */}+ {props.comments.length > 0 && (+ <VStack spacing={4}>+ {props.comments.map((c) => (+ <ShowComment key={c.id} post={props.post} comment={c} highlighted={highlightedComment === c.id} />+ ))}+ </VStack>+ )}</div></div>++ {/* Right Sidebar */}<div className="p-show-post__action-col">+ {/* Stay Updated Card */}+ {!editMode && <StayUpdatedCard post={props.post} subscribed={props.subscribed} />}++ {/* Voters Panel */}<VotesPanel post={props.post} votes={props.votes} />+<PoweredByFider slot="show-post" className="mt-3" /></div></div></div>++ {/* Modals */}+ <RSSModal isOpen={isRSSModalOpen} onClose={hideRSSModal} url={`${fider.settings.baseURL}/feed/posts/${props.post.number}.atom`} />+ <DeletePostModal onModalClose={() => setShowDeleteModal(false)} showModal={showDeleteModal} post={props.post} />+ {Fider.session.isAuthenticated && Fider.session.user.isCollaborator && (+ <ResponseModal onCloseModal={() => setShowResponseModal(false)} showModal={showResponseModal} post={props.post} />+ )}</>)}diff --git a/public/pages/ShowPost/components/ActionButton.scss b/public/pages/ShowPost/components/ActionButton.scssnew file mode 100644index 000000000..6f26fa9c2--- /dev/null+++ b/public/pages/ShowPost/components/ActionButton.scss@@ -0,0 +1,37 @@+@use "~@fider/assets/styles/variables.scss" as *;++.c-action-button {+ display: inline-flex;+ align-items: center;+ padding: spacing(2) spacing(3);+ border: none;+ background-color: transparent;+ border-radius: get("border.radius.medium");+ color: var(--colors-gray-700);+ font-size: get("font.size.sm");+ font-weight: get("font.weight.medium");+ cursor: pointer;+ transition: background-color 0.2s ease-in-out;++ &:hover {+ background-color: var(--colors-gray-100);+ }++ &--danger {+ color: var(--colors-red-700);++ &:hover {+ background-color: var(--colors-red-50);+ }+ }++ &__icon {+ width: 18px;+ height: 18px;+ flex-shrink: 0;+ }++ &__text {+ white-space: nowrap;+ }+}diff --git a/public/pages/ShowPost/components/ActionButton.tsx b/public/pages/ShowPost/components/ActionButton.tsxnew file mode 100644index 000000000..1475b9123--- /dev/null+++ b/public/pages/ShowPost/components/ActionButton.tsx@@ -0,0 +1,26 @@+import "./ActionButton.scss"++import React from "react"+import { Icon } from "@fider/components"+import { HStack } from "@fider/components/layout"++interface ActionButtonProps {+ icon: SpriteSymbol | string+ onClick: () => void+ children: React.ReactNode+ variant?: "normal" | "danger"+}++export const ActionButton = (props: ActionButtonProps) => {+ const { icon, onClick, children, variant = "normal" } = props+ const className = `c-action-button ${variant === "danger" ? "c-action-button--danger" : ""}`++ return (+ <button className={className} onClick={onClick}>+ <HStack spacing={2} align="center">+ <Icon sprite={icon} className="c-action-button__icon" />+ <span className="c-action-button__text">{children}</span>+ </HStack>+ </button>+ )+}diff --git a/public/pages/ShowPost/components/CommentInput.tsx b/public/pages/ShowPost/components/CommentInput.tsxindex 3549bc945..7d8ae1cb2 100644--- a/public/pages/ShowPost/components/CommentInput.tsx+++ b/public/pages/ShowPost/components/CommentInput.tsx@@ -1,7 +1,7 @@import React, { useCallback, useState, useEffect } from "react"import { Post } from "@fider/models"-import { Avatar, UserName, Button, Form } from "@fider/components"+import { Avatar, Button, Form } from "@fider/components"import { SignInModal } from "@fider/components"import { cache, actions, Failure, Fider } from "@fider/services"@@ -76,16 +76,10 @@ export const CommentInput = (props: CommentInputProps) => {return (<><SignInModal isOpen={isSignInModalOpen} onClose={hideModal} />- <HStack spacing={2} className="c-comment-input" align="start">- {Fider.session.isAuthenticated && <Avatar user={Fider.session.user} />}- <div className="flex-grow bg-gray-100 rounded-md p-2">+ <HStack spacing={4} className="c-comment-input" align="start">+ {Fider.session.isAuthenticated && <Avatar user={Fider.session.user} size="large" />}+ <div className="c-comment-input-card"><Form error={error}>- {Fider.session.isAuthenticated && (- <div className="mb-1">- <UserName user={Fider.session.user} />- </div>- )}-{isClient ? (<><CommentEditor@@ -103,8 +97,8 @@ export const CommentInput = (props: CommentInputProps) => {{hasContent && (<>- <Button variant="primary" onClick={submit} className="mt-2">- <Trans id="action.submit">Submit</Trans>+ <Button variant="primary" onClick={submit} className="mt-4">+ <Trans id="action.postcomment">Post Comment</Trans></Button></>)}diff --git a/public/pages/ShowPost/components/ShowComment.scss b/public/pages/ShowPost/components/ShowComment.scssindex 4cbbfb543..0f199c493 100644--- a/public/pages/ShowPost/components/ShowComment.scss+++ b/public/pages/ShowPost/components/ShowComment.scss@@ -1,6 +1,21 @@@use "~@fider/assets/styles/variables.scss" as *;-.comment-area {- // spacing(8) for the avatar + spacing(1) for padding right- width: calc(100% - spacing(9));+.c-comment {+ &__card {+ flex-grow: 1;+ background-color: var(--colors-white);+ border-radius: get("border.radius.xlarge");+ padding: spacing(6);+ box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);+ }++ &__content {+ flex-grow: 1;++ &--highlighted {+ padding: spacing(2);+ background-color: var(--colors-yellow-50);+ border-radius: get("border.radius.medium");+ }+ }}diff --git a/public/pages/ShowPost/components/ShowComment.tsx b/public/pages/ShowPost/components/ShowComment.tsxindex fb090f084..60b6af103 100644--- a/public/pages/ShowPost/components/ShowComment.tsx+++ b/public/pages/ShowPost/components/ShowComment.tsx@@ -158,19 +158,16 @@ export const ShowComment = (props: ShowCommentProps) => {)const classList = classSet({- "flex-grow rounded-md p-2 comment-area": true,- "bg-gray-100": !props.highlighted,- "bg-gray-200": props.highlighted,+ "c-comment__content": true,+ "c-comment__content--highlighted": props.highlighted,})return (<div id={`comment-${comment.id}`}>- <HStack spacing={2} className="c-comment flex-items-baseline">- {modal()}- <div className="pt-4">- <Avatar user={comment.user} />- </div>- <div ref={node} className={classList}>+ {modal()}+ <HStack spacing={4} align="start">+ <Avatar user={comment.user} size="large" />+ <div ref={node} className={`c-comment__card ${classList}`}><div className="mb-1"><HStack justify="between"><HStack>diff --git a/public/pages/ShowPost/components/StayUpdatedCard.tsx b/public/pages/ShowPost/components/StayUpdatedCard.tsxnew file mode 100644index 000000000..7614a2bfe--- /dev/null+++ b/public/pages/ShowPost/components/StayUpdatedCard.tsx@@ -0,0 +1,60 @@+import React, { useState } from "react"+import { Button, Icon } from "@fider/components"+import { actions } from "@fider/services"+import { useFider } from "@fider/hooks"+import IconPlus from "@fider/assets/images/heroicons-plus.svg"+import IconCheck from "@fider/assets/images/heroicons-check.svg"+import { VStack } from "@fider/components/layout"+import { Trans } from "@lingui/macro"+import { Post } from "@fider/models"++export interface StayUpdatedCardProps {+ post: Post+ subscribed: boolean+}++export const StayUpdatedCard = (props: StayUpdatedCardProps) => {+ const fider = useFider()+ const [subscribed, setSubscribed] = useState(props.subscribed)++ const subscribeOrUnsubscribe = async () => {+ const action = subscribed ? actions.unsubscribe : actions.subscribe++ const response = await action(props.post.number)+ if (response.ok) {+ setSubscribed(!subscribed)+ }+ }++ if (!fider.session.isAuthenticated) {+ return null+ }++ const button = subscribed ? (+ <Button className="w-full text-gray-800 bg-white border border-gray-800 no-focus" onClick={subscribeOrUnsubscribe} disabled={fider.isReadOnly}>+ <Icon sprite={IconCheck} />{" "}+ <span>+ <Trans id="label.following">Following</Trans>+ </span>+ </Button>+ ) : (+ <Button className="w-full text-blue-600 bg-white border border-blue-600 no-focus" onClick={subscribeOrUnsubscribe} disabled={fider.isReadOnly}>+ <Icon sprite={IconPlus} />+ <span>+ <Trans id="label.follow">Follow</Trans>+ </span>+ </Button>+ )++ return (+ <VStack spacing={2}>+ <h3 className="text-base font-semibold 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>+ </p>+ {button}+ </VStack>+ )+}