Open platform to collect and prioritize feedback
Move post actions into a 3-dot menu at the top of the post
Matt Roberts847ed51e98ec
diff --git a/locale/ar/client.json b/locale/ar/client.jsonindex c29dc36b4..dac3f13d6 100644--- a/locale/ar/client.json+++ b/locale/ar/client.json@@ -9,6 +9,7 @@"action.delete.block": "حذف وحظر","action.edit": "تعديل","action.markallasread": "تمييز الكل كمقروءة",+ "action.more": "","action.ok": "حسناً","action.postcomment": "بريد","action.postsfeed": "تغذية المنشورات",diff --git a/locale/de/client.json b/locale/de/client.jsonindex d43bc6157..76cd24a84 100644--- a/locale/de/client.json+++ b/locale/de/client.json@@ -9,6 +9,7 @@"action.delete.block": "Löschen & Blockieren","action.edit": "Bearbeiten","action.markallasread": "Alle als gelesen markieren",+ "action.more": "","action.ok": "OK","action.postcomment": "Senden","action.postsfeed": "Beiträge-Feed",diff --git a/locale/el/client.json b/locale/el/client.jsonindex 854428ed1..8a980c43b 100644--- a/locale/el/client.json+++ b/locale/el/client.json@@ -9,6 +9,7 @@"action.delete.block": "Διαγραφή & Αποκλεισμός","action.edit": "Επεξεργασία","action.markallasread": "Σήμανση όλων ως αναγνωσμένων",+ "action.more": "","action.ok": "ΟΚ","action.postcomment": "Θέση","action.postsfeed": "Ροή αναρτήσεων",diff --git a/locale/en/client.json b/locale/en/client.jsonindex 7d1a20b95..d735b2472 100644--- a/locale/en/client.json+++ b/locale/en/client.json@@ -9,6 +9,7 @@"action.delete.block": "Delete & Block","action.edit": "Edit","action.markallasread": "Mark All as Read",+ "action.more": "More actions","action.ok": "OK","action.postcomment": "Post","action.postsfeed": "Posts Feed",diff --git a/locale/es-ES/client.json b/locale/es-ES/client.jsonindex 452fd9095..62911c2b1 100644--- a/locale/es-ES/client.json+++ b/locale/es-ES/client.json@@ -9,6 +9,7 @@"action.delete.block": "Eliminar y bloquear","action.edit": "Editar","action.markallasread": "Marcar Todo como Leído",+ "action.more": "","action.ok": "Aceptar","action.postcomment": "Correo","action.postsfeed": "Feed de publicaciones",diff --git a/locale/fa/client.json b/locale/fa/client.jsonindex 5ee4bacea..5a4de2571 100644--- a/locale/fa/client.json+++ b/locale/fa/client.json@@ -9,6 +9,7 @@"action.delete.block": "حذف و مسدود کردن","action.edit": "ویرایش","action.markallasread": "علامتگذاری همه بهعنوان خواندهشده",+ "action.more": "","action.ok": "باشه","action.postcomment": "پست","action.postsfeed": "فید پستها",diff --git a/locale/fr/client.json b/locale/fr/client.jsonindex a18cb6a20..ad6583c93 100644--- a/locale/fr/client.json+++ b/locale/fr/client.json@@ -9,6 +9,7 @@"action.delete.block": "Supprimer et bloquer","action.edit": "Modifier","action.markallasread": "Tout marquer comme lu",+ "action.more": "","action.ok": "D'ACCORD","action.postcomment": "Poste","action.postsfeed": "Flux de publications",diff --git a/locale/it/client.json b/locale/it/client.jsonindex 61bb46586..edb5d5e5e 100644--- a/locale/it/client.json+++ b/locale/it/client.json@@ -9,6 +9,7 @@"action.delete.block": "Elimina e blocca","action.edit": "Modifica","action.markallasread": "Segna tutto come letto",+ "action.more": "","action.ok": "OK","action.postcomment": "Inviare","action.postsfeed": "Feed dei post",diff --git a/locale/ja/client.json b/locale/ja/client.jsonindex 6c1fb5857..efa6f972c 100644--- a/locale/ja/client.json+++ b/locale/ja/client.json@@ -9,6 +9,7 @@"action.delete.block": "削除&ブロック","action.edit": "編集","action.markallasread": "すべて既読にする",+ "action.more": "","action.ok": "わかりました","action.postcomment": "役職","action.postsfeed": "投稿フィード",diff --git a/locale/nl/client.json b/locale/nl/client.jsonindex fbcde04db..9dfa04eb5 100644--- a/locale/nl/client.json+++ b/locale/nl/client.json@@ -9,6 +9,7 @@"action.delete.block": "Verwijderen en blokkeren","action.edit": "Bewerken","action.markallasread": "Markeer alles als gelezen",+ "action.more": "","action.ok": "OK","action.postcomment": "Na","action.postsfeed": "Berichtenfeed",diff --git a/locale/pl/client.json b/locale/pl/client.jsonindex f22e04959..d63565e60 100644--- a/locale/pl/client.json+++ b/locale/pl/client.json@@ -9,6 +9,7 @@"action.delete.block": "Usuń i zablokuj","action.edit": "Edytuj","action.markallasread": "Oznacz wszystkie jako przeczytane",+ "action.more": "","action.ok": "OK","action.postcomment": "Opublikuj","action.postsfeed": "Kanał postów",diff --git a/locale/pt-BR/client.json b/locale/pt-BR/client.jsonindex 82631ef08..094e100db 100644--- a/locale/pt-BR/client.json+++ b/locale/pt-BR/client.json@@ -9,6 +9,7 @@"action.delete.block": "Excluir e bloquear","action.edit": "Editar","action.markallasread": "Marcar todas como lidas",+ "action.more": "","action.ok": "OK","action.postcomment": "Publicar","action.postsfeed": "Feed de postagens",diff --git a/locale/ru/client.json b/locale/ru/client.jsonindex 8800ded1c..46d573825 100644--- a/locale/ru/client.json+++ b/locale/ru/client.json@@ -9,6 +9,7 @@"action.delete.block": "Удалить и заблокировать","action.edit": "Изменить","action.markallasread": "Отметить всё как прочитанное",+ "action.more": "","action.ok": "ХОРОШО","action.postcomment": "Почта","action.postsfeed": "Лента сообщений",diff --git a/locale/sk/client.json b/locale/sk/client.jsonindex 2306ed2ab..5554b4428 100644--- a/locale/sk/client.json+++ b/locale/sk/client.json@@ -9,6 +9,7 @@"action.delete.block": "Odstrániť a zablokovať","action.edit": "Upraviť","action.markallasread": "Označiť všetko ako prečítané",+ "action.more": "","action.ok": "V poriadku","action.postcomment": "Príspevok","action.postsfeed": "Kanál príspevkov",diff --git a/locale/sv-SE/client.json b/locale/sv-SE/client.jsonindex 9ff1553a5..9a9e28274 100644--- a/locale/sv-SE/client.json+++ b/locale/sv-SE/client.json@@ -9,6 +9,7 @@"action.delete.block": "Ta bort och blockera","action.edit": "Ändra","action.markallasread": "Markera alla som lästa",+ "action.more": "","action.ok": "OK","action.postcomment": "Posta","action.postsfeed": "Inläggsflöde",diff --git a/locale/tr/client.json b/locale/tr/client.jsonindex 2e4a5ad12..747c6523e 100644--- a/locale/tr/client.json+++ b/locale/tr/client.json@@ -9,6 +9,7 @@"action.delete.block": "Sil ve Engelle","action.edit": "Düzenle","action.markallasread": "Tümünü Okundu olarak işaretle",+ "action.more": "","action.ok": "Tamam","action.postcomment": "Postalamak","action.postsfeed": "Gönderi Beslemesi",diff --git a/locale/zh-CN/client.json b/locale/zh-CN/client.jsonindex 3370ef097..50e249ce6 100644--- a/locale/zh-CN/client.json+++ b/locale/zh-CN/client.json@@ -9,6 +9,7 @@"action.delete.block": "删除和屏蔽","action.edit": "编辑","action.markallasread": "将全部标记为已读",+ "action.more": "","action.ok": "确定","action.postcomment": "邮政","action.postsfeed": "帖子提要",diff --git a/locale/zh-TW/client.json b/locale/zh-TW/client.jsonindex 1a09fe14b..cd1fa37c4 100644--- a/locale/zh-TW/client.json+++ b/locale/zh-TW/client.json@@ -9,6 +9,7 @@"action.delete.block": "刪除並封鎖","action.edit": "編輯","action.markallasread": "全部標為已讀",+ "action.more": "","action.ok": "確定","action.postcomment": "發表","action.postsfeed": "文章訂閱",diff --git a/public/components/PostDetails/PostDetails.scss b/public/components/PostDetails/PostDetails.scssindex 38f522626..1e5d5c37f 100644--- a/public/components/PostDetails/PostDetails.scss+++ b/public/components/PostDetails/PostDetails.scss@@ -67,13 +67,6 @@border-top: 5px solid var(--colors-blue-500);padding-top: spacing(4);margin-top: spacing(8);-- // Remove flex-grow on mobile so Following button doesn't get pushed to the right- @include media("sm") {- .flex-grow {- display: none;- }- }}&__discussion-section {diff --git a/public/components/PostDetails/PostDetails.tsx b/public/components/PostDetails/PostDetails.tsxindex 78d12bc4e..e35a85dbf 100644--- a/public/components/PostDetails/PostDetails.tsx+++ b/public/components/PostDetails/PostDetails.tsx@@ -9,8 +9,25 @@ 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, Avatar, PoweredByFider, RSSModal, ResponseLozenge } from "@fider/components"+import IconDotsHorizontal from "@fider/assets/images/heroicons-dots-horizontal.svg"+import IconPlus from "@fider/assets/images/heroicons-plus.svg"+import IconCheck from "@fider/assets/images/heroicons-check.svg"++import {+ ResponseDetails,+ Button,+ UserName,+ Moment,+ Markdown,+ Input,+ Form,+ Icon,+ Avatar,+ PoweredByFider,+ RSSModal,+ ResponseLozenge,+ Dropdown,+} from "@fider/components"import { CommentInput } from "@fider/pages/ShowPost/components/CommentInput"import { ShowComment } from "@fider/pages/ShowPost/components/ShowComment"import { VoteSection } from "@fider/pages/ShowPost/components/VoteSection"@@ -29,7 +46,6 @@ import { ActionButton } from "@fider/pages/ShowPost/components/ActionButton"import { t } from "@lingui/macro"import { useFider } from "@fider/hooks"import { useAttachments } from "@fider/hooks/useAttachments"-import { FollowButton } from "@fider/pages/ShowPost/components/FollowButton"interface PostDetailsProps {postNumber: number@@ -290,6 +306,15 @@ export const PostDetails: React.FC<PostDetailsProps> = (props) => {}}+ const toggleSubscription = async () => {+ if (!post) return+ const action = subscribed ? actions.unsubscribe : actions.subscribe+ const response = await action(post.number)+ if (response.ok) {+ setSubscribed(!subscribed)+ }+ }+const hideRSSModal = () => setIsRSSModalOpen(false)if (loading || !post) {@@ -302,6 +327,35 @@ export const PostDetails: React.FC<PostDetailsProps> = (props) => {)}+ const menuItems = [+ Fider.session.isAuthenticated && canEditPost(Fider.session.user, post) && (+ <Dropdown.ListItem key="edit" icon={IconPencil} onClick={onActionSelected("edit")}>+ <Trans id="action.edit">Edit</Trans>+ </Dropdown.ListItem>+ ),+ Fider.session.isAuthenticated && Fider.session.user.isCollaborator && (+ <Dropdown.ListItem key="status" icon={IconChat} onClick={onActionSelected("status")}>+ <Trans id="action.respond">Update Status</Trans>+ </Dropdown.ListItem>+ ),+ Fider.session.tenant.isFeedEnabled && (+ <Dropdown.ListItem key="feed" icon={IconRSS} onClick={onActionSelected("feed")}>+ <Trans id="action.commentsfeed">Comment Feed</Trans>+ </Dropdown.ListItem>+ ),+ Fider.session.isAuthenticated && !Fider.isReadOnly && (+ <Dropdown.ListItem key="follow" icon={subscribed ? IconCheck : IconPlus} onClick={toggleSubscription}>+ {subscribed ? <Trans id="label.following">Following</Trans> : <Trans id="label.follow">Follow</Trans>}+ </Dropdown.ListItem>+ ),+ canDeletePost() && [+ <Dropdown.Divider key="divider" />,+ <Dropdown.ListItem key="delete" icon={IconTrash} onClick={onActionSelected("delete")}>+ <Trans id="action.delete">Delete</Trans>+ </Dropdown.ListItem>,+ ],+ ].filter(Boolean)+return (<div className="p-show-post">{/* Left Sidebar - hidden on mobile, shown on desktop */}@@ -322,7 +376,19 @@ export const PostDetails: React.FC<PostDetailsProps> = (props) => {<Input field="title" maxLength={100} value={newTitle} onChange={setNewTitle} /></Form>) : (- <h1 className="p-show-post__title">{post.title}</h1>+ <HStack justify="between" align="start">+ <h1 className="p-show-post__title">{post.title}</h1>+ {menuItems.length > 0 && (+ <Dropdown+ position="left"+ variant="primary"+ ariaLabel={i18n._({ id: "action.more", message: "More actions" })}+ renderHandle={<Icon sprite={IconDotsHorizontal} width="24" height="24" />}+ >+ {menuItems}+ </Dropdown>+ )}+ </HStack>)}{/* Posted by info with status */}@@ -429,39 +495,9 @@ export const PostDetails: React.FC<PostDetailsProps> = (props) => {{/* Bottom Action Bar */}{!editMode && (<div className="p-show-post__actions">- <HStack spacing={0} align="center" className="flex-wrap gap-2">- <ActionButton icon={IconDuplicate} onClick={onActionSelected("copy")}>- <Trans id="action.copylink">Copy link</Trans>- </ActionButton>-- {Fider.session.isAuthenticated && canEditPost(Fider.session.user, 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">Update Status</Trans>- </ActionButton>- )}-- {Fider.session.tenant.isFeedEnabled && (- <ActionButton icon={IconRSS} onClick={onActionSelected("feed")}>- <Trans id="action.commentsfeed">Comment Feed</Trans>- </ActionButton>- )}-- {canDeletePost() && (- <ActionButton icon={IconTrash} onClick={onActionSelected("delete")} variant="danger">- <Trans id="action.delete">Delete</Trans>- </ActionButton>- )}-- <div className="flex-grow" />-- <FollowButton post={post} subscribed={subscribed} />- </HStack>+ <ActionButton icon={IconDuplicate} onClick={onActionSelected("copy")}>+ <Trans id="action.copylink">Copy link</Trans>+ </ActionButton></div>)}</div>diff --git a/public/components/common/Dropdown.scss b/public/components/common/Dropdown.scssindex 4548a9608..9e7d8e387 100644--- a/public/components/common/Dropdown.scss+++ b/public/components/common/Dropdown.scss@@ -37,6 +37,25 @@max-width: sizing(180);}+ &--primary {+ background-color: var(--colors-primary-base);+ border-color: var(--colors-primary-base);+ color: var(--colors-white);++ .c-dropdown__listitem {+ padding: spacing(2) spacing(3);++ &:hover {+ background-color: var(--colors-primary-dark);+ }+ }++ .c-dropdown__divider {+ background-color: currentColor;+ opacity: 0.3;+ }+ }+&--fullscreen-small {@include media("sm") {position: fixed;diff --git a/public/components/common/Dropdown.tsx b/public/components/common/Dropdown.tsxindex 10cd86d37..aeef72dcb 100644--- a/public/components/common/Dropdown.tsx+++ b/public/components/common/Dropdown.tsx@@ -51,6 +51,8 @@ interface DropdownProps {children: React.ReactNodewide?: booleanfullsceenSm?: boolean+ variant?: "primary"+ ariaLabel?: string}interface DropdownContextFuncs {@@ -101,12 +103,13 @@ export const Dropdown = (props: DropdownProps) => {"c-dropdown__list shadow-lg": true,"c-dropdown__list--fullscreen-small": props.fullsceenSm,[`c-dropdown__list--${position}`]: position === "left",+ "c-dropdown__list--primary": props.variant === "primary",})return (<DropdownContext.Provider value={{ close }}><div ref={node} className="c-dropdown">- <button type="button" className="c-dropdown__handle" onClick={toggleIsOpen}>+ <button type="button" className="c-dropdown__handle" onClick={toggleIsOpen} aria-label={props.ariaLabel}>{props.renderHandle}</button>{isOpen && <div className={listClassName}>{props.children}</div>}diff --git a/public/pages/ShowPost/ShowPost.page.scss b/public/pages/ShowPost/ShowPost.page.scssindex eef5501df..d15a75198 100644--- a/public/pages/ShowPost/ShowPost.page.scss+++ b/public/pages/ShowPost/ShowPost.page.scss@@ -75,13 +75,6 @@border-top: 5px solid var(--colors-blue-500);padding-top: spacing(4);margin-top: spacing(8);-- // Remove flex-grow on mobile so Following button doesn't get pushed to the right- @include media("sm") {- .flex-grow {- display: none;- }- }}&__discussion-section {diff --git a/public/pages/ShowPost/components/FollowButton.tsx b/public/pages/ShowPost/components/FollowButton.tsxdeleted file mode 100644index 1bd3cf37f..000000000--- a/public/pages/ShowPost/components/FollowButton.tsx+++ /dev/null@@ -1,41 +0,0 @@-import React, { useState } from "react"-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 { Trans } from "@lingui/react/macro"-import { Post } from "@fider/models"-import { ActionButton } from "./ActionButton"--export interface NotificationsPanelProps {- post: Post- subscribed: boolean-}--export const FollowButton = (props: NotificationsPanelProps) => {- 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- }-- return subscribed ? (- <ActionButton icon={IconCheck} onClick={subscribeOrUnsubscribe} disabled={fider.isReadOnly}>- <Trans id="label.following">Following</Trans>- </ActionButton>- ) : (- <ActionButton icon={IconPlus} onClick={subscribeOrUnsubscribe} disabled={fider.isReadOnly}>- <Trans id="label.follow">Follow</Trans>- </ActionButton>- )-}