Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

More tweaks to the UI

Matt Roberts8982f63ce1aa
diff --git a/public/assets/images/heroicons-trash.svg b/public/assets/images/heroicons-trash.svg
new file mode 100644
index 000000000..37a3374c3
--- /dev/null
+++ b/public/assets/images/heroicons-trash.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="m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0" />
+</svg>
diff --git a/public/pages/ShowPost/ShowPost.page.scss b/public/pages/ShowPost/ShowPost.page.scss
index d91672cdf..82131085d 100644
--- a/public/pages/ShowPost/ShowPost.page.scss
+++ b/public/pages/ShowPost/ShowPost.page.scss
@@ -56,22 +56,21 @@
}
&__vote-section {
- margin-top: spacing(6);
+ margin-top: spacing(10);
}
&__description-section {
margin-top: spacing(7);
}
-
- &__description {
+  ch &__description {
color: var(--colors-gray-800);
line-height: 1.6;
}
&__actions {
- border-top: 1px solid var(--colors-gray-200);
+ border-top: 5px solid var(--colors-blue-500);
padding-top: spacing(4);
- margin-top: spacing(6);
+ margin-top: spacing(8);
}
&__discussion-section {
diff --git a/public/pages/ShowPost/ShowPost.page.tsx b/public/pages/ShowPost/ShowPost.page.tsx
index 069a22a11..933351c97 100644
--- a/public/pages/ShowPost/ShowPost.page.tsx
+++ b/public/pages/ShowPost/ShowPost.page.tsx
@@ -32,9 +32,9 @@ 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 IconTrash from "@fider/assets/images/heroicons-trash.svg"
import { HStack, VStack } from "@fider/components/layout"
import { Trans } from "@lingui/react/macro"
-import { StayUpdatedCard } from "./components/StayUpdatedCard"
import { DeletePostModal } from "./components/DeletePostModal"
import { ResponseModal } from "./components/ResponseModal"
import { VotesPanel } from "./components/VotesPanel"
@@ -43,6 +43,7 @@ import { ActionButton } from "./components/ActionButton"
import { t } from "@lingui/macro"
import { useFider } from "@fider/hooks"
import { useAttachments } from "@fider/hooks/useAttachments"
+import { FollowButton } from "./components/FollowButton"
interface ShowPostPageProps {
post: Post
@@ -190,8 +191,6 @@ export default function ShowPostPage(props: ShowPostPageProps) {
<div className="p-show-post">
{/* Left Sidebar */}
<div className="p-show-post__action-col">
- <StayUpdatedCard post={props.post} subscribed={props.subscribed} />
-
<VotesPanel post={props.post} votes={props.votes} />
<PoweredByFider slot="show-post" className="mt-3" />
@@ -253,6 +252,12 @@ export default function ShowPostPage(props: ShowPostPageProps) {
</div>
)}
+ {props.tags.length >= 1 && (
+ <div className="pt-7">
+ <TagsPanel post={props.post} tags={props.tags} />
+ </div>
+ )}
+
{/* Vote Section */}
{!editMode && (
<div className="p-show-post__vote-section">
@@ -260,11 +265,6 @@ export default function ShowPostPage(props: ShowPostPageProps) {
</div>
)}
- {/* Tags inline */}
- <div className="pt-7">
- <TagsPanel post={props.post} tags={props.tags} />
- </div>
-
{/* Edit Mode Actions */}
{editMode && (
<HStack className="mt-6">
@@ -310,12 +310,14 @@ export default function ShowPostPage(props: ShowPostPageProps) {
)}
{canDeletePost() && (
- <ActionButton icon={IconX} onClick={onActionSelected("delete")} variant="danger">
+ <ActionButton icon={IconTrash} onClick={onActionSelected("delete")} variant="danger">
<Trans id="action.delete">Delete</Trans>
</ActionButton>
)}
<div className="flex-grow" />
+
+ <FollowButton post={props.post} subscribed={props.subscribed} />
</HStack>
</div>
)}
diff --git a/public/pages/ShowPost/components/ActionButton.tsx b/public/pages/ShowPost/components/ActionButton.tsx
index 1475b9123..a33b4518c 100644
--- a/public/pages/ShowPost/components/ActionButton.tsx
+++ b/public/pages/ShowPost/components/ActionButton.tsx
@@ -8,6 +8,7 @@ interface ActionButtonProps {
icon: SpriteSymbol | string
onClick: () => void
children: React.ReactNode
+ disabled?: boolean
variant?: "normal" | "danger"
}
@@ -16,7 +17,7 @@ export const ActionButton = (props: ActionButtonProps) => {
const className = `c-action-button ${variant === "danger" ? "c-action-button--danger" : ""}`
return (
- <button className={className} onClick={onClick}>
+ <button className={className} onClick={onClick} disabled={props.disabled}>
<HStack spacing={2} align="center">
<Icon sprite={icon} className="c-action-button__icon" />
<span className="c-action-button__text">{children}</span>
diff --git a/public/pages/ShowPost/components/FollowButton.tsx b/public/pages/ShowPost/components/FollowButton.tsx
index b596f666a..1bd3cf37f 100644
--- a/public/pages/ShowPost/components/FollowButton.tsx
+++ b/public/pages/ShowPost/components/FollowButton.tsx
@@ -1,12 +1,11 @@
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 { Trans } from "@lingui/react/macro"
import { Post } from "@fider/models"
+import { ActionButton } from "./ActionButton"
export interface NotificationsPanelProps {
post: Post
@@ -30,21 +29,13 @@ export const FollowButton = (props: NotificationsPanelProps) => {
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>
+ return subscribed ? (
+ <ActionButton icon={IconCheck} onClick={subscribeOrUnsubscribe} disabled={fider.isReadOnly}>
+ <Trans id="label.following">Following</Trans>
+ </ActionButton>
) : (
- <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>
+ <ActionButton icon={IconPlus} onClick={subscribeOrUnsubscribe} disabled={fider.isReadOnly}>
+ <Trans id="label.follow">Follow</Trans>
+ </ActionButton>
)
-
- return <VStack>{button}</VStack>
}
diff --git a/public/pages/ShowPost/components/StayUpdatedCard.tsx b/public/pages/ShowPost/components/StayUpdatedCard.tsx
deleted file mode 100644
index 809d0a773..000000000
--- a/public/pages/ShowPost/components/StayUpdatedCard.tsx
+++ /dev/null
@@ -1,60 +0,0 @@
-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/react/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="p-show-post__action-col__follow-button--following no-focus" onClick={subscribeOrUnsubscribe} disabled={fider.isReadOnly}>
- <Icon sprite={IconCheck} />{" "}
- <span>
- <Trans id="label.following">Following</Trans>
- </span>
- </Button>
- ) : (
- <Button className="p-show-post__action-col__follow-button--follow no-focus" onClick={subscribeOrUnsubscribe} disabled={fider.isReadOnly}>
- <Icon sprite={IconPlus} />
- <span>
- <Trans id="label.follow">Follow</Trans>
- </span>
- </Button>
- )
-
- return (
- <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 about updates to this idea</Trans>
- </p>
- {button}
- </VStack>
- )
-}
diff --git a/public/pages/ShowPost/components/VoteSection.tsx b/public/pages/ShowPost/components/VoteSection.tsx
index 480f1086b..65093d4e9 100644
--- a/public/pages/ShowPost/components/VoteSection.tsx
+++ b/public/pages/ShowPost/components/VoteSection.tsx
@@ -46,7 +46,7 @@ export const VoteSection = (props: VoteSectionProps) => {
<SignInModal isOpen={isSignInModalOpen} onClose={hideModal} />
<VStack spacing={4}>
<div className="align-self-start">
- <Button variant={hasVoted ? "primary" : "secondary"} onClick={voteOrUndo} disabled={isDisabled} style={{ minWidth: "180px" }}>
+ <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>