diff --git a/public/fonts/README.md b/public/fonts/README.md new file mode 100644 index 0000000..317127f --- /dev/null +++ b/public/fonts/README.md @@ -0,0 +1,13 @@ +# Fonts + +Self-hosted Latin subsets (variable weight) used by the Shelf design. All three +are licensed under the SIL Open Font License 1.1 and were downloaded from +Google Fonts. + +| File | Family | Source | +| ----------------------------------- | --------------------------------- | ----------------------------------------- | +| `bricolage-grotesque-500-800.woff2` | Bricolage Grotesque (headings) | https://github.com/ateliertriay/bricolage | +| `mona-sans-400-700.woff2` | Mona Sans (text) | https://github.com/github/mona-sans | +| `geist-mono-400-600.woff2` | Geist Mono (handles, NSIDs, code) | https://github.com/vercel/geist-font | + +License text: https://openfontlicense.org diff --git a/public/fonts/bricolage-grotesque-500-800.woff2 b/public/fonts/bricolage-grotesque-500-800.woff2 new file mode 100644 index 0000000..86d4f45 Binary files /dev/null and b/public/fonts/bricolage-grotesque-500-800.woff2 differ diff --git a/public/fonts/geist-mono-400-600.woff2 b/public/fonts/geist-mono-400-600.woff2 new file mode 100644 index 0000000..cf24126 Binary files /dev/null and b/public/fonts/geist-mono-400-600.woff2 differ diff --git a/public/fonts/mona-sans-400-700.woff2 b/public/fonts/mona-sans-400-700.woff2 new file mode 100644 index 0000000..88ec89e Binary files /dev/null and b/public/fonts/mona-sans-400-700.woff2 differ diff --git a/src/components/AppCard.tsx b/src/components/AppCard.tsx index a3d7883..f6b7aca 100644 --- a/src/components/AppCard.tsx +++ b/src/components/AppCard.tsx @@ -63,7 +63,6 @@ const styles = stylex.create({ }, surface: { borderRadius: radius.lg, - cornerShape: "squircle", boxShadow: { default: shadow.sm, [stylex.when.ancestor(":hover")]: shadow.lg, diff --git a/src/components/AppListRow.tsx b/src/components/AppListRow.tsx index 06dc54b..d427adf 100644 --- a/src/components/AppListRow.tsx +++ b/src/components/AppListRow.tsx @@ -5,7 +5,6 @@ import { Link as RouterLink } from "@tanstack/react-router"; import { ChevronRight, Heart } from "lucide-react"; import { useId } from "react"; -import type { DirectoryListingCard } from "../integrations/tanstack-query/api-directory-listings.functions"; import type { BrowseListingCard } from "../lib/browse-listings"; import { Avatar } from "../design-system/avatar"; @@ -32,9 +31,8 @@ import { getListingLabels } from "../lib/listing-labels"; import { AppCardLabels, AppCardRating } from "./AppCard"; /** - * List rows for apps. Two variants share one look and one interaction: - * - RankedAppRow: compact, numbered (home "Trending"). - * - DetailedAppRow: labels, rating, favorites, last update (Browse). + * DetailedAppRow: labels, rating, favorites, last update (games list). Browse + * and home use `shelf/ListingRow` instead. * * Like AppCard, the whole row is a single link that never moves; the surface * inside it tints on hover and draws the keyboard focus ring. @@ -53,17 +51,12 @@ const styles = stylex.create({ // Rows sit flush against each other. This padding is the visual gap between // rows but still belongs to the link, so the pointer never falls into a dead // zone (and flips back to an arrow) while moving down the list. - rankedLink: { - paddingBottom: verticalSpace.xs, - paddingTop: verticalSpace.xs, - }, detailedLink: { paddingBottom: verticalSpace.sm, paddingTop: verticalSpace.sm, }, surface: { borderRadius: radius.md, - cornerShape: "squircle", backgroundColor: { default: uiColor.bg, [stylex.when.ancestor(":hover")]: uiColor.component1, @@ -92,24 +85,6 @@ const styles = stylex.create({ }, contentVisibility: "auto", }, - rankedBody: { - gap: gap.xl, - alignItems: "center", - display: "flex", - paddingBottom: verticalSpace["2xl"], - paddingLeft: horizontalSpace["4xl"], - paddingRight: horizontalSpace["2xl"], - paddingTop: verticalSpace["2xl"], - }, - rank: { - minWidth: "1.25rem", - }, - rankedText: { - flexBasis: "0%", - flexGrow: 1, - flexShrink: 1, - minWidth: 0, - }, detailedBody: { gridTemplateAreas: { default: '"avatar main chevron" "avatar stats chevron"', @@ -226,57 +201,6 @@ function RowChevron() { return ; } -/** - * Compact numbered row. Render inside an `
    `: the list supplies the - * position to screen readers, so the visible number is decorative. - */ -export function RankedAppRow({ - listing, - rank, -}: { - listing: DirectoryListingCard; - rank: number; -}) { - const nameId = useId(); - const taglineId = useId(); - - return ( - -
    - - {rank} - - - - - {listing.name} - - - {listing.tagline} - - - -
    -
    - ); -} - const relativeTimeFormat = new Intl.RelativeTimeFormat("en", { numeric: "auto", }); diff --git a/src/components/AppTagCard.tsx b/src/components/AppTagCard.tsx index 2de1006..03266bc 100644 --- a/src/components/AppTagCard.tsx +++ b/src/components/AppTagCard.tsx @@ -47,7 +47,6 @@ import { getAppTagAccent, getAppTagEmoji } from "../lib/app-tag-visuals"; const styles = stylex.create({ cardLink: { borderRadius: radius["2xl"], - cornerShape: "squircle", textDecoration: "none", boxShadow: shadow.md, display: "flex", @@ -64,7 +63,6 @@ const styles = stylex.create({ borderRadius: radius.xl, borderStyle: "solid", borderWidth: 1, - cornerShape: "squircle", gap: gap["8xl"], color: "white", display: "flex", @@ -98,7 +96,6 @@ const styles = stylex.create({ "::before": { inset: 0, borderRadius: radius.xl, - cornerShape: "squircle", boxShadow: shadow["xl"], content: "''", opacity: 0, diff --git a/src/components/AppTagHero.tsx b/src/components/AppTagHero.tsx index e3e10c9..36dddc1 100644 --- a/src/components/AppTagHero.tsx +++ b/src/components/AppTagHero.tsx @@ -62,7 +62,6 @@ const styles = stylex.create({ }, imageFrame: { borderRadius: radius["2xl"], - cornerShape: "squircle", overflow: "hidden", maxHeight: "240px", width: "100%", @@ -85,7 +84,6 @@ const styles = stylex.create({ borderRadius: radius["2xl"], borderStyle: "solid", borderWidth: 1, - cornerShape: "squircle", overflow: "hidden", display: "flex", flexDirection: "column", diff --git a/src/components/AtStoreLogo.tsx b/src/components/AtStoreLogo.tsx index 16061aa..c7d23ee 100644 --- a/src/components/AtStoreLogo.tsx +++ b/src/components/AtStoreLogo.tsx @@ -1,66 +1,51 @@ /** - * AT Store wordmark. © Atproto Community Collective — see README (design vs - * Apache-licensed source code). + * at-store wordmark (Shelf): "at·store" in the heavy display face with an + * accent-blue interpunct. © Atproto Community Collective — see README + * (design vs Apache-licensed source code). */ import * as stylex from "@stylexjs/stylex"; -import { blue } from "../design-system/theme/colors/blue.stylex"; +import { uiColor } from "../design-system/theme/color.stylex"; +import { breakpoints } from "../design-system/theme/media-queries.stylex"; import { fontFamily, - fontSize, fontWeight, } from "../design-system/theme/typography.stylex"; const styles = stylex.create({ root: { alignItems: "center", - columnGap: "0.3em", + color: uiColor.text2, display: "inline-flex", + fontFamily: fontFamily.title, + fontWeight: fontWeight.extrabold, + letterSpacing: "-0.025em", + lineHeight: 1, + whiteSpace: "nowrap", }, - atNavbar: { - color: blue.solid1, - fontWeight: "bold", + navbar: { + fontSize: { default: 20, [breakpoints.md]: 21 }, }, - atHero: { - color: blue.solid1, + footer: { + fontSize: 19, }, hero: { - flexDirection: "column", - fontFamily: fontFamily.sans, - fontSize: fontSize["6xl"], - fontWeight: fontWeight.black, + fontSize: 28, }, - mark: { - blockSize: "1.2em", - flexShrink: 0, - inlineSize: "1.2em", + dot: { + marginInline: 1, + color: "light-dark(#1c4ef5, #7b97ff)", }, }); type AtStoreLogoProps = { - variant?: "navbar" | "hero"; + variant?: "navbar" | "footer" | "hero"; }; export function AtStoreLogo({ variant = "navbar" }: AtStoreLogoProps) { - if (variant === "hero") { - return ( - - - - AT - Store - - - ); - } - return ( - - - - AT - Store - + + at·store ); } diff --git a/src/components/BlueskyMentionCard.tsx b/src/components/BlueskyMentionCard.tsx index 729a90d..e0b9c50 100644 --- a/src/components/BlueskyMentionCard.tsx +++ b/src/components/BlueskyMentionCard.tsx @@ -2,104 +2,166 @@ import type { ReactNode } from "react"; import { RichText } from "@atproto/api"; import * as stylex from "@stylexjs/stylex"; -import { Link as RouterLink, createLink } from "@tanstack/react-router"; -import { IconButton } from "#/design-system/icon-button"; -import { ExternalLink } from "lucide-react"; +import { Link as RouterLink } from "@tanstack/react-router"; +import { ArrowUpRight } from "lucide-react"; import type { DirectoryListingMention } from "../integrations/tanstack-query/api-directory-listings.functions"; import { Avatar } from "../design-system/avatar"; -import { - Card, - CardBody, - CardHeader, - CardHeaderAction, -} from "../design-system/card"; -import { Flex } from "../design-system/flex"; +import { animationDuration } from "../design-system/theme/animations.stylex"; import { uiColor } from "../design-system/theme/color.stylex"; -import { radius } from "../design-system/theme/radius.stylex"; -import { verticalSpace } from "../design-system/theme/semantic-spacing.stylex"; -import { Body, SmallBody } from "../design-system/typography"; -import { Text } from "../design-system/typography/text"; +import { breakpoints } from "../design-system/theme/media-queries.stylex"; +import { fontWeight } from "../design-system/theme/typography.stylex"; import { getInitials } from "../lib/get-initials"; - -const IconButtonLink = createLink(IconButton); +import { formatReviewDate } from "./shelf/listing/listing-helpers"; const styles = stylex.create({ - mentionCard: { - borderColor: uiColor.component2, - borderBottomLeftRadius: { - default: 0, - ":last-child": radius.lg, - }, - borderBottomRightRadius: { - default: 0, - ":last-child": radius.lg, - }, - borderTopLeftRadius: { - default: 0, - ":first-child": radius.lg, - }, - borderTopRightRadius: { - default: 0, - ":first-child": radius.lg, - }, - borderTopWidth: { - default: 0, - ":first-child": 1, - }, + row: { + paddingBlock: 20, + borderTopColor: uiColor.border1, + borderTopStyle: "solid", + borderTopWidth: 1, }, - mentionProfileLink: { - borderRadius: radius.md, - textDecoration: "none", - color: "inherit", - flexBasis: "0%", - flexGrow: "1", - flexShrink: "1", - outlineOffset: 2, + who: { + alignItems: "center", + columnGap: 12, + display: "flex", minWidth: 0, }, - mentionAuthorRow: { - minWidth: 0, + avatarLink: { + borderRadius: "50%", + display: "block", + flexShrink: 0, + }, + avatar: { + borderRadius: "50%", + height: 38, + width: 38, }, - mentionAuthorTextColumn: { + whoText: { + flexBasis: 0, + flexGrow: 1, minWidth: 0, }, - mentionPostText: { - paddingTop: verticalSpace["md"], + name: { + overflow: "hidden", + color: uiColor.text2, + display: "block", + fontSize: 15, + fontWeight: fontWeight.semibold, + textDecorationLine: { default: "none", ":hover": "underline" }, + textOverflow: "ellipsis", + textUnderlineOffset: 3, + whiteSpace: "nowrap", + }, + sub: { + overflow: "hidden", + color: uiColor.text1, + fontSize: 13, + textOverflow: "ellipsis", + whiteSpace: "nowrap", + marginTop: 1, + }, + open: { + borderRadius: 999, + alignItems: "center", + backgroundColor: { + default: "transparent", + ":hover": uiColor.component1, + }, + color: { + default: uiColor.text1, + ":hover": uiColor.text2, + }, + display: "inline-flex", + flexShrink: 0, + justifyContent: "center", + outlineColor: uiColor.text2, + outlineOffset: 2, + outlineStyle: { default: "none", ":focus-visible": "solid" }, + outlineWidth: 2, + transitionDuration: animationDuration.default, + transitionProperty: "background-color, color", + height: 32, + width: 32, }, postText: { + color: uiColor.text2, + fontSize: { default: 15, [breakpoints.md]: 16 }, + lineHeight: 1.6, + overflowWrap: "anywhere", whiteSpace: "pre-wrap", + marginBottom: 0, + marginTop: 12, }, facetLink: { - textDecoration: "underline", - color: uiColor.solid1, + color: uiColor.text2, + textDecorationColor: uiColor.border3, + textDecorationLine: "underline", + textUnderlineOffset: 3, }, embedCard: { - borderColor: uiColor.component2, - borderRadius: radius.md, + borderColor: { + default: uiColor.border1, + ":hover": uiColor.border2, + }, + borderRadius: 14, borderStyle: "solid", borderWidth: 1, overflow: "hidden", textDecoration: "none", + backgroundColor: uiColor.bg, color: "inherit", - maxWidth: 400, + display: "block", + transitionDuration: animationDuration.default, + transitionProperty: "border-color", + marginTop: 12, + maxWidth: 420, }, embedThumb: { - aspectRatio: 16 / 9, display: "block", objectFit: "cover", - height: 120, + height: 140, width: "100%", }, embedBody: { - padding: verticalSpace["3xl"], + paddingBlock: 12, + paddingInline: 14, + display: "flex", + flexDirection: "column", + rowGap: 4, + }, + embedTitle: { + color: uiColor.text2, + fontSize: 14, + fontWeight: fontWeight.semibold, + }, + embedDescription: { + overflow: "hidden", + WebkitBoxOrient: "vertical", + WebkitLineClamp: 2, + color: uiColor.text1, + display: "-webkit-box", + fontSize: 13, + lineHeight: 1.45, }, embedUrl: { - overflowWrap: "anywhere", + overflow: "hidden", + color: uiColor.text1, + fontSize: 12, + textOverflow: "ellipsis", + whiteSpace: "nowrap", }, }); +function hostOf(uri: string) { + try { + return new URL(uri).hostname.replace(/^www\./, ""); + } catch { + return uri; + } +} + function mentionAuthorLabel(mention: DirectoryListingMention): string { return ( mention.authorDisplayName?.trim() || @@ -115,7 +177,7 @@ function renderPostText(mention: DirectoryListingMention) { if (!text) return null; const facets = mention.postFacets; if (!facets || facets.length === 0) { - return {text}; + return

    {text}

    ; } const richText = new RichText({ @@ -172,9 +234,10 @@ function renderPostText(mention: DirectoryListingMention) { parts.push({segment.text}); } - return {parts}; + return

    {parts}

    ; } +/** A Bluesky post that mentions a listing, as a row between hairlines. */ export function BlueskyMentionCard({ mention, }: { @@ -184,94 +247,84 @@ export function BlueskyMentionCard({ const authorLabel = mentionAuthorLabel(mention); const handlePlain = mention.authorHandle?.replace(/^@/, "").trim() ?? ""; const displayName = mention.authorDisplayName?.trim(); - const showHandleSubline = - Boolean(displayName) && + const showHandle = handlePlain.length > 0 && (displayName ?? "").toLowerCase() !== handlePlain.toLowerCase(); const embed = mention.postEmbed; + return ( - - +
    +
    - - - - - {authorLabel} - - {showHandleSubline ? ( - - @{handlePlain} - - ) : null} - - + - - {href ? ( - - - - ) : null} - - - - - {renderPostText(mention)} - {embed ? ( - - {embed.thumbUrl ? ( - - ) : null} - - {embed.title ? ( - - {embed.title} - - ) : null} - {embed.description ? ( - {embed.description} - ) : null} - - {embed.uri} - - - +
    + + {authorLabel} + +
    + {showHandle ? `@${handlePlain} · ` : ""} + +
    +
    + {href ? ( + + + + ) : null} +
    + {renderPostText(mention)} + {embed ? ( + + {embed.thumbUrl ? ( + ) : null} - - {Intl.DateTimeFormat("en-US", { - dateStyle: "short", - timeStyle: "short", - }).format(new Date(mention.postCreatedAt))} - - - - + + {embed.title ? ( + {embed.title} + ) : null} + {embed.description ? ( + + {embed.description} + + ) : null} + {hostOf(embed.uri)} + + + ) : null} +
    ); } diff --git a/src/components/BrowseFilterPanel.tsx b/src/components/BrowseFilterPanel.tsx index 73abced..a308265 100644 --- a/src/components/BrowseFilterPanel.tsx +++ b/src/components/BrowseFilterPanel.tsx @@ -1,4 +1,7 @@ +import type { ReactNode } from "react"; + import * as stylex from "@stylexjs/stylex"; +import { Check } from "lucide-react"; import { useState } from "react"; import type { @@ -8,53 +11,171 @@ import type { BrowseFilters, } from "../lib/browse-listings"; -import { Avatar } from "../design-system/avatar"; -import { Button } from "../design-system/button"; -import { Checkbox } from "../design-system/checkbox"; -import { - Disclosure, - DisclosurePanel, - DisclosureTitle, -} from "../design-system/disclosure"; -import { Flex } from "../design-system/flex"; import { SearchField } from "../design-system/search-field"; +import { animationDuration } from "../design-system/theme/animations.stylex"; import { uiColor } from "../design-system/theme/color.stylex"; import { - gap, - horizontalSpace, -} from "../design-system/theme/semantic-spacing.stylex"; -import { fontSize } from "../design-system/theme/typography.stylex"; -import { SmallBody } from "../design-system/typography"; -import { getAppTagEmoji } from "../lib/app-tag-visuals"; -import { getInitials } from "../lib/get-initials"; + fontFamily, + fontWeight, +} from "../design-system/theme/typography.stylex"; +import { ListingIcon } from "./shelf/ListingIcon"; const COLLAPSED_OPTION_COUNT = 8; +const COLLAPSED_DATA_COUNT = 6; const COLLAPSED_ECOSYSTEM_COUNT = 3; +const ACCENT = "light-dark(#1c4ef5, #7b97ff)"; + const styles = stylex.create({ - optionLabel: { - alignItems: "center", - columnGap: gap["md"], + panel: { + display: "flex", + flexDirection: "column", + }, + group: { + borderTopColor: { + default: uiColor.border1, + ":first-child": "transparent", + }, + borderTopStyle: "solid", + borderTopWidth: { default: 1, ":first-child": 0 }, + paddingBottom: 20, + paddingTop: { default: 18, ":first-child": 4 }, + }, + title: { + alignItems: "baseline", + color: uiColor.text2, + columnGap: 8, display: "flex", + fontSize: 13, + fontWeight: fontWeight.semibold, + rowGap: 8, + marginBottom: 10, + marginTop: 0, + }, + selected: { + color: ACCENT, + fontSize: 12, + fontWeight: fontWeight.medium, }, - optionCount: { + hint: { color: uiColor.text1, - fontSize: fontSize["xs"], - fontVariantNumeric: "tabular-nums", + fontSize: 12, + lineHeight: 1.45, + marginBottom: 10, + marginTop: -4, + }, + find: { + marginBottom: 8, + }, + option: { + borderRadius: 8, + marginInline: -8, + paddingBlock: 6, + paddingInline: 8, + alignItems: "center", + backgroundColor: { + default: "transparent", + ":hover": uiColor.component1, + }, + color: uiColor.text2, + columnGap: 10, + cursor: "pointer", + display: "flex", + fontSize: 14, + position: "relative", + rowGap: 10, + transitionDuration: animationDuration.fast, + transitionProperty: "background-color", + }, + optionDisabled: { + backgroundColor: { default: "transparent", ":hover": "transparent" }, + cursor: "default", + opacity: 0.45, + }, + // Visually hidden; the label row draws the box and the focus ring. + input: { + margin: 0, + overflow: "hidden", + clip: "rect(0 0 0 0)", + clipPath: "inset(50%)", + position: "absolute", + whiteSpace: "nowrap", + height: 1, + width: 1, + }, + optionSelected: { + fontWeight: fontWeight.medium, }, childOption: { - paddingLeft: horizontalSpace["4xl"], + paddingLeft: 22, + }, + box: { + borderColor: uiColor.border2, + borderRadius: 5, + borderStyle: "solid", + borderWidth: 1.5, + placeItems: "center", + color: uiColor.bg, + display: "grid", + flexShrink: 0, + outlineColor: uiColor.text2, + outlineOffset: 2, + outlineStyle: { + default: "none", + [stylex.when.siblingBefore(":focus-visible")]: "solid", + }, + outlineWidth: 2, + transitionDuration: animationDuration.fast, + transitionProperty: "background-color, border-color", + height: 16, + width: 16, }, - emoji: { - fontSize: fontSize["sm"], - lineHeight: 1, + boxChecked: { + borderColor: uiColor.text2, + backgroundColor: uiColor.text2, }, - ecosystemIcon: { - height: "1.25rem", - width: "1.25rem", + label: { + overflow: "hidden", + flexGrow: 1, + textOverflow: "ellipsis", + whiteSpace: "nowrap", + minWidth: 0, }, - facetHint: { + detail: { color: uiColor.text1, + fontFamily: fontFamily.mono, + fontSize: 12, + fontWeight: fontWeight.normal, + marginLeft: 6, + }, + count: { + color: uiColor.text1, + fontSize: 12, + fontVariantNumeric: "tabular-nums", + fontWeight: fontWeight.normal, + }, + showAll: { + padding: 0, + borderWidth: 0, + backgroundColor: "transparent", + color: { + default: uiColor.text1, + ":hover": uiColor.text2, + }, + cursor: "pointer", + fontFamily: "inherit", + fontSize: 13, + outlineColor: uiColor.text2, + outlineOffset: 2, + outlineStyle: { default: "none", ":focus-visible": "solid" }, + outlineWidth: 2, + textDecorationColor: { + default: uiColor.border2, + ":hover": "currentColor", + }, + textDecorationLine: "underline", + textUnderlineOffset: 3, + marginTop: 6, }, }); @@ -64,6 +185,7 @@ interface BrowseFilterPanelProps { onToggle: (facet: BrowseFacet, value: string) => void; } +/** The Browse filter column (and mobile drawer): checkbox rows with live counts. */ export function BrowseFilterPanel({ facets, filters, @@ -84,7 +206,7 @@ export function BrowseFilterPanel({ }; return ( - +
    ( - - {getAppTagEmoji(option.label.toLowerCase())} - - )} + collapsedCount={COLLAPSED_OPTION_COUNT} /> - {facets.data.length > 0 ? ( - - ) : null} + {facets.minRating.map((option) => ( isSelected("categories", value)} onToggle={(value) => onToggle("categories", value)} /> - +
    ); } @@ -188,19 +304,17 @@ function CategoryFacetSection({ return ( {visible.map((option) => ( - +
    onToggle(option.id)} icon={ option.iconUrl === undefined ? undefined : ( - ) } @@ -216,108 +330,100 @@ function CategoryFacetSection({ style={styles.childOption} /> ))} - +
    ))} {ecosystems.length > COLLAPSED_ECOSYSTEM_COUNT ? ( -
    - -
    + setShowAll((value) => !value)}> + {showAll + ? "Show fewer ecosystems" + : `Show all ${ecosystems.length} ecosystems`} + ) : null}
    ); } -/** Collapsed by default unless it has a selection; pass `defaultExpanded` to override. */ function FacetSection({ title, selectedCount, - defaultExpanded = selectedCount > 0, hint, children, }: { title: string; selectedCount: number; - defaultExpanded?: boolean; hint?: string; - children: React.ReactNode; + children: ReactNode; }) { return ( - - - {selectedCount > 0 ? `${title} (${selectedCount})` : title} - - - - {hint ? {hint} : null} - {children} - - - +
    +

    + {title} + {selectedCount > 0 ? ( + + {`${selectedCount} selected`} + + ) : null} +

    + {hint ?

    {hint}

    : null} + {children} +
    ); } -/** Long facets (tags, data) get an inline filter box and a "show all" toggle. */ +/** + * Long facets (tags, data) show the top few; "Show all" reveals the rest with + * an inline filter box. Selected values always stay visible at the top. + */ function SearchableFacetSection({ title, hint, facet, options, selectedCount, - defaultExpanded, + collapsedCount, + showDetail = false, isSelected, onToggle, - renderIcon, }: { title: string; hint?: string; - defaultExpanded?: boolean; facet: BrowseFacet; options: Array; selectedCount: number; + collapsedCount: number; + /** Show the option id beside its label (data producers: `app.bsky`). */ + showDetail?: boolean; isSelected: (facet: BrowseFacet, value: string) => boolean; onToggle: (facet: BrowseFacet, value: string) => void; - renderIcon?: (option: BrowseFacetOption) => React.ReactNode; }) { const [query, setQuery] = useState(""); const [showAll, setShowAll] = useState(false); - const normalizedQuery = query.trim().toLowerCase(); + const normalizedQuery = showAll ? query.trim().toLowerCase() : ""; const available = options.filter( (option) => option.count > 0 || isSelected(facet, option.id), ); const matching = normalizedQuery - ? available.filter((option) => - option.label.toLowerCase().includes(normalizedQuery), + ? available.filter( + (option) => + option.label.toLowerCase().includes(normalizedQuery) || + option.id.toLowerCase().includes(normalizedQuery), ) : available; const selectedFirst = matching.toSorted( (a, b) => Number(isSelected(facet, b.id)) - Number(isSelected(facet, a.id)), ); - const visible = - showAll || normalizedQuery - ? selectedFirst - : selectedFirst.slice(0, COLLAPSED_OPTION_COUNT); + const visible = showAll + ? selectedFirst + : selectedFirst.slice(0, collapsedCount); if (available.length === 0) { return null; } return ( - - {available.length > COLLAPSED_OPTION_COUNT ? ( + + {showAll && available.length > collapsedCount ? ( ) : null} {visible.map((option) => ( onToggle(facet, option.id)} - icon={renderIcon?.(option)} /> ))} - {!normalizedQuery && available.length > COLLAPSED_OPTION_COUNT ? ( -
    - -
    + {available.length > collapsedCount ? ( + { + setShowAll((value) => !value); + setQuery(""); + }} + > + {showAll ? "Show fewer" : `Show all ${available.length}`} + ) : null}
    ); } +function ShowAllButton({ + onPress, + children, +}: { + onPress: () => void; + children: ReactNode; +}) { + return ( +
    + +
    + ); +} + function FacetOption({ option, + detail, isSelected, onToggle, icon, style, }: { option: BrowseFacetOption; + detail?: string | null; isSelected: boolean; onToggle: () => void; - icon?: React.ReactNode; + icon?: ReactNode; style?: stylex.StyleXStyles; }) { + const isDisabled = option.count === 0 && !isSelected; return ( - - - {icon} - {option.label} - {option.count} + + + {isSelected ? : null} + + {icon} + + {option.label} + {detail ? {detail} : null} - + {option.count} + ); } diff --git a/src/components/DirectoryListingReviewCard.tsx b/src/components/DirectoryListingReviewCard.tsx index 51fe991..49ca6d4 100644 --- a/src/components/DirectoryListingReviewCard.tsx +++ b/src/components/DirectoryListingReviewCard.tsx @@ -3,11 +3,10 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import { Link as TanstackLink, createLink } from "@tanstack/react-router"; import { ChevronDown, - ChevronUp, MessageCircle, - MoreVertical, + MoreHorizontal, Pencil, - Share2, + Share, Trash2, } from "lucide-react"; import { useState } from "react"; @@ -33,192 +32,276 @@ import { } from "../design-system/alert-dialog"; import { Avatar } from "../design-system/avatar"; import { Button } from "../design-system/button"; -import { - Card, - CardBody, - CardHeader, - CardHeaderAction, -} from "../design-system/card"; -import { Flex } from "../design-system/flex"; import { Form } from "../design-system/form"; import { IconButton } from "../design-system/icon-button"; import { Menu, MenuItem } from "../design-system/menu"; import { StarRating } from "../design-system/star-rating"; import { TextArea } from "../design-system/text-area"; +import { animationDuration } from "../design-system/theme/animations.stylex"; import { uiColor } from "../design-system/theme/color.stylex"; -import { radius } from "../design-system/theme/radius.stylex"; -import { - gap, - horizontalSpace, - size, - verticalSpace, -} from "../design-system/theme/semantic-spacing.stylex"; -import { shadow } from "../design-system/theme/shadow.stylex"; -import { fontSize } from "../design-system/theme/typography.stylex"; -import { Text } from "../design-system/typography/text"; +import { breakpoints } from "../design-system/theme/media-queries.stylex"; +import { fontWeight } from "../design-system/theme/typography.stylex"; import { directoryListingApi } from "../integrations/tanstack-query/api-directory-listings.functions"; import { blueskyReviewShareIntentHref } from "../lib/bluesky-review-share"; import { getDirectoryListingSlug } from "../lib/directory-listing-slugs"; import { getInitials } from "../lib/get-initials"; import { RestrictedMarkdownContent } from "./restricted-markdown-content"; +import { formatReviewDate } from "./shelf/listing/listing-helpers"; +import { ListingIcon } from "./shelf/ListingIcon"; const IconButtonLink = createLink(IconButton); +const fullDate = new Intl.DateTimeFormat("en-US", { + dateStyle: "medium", + timeStyle: "short", +}); + +function formatFullDate(iso: string) { + const time = Date.parse(iso); + return Number.isNaN(time) ? "" : fullDate.format(time); +} + const styles = stylex.create({ - repliesDisclosure: { - paddingTop: gap["xl"], + /** Default: a flat row between hairlines, for review lists. */ + row: { + paddingBlock: 22, + borderTopColor: uiColor.border1, + borderTopStyle: "solid", + borderTopWidth: 1, + scrollMarginTop: 96, }, - reviewedListingCardBody: { - paddingBottom: verticalSpace["xl"], - paddingTop: verticalSpace["xl"], + /** With `reviewedListing`: a standalone card (profile grids). */ + card: { + padding: 20, + borderColor: uiColor.border1, + borderRadius: 18, + borderStyle: "solid", + borderWidth: 1, + backgroundColor: uiColor.bg, + minWidth: 0, + scrollMarginTop: 96, }, - reviewCard: { - boxShadow: shadow.sm, - height: "100%", + forLink: { + textDecoration: "none", + alignItems: "center", + color: "inherit", + columnGap: 12, + display: "flex", + outlineColor: uiColor.text2, + outlineOffset: 2, + outlineStyle: { default: "none", ":focus-visible": "solid" }, + outlineWidth: 2, + borderBottomColor: uiColor.border1, + borderBottomStyle: "solid", + borderBottomWidth: 1, + marginBottom: 14, + minWidth: 0, + paddingBottom: 14, }, - reviewCardBody: { - gap: gap["5xl"], - height: "100%", + forText: { + display: "flex", + flexDirection: "column", + fontSize: 14, + minWidth: 0, }, - reviewHeader: { + forName: { + color: { + default: uiColor.text2, + ":hover": uiColor.text1, + }, + fontWeight: fontWeight.semibold, + }, + forTagline: { + overflow: "hidden", + color: uiColor.text1, + fontSize: 13, + textOverflow: "ellipsis", + whiteSpace: "nowrap", + }, + who: { alignItems: "center", + columnGap: 12, + display: "flex", + minWidth: 0, }, - reviewAuthor: { - flexBasis: "0%", - flexGrow: "1", - flexShrink: "1", + whoText: { + flexBasis: 0, + flexGrow: 1, minWidth: 0, }, - reviewMeta: { - color: uiColor.text1, + avatar: { + borderRadius: "50%", + flexShrink: 0, + height: 38, + width: 38, }, - reviewQuoteParagraph: { - fontSize: fontSize["lg"], + avatarSmall: { + borderRadius: "50%", + flexShrink: 0, + height: 28, + width: 28, }, - ratingActions: { - gap: gap.sm, - alignItems: "center", + avatarLink: { + borderRadius: "50%", + display: "block", flexShrink: 0, + outlineColor: uiColor.text2, + outlineOffset: 2, + outlineStyle: { default: "none", ":focus-visible": "solid" }, + outlineWidth: 2, }, - /** Inert trigger so `AlertDialog` can be opened only via `isOpen` (e.g. from the menu). */ - dialogTriggerPlaceholder: { - margin: -1, - padding: 0, - borderWidth: 0, + name: { overflow: "hidden", - clip: "rect(0, 0, 0, 0)", - position: "absolute", + textDecoration: "none", + color: uiColor.text2, + display: "block", + fontSize: 15, + fontWeight: fontWeight.semibold, + textDecorationLine: { default: "none", ":hover": "underline" }, + textOverflow: "ellipsis", + textUnderlineOffset: 3, whiteSpace: "nowrap", - height: 1, - width: 1, }, - profileLink: { - borderRadius: radius.md, - textDecoration: "none", - color: "inherit", - flexBasis: "0%", - flexGrow: "1", - flexShrink: "1", - outlineOffset: 2, - minWidth: 0, + sub: { + overflow: "hidden", + color: uiColor.text1, + fontSize: 13, + textOverflow: "ellipsis", + whiteSpace: "nowrap", + marginTop: 1, }, - authorLinkRow: { - gap: gap["xl"], + right: { alignItems: "center", - flexBasis: "0%", - flexGrow: "1", - flexShrink: "1", - minWidth: 0, + columnGap: 2, + display: "flex", + flexShrink: 0, + marginLeft: "auto", }, - reviewSubjectLink: { - textDecoration: "none", - color: "inherit", - flexBasis: "0%", - flexGrow: "1", - flexShrink: "1", - minWidth: 0, + stars: { + marginRight: 6, }, - reviewSubjectMedia: { - gap: gap["2xl"], - alignItems: "center", - flexBasis: "0%", - flexGrow: "1", - flexShrink: "1", - minWidth: 0, + ghostIcon: { + color: uiColor.text1, }, - listingTagline: { - overflow: "hidden", - WebkitBoxOrient: "vertical", - WebkitLineClamp: 2, - display: "-webkit-box", + text: { + marginTop: 12, }, - replySection: { - gap: gap.md, - borderTopColor: uiColor.component3, - borderTopStyle: "solid", - borderTopWidth: 1, - paddingTop: verticalSpace.lg, + paragraph: { + color: uiColor.text2, + fontSize: { default: 15, [breakpoints.md]: 16 }, + lineHeight: 1.6, + whiteSpace: "pre-wrap", }, - repliesToggleRow: { - borderRadius: radius.md, + thread: { + display: "flex", + flexDirection: "column", + rowGap: 12, + marginTop: 12, + }, + repliesToggle: { + borderRadius: 999, borderWidth: 0, - cornerShape: "squircle", - gap: gap["2xl"], + paddingBlock: 5, + paddingInline: 12, alignItems: "center", - backgroundColor: "transparent", - color: { - default: uiColor.text1, - ":is([data-hovered])": uiColor.text2, + alignSelf: "flex-start", + backgroundColor: { + default: uiColor.component1, + ":is([data-hovered])": uiColor.component2, }, + color: uiColor.text2, + columnGap: 6, cursor: "pointer", + display: "inline-flex", + fontSize: 13, + outlineColor: uiColor.text2, + outlineOffset: 2, + outlineStyle: { + default: "none", + ":is([data-focus-visible])": "solid", + }, + outlineWidth: 2, + transitionDuration: animationDuration.default, + transitionProperty: "background-color", + }, + chevron: { + transform: { + default: null, + ":is([data-expanded] *)": "rotate(180deg)", + }, + transitionDuration: animationDuration.default, + transitionProperty: "transform", + }, + repliesPanel: { display: "flex", - justifyContent: "space-between", - height: size["3xl"], - paddingBottom: verticalSpace.sm, - paddingTop: verticalSpace.sm, - width: "100%", + flexDirection: "column", + rowGap: 12, + paddingTop: 12, }, - repliesToggleLeading: { - gap: gap["2xl"], + rail: { + display: "flex", + flexDirection: "column", + rowGap: 16, + borderLeftColor: uiColor.border1, + borderLeftStyle: "solid", + borderLeftWidth: 2, + marginLeft: 6, + paddingLeft: 16, + }, + reply: { + display: "flex", + flexDirection: "column", + rowGap: 8, + scrollMarginTop: 96, + }, + replyHeader: { alignItems: "center", - flexShrink: 1, + columnGap: 10, + display: "flex", minWidth: 0, }, - repliesIconWrap: { - flexShrink: 0, + replyText: { + paddingLeft: 38, }, - threadRail: { - borderLeftColor: uiColor.border1, - borderLeftStyle: "solid", - borderLeftWidth: 1, - marginLeft: horizontalSpace.sm, - paddingLeft: horizontalSpace["2xl"], + replyParagraph: { + color: uiColor.text2, + fontSize: 15, + lineHeight: 1.55, + whiteSpace: "pre-wrap", }, - replyBubble: { - borderColor: uiColor.component3, - borderRadius: radius.md, - borderStyle: "solid", - borderWidth: 1, - gap: gap["4xl"], - backgroundColor: uiColor.bgSubtle, + replyEdit: { display: "flex", flexDirection: "column", - paddingBottom: verticalSpace["4xl"], - paddingLeft: horizontalSpace["3xl"], - paddingRight: horizontalSpace["3xl"], - paddingTop: verticalSpace["2xl"], + rowGap: 8, + paddingLeft: 38, + }, + replyEditActions: { + columnGap: 8, + display: "flex", }, - replyBubbleHeaderRow: { - gap: gap["2xl"], - alignItems: "flex-start", - justifyContent: "space-between", - width: "100%", + composer: { + display: "flex", + flexDirection: "column", + rowGap: 6, }, - replyBodyParagraph: { - fontSize: fontSize.sm, + composerButton: { + marginTop: 4, }, - replyComposerButton: { - marginTop: verticalSpace["sm"], + muted: { + color: uiColor.text1, + fontSize: 13, + }, + /** Inert trigger so `AlertDialog` can be opened only via `isOpen` (e.g. from the menu). */ + dialogTriggerPlaceholder: { + margin: -1, + padding: 0, + borderWidth: 0, + overflow: "hidden", + clip: "rect(0, 0, 0, 0)", + position: "absolute", + whiteSpace: "nowrap", + height: 1, + width: 1, }, }); @@ -229,7 +312,7 @@ export type DirectoryListingReviewCardProps = { /** When set and equal to `review.authorDid`, shows the overflow menu for edit/delete. */ viewerDid?: string | null; onEditReview?: () => void; - /** Forwarded to the outer `Card` for layout contexts (e.g. grids). */ + /** Forwarded to the outer element for layout contexts (e.g. grids). */ style?: stylex.StyleXStyles; /** When true (default), avatar and name link to the reviewer profile. */ linkAuthorProfile?: boolean; @@ -392,52 +475,14 @@ function ReviewConversationSection({ }); const replies = repliesQuery.data ?? []; - const showComposerControls = showReplyComposer; - - const authorRowForReply = (reply: DirectoryListingReviewReply) => { - const label = authorLabelForReply(reply); - const handleSubtitle = replyHandleLabel(reply.authorHandle); - - const nameBlock = ( - - - - - {label} - - {handleSubtitle ? ( - - {handleSubtitle} - - ) : null} - - - ); - - return linkAuthorProfile ? ( - - {nameBlock} - - ) : ( - nameBlock - ); - }; const isReplyAuthor = (did: string) => viewerDid != null && viewerDid !== "" && viewerDid.trim() === did.trim(); const replyHeadingLabel = - review.replyCount === 1 ? "1 Reply" : `${review.replyCount} Replies`; + review.replyCount === 1 ? "1 reply" : `${review.replyCount} replies`; - const composer = showComposerControls ? ( + const composer = showReplyComposer ? (
    { e.preventDefault(); @@ -447,7 +492,7 @@ function ReviewConversationSection({ createReply.mutate(); }} > - +