Open platform to collect and prioritize feedback
Post status lozenge
Matt Roberts0f0d33d3317c
diff --git a/public/assets/images/heroicons-sparkles-outline.svg b/public/assets/images/heroicons-sparkles-outline.svgnew file mode 100644index 000000000..a9d0a4d22--- /dev/null+++ b/public/assets/images/heroicons-sparkles-outline.svg@@ -0,0 +1,3 @@+<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">+ <path stroke-linecap="round" stroke-linejoin="round" d="M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09ZM18.259 8.715 18 9.75l-.259-1.035a3.375 3.375 0 0 0-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 0 0 2.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 0 0 2.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 0 0-2.456 2.456ZM16.894 20.567 16.5 21.75l-.394-1.183a2.25 2.25 0 0 0-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 0 0 1.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 0 0 1.423 1.423l1.183.394-1.183.394a2.25 2.25 0 0 0-1.423 1.423Z" />+</svg>diff --git a/public/assets/styles/utility/display.scss b/public/assets/styles/utility/display.scssindex 70738cc13..527acd1ed 100644--- a/public/assets/styles/utility/display.scss+++ b/public/assets/styles/utility/display.scss@@ -110,6 +110,10 @@align-items: start;}+.flex-items-end {+ align-items: end;+}+.justify-between {justify-content: space-between;}diff --git a/public/components/Reactions.tsx b/public/components/Reactions.tsxindex 613030a75..2bcf0ee06 100644--- a/public/components/Reactions.tsx+++ b/public/components/Reactions.tsx@@ -34,7 +34,7 @@ export const Reactions: React.FC<ReactionsProps> = ({ emojiSelectorRef, toggleRereturn (<div ref={emojiSelectorRef}>- <HStack spacing={2} center={true} className="mt-2 c-reactions relative">+ <HStack spacing={2} align="center" className="mt-2 c-reactions relative">{fider.session.isAuthenticated && (<><spandiff --git a/public/components/ShowPostResponse.tsx b/public/components/ShowPostResponse.tsxindex 065b0d093..e5c6a0129 100644--- a/public/components/ShowPostResponse.tsx+++ b/public/components/ShowPostResponse.tsx@@ -2,10 +2,9 @@ import React from "react"import { PostResponse, PostStatus } from "@fider/models"import { Icon, Markdown } from "@fider/components"import HeroIconDuplicate from "@fider/assets/images/heroicons-duplicate.svg"-import HeroIconSmile from "@fider/assets/images/heroicons-smile.svg"-import HeroIconStar from "@fider/assets/images/heroicons-star.svg"+import HeroIconCheck from "@fider/assets/images/heroicons-check-circle.svg"+import HeroIconSparkles from "@fider/assets/images/heroicons-sparkles-outline.svg"import HeroIconThumbsUp from "@fider/assets/images/heroicons-thumbsup.svg"-import HeroIconInbox from "@fider/assets/images/heroicons-inbox.svg"import { t } from "@lingui/macro"import { HStack } from "./layout"@@ -76,23 +75,27 @@ const getStatusIcon = (status: PostStatus): SpriteSymbol => {case PostStatus.Duplicate:return HeroIconDuplicatecase PostStatus.Completed:- return HeroIconStar+ return HeroIconCheckcase PostStatus.Planned:return HeroIconThumbsUpcase PostStatus.Started:- return HeroIconSmile+ return HeroIconSparkles}- return HeroIconInbox+ return HeroIconThumbsUp}-export const ResponseStatusLabel = (props: PostResponseProps): JSX.Element | null => {+export const ResponseLozenge = (props: PostResponseProps): JSX.Element | null => {const status = PostStatus.Get(props.status)+ if (status === PostStatus.Open) {+ return <div />+ }+return (<>- <HStack>- <Icon sprite={getStatusIcon(status)} className={`h-6 c-status-col--${status.value}`} />- <span className={`text-semibold text-lg c-status-col--${status.value}`}>{status.title}</span>+ <HStack align="start" className="align-self-start bg-blue-100 border border-blue-300 rounded-full p-1 px-3 mb-4">+ <Icon sprite={getStatusIcon(status)} className={`h-5 c-status-col--${status.value}`} />+ <span className={`text-semibold c-status-col--${status.value}`}>{status.title}</span></HStack></>)diff --git a/public/components/common/form/Input.tsx b/public/components/common/form/Input.tsxindex 81e0fdd93..917b5ff0f 100644--- a/public/components/common/form/Input.tsx+++ b/public/components/common/form/Input.tsx@@ -53,7 +53,7 @@ export const Input: React.FunctionComponent<InputProps> = (props) => {{props.afterLabel}</label>)}- <HStack spacing={0} center={!!props.icon} className="relative">+ <HStack spacing={0} align={props.icon ? "center" : "start"} className="relative"><inputclassName={classSet({"c-input": true,diff --git a/public/components/layout/Stack.tsx b/public/components/layout/Stack.tsxindex be356c4ca..562a3feb9 100644--- a/public/components/layout/Stack.tsx+++ b/public/components/layout/Stack.tsx@@ -5,9 +5,9 @@ interface StackProps {className?: stringchildren: React.ReactNodeonClick?: () => void- center?: booleandivide?: booleanjustify?: "between" | "evenly" | "full" | "center"+ align?: "start" | "center" | "end"spacing?: 0 | 1 | 2 | 4 | 6 | 8}@@ -20,11 +20,13 @@ const Stack = (props: StackProps, dir: "x" | "y") => {"flex-y": dir === "y",[`flex--spacing-${spacing}`]: spacing > 0 && !props.divide,[`flex--divide-${spacing}`]: spacing > 0 && !!props.divide,- "flex-items-center": dir === "x" && props.center !== false,"justify-between": props.justify === "between","justify-evenly": props.justify === "evenly","justify-full": props.justify === "full","justify-center": props.justify === "center",+ "flex-items-start": props.align === "start",+ "flex-items-center": props.align === "center" && dir === "x",+ "items-end": props.align === "end",})return (diff --git a/public/pages/Home/components/ListPosts.tsx b/public/pages/Home/components/ListPosts.tsxindex cc02b1faf..3c0758428 100644--- a/public/pages/Home/components/ListPosts.tsx+++ b/public/pages/Home/components/ListPosts.tsx@@ -1,6 +1,6 @@import React from "react"import { Post, Tag, CurrentUser } from "@fider/models"-import { ShowTag, VoteCounter, Markdown, Icon, ResponseStatusLabel } from "@fider/components"+import { ShowTag, VoteCounter, Markdown, Icon, ResponseLozenge } from "@fider/components"import IconChatAlt2 from "@fider/assets/images/heroicons-chat-alt-2.svg"import { HStack, VStack } from "@fider/components/layout"@@ -12,7 +12,7 @@ interface ListPostsProps {const ListPostItem = (props: { post: Post; user?: CurrentUser; tags: Tag[] }) => {return (- <HStack center={true}>+ <HStack align="center"><div className="align-self-start"><VoteCounter post={props.post} /></div>@@ -28,7 +28,7 @@ const ListPostItem = (props: { post: Post; user?: CurrentUser; tags: Tag[] }) =>)}</HStack><Markdown className="text-gray-600" maxLength={300} text={props.post.description} style="plainText" />- <ResponseStatusLabel status={props.post.status} response={props.post.response} />+ <ResponseLozenge status={props.post.status} response={props.post.response} />{props.tags.length >= 1 && (<HStack className="flex-wrap">{props.tags.map((tag) => (@@ -51,7 +51,7 @@ export const ListPosts = (props: ListPostsProps) => {}return (- <VStack spacing={4} divide={true} center={true}>+ <VStack spacing={4} divide={true} align="center">{props.posts.map((post) => (<ListPostItem key={post.id} post={post} tags={props.tags.filter((tag) => post.tags.indexOf(tag.slug) >= 0)} />))}diff --git a/public/pages/ShowPost/ShowPost.page.tsx b/public/pages/ShowPost/ShowPost.page.tsxindex a345d7c12..6407ab931 100644--- a/public/pages/ShowPost/ShowPost.page.tsx+++ b/public/pages/ShowPost/ShowPost.page.tsx@@ -7,7 +7,7 @@ import { actions, clearUrlHash, Failure, Fider, notify, timeAgo } from "@fider/simport IconDotsHorizontal from "@fider/assets/images/heroicons-dots-horizontal.svg"import {- ResponseStatusLabel,+ ResponseLozenge,ResponseDetails,Button,UserName,@@ -192,7 +192,20 @@ export default class ShowPostPage extends React.Component<ShowPostPageProps, Sho<div className="p-show-post__header-col"><VStack spacing={8}><HStack justify="between">- <ResponseStatusLabel status={this.props.post.status} response={this.props.post.response} />+ <VStack align="start">+ <ResponseLozenge status={this.props.post.status} response={this.props.post.response} />+ <div className="flex-grow">+ {this.state.editMode ? (+ <Form error={this.state.error}>+ <Input field="title" maxLength={100} value={this.state.newTitle} onChange={this.setNewTitle} />+ </Form>+ ) : (+ <>+ <h1 className="text-large">{this.props.post.title}</h1>+ </>+ )}+ </div>+ </VStack>{!this.state.editMode && (<Dropdown position="left" renderHandle={<Icon sprite={IconDotsHorizontal} width="24" height="24" />}><Dropdown.ListItem onClick={this.onActionSelected("copy")}>@@ -220,23 +233,10 @@ export default class ShowPostPage extends React.Component<ShowPostPageProps, Sho</HStack><ResponseDetails status={this.props.post.status} response={this.props.post.response} />- <HStack justify="between">- <div className="flex-grow">- {this.state.editMode ? (- <Form error={this.state.error}>- <Input field="title" maxLength={100} value={this.state.newTitle} onChange={this.setNewTitle} />- </Form>- ) : (- <>- <h1 className="text-large">{this.props.post.title}</h1>- </>- )}- </div>- <DeletePostModal onModalClose={() => this.setShowDeleteModal(false)} showModal={this.state.showDeleteModal} post={this.props.post} />- {Fider.session.user.isCollaborator && (- <ResponseModal onCloseModal={() => this.setShowResponseModal(false)} showModal={this.state.showResponseModal} post={this.props.post} />- )}- </HStack>+ <DeletePostModal onModalClose={() => this.setShowDeleteModal(false)} showModal={this.state.showDeleteModal} post={this.props.post} />+ {Fider.session.user.isCollaborator && (+ <ResponseModal onCloseModal={() => this.setShowResponseModal(false)} showModal={this.state.showResponseModal} post={this.props.post} />+ )}{!this.state.editMode && (<HStack><Avatar user={this.props.post.user} />@@ -272,7 +272,7 @@ export default class ShowPostPage extends React.Component<ShowPostPageProps, Sho<VStack spacing={4}>{!this.state.editMode ? (- <HStack justify="between" center={false}>+ <HStack justify="between"><VoteSection post={this.props.post} votes={this.props.votes} /><FollowButton post={this.props.post} subscribed={this.props.subscribed} /></HStack>diff --git a/public/pages/ShowPost/components/CommentInput.tsx b/public/pages/ShowPost/components/CommentInput.tsxindex e3ffb3e19..d5e17f523 100644--- a/public/pages/ShowPost/components/CommentInput.tsx+++ b/public/pages/ShowPost/components/CommentInput.tsx@@ -55,7 +55,7 @@ export const CommentInput = (props: CommentInputProps) => {return (<><SignInModal isOpen={isSignInModalOpen} onClose={hideModal} />- <HStack spacing={2} center={false} className="c-comment-input">+ <HStack spacing={2} className="c-comment-input">{Fider.session.isAuthenticated && <Avatar user={Fider.session.user} />}<div className="flex-grow bg-gray-50 rounded-md p-2"><Form error={error}>diff --git a/public/pages/ShowPost/components/ShowComment.tsx b/public/pages/ShowPost/components/ShowComment.tsxindex c49f281d5..193d24458 100644--- a/public/pages/ShowPost/components/ShowComment.tsx+++ b/public/pages/ShowPost/components/ShowComment.tsx@@ -173,7 +173,7 @@ export const ShowComment = (props: ShowCommentProps) => {return (<div id={`comment-${comment.id}`}>- <HStack spacing={2} center={false} className="c-comment flex-items-baseline">+ <HStack spacing={2} className="c-comment flex-items-baseline">{modal()}<div className="pt-4"><Avatar user={comment.user} />diff --git a/public/pages/ShowPost/components/TagsPanel.tsx b/public/pages/ShowPost/components/TagsPanel.tsxindex cf6ef268e..8fbb3e098 100644--- a/public/pages/ShowPost/components/TagsPanel.tsx+++ b/public/pages/ShowPost/components/TagsPanel.tsx@@ -51,9 +51,9 @@ export const TagsPanel = (props: TagsPanelProps) => {}const tagsList = (- <HStack spacing={2} center={true}>+ <HStack spacing={2} align="center">{assignedTags.length > 0 && assignedTags.map((tag) => <ShowTag key={tag.id} tag={tag} link />)}- <HStack spacing={1} center={true} className="clickable" onClick={onSubtitleClick}>+ <HStack spacing={1} align="center" className="clickable" onClick={onSubtitleClick}><span><Trans id="label.edittags">Edit tags</Trans></span>@@ -85,7 +85,7 @@ export const TagsPanel = (props: TagsPanelProps) => {return (<VStack>- <HStack spacing={2} center={true} className="text-primary-base text-xs">+ <HStack spacing={2} align="center" className="text-primary-base text-xs">{!isEditing && tagsList}{isEditing && editTagsList}</HStack>