Open platform to collect and prioritize feedback
UI visual tweaks to the roadmap
Matt Roberts7c89c5b8840f
diff --git a/app/handlers/roadmap.go b/app/handlers/roadmap.goindex bfe1e0790..262edcf59 100644--- a/app/handlers/roadmap.go+++ b/app/handlers/roadmap.go@@ -20,9 +20,12 @@ func RoadmapPage() web.HandlerFunc {}if env.IsSingleHostMode() || c.Tenant().IsPro {- plannedPosts := &query.SearchPosts{View: "planned"}- startedPosts := &query.SearchPosts{View: "started"}- completedPosts := &query.SearchPosts{View: "completed"}+ // Keep in sync with ROADMAP_DEFAULT_LIMIT on the client; the "Show more"+ // link uses posts.length >= limit as its heuristic and needs both ends+ // to agree on the initial cap.+ plannedPosts := &query.SearchPosts{View: "planned", Limit: "10"}+ startedPosts := &query.SearchPosts{View: "started", Limit: "10"}+ completedPosts := &query.SearchPosts{View: "completed", Limit: "10"}getAllTags := &query.GetAllTags{}if err := bus.Dispatch(c, plannedPosts, startedPosts, completedPosts, getAllTags); err != nil {diff --git a/public/components/ShowPostResponse.tsx b/public/components/ShowPostResponse.tsxindex 9be547232..0481e16db 100644--- a/public/components/ShowPostResponse.tsx+++ b/public/components/ShowPostResponse.tsx@@ -122,7 +122,7 @@ export const ResponseLozenge = (props: PostResponseProps): JSX.Element | null =>return (<div>- <HStack align="start" className={`${color} ${bg} border ${border} rounded-full p-1 px-3`}>+ <HStack align="center" className={`${color} ${bg} border ${border} rounded-full p-1 px-3`}>{!props.size && <Icon sprite={icon} className={`h-5 c-status-col--${status.value}`} />}<span className={`c-status-col--${status.value} ${props.size === "small" ? "text-sm" : "text-semibold"}`}>{translatedStatus}</span></HStack>diff --git a/public/pages/Roadmap/Roadmap.page.scss b/public/pages/Roadmap/Roadmap.page.scssindex 18e0d4023..1499f2341 100644--- a/public/pages/Roadmap/Roadmap.page.scss+++ b/public/pages/Roadmap/Roadmap.page.scss@@ -29,6 +29,49 @@}}+.c-roadmap-post-link {+ display: block;+ text-decoration: none;+ color: inherit;+}++.c-roadmap-post {+ background-color: var(--colors-white);+ @include dark-mode {+ background-color: var(--colors-gray-200);+ }+ border-radius: get("border.radius.xlarge");+ padding: spacing(5) spacing(6);+ box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);+ transition: box-shadow 0.2s ease-in-out;++ .c-roadmap-post-link:hover & {+ box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);+ }++ &__title {+ font-size: get("font.size.base");+ font-weight: get("font.weight.bold");+ color: var(--colors-gray-900);+ line-height: 1.4;+ transition: color 0.2s ease-in-out;++ .c-roadmap-post-link:hover & {+ color: var(--colors-primary-base);+ }+ }++ &__votes {+ font-size: get("font.size.sm");+ color: var(--colors-gray-700);+ }++ &__completed {+ font-size: get("font.size.sm");+ color: var(--colors-gray-700);+ }+}+#p-roadmap-upsell,#p-roadmap-blank {padding-top: spacing(8);diff --git a/public/pages/Roadmap/Roadmap.page.tsx b/public/pages/Roadmap/Roadmap.page.tsxindex 910994591..580d9f651 100644--- a/public/pages/Roadmap/Roadmap.page.tsx+++ b/public/pages/Roadmap/Roadmap.page.tsx@@ -1,11 +1,10 @@import "./Roadmap.page.scss"-import "@fider/pages/Home/components/PostsContainer.scss"import IconArrowLeft from "@fider/assets/images/heroicons-arrowleft.svg"+import IconCheckCircle from "@fider/assets/images/heroicons-check-circle.svg"import React, { useState, useCallback } from "react"import { Post, Tag } from "@fider/models"-import { Header, Button, Icon, ResponseLozenge } from "@fider/components"-import { ListPosts } from "@fider/pages/Home/components/ListPosts"+import { Header, Button, Icon, ResponseLozenge, ShowTag, Moment } from "@fider/components"import { VStack, HStack } from "@fider/components/layout"import { useFider, usePostOverlay } from "@fider/hooks"import { actions } from "@fider/services"@@ -23,17 +22,100 @@ interface RoadmapColumnProps {status: stringposts: Post[]tags: Tag[]+ currentLimit: number+ onShowMore: () => voidonPostClick?: (postNumber: number, slug: string) => void}+// Must match the Limit sent by the server-side RoadmapPage handler. The "Show+// more" link uses posts.length >= currentLimit as its heuristic, so the SSR+// payload and the client's first render must agree on the initial cap.+const ROADMAP_DEFAULT_LIMIT = 10+const ROADMAP_LIMIT_STEP = 10++type RoadmapView = "planned" | "started" | "completed"++const RoadmapPost = (props: { post: Post; tags: Tag[]; status: string; onPostClick?: (postNumber: number, slug: string) => void }) => {+ const fider = useFider()+ const isModerationEnabled = fider.session.tenant.isModerationEnabled+ const isPending = isModerationEnabled && !props.post.isApproved+ const isCompleted = props.status === "completed"++ const handleClick = (e: React.MouseEvent<HTMLAnchorElement>) => {+ if (props.onPostClick) {+ e.preventDefault()+ props.onPostClick(props.post.number, props.post.slug)+ }+ }++ return (+ <a href={`/posts/${props.post.number}/${props.post.slug}`} className="c-roadmap-post-link" onClick={handleClick}>+ <VStack className="c-roadmap-post w-full" spacing={2}>+ <HStack spacing={2} align="start" className="w-full">+ <h3 className="c-roadmap-post__title text-break">{props.post.title}</h3>+ {isPending && (+ <span className="text-xs bg-yellow-100 text-yellow-800 px-2 py-1 rounded flex-shrink-0">+ <Trans id="post.pending">pending</Trans>+ </span>+ )}+ </HStack>+ {props.tags.length >= 1 && (+ <HStack spacing={0} className="gap-2 flex-wrap">+ {props.tags.map((tag) => (+ <ShowTag key={tag.id} tag={tag} />+ ))}+ </HStack>+ )}+ {isCompleted && props.post.response?.respondedAt ? (+ <HStack spacing={1} className="c-roadmap-post__completed flex-items-center">+ <Icon sprite={IconCheckCircle} className="h-4 w-4 text-green-600" />+ <Moment locale={fider.currentLocale} date={props.post.response.respondedAt} />+ </HStack>+ ) : (+ <span className="c-roadmap-post__votes">+ <span className="text-semibold">{props.post.votesCount}</span>{" "}+ {props.post.votesCount === 1 ? <Trans id="label.vote">Vote</Trans> : <Trans id="label.votes">Votes</Trans>}+ </span>+ )}+ </VStack>+ </a>+ )+}+const RoadmapColumn = (props: RoadmapColumnProps) => {+ // If we received at least as many posts as we asked for there may be more on+ // the server — same heuristic the Home feed uses (PostsContainer.getShowMoreLink).+ const hasMore = props.posts.length >= props.currentLimit+return (<div className="c-roadmap-column"><div className="c-roadmap-column__header"><ResponseLozenge status={props.status} response={null} /></div><div className="c-roadmap-column__body">- <ListPosts posts={props.posts} tags={props.tags} showStatus={false} emptyText="" maxVisible={20} onPostClick={props.onPostClick} />+ {props.posts.map((post) => (+ <RoadmapPost+ key={post.id}+ post={post}+ tags={props.tags.filter((tag) => post.tags.indexOf(tag.slug) >= 0)}+ status={props.status}+ onPostClick={props.onPostClick}+ />+ ))}+ {hasMore && (+ <div className="my-4 text-center">+ <a+ href="#"+ className="text-primary-base text-medium hover:underline"+ onClick={(e) => {+ e.preventDefault()+ props.onShowMore()+ }}+ >+ <Trans id="roadmap.column.showmore">Show more</Trans>+ </a>+ </div>+ )}</div></div>)@@ -43,18 +125,38 @@ const RoadmapBoard = (props: RoadmapPageProps) => {const [plannedPosts, setPlannedPosts] = useState<Post[]>(props.plannedPosts || [])const [startedPosts, setStartedPosts] = useState<Post[]>(props.startedPosts || [])const [completedPosts, setCompletedPosts] = useState<Post[]>(props.completedPosts || [])+ const [plannedLimit, setPlannedLimit] = useState(ROADMAP_DEFAULT_LIMIT)+ const [startedLimit, setStartedLimit] = useState(ROADMAP_DEFAULT_LIMIT)+ const [completedLimit, setCompletedLimit] = useState(ROADMAP_DEFAULT_LIMIT)const tags = props.tags || []const reloadPosts = useCallback(async () => {const [planned, started, completed] = await Promise.all([- actions.searchPosts({ view: "planned" }),- actions.searchPosts({ view: "started" }),- actions.searchPosts({ view: "completed" }),+ actions.searchPosts({ view: "planned", limit: plannedLimit }),+ actions.searchPosts({ view: "started", limit: startedLimit }),+ actions.searchPosts({ view: "completed", limit: completedLimit }),])if (planned.ok) setPlannedPosts(planned.data)if (started.ok) setStartedPosts(started.data)if (completed.ok) setCompletedPosts(completed.data)- }, [])+ }, [plannedLimit, startedLimit, completedLimit])++ const showMore = async (view: RoadmapView) => {+ const currentLimit = view === "planned" ? plannedLimit : view === "started" ? startedLimit : completedLimit+ const nextLimit = currentLimit + ROADMAP_LIMIT_STEP+ const result = await actions.searchPosts({ view, limit: nextLimit })+ if (!result.ok) return+ if (view === "planned") {+ setPlannedLimit(nextLimit)+ setPlannedPosts(result.data)+ } else if (view === "started") {+ setStartedLimit(nextLimit)+ setStartedPosts(result.data)+ } else {+ setCompletedLimit(nextLimit)+ setCompletedPosts(result.data)+ }+ }const { selectedPostId, handlePostClick, handleCloseOverlay, setIsPostDirty } = usePostOverlay({basePath: "/roadmap",@@ -72,9 +174,30 @@ const RoadmapBoard = (props: RoadmapPageProps) => {<div style={selectedPostId !== null ? { display: "none" } : undefined}><VStack spacing={4}><div className="c-roadmap-board">- <RoadmapColumn status="planned" posts={plannedPosts} tags={tags} onPostClick={handlePostClick} />- <RoadmapColumn status="started" posts={startedPosts} tags={tags} onPostClick={handlePostClick} />- <RoadmapColumn status="completed" posts={completedPosts} tags={tags} onPostClick={handlePostClick} />+ <RoadmapColumn+ status="planned"+ posts={plannedPosts}+ tags={tags}+ currentLimit={plannedLimit}+ onShowMore={() => showMore("planned")}+ onPostClick={handlePostClick}+ />+ <RoadmapColumn+ status="started"+ posts={startedPosts}+ tags={tags}+ currentLimit={startedLimit}+ onShowMore={() => showMore("started")}+ onPostClick={handlePostClick}+ />+ <RoadmapColumn+ status="completed"+ posts={completedPosts}+ tags={tags}+ currentLimit={completedLimit}+ onShowMore={() => showMore("completed")}+ onPostClick={handlePostClick}+ /></div></VStack></div>