Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { TablerIcon } from "@feeblo/ui/icon-picker";
import { cn } from "@feeblo/ui/utils";
import { boardIconName } from "@feeblo/web-shared/icons/defaults";
import { eq, useLiveQuery } from "@tanstack/react-db";
import { Link, useLocation } from "@tanstack/react-router";

Expand Down Expand Up @@ -33,6 +35,7 @@ export function BoardListCard() {
{data?.map((board) => (
<BoardNavLink
href={boardPaths.board(board.slug)}
icon={board.icon}
key={board.id}
label={board.name}
/>
Expand All @@ -44,10 +47,12 @@ export function BoardListCard() {

export function BoardNavLink({
href,
icon,
label,
showActiveIndicator = false,
}: {
href: string;
icon?: string | null;
label: string;
showActiveIndicator?: boolean;
}) {
Expand All @@ -64,13 +69,23 @@ export function BoardNavLink({
)}
to={href}
>
<span
className={cn(
"size-1.5 shrink-0 rounded-full",
isActive ? "bg-primary" : "bg-muted-foreground/40",
showActiveIndicator ? "bg-primary" : ""
)}
/>
{icon === undefined ? (
<span
className={cn(
"size-1.5 shrink-0 rounded-full",
isActive ? "bg-primary" : "bg-muted-foreground/40",
showActiveIndicator ? "bg-primary" : ""
)}
/>
) : (
<TablerIcon
className={cn(
"size-4",
isActive ? "text-foreground" : "text-muted-foreground"
)}
name={boardIconName(icon)}
/>
)}
<span className="truncate">{label}</span>
</Link>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { TPostStatus } from "@feeblo/domain/post-status/schema";
import { usePostCollectionData } from "@feeblo/post-ui/post-page-context";
import { PostCard as SharedPostCard } from "@feeblo/post-ui/post/post-card";
import { UpvoteButton } from "@feeblo/post-ui/upvote-toggle";
Expand Down Expand Up @@ -56,7 +57,7 @@ function FeedbackPostCardBoardBadge({ children }: { children?: ReactNode }) {
const { board } = usePostCollectionData();

return (
<SharedPostCard.BoardBadge>
<SharedPostCard.BoardBadge icon={board.icon}>
{children ?? board.name}
</SharedPostCard.BoardBadge>
);
Expand Down Expand Up @@ -120,11 +121,15 @@ export const PostCard = {

// Convenience wrapper for feedback-page / board-page reuse
export function FeedbackCard({
label,
color,
icon,
label,
type,
}: {
label: string;
color?: string;
icon?: string | null;
label: string;
type?: TPostStatus["type"];
}) {
return (
<PostCard.Root>
Expand All @@ -136,7 +141,7 @@ export function FeedbackCard({
<PostCard.MobileMeta />
</PostCard.Body>
<PostCard.DesktopMeta>
<PostCard.Status color={color} label={label} />
<PostCard.Status color={color} icon={icon} label={label} type={type} />
<PostCard.BoardBadge />
<PostCard.Author />
</PostCard.DesktopMeta>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ function PublicRoadmapBoardContent() {
key={post.id}
onClick={() => openPost(post.slug)}
status={post.status}
statusIcon={post.statusIcon}
title={post.title}
updatedAt={post.updatedAt}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { TablerIcon } from "@feeblo/ui/icon-picker";
import {
Select,
SelectItem,
Expand All @@ -6,6 +7,7 @@ import {
SelectValue,
} from "@feeblo/ui/select";
import { cn } from "@feeblo/ui/utils";
import { boardIconName } from "@feeblo/web-shared/icons/defaults";

import { useHome } from "../home-context";

Expand All @@ -24,12 +26,32 @@ export function HomeBoardSelect({ className }: { className?: string }) {
value={selectedBoard}
>
<SelectTrigger className={cn("min-w-0", className)}>
<SelectValue />
<SelectValue>
{(value: string) => {
const item = boardItems.find(
(candidate) => candidate.value === value
);

return item ? (
<span className="flex items-center gap-2">
{item.icon === undefined ? null : (
<TablerIcon name={boardIconName(item.icon)} />
)}
{item.label}
</span>
) : null;
}}
</SelectValue>
</SelectTrigger>
<SelectPopup>
{boardItems.map((item) => (
<SelectItem key={item.value} value={item.value}>
{item.label}
<span className="flex items-center gap-2">
{item.icon === undefined ? null : (
<TablerIcon name={boardIconName(item.icon)} />
)}
{item.label}
</span>
</SelectItem>
))}
</SelectPopup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { PostStatusIcon } from "@feeblo/post-ui/post-status-icon";
import { Button } from "@feeblo/ui/button";
import {
Menu,
Expand Down Expand Up @@ -42,7 +43,12 @@ export function HomeStatusMenu({ className }: { className?: string }) {
>
{statusItems.map((item) => (
<MenuRadioItem closeOnClick key={item.value} value={item.value}>
{item.label}
<span className="flex items-center gap-2">
{item.statusType ? (
<PostStatusIcon icon={item.icon} type={item.statusType} />
) : null}
{item.label}
</span>
</MenuRadioItem>
))}
</MenuRadioGroup>
Expand Down
6 changes: 5 additions & 1 deletion apps/public-feature-board/src/features/home/home-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@ import type { HomePageSortOption } from "../../hooks/use-home-page-filters";

export type HomeFilterItem = {
count: number;
/** The board or status mark; absent on the "all" row. */
icon?: string | null;
label: string;
/** Present on status rows, absent on board rows and "all". */
statusType?: TPostStatus["type"];
value: string;
};

export type HomePost = {
board: TBoard;
post: TPostListItem;
status: Pick<TPostStatus, "color" | "label" | "type">;
status: Pick<TPostStatus, "color" | "icon" | "label" | "type">;
};

export type HomeFilters = {
Expand Down
4 changes: 4 additions & 0 deletions apps/public-feature-board/src/features/home/home-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ export function HomeProvider({ children }: { children: ReactNode }) {
type: status.type,
label: status.label,
color: status.color,
icon: status.icon,
},
createdAt: post.createdAt,
upvoteCount: coalesce(upvoteCounts.upvoteCount, 0),
Expand Down Expand Up @@ -272,7 +273,9 @@ export function HomeProvider({ children }: { children: ReactNode }) {
{ count: totalPosts, label: m.curly_many_badger(), value: "all" },
...statuses.map((status) => ({
count: countMap.get(status.id) ?? 0,
icon: status.icon,
label: status.label || formatPostStatus(status.type),
statusType: status.type,
value: status.id,
})),
];
Expand All @@ -298,6 +301,7 @@ export function HomeProvider({ children }: { children: ReactNode }) {
{ count: totalPosts, label: m.spry_male_nils(), value: "all" },
...boards.map((board) => ({
count: countMap.get(board.slug) ?? 0,
icon: board.icon,
label: board.name,
value: board.slug,
})),
Expand Down
2 changes: 2 additions & 0 deletions apps/public-feature-board/src/features/home/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ function HomeList() {
<PostCard.DesktopMeta>
<PostCard.Status
color={status.color ?? undefined}
icon={status.icon}
label={status.label || formatPostStatus(status.type)}
type={status.type}
/>
<PostCard.BoardBadge />
<PostCard.Author />
Expand Down
24 changes: 20 additions & 4 deletions apps/public-feature-board/src/pages/board-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ import {
EmptyHeader,
EmptyTitle,
} from "@feeblo/ui/empty";
import { TablerIcon } from "@feeblo/ui/icon-picker";
import {
isLiveQueryFailed,
isLiveQueryPending,
} from "@feeblo/web-shared/collections";
import { boardIconName } from "@feeblo/web-shared/icons/defaults";
import { and, eq, useLiveQuery } from "@tanstack/react-db";
import type { ReactNode } from "react";

Expand Down Expand Up @@ -41,10 +43,21 @@ function MainContent({ children }: { children: ReactNode }) {
);
}

function ListHeader({ count, title }: { count?: number; title: string }) {
function ListHeader({
count,
icon,
title,
}: {
count?: number;
icon?: string | null;
title: string;
}) {
return (
<div className="flex items-baseline justify-between px-1 pb-3">
<h2 className="text-xl leading-tight font-semibold tracking-tight">
<h2 className="flex items-center gap-2 text-xl leading-tight font-semibold tracking-tight">
{icon === undefined ? null : (
<TablerIcon className="size-5" name={boardIconName(icon)} />
)}
{title}
</h2>
{count !== undefined && (
Expand Down Expand Up @@ -134,6 +147,7 @@ export function BoardPage({ boardSlug }: { readonly boardSlug: string }) {
type: postStatus.type,
label: postStatus.label,
color: postStatus.color,
icon: postStatus.icon,
},
}));
},
Expand Down Expand Up @@ -192,7 +206,7 @@ export function BoardPage({ boardSlug }: { readonly boardSlug: string }) {
return (
<MainContent>
<div className="min-w-0">
<ListHeader count={0} title={board.name} />
<ListHeader count={0} icon={board.icon} title={board.name} />
<Empty className="border">
<EmptyHeader>
<EmptyTitle>{m.plane_strong_crow()}</EmptyTitle>
Expand All @@ -207,7 +221,7 @@ export function BoardPage({ boardSlug }: { readonly boardSlug: string }) {
return (
<MainContent>
<div className="min-w-0">
<ListHeader count={posts.length} title={board.name} />
<ListHeader count={posts.length} icon={board.icon} title={board.name} />
<div className="divide-border/40 border-border/60 w-full divide-y overflow-hidden rounded-lg border">
{posts.map(({ post, postStatus }) => (
<PostCollectionDataProvider
Expand All @@ -220,7 +234,9 @@ export function BoardPage({ boardSlug }: { readonly boardSlug: string }) {
<div className="[contain-intrinsic-size:auto_72px] [content-visibility:auto]">
<FeedbackCard
color={postStatus.color ?? undefined}
icon={postStatus.icon}
label={postStatus.label || formatPostStatus(postStatus.type)}
type={postStatus.type}
/>
</div>
</PostCollectionDataProvider>
Expand Down
8 changes: 7 additions & 1 deletion apps/web/src/dashboard/components/common/app-sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useAtomMount } from "@effect/atom-react";
import { TablerIcon } from "@feeblo/ui/icon-picker";
import {
Menu,
MenuItem,
Expand All @@ -21,6 +22,7 @@ import {
useSidebar,
} from "@feeblo/ui/sidebar";
import { SkeletonLoader, SkeletonWrapper } from "@feeblo/ui/skeleton-loader";
import { boardIconName } from "@feeblo/web-shared/icons/defaults";
import { FeatureFlagGuard } from "@feeblo/web-shared/use-feature-flag";
import {
anyPolicy,
Expand Down Expand Up @@ -283,6 +285,7 @@ function BoardList() {
<BoardItem
boardPublicId={`board-id-${index}`}
boardSlug={`board-slug-${index}`}
icon={null}
key={`board-skeleton-${index}`}
name="Loading"
/>
Expand All @@ -297,6 +300,7 @@ function BoardList() {
<BoardItem
boardPublicId={board.id}
boardSlug={board.slug}
icon={board.icon}
key={board.id}
name={board.name}
/>
Expand All @@ -308,10 +312,11 @@ function BoardList() {
interface BoardItemProp {
boardPublicId: string;
boardSlug: string;
icon: string | null;
name: string;
}

function BoardItem({ boardPublicId, name, boardSlug }: BoardItemProp) {
function BoardItem({ boardPublicId, icon, name, boardSlug }: BoardItemProp) {
const organizationId = useOrganizationId();

const pathname = useRouterState({
Expand All @@ -331,6 +336,7 @@ function BoardItem({ boardPublicId, name, boardSlug }: BoardItemProp) {
to="/$organizationId/board/$boardSlug"
{...props}
>
<TablerIcon name={boardIconName(icon)} />
<span>{name}</span>
</Link>
)}
Expand Down
Loading
Loading