From 8567996e1d80ef4167ff7b9d54a9feb4a1d84cb3 Mon Sep 17 00:00:00 2001 From: Andrew Lisowski Date: Sat, 5 Dec 2026 12:54:02 -0800 Subject: [PATCH] Add a team section to listings and a Work showcase on profiles Listing owners can credit the people behind a listing (developers, designers, anyone) with a free-form role. Team is a new optional `team` field on fyi.atstore.listing.detail, mirrored to a `team` jsonb column (GIN-indexed) and resolved to profiles in the page snapshot. - Listing form: Team editor with handle autocomplete and role suggestions; handles resolve to DIDs on save - Listing page: compact Team row in the sidebar linking to profiles - Profile: "Work" grid first, listing products the account owns or is credited on, with its role and teammate avatars - getListing XRPC returns team; Tap ingest reads it from records Co-Authored-By: Claude Opus 5.5 --- drizzle/0046_store_listing_team.sql | 3 + drizzle/meta/_journal.json | 7 + .../fyi/atstore/directory/getListing.json | 16 ++ lexicons/fyi/atstore/listing/detail.json | 26 ++ src/components/product-listing-form.tsx | 193 +++++++++++++- .../shelf/account/ProfileWorkCard.tsx | 236 ++++++++++++++++++ .../shelf/listing/ListingSidebar.tsx | 6 + .../shelf/listing/ListingTeamRow.tsx | 90 +++++++ src/components/user-handle-autocomplete.tsx | 3 + src/db/schema.ts | 17 +- src/design-system/autocomplete/index.tsx | 4 + .../api-directory-listings.functions.ts | 159 +++++++++++- src/lexicons/generated/bundle.ts | 50 ++++ src/lib/atproto/listing-record.ts | 51 ++++ src/lib/atproto/listing-team.test.ts | 85 +++++++ src/lib/atproto/tap-listing-sync.ts | 25 ++ src/lib/listing-page-snapshot.types.ts | 11 + ...layout._admin-layout.admin.add-listing.tsx | 1 + ...t._admin-layout.admin.managed-listings.tsx | 2 + ...header-layout.products.$productId.edit.tsx | 2 + ...eader-layout.products.$productId.index.tsx | 1 + src/routes/_header-layout.products.create.tsx | 1 + src/routes/_header-layout.profile.$actor.tsx | 45 ++-- .../atstore-xrpc-handler.server.ts | 16 +- 24 files changed, 1009 insertions(+), 41 deletions(-) create mode 100644 drizzle/0046_store_listing_team.sql create mode 100644 src/components/shelf/account/ProfileWorkCard.tsx create mode 100644 src/components/shelf/listing/ListingTeamRow.tsx create mode 100644 src/lib/atproto/listing-team.test.ts diff --git a/drizzle/0046_store_listing_team.sql b/drizzle/0046_store_listing_team.sql new file mode 100644 index 0000000..fa4bb2e --- /dev/null +++ b/drizzle/0046_store_listing_team.sql @@ -0,0 +1,3 @@ +ALTER TABLE "store_listings" ADD COLUMN IF NOT EXISTS "team" jsonb DEFAULT '[]'::jsonb NOT NULL; +--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "store_listings_team_idx" ON "store_listings" USING gin ("team" jsonb_path_ops); diff --git a/drizzle/meta/_journal.json b/drizzle/meta/_journal.json index 0debf17..7dc05da 100644 --- a/drizzle/meta/_journal.json +++ b/drizzle/meta/_journal.json @@ -316,6 +316,13 @@ "when": 1779600000000, "tag": "0045_store_listing_transfers", "breakpoints": true + }, + { + "idx": 46, + "version": "7", + "when": 1779700000000, + "tag": "0046_store_listing_team", + "breakpoints": true } ] } diff --git a/lexicons/fyi/atstore/directory/getListing.json b/lexicons/fyi/atstore/directory/getListing.json index 62c1819..090ee09 100644 --- a/lexicons/fyi/atstore/directory/getListing.json +++ b/lexicons/fyi/atstore/directory/getListing.json @@ -87,6 +87,14 @@ "uri": { "type": "string", "maxLength": 2048 } } }, + "listingTeamMemberRow": { + "type": "object", + "required": ["did"], + "properties": { + "did": { "type": "string", "format": "did" }, + "role": { "type": "string", "maxLength": 640 } + } + }, "listingDetailResponse": { "type": "object", "required": [ @@ -147,6 +155,14 @@ "type": "ref", "ref": "#listingLinkRow" } + }, + "team": { + "type": "array", + "description": "People behind the listing, in display order.", + "items": { + "type": "ref", + "ref": "#listingTeamMemberRow" + } } } }, diff --git a/lexicons/fyi/atstore/listing/detail.json b/lexicons/fyi/atstore/listing/detail.json index 08eba35..dd43192 100644 --- a/lexicons/fyi/atstore/listing/detail.json +++ b/lexicons/fyi/atstore/listing/detail.json @@ -133,10 +133,36 @@ "type": "ref", "ref": "#link" } + }, + "team": { + "type": "array", + "maxLength": 24, + "description": "People behind the listing (developers, designers, and anyone else the owner wants to credit), in display order.", + "items": { + "type": "ref", + "ref": "#teamMember" + } } } } }, + "teamMember": { + "type": "object", + "required": ["did"], + "properties": { + "did": { + "type": "string", + "format": "did", + "description": "The team member's account." + }, + "role": { + "type": "string", + "maxLength": 640, + "maxGraphemes": 64, + "description": "Free-form role on the team, e.g. 'Developer' or 'Design'." + } + } + }, "link": { "type": "object", "required": ["type", "url"], diff --git a/src/components/product-listing-form.tsx b/src/components/product-listing-form.tsx index c2af98e..136bf91 100644 --- a/src/components/product-listing-form.tsx +++ b/src/components/product-listing-form.tsx @@ -1,12 +1,13 @@ import type { ListingLink, ListingLinkType, + ListingTeamMember, } from "#/lib/atproto/listing-record"; import type { ReactNode } from "react"; import type { DropTarget } from "react-aria-components"; import * as stylex from "@stylexjs/stylex"; -import { useSuspenseQuery } from "@tanstack/react-query"; +import { useQuery, useSuspenseQuery } from "@tanstack/react-query"; import { ImageCropperDialog } from "#/components/image-cropper-dialog"; import { FieldHelp, @@ -28,6 +29,9 @@ import { import { LISTING_LINK_MAX_COUNT, LISTING_LINK_TYPES, + LISTING_TEAM_MAX_COUNT, + LISTING_TEAM_ROLE_MAX_LENGTH, + LISTING_TEAM_ROLE_SUGGESTIONS, } from "#/lib/atproto/listing-record"; import { slugifyDirectoryListingName } from "#/lib/directory-listing-slugs"; import { @@ -111,6 +115,55 @@ type LinkRow = { label: string; }; +type TeamRow = { + /** Local-only id so React can track the row across removals. */ + id: string; + /** Handle as typed (or a DID until the saved member's handle loads). */ + actor: string; + role: string; +}; + +/** What the form submits per team row; the server resolves handles to DIDs. */ +type ProductListingTeamInput = { actor: string; role?: string }; + +const TEAM_ROLE_OPTIONS = LISTING_TEAM_ROLE_SUGGESTIONS.map((role) => ({ + id: role, + label: role, +})); + +function createTeamRowId(): string { + return `team-${crypto.randomUUID()}`; +} + +/** + * Saved team members are DIDs; look up their current handles so the editor + * shows `alice.bsky.social` rather than `did:plc:…`. + */ +async function fetchTeamHandles( + dids: ReadonlyArray, +): Promise> { + const out: Record = {}; + for (let i = 0; i < dids.length; i += 25) { + const url = new URL( + "xrpc/app.bsky.actor.getProfiles", + "https://public.api.bsky.app", + ); + for (const did of dids.slice(i, i + 25)) { + url.searchParams.append("actors", did); + } + const res = await fetch(url); + if (!res.ok) continue; + const data = (await res.json()) as { + profiles?: Array<{ did?: string; handle?: string }>; + }; + for (const profile of data.profiles ?? []) { + if (profile.did && profile.handle && profile.handle !== "handle.invalid") + out[profile.did] = profile.handle; + } + } + return out; +} + const MAX_SCREENSHOT_COUNT = 4; /** `fyi.atstore.listing.detail#tagline` maxLength. */ @@ -644,6 +697,16 @@ const styles = stylex.create({ alignSelf: "flex-start", marginTop: 4, }, + teamActor: { + flexBasis: { default: "100%", [breakpoints.md]: 0 }, + flexGrow: 3, + minWidth: 0, + }, + teamRole: { + flexBasis: 0, + flexGrow: 2, + minWidth: 0, + }, // Footer footerActions: { alignItems: "center", @@ -699,6 +762,8 @@ export type ProductListingFormSubmitValues = { pendingScreenshotBlobs: Array; retainedScreenshotUrls: Array; links: Array; + /** People behind the listing, in display order (handles or DIDs + optional role). */ + team: Array; /** * Editorial app tags for `apps/` listings. Empty for app-tool categories * since the lexicon only uses tags on top-level apps. @@ -719,6 +784,7 @@ export type ProductListingFormInitialValues = { iconUrl?: string | null; screenshotUrls?: Array; links?: Array; + team?: Array; appTags?: Array; }; @@ -911,6 +977,31 @@ export function ProductListingForm({ const [linkRows, setLinkRows] = useState>(() => buildInitialLinkRows(initialValues.links), ); + const [teamRows, setTeamRows] = useState>(() => + (initialValues.team ?? []) + .slice(0, LISTING_TEAM_MAX_COUNT) + .map((member) => ({ + id: createTeamRowId(), + actor: member.did, + role: member.role ?? "", + })), + ); + const initialTeamDids = (initialValues.team ?? []).map((m) => m.did); + const { data: initialTeamHandles } = useQuery({ + queryKey: ["listing-team-handles", initialTeamDids], + queryFn: () => fetchTeamHandles(initialTeamDids), + enabled: initialTeamDids.length > 0, + staleTime: 5 * 60_000, + }); + useEffect(() => { + if (!initialTeamHandles) return; + setTeamRows((rows) => + rows.map((row) => { + const handle = initialTeamHandles[row.actor]; + return handle ? { ...row, actor: handle } : row; + }), + ); + }, [initialTeamHandles]); const initialNormalizedAppTags = normalizeAppTags( initialValues.appTags ?? [], @@ -1006,6 +1097,35 @@ export function ProductListingForm({ }); } + function updateTeamRow(id: string, patch: Partial) { + setTeamRows((rows) => + rows.map((row) => (row.id === id ? { ...row, ...patch } : row)), + ); + } + + function removeTeamRow(id: string) { + setTeamRows((rows) => rows.filter((row) => row.id !== id)); + } + + function addTeamRow() { + setTeamRows((rows) => + rows.length >= LISTING_TEAM_MAX_COUNT + ? rows + : [...rows, { id: createTeamRowId(), actor: "", role: "" }], + ); + } + + function collectTeamForSubmit(): Array { + const out: Array = []; + for (const row of teamRows) { + const actor = row.actor.trim().replace(/^@+/, ""); + if (!actor) continue; + const role = row.role.trim(); + out.push(role ? { actor, role } : { actor }); + } + return out; + } + function collectLinksForSubmit(): Array { const out: Array = []; for (const row of linkRows) { @@ -1229,6 +1349,7 @@ export function ProductListingForm({ .filter((item) => item.blob == null) .map((item) => item.previewUrl), links: collectLinksForSubmit(), + team: collectTeamForSubmit(), appTags: collectAppTagsForSubmit(), }); }} @@ -1824,6 +1945,76 @@ export function ProductListingForm({ + + {teamRows.length > 0 ? ( +
+ {teamRows.map((row) => ( +
+
+ { + updateTeamRow(row.id, { actor: value }); + }} + /> +
+ { + updateTeamRow(row.id, { + role: value.slice(0, LISTING_TEAM_ROLE_MAX_LENGTH), + }); + }} + onChange={(key) => { + if (key === null) return; + updateTeamRow(row.id, { role: String(key) }); + }} + style={styles.teamRole} + > + {(item) => ( + {item.label} + )} + + { + removeTeamRow(row.id); + }} + > + + +
+ ))} +
+ ) : null} + +
+ {errorMessage ? ( ) : null} diff --git a/src/components/shelf/account/ProfileWorkCard.tsx b/src/components/shelf/account/ProfileWorkCard.tsx new file mode 100644 index 0000000..a2046bd --- /dev/null +++ b/src/components/shelf/account/ProfileWorkCard.tsx @@ -0,0 +1,236 @@ +import * as stylex from "@stylexjs/stylex"; +import { Link as RouterLink } from "@tanstack/react-router"; + +import { animationDuration } from "../../../design-system/theme/animations.stylex"; +import { uiColor } from "../../../design-system/theme/color.stylex"; +import { shadow } from "../../../design-system/theme/shadow.stylex"; +import { fontWeight } from "../../../design-system/theme/typography.stylex"; +import { getDirectoryListingSlug } from "../../../lib/directory-listing-slugs"; +import { ListingIcon } from "../ListingIcon"; +import { ListingRating } from "../ListingRating"; +import { PersonAvatar } from "./PersonAvatar"; + +const MAX_TEAMMATES_SHOWN = 4; + +const styles = stylex.create({ + card: { + padding: 20, + borderColor: { + default: uiColor.border1, + ":hover": uiColor.border2, + }, + borderRadius: 20, + borderStyle: "solid", + borderWidth: 1, + backgroundColor: uiColor.bg, + boxShadow: { default: shadow.none, ":hover": shadow.md }, + display: "flex", + flexDirection: "column", + position: "relative", + rowGap: 16, + transform: { default: null, ":hover": "translateY(-2px)" }, + transitionDuration: animationDuration.slow, + transitionProperty: "border-color, box-shadow, transform", + minWidth: 0, + }, + head: { + alignItems: "center", + columnGap: 14, + display: "flex", + minWidth: 0, + }, + titles: { + display: "flex", + flexDirection: "column", + rowGap: 4, + minWidth: 0, + }, + /** The listing link covers the whole card; teammate links sit above it. */ + nameLink: { + borderRadius: 4, + overflow: "hidden", + textDecoration: "none", + color: uiColor.text2, + fontSize: 16, + fontWeight: fontWeight.semibold, + letterSpacing: "-0.006em", + outlineColor: uiColor.text2, + outlineOffset: 2, + outlineStyle: { default: "none", ":focus-visible": "solid" }, + outlineWidth: 2, + textOverflow: "ellipsis", + whiteSpace: "nowrap", + "::after": { + inset: 0, + content: "''", + position: "absolute", + }, + }, + role: { + borderRadius: 999, + overflow: "hidden", + paddingBlock: 2, + paddingInline: 8, + alignSelf: "flex-start", + backgroundColor: uiColor.component1, + color: uiColor.text2, + fontSize: 12, + textOverflow: "ellipsis", + whiteSpace: "nowrap", + maxWidth: "100%", + }, + tagline: { + margin: 0, + overflow: "hidden", + WebkitBoxOrient: "vertical", + WebkitLineClamp: 2, + color: uiColor.text1, + display: "-webkit-box", + fontSize: 14, + lineHeight: 1.45, + }, + foot: { + alignItems: "center", + color: uiColor.text1, + columnGap: 8, + display: "flex", + fontSize: 13, + justifyContent: "space-between", + rowGap: 8, + marginTop: "auto", + }, + team: { + alignItems: "center", + columnGap: 6, + display: "flex", + flexShrink: 0, + // Stay right-aligned even when there is no rating beside it. + marginLeft: "auto", + }, + teamLabel: { + color: uiColor.text1, + fontSize: 12, + }, + stack: { + display: "flex", + }, + mateLink: { + borderRadius: "50%", + display: "inline-flex", + outlineColor: uiColor.text2, + outlineOffset: 2, + outlineStyle: { default: "none", ":focus-visible": "solid" }, + outlineWidth: 2, + position: "relative", + zIndex: { default: 1, ":focus-visible": 2, ":hover": 2 }, + marginLeft: { default: -6, ":first-child": 0 }, + }, + mateAvatar: { + boxShadow: `0 0 0 2px ${uiColor.bg}`, + }, + more: { + color: uiColor.text1, + fontSize: 12, + fontVariantNumeric: "tabular-nums", + marginLeft: 4, + }, +}); + +export type ProfileWorkTeammate = { + did: string; + handle: string | null; + displayName: string | null; + avatarUrl: string | null; +}; + +export type ProfileWorkListing = { + id: string; + name: string; + slug?: string | null; + iconUrl: string | null; + tagline: string | null; + averageRating: number | string | null; + reviewCount: number; + /** The profile owner's role on this listing's team, if credited. */ + teamRole: string | null; + teammates: Array; +}; + +function teammateLabel(mate: ProfileWorkTeammate): string { + const handle = + mate.handle && mate.handle !== "handle.invalid" ? mate.handle : null; + return mate.displayName?.trim() || (handle ? `@${handle}` : "Team member"); +} + +/** + * A listing in a profile's "Work" grid: icon, name, the person's role, tagline, + * rating, and the other people on the team. The card links to the listing; + * each teammate avatar links to that person's profile. + */ +export function ProfileWorkCard({ listing }: { listing: ProfileWorkListing }) { + const shown = listing.teammates.slice(0, MAX_TEAMMATES_SHOWN); + const hidden = listing.teammates.length - shown.length; + + return ( +
+
+ +
+ + {listing.name} + + {listing.teamRole ? ( + {listing.teamRole} + ) : null} +
+
+ {listing.tagline?.trim() ? ( +

{listing.tagline}

+ ) : null} +
+ + {shown.length > 0 ? ( +
+ with + + {shown.map((mate) => { + const label = teammateLabel(mate); + const handle = + mate.handle && mate.handle !== "handle.invalid" + ? mate.handle + : null; + return ( + + + + ); + })} + + {hidden > 0 ? ( + +{hidden} + ) : null} +
+ ) : null} +
+
+ ); +} diff --git a/src/components/shelf/listing/ListingSidebar.tsx b/src/components/shelf/listing/ListingSidebar.tsx index e8b4d29..d61d85e 100644 --- a/src/components/shelf/listing/ListingSidebar.tsx +++ b/src/components/shelf/listing/ListingSidebar.tsx @@ -4,6 +4,7 @@ import { createLink } from "@tanstack/react-router"; import { BadgeCheck, Info } from "lucide-react"; import type { DirectoryListingDetail } from "../../../integrations/tanstack-query/api-directory-listings.functions"; +import type { SnapshotTeamMember } from "../../../lib/listing-page-snapshot.types"; import { Button } from "../../../design-system/button"; import { uiColor } from "../../../design-system/theme/color.stylex"; @@ -39,6 +40,7 @@ import { PillLink, SmallArrowLink, } from "./ListingParts"; +import { ListingTeamRow } from "./ListingTeamRow"; const ButtonLink = createLink(Button); @@ -97,11 +99,14 @@ export function ListingSidebar({ productId, productSlug, hasCompatibleApps, + teamProfiles, }: { listing: DirectoryListingDetail; productId: string; productSlug: string; hasCompatibleApps: boolean; + /** Resolved team profiles from the page snapshot. */ + teamProfiles?: ReadonlyArray; }) { const website = listing.externalUrl?.trim() || null; const domain = getUrlDomain(website); @@ -145,6 +150,7 @@ export function ListingSidebar({ ) : null} + {categorySlug ? ( diff --git a/src/components/shelf/listing/ListingTeamRow.tsx b/src/components/shelf/listing/ListingTeamRow.tsx new file mode 100644 index 0000000..04a7037 --- /dev/null +++ b/src/components/shelf/listing/ListingTeamRow.tsx @@ -0,0 +1,90 @@ +import * as stylex from "@stylexjs/stylex"; +import { Link as RouterLink } from "@tanstack/react-router"; + +import type { ListingTeamMember } from "../../../lib/atproto/listing-record"; +import type { SnapshotTeamMember } from "../../../lib/listing-page-snapshot.types"; + +import { animationDuration } from "../../../design-system/theme/animations.stylex"; +import { uiColor } from "../../../design-system/theme/color.stylex"; +import { PersonAvatar } from "../account/PersonAvatar"; +import { DetailRow } from "./ListingParts"; + +const styles = stylex.create({ + member: { + paddingBlock: 2, + alignItems: "center", + columnGap: 8, + display: "flex", + minWidth: 0, + }, + link: { + borderRadius: 2, + overflow: "hidden", + color: uiColor.text2, + outlineColor: uiColor.text2, + outlineOffset: 2, + outlineStyle: { default: "none", ":focus-visible": "solid" }, + outlineWidth: 2, + textDecorationColor: { + default: uiColor.border2, + ":hover": uiColor.text2, + }, + textDecorationLine: "underline", + textOverflow: "ellipsis", + textUnderlineOffset: 3, + transitionDuration: animationDuration.default, + transitionProperty: "text-decoration-color", + whiteSpace: "nowrap", + minWidth: 0, + }, + role: { + color: uiColor.text1, + flexShrink: 0, + }, +}); + +function validHandle(handle: string | null | undefined): string | null { + return handle && handle !== "handle.invalid" ? handle : null; +} + +/** + * Sidebar "Team" row: the people behind the listing, each linking to their + * at-store profile. Order and roles come from the record; names and avatars + * from the page snapshot (a member added since the last snapshot still + * renders, just without a name or avatar). + */ +export function ListingTeamRow({ + team, + profiles, +}: { + team: ReadonlyArray; + profiles: ReadonlyArray | undefined; +}) { + if (team.length === 0) return null; + const byDid = new Map((profiles ?? []).map((p) => [p.did, p])); + + return ( + + {team.map((member) => { + const profile = byDid.get(member.did); + const handle = validHandle(profile?.handle); + const name = + profile?.displayName?.trim() || (handle ? `@${handle}` : member.did); + const role = member.role?.trim(); + return ( + + + + {name} + + {role ? {role} : null} + + ); + })} + + ); +} diff --git a/src/components/user-handle-autocomplete.tsx b/src/components/user-handle-autocomplete.tsx index 8732d3f..cede8da 100644 --- a/src/components/user-handle-autocomplete.tsx +++ b/src/components/user-handle-autocomplete.tsx @@ -17,6 +17,7 @@ export interface UserHandleAutocompleteProps { onValueChange: (value: string) => void; onSelect?: (handle: string) => void; label?: React.ReactNode; + "aria-label"?: string; placeholder?: string; size?: "sm" | "md" | "lg"; } @@ -33,6 +34,7 @@ export function UserHandleAutocomplete({ onValueChange, onSelect, label, + "aria-label": ariaLabel, placeholder = "your.handle.com", size = "lg", }: UserHandleAutocompleteProps) { @@ -74,6 +76,7 @@ export function UserHandleAutocomplete({ size={size} placeholder={placeholder} label={label} + aria-label={ariaLabel} inputValue={value} onInputChange={onValueChange} items={actors} diff --git a/src/db/schema.ts b/src/db/schema.ts index b1efcdc..1ed99aa 100644 --- a/src/db/schema.ts +++ b/src/db/schema.ts @@ -2,7 +2,10 @@ import type { GameDetails, ListingType, } from "#/lib/atproto/game-define-record"; -import type { ListingLink } from "#/lib/atproto/listing-record"; +import type { + ListingLink, + ListingTeamMember, +} from "#/lib/atproto/listing-record"; import type { StoreListingPageSnapshotPayload } from "#/lib/listing-page-snapshot.types"; import type { DirectoryOAuthLexiconHubData } from "#/lib/oauth-lexicon-hub.types"; import type { OAuthAuthProbeReport } from "#/lib/oauth-listing-auth-probe"; @@ -216,6 +219,14 @@ export const storeListings = pgTable( .$type>() .notNull() .default(sql`'[]'::jsonb`), + /** + * Mirror of `fyi.atstore.listing.detail#main.properties.team` — the people + * behind the listing (`{ did, role? }`). Profiles are resolved into the page snapshot. + */ + team: jsonb("team") + .$type>() + .notNull() + .default(sql`'[]'::jsonb`), atUri: text("at_uri"), repoDid: text("repo_did"), rkey: text("rkey"), @@ -353,6 +364,10 @@ export const storeListings = pgTable( gameDefinePriorAtUrisIdx: index( "store_listings_game_define_prior_at_uris_idx", ).using("gin", table.gameDefinePriorAtUris), + teamIdx: index("store_listings_team_idx").using( + "gin", + sql`${table.team} jsonb_path_ops`, + ), }), ); diff --git a/src/design-system/autocomplete/index.tsx b/src/design-system/autocomplete/index.tsx index 6c32fd7..09e7812 100644 --- a/src/design-system/autocomplete/index.tsx +++ b/src/design-system/autocomplete/index.tsx @@ -53,6 +53,8 @@ export interface AutocompleteInputProps Pick, "renderEmptyState"> { /** Label for the text field. */ label?: React.ReactNode; + /** Accessible name for the text field when there is no visible label. */ + "aria-label"?: string; /** Description text shown below the input. */ description?: string; /** Error message or function returning message from validation. */ @@ -79,6 +81,7 @@ export interface AutocompleteInputProps export function AutocompleteInput({ label, + "aria-label": ariaLabel, description, errorMessage, children, @@ -155,6 +158,7 @@ export function AutocompleteInput({ > ; + /** + * People behind the listing (`fyi.atstore.listing.detail#teamMember`), in display order. + * Profiles (handle, name, avatar) live on the page snapshot's `team`. + */ + team: Array; /** OAuth / authorization metadata sampled from storefront link (see cron sync). Null if never probed. */ oauthProbe: DirectoryListingOAuthProbe | null; /** @@ -1083,6 +1097,7 @@ type DirectoryListingDetailRow = DirectoryListingRow & { classificationReason: string | null; appTags: Array; links: ListingLink[] | null; + team: ListingTeamMember[] | null; listingType: string; gameDetails: GameDetails | null; createdAt: Date; @@ -1402,6 +1417,7 @@ function toListingDetail( createdAt: row.createdAt.toISOString(), updatedAt: row.updatedAt.toISOString(), links: normalizeListingLinks(row.links ?? null), + team: normalizeListingTeam(row.team ?? null), oauthProbe: options.oauthProbe, germDmHref: options.germDmHref, fundingDetail, @@ -2945,6 +2961,7 @@ const getDirectoryListingDetail = createServerFn({ method: "GET" }) ...storeListingLegacyDetailColumns, appTags: table.appTags, links: table.links, + team: table.team, listingType: table.listingType, gameDetails: table.gameDetails, createdAt: table.createdAt, @@ -3002,6 +3019,7 @@ const getDirectoryListingDetailBySlug = createServerFn({ method: "GET" }) ...storeListingLegacyDetailColumns, appTags: table.appTags, links: table.links, + team: table.team, listingType: table.listingType, gameDetails: table.gameDetails, createdAt: table.createdAt, @@ -3199,6 +3217,7 @@ async function selectDirectoryListingDetailRow(db: Database, whereClause: SQL) { ...storeListingLegacyDetailColumns, appTags: table.appTags, links: table.links, + team: table.team, listingType: table.listingType, gameDetails: table.gameDetails, createdAt: table.createdAt, @@ -3426,6 +3445,7 @@ const getDirectoryListingDetailForOwnerEdit = createServerFn({ ...storeListingLegacyDetailColumns, appTags: table.appTags, links: table.links, + team: table.team, listingType: table.listingType, gameDetails: table.gameDetails, createdAt: table.createdAt, @@ -5625,6 +5645,42 @@ const listingLinkInputSchema = z.object({ .transform((s) => (s && s.length > 0 ? s : undefined)), }); +const listingTeamMemberInputSchema = z.object({ + /** Bluesky handle (with or without `@`) or DID. */ + actor: z.string().trim().min(1).max(2048), + role: z.string().trim().max(LISTING_TEAM_ROLE_MAX_LENGTH).optional(), +}); + +const listingTeamInputSchema = z + .array(listingTeamMemberInputSchema) + .max(LISTING_TEAM_MAX_COUNT) + .optional(); + +/** + * Resolve the form's team rows (handles or DIDs) to `{ did, role }`. Throws a + * readable error naming the first handle that does not resolve. + */ +async function resolveListingTeamInput( + rows: ReadonlyArray>, +): Promise> { + const resolved = await Promise.all( + rows.map(async (row) => { + const actor = row.actor.trim().replace(/^@+/, ""); + if (!actor) return null; + const did = actor.startsWith("did:") + ? actor + : await resolveBlueskyHandleToDid(actor.toLowerCase()); + if (!did) { + throw new Error(`Couldn't find @${actor} on Bluesky.`); + } + return { did, role: row.role }; + }), + ); + return normalizeListingTeam( + resolved.filter((m): m is NonNullable => m != null), + ); +} + const updateOwnedProductListingInput = z.object({ listingId: z.string().uuid(), name: z.string().trim().min(1).max(640), @@ -5643,6 +5699,7 @@ const updateOwnedProductListingInput = z.object({ .max(LISTING_LINK_MAX_COUNT) .optional() .default([]), + team: listingTeamInputSchema, appTags: z.array(z.string()).max(64).optional().default([]), }); @@ -5680,6 +5737,7 @@ const createOwnedProductListingInput = z.object({ .max(LISTING_LINK_MAX_COUNT) .optional() .default([]), + team: listingTeamInputSchema, appTags: z.array(z.string()).max(64).optional().default([]), }); @@ -5932,6 +5990,10 @@ const updateOwnedProductListing = createServerFn({ method: "POST" }) } const links = normalizeListingLinks(data.links as Array); + const team = + data.team === undefined + ? normalizeListingTeam(full.team) + : await resolveListingTeamInput(data.team); /** * Only `apps/` listings surface app tags; clear them otherwise so we don't @@ -5961,6 +6023,7 @@ const updateOwnedProductListing = createServerFn({ method: "POST" }) productAccountDid, productAccountHandle, links, + team, appTags, }; @@ -6001,6 +6064,7 @@ const updateOwnedProductListing = createServerFn({ method: "POST" }) productAccountHandle, atUri: uri, links, + team, appTags, ...verificationStatusPatch, updatedAt: now, @@ -6102,6 +6166,7 @@ const createOwnedProductListing = createServerFn({ method: "POST" }) const now = new Date(); const links = normalizeListingLinks(data.links as Array); + const team = await resolveListingTeamInput(data.team ?? []); /** * Only `apps/` listings carry app tags in the lexicon; other category kinds * drop them so we don't pin editorial tags onto protocol/app-tool records (mirrors @@ -6123,6 +6188,7 @@ const createOwnedProductListing = createServerFn({ method: "POST" }) categorySlugs: [categorySlug], appTags, links, + team, atUri: null, repoDid: session.did, rkey: null, @@ -6900,6 +6966,7 @@ const getProfileOwnedProductListings = createServerFn({ method: "GET" }) } const t = context.schema.storeListings; + const snap = context.schema.storeListingPageSnapshots; const rows = await context.db .select({ id: t.id, @@ -6910,16 +6977,52 @@ const getProfileOwnedProductListings = createServerFn({ method: "GET" }) heroImageUrl: t.heroImageUrl, reviewCount: t.reviewCount, averageRating: t.averageRating, + team: t.team, + /** Team profiles resolved when the listing's page snapshot was built. */ + teamProfiles: sql | null>`${snap.payload}->'team'`, }) .from(t) - .where(listingPublicWhere(t, eq(t.productAccountDid, did))) + .leftJoin(snap, eq(snap.storeListingId, t.id)) + .where( + listingPublicWhere( + t, + or( + eq(t.productAccountDid, did), + // Listings that credit this account on their team (GIN-indexed containment). + sql`${t.team} @> ${JSON.stringify([{ did }])}::jsonb`, + ), + ), + ) .orderBy(asc(t.name)); - return rows.map((row) => ({ - ...row, - iconUrl: httpsListingImageUrlOrNull(row.iconUrl), - heroImageUrl: httpsListingImageUrlOrNull(row.heroImageUrl), - })); + return rows.map(({ team: rawTeam, teamProfiles, ...row }) => { + const team = normalizeListingTeam(rawTeam); + const profilesByDid = new Map( + (Array.isArray(teamProfiles) ? teamProfiles : []).map((p) => [ + p.did, + p, + ]), + ); + return { + ...row, + iconUrl: httpsListingImageUrlOrNull(row.iconUrl), + heroImageUrl: httpsListingImageUrlOrNull(row.heroImageUrl), + /** This account's role on the listing's team, when it is credited there. */ + teamRole: team.find((member) => member.did === did)?.role ?? null, + /** Everyone else on the team, in display order. */ + teammates: team + .filter((member) => member.did !== did) + .map((member) => { + const profile = profilesByDid.get(member.did); + return { + did: member.did, + handle: profile?.handle ?? null, + displayName: profile?.displayName ?? null, + avatarUrl: profile?.avatarUrl ?? null, + }; + }), + }; + }); }); function getProfileOwnedProductListingsQueryOptions(did: string) { @@ -7308,6 +7411,7 @@ const updateStoreManagedListingInput = z.object({ .max(LISTING_LINK_MAX_COUNT) .optional() .default([]), + team: listingTeamInputSchema, appTags: z.array(z.string()).max(64).optional().default([]), heroImage: z .object({ @@ -7386,6 +7490,10 @@ const updateStoreManagedListing = createServerFn({ method: "POST" }) } const links = normalizeListingLinks(data.links as Array); + const team = + data.team === undefined + ? normalizeListingTeam(full.team) + : await resolveListingTeamInput(data.team); const appTags = isEditableAppCategorySlug(categorySlug) ? normalizeAppTags(data.appTags ?? []) : []; @@ -7522,6 +7630,7 @@ const updateStoreManagedListing = createServerFn({ method: "POST" }) externalUrl, categorySlugs: [categorySlug], links, + team, appTags, }; if (productAccountDid) { @@ -7552,6 +7661,7 @@ const updateStoreManagedListing = createServerFn({ method: "POST" }) productAccountHandle, atUri: uri, links, + team, appTags, updatedAt: now, }) @@ -7577,6 +7687,7 @@ const createStoreManagedListingInput = z.object({ .max(LISTING_LINK_MAX_COUNT) .optional() .default([]), + team: listingTeamInputSchema, appTags: z.array(z.string()).max(64).optional().default([]), heroImage: z .object({ @@ -7641,6 +7752,7 @@ const createStoreManagedListing = createServerFn({ method: "POST" }) const now = new Date(); const links = normalizeListingLinks(data.links as Array); + const team = await resolveListingTeamInput(data.team ?? []); const appTags = isEditableAppCategorySlug(categorySlug) ? normalizeAppTags(data.appTags ?? []) : []; @@ -7657,6 +7769,7 @@ const createStoreManagedListing = createServerFn({ method: "POST" }) categorySlugs: [categorySlug], appTags, links, + team, atUri: null, repoDid, rkey: null, @@ -8249,6 +8362,27 @@ async function loadDirectoryCategoryTreeForContext( ); } +/** Resolve each team member's Bluesky profile (one batched call) for the page snapshot. */ +async function loadListingTeamProfiles( + raw: ReadonlyArray | null, +): Promise> { + const team = normalizeListingTeam(raw); + if (team.length === 0) return []; + const profiles = await fetchBlueskyPublicProfilesBatch( + team.map((member) => member.did), + ); + return team.map((member) => { + const profile = profiles.get(member.did) ?? null; + return { + did: member.did, + role: member.role ?? null, + handle: profile?.handle ?? null, + displayName: profile?.displayName ?? null, + avatarUrl: profile?.avatarUrl ?? null, + }; + }); +} + /** * Rebuild the precomputed product-page JSON for one listing. Safe to call from * Tap ingest, Jetstream, OAuth probe jobs, or lazy on first page view. @@ -8274,7 +8408,10 @@ export async function refreshListingPageSnapshot( } const [row] = await db - .select({ categorySlugs: dbSchema.storeListings.categorySlugs }) + .select({ + categorySlugs: dbSchema.storeListings.categorySlugs, + team: dbSchema.storeListings.team, + }) .from(dbSchema.storeListings) .where(eq(dbSchema.storeListings.id, listingId)) .limit(1); @@ -8287,6 +8424,7 @@ export async function refreshListingPageSnapshot( relatedInCategory, relatedByLexicon, categoryTree, + team, ] = await Promise.all([ loadDirectoryListingReviewsForContext( ctx, @@ -8315,6 +8453,7 @@ export async function refreshListingPageSnapshot( RELATED_BY_LEXICON_SNAPSHOT_LIMIT, ), loadDirectoryCategoryTreeForContext(ctx), + loadListingTeamProfiles(row?.team ?? null), ]); const ecosystemRootId = getAppEcosystemRootCategoryId( @@ -8339,6 +8478,7 @@ export async function refreshListingPageSnapshot( relatedInCategory, relatedByLexicon: relatedByLexicon.listings, ecosystemChildren: ecosystemNode?.children ?? null, + team, } satisfies StoreListingPageSnapshotPayload); const now = new Date(); @@ -8371,6 +8511,7 @@ export const directoryListingXrpcHelpers = { computeIsStoreManaged, viewerMayReplyOnListingReview, normalizeListingLinks, + normalizeListingTeam, } as const; export const directoryListingApi = { diff --git a/src/lexicons/generated/bundle.ts b/src/lexicons/generated/bundle.ts index 1d7ab5e..dd7cac3 100644 --- a/src/lexicons/generated/bundle.ts +++ b/src/lexicons/generated/bundle.ts @@ -176,6 +176,20 @@ export const lexicons = [ }, }, }, + listingTeamMemberRow: { + type: "object", + required: ["did"], + properties: { + did: { + type: "string", + format: "did", + }, + role: { + type: "string", + maxLength: 640, + }, + }, + }, listingDetailResponse: { type: "object", required: [ @@ -254,6 +268,14 @@ export const lexicons = [ ref: "#listingLinkRow", }, }, + team: { + type: "array", + description: "People behind the listing, in display order.", + items: { + type: "ref", + ref: "#listingTeamMemberRow", + }, + }, }, }, main: { @@ -667,6 +689,34 @@ export const lexicons = [ ref: "#link", }, }, + team: { + type: "array", + maxLength: 24, + description: + "People behind the listing (developers, designers, and anyone else the owner wants to credit), in display order.", + items: { + type: "ref", + ref: "#teamMember", + }, + }, + }, + }, + }, + teamMember: { + type: "object", + required: ["did"], + properties: { + did: { + type: "string", + format: "did", + description: "The team member's account.", + }, + role: { + type: "string", + maxLength: 640, + maxGraphemes: 64, + description: + "Free-form role on the team, e.g. 'Developer' or 'Design'.", }, }, }, diff --git a/src/lib/atproto/listing-record.ts b/src/lib/atproto/listing-record.ts index 23222cb..70ffaab 100644 --- a/src/lib/atproto/listing-record.ts +++ b/src/lib/atproto/listing-record.ts @@ -90,6 +90,8 @@ export type FyiAtstoreListingDetail = { links?: Array; /** `games.atmosphere.define` record describing this listing as a game (atmosphere.games). */ game?: string; + /** People behind the listing (developers, designers, …), each a Bluesky account with a role. */ + team?: Array; }; /** Max length checks mirror `detail.json`: `links` ≤ 12 entries, label ≤ 100 chars. */ @@ -128,6 +130,52 @@ export function normalizeListingLinks( return out; } +/** One entry of `fyi.atstore.listing.detail#teamMember`. */ +export type ListingTeamMember = { + did: string; + /** Free-form role, e.g. "Developer" or "Design". */ + role?: string; +}; + +/** Max length checks mirror `detail.json`: `team` ≤ 24 entries, role ≤ 64 chars. */ +export const LISTING_TEAM_MAX_COUNT = 24; +export const LISTING_TEAM_ROLE_MAX_LENGTH = 64; + +/** Suggested roles for the listing form; any other text is allowed too. */ +export const LISTING_TEAM_ROLE_SUGGESTIONS = [ + "Developer", + "Designer", + "Founder", + "Maintainer", + "Product", + "Community", + "Support", + "Artist", + "Writer", +] as const; + +const TEAM_MEMBER_DID_RE = /^did:(plc|web):[a-zA-Z0-9._:%-]{1,2000}$/; + +/** Trim, validate DIDs, drop duplicates (first wins) and cap at {@link LISTING_TEAM_MAX_COUNT}. */ +export function normalizeListingTeam( + raw: readonly ListingTeamMember[] | null | undefined, +): Array { + if (!raw?.length) return []; + const out: Array = []; + const seen = new Set(); + for (const entry of raw) { + const did = entry?.did?.trim(); + if (!did || !TEAM_MEMBER_DID_RE.test(did) || seen.has(did)) continue; + seen.add(did); + const member: ListingTeamMember = { did }; + const role = entry.role?.trim().replaceAll(/\s+/g, " "); + if (role) member.role = role.slice(0, LISTING_TEAM_ROLE_MAX_LENGTH); + out.push(member); + if (out.length >= LISTING_TEAM_MAX_COUNT) break; + } + return out; +} + function isHttpsUri(s: string | null | undefined): s is string { if (!s?.trim()) return false; try { @@ -423,6 +471,9 @@ export async function buildListingDetailRecordWithBlobs( const links = normalizeListingLinks(row.links ?? null); if (links.length > 0) record.links = links; + const team = normalizeListingTeam(row.team ?? null); + if (team.length > 0) record.team = team; + /** Only for merged listings — a game-only row's `at_uri` *is* the define record. */ const game = row.gameDefineAtUri?.trim(); if (game && game !== row.atUri) record.game = game; diff --git a/src/lib/atproto/listing-team.test.ts b/src/lib/atproto/listing-team.test.ts new file mode 100644 index 0000000..627e299 --- /dev/null +++ b/src/lib/atproto/listing-team.test.ts @@ -0,0 +1,85 @@ +import { + LISTING_TEAM_MAX_COUNT, + LISTING_TEAM_ROLE_MAX_LENGTH, + normalizeListingTeam, +} from "#/lib/atproto/listing-record"; +import { tryParseListingDetailRecord } from "#/lib/atproto/tap-listing-sync"; +import { describe, expect, it } from "vitest"; + +const ALICE = "did:plc:alice"; +const BOB = "did:web:bob.example.com"; + +describe("normalizeListingTeam", () => { + it("keeps order, trims roles and drops empty ones", () => { + expect( + normalizeListingTeam([ + { did: ` ${ALICE} `, role: " Lead developer " }, + { did: BOB, role: " " }, + ]), + ).toEqual([{ did: ALICE, role: "Lead developer" }, { did: BOB }]); + }); + + it("drops invalid DIDs and duplicates (first wins)", () => { + expect( + normalizeListingTeam([ + { did: "alice.bsky.social" }, + { did: ALICE, role: "Design" }, + { did: ALICE, role: "Dev" }, + { did: "" }, + ]), + ).toEqual([{ did: ALICE, role: "Design" }]); + }); + + it("caps the team size and role length", () => { + const team = normalizeListingTeam( + Array.from({ length: LISTING_TEAM_MAX_COUNT + 5 }, (_, i) => ({ + did: `did:plc:member${String(i)}`, + role: "x".repeat(200), + })), + ); + expect(team).toHaveLength(LISTING_TEAM_MAX_COUNT); + expect(team[0]?.role).toHaveLength(LISTING_TEAM_ROLE_MAX_LENGTH); + }); + + it("handles missing input", () => { + expect(normalizeListingTeam(null)).toEqual([]); + }); +}); + +describe("tryParseListingDetailRecord team", () => { + const base = { + slug: "example", + name: "Example", + tagline: "An app", + externalUrl: "https://example.com", + icon: { + $type: "blob", + ref: { + $link: "bafkreigh2akiscaildcqabsyg3dfr6chu3fgpregiymsck7e7aqa4s52zy", + }, + mimeType: "image/png", + size: 1024, + }, + categorySlug: ["apps/example"], + createdAt: "2026-01-01T00:00:00.000Z", + updatedAt: "2026-01-01T00:00:00.000Z", + }; + + it("reads the team from the record", () => { + const result = tryParseListingDetailRecord({ + ...base, + team: [{ did: ALICE, role: "Developer" }, { did: BOB }, { did: "nope" }], + }); + expect(result.ok).toBe(true); + expect(result.ok && result.record.team).toEqual([ + { did: ALICE, role: "Developer" }, + { did: BOB }, + ]); + }); + + it("omits the field when the record has no team", () => { + const result = tryParseListingDetailRecord(base); + expect(result.ok).toBe(true); + expect(result.ok && result.record.team).toBeUndefined(); + }); +}); diff --git a/src/lib/atproto/tap-listing-sync.ts b/src/lib/atproto/tap-listing-sync.ts index c9978a9..e16fe0d 100644 --- a/src/lib/atproto/tap-listing-sync.ts +++ b/src/lib/atproto/tap-listing-sync.ts @@ -17,7 +17,9 @@ import { LISTING_LINK_LABEL_MAX_LENGTH, LISTING_LINK_MAX_COUNT, LISTING_LINK_URL_MAX_LENGTH, + LISTING_TEAM_MAX_COUNT, normalizeListingLinks, + normalizeListingTeam, } from "#/lib/atproto/listing-record"; import { COLLECTION, GAMES_NSID } from "#/lib/atproto/nsids"; import { resolveAtprotoPdsBaseUrl } from "#/lib/atproto/resolve-atproto-pds"; @@ -114,6 +116,18 @@ const listingLinkLexicon = z.object({ }), }); +const listingTeamMemberLexicon = z.object({ + did: z.string().trim().min(1).max(2048), + role: z + .union([z.string(), z.null()]) + .optional() + .transform((s) => { + if (s == null) return; + const t = String(s).trim(); + return t || undefined; + }), +}); + const listingBodySchema = z.object({ slug: z.string().min(1), name: z.string(), @@ -148,6 +162,10 @@ const listingBodySchema = z.object({ message: "migratedFromAtUri must be an at:// URI", }), links: z.array(listingLinkLexicon).max(LISTING_LINK_MAX_COUNT).optional(), + team: z + .array(listingTeamMemberLexicon) + .max(LISTING_TEAM_MAX_COUNT) + .optional(), game: z .union([z.string(), z.null()]) .optional() @@ -279,6 +297,10 @@ export function tryParseListingDetailRecord( ); if (normalized.length > 0) rec.links = normalized; } + if (d.team?.length) { + const team = normalizeListingTeam(d.team); + if (team.length > 0) rec.team = team; + } return { ok: true, record: rec }; } @@ -599,6 +621,7 @@ export async function upsertDirectoryListingFromTap(input: { const migratedFromAtUri = record.migratedFromAtUri?.trim() ?? null; const links = normalizeListingLinks(record.links ?? null); + const team = normalizeListingTeam(record.team ?? null); try { await db @@ -621,6 +644,7 @@ export async function upsertDirectoryListingFromTap(input: { verificationStatus, appTags, links, + team, productAccountDid: productDid, productAccountHandle, migratedFromAtUri, @@ -646,6 +670,7 @@ export async function upsertDirectoryListingFromTap(input: { verificationStatus, appTags, links, + team, productAccountDid: productDid, productAccountHandle, migratedFromAtUri, diff --git a/src/lib/listing-page-snapshot.types.ts b/src/lib/listing-page-snapshot.types.ts index 1682592..97c4931 100644 --- a/src/lib/listing-page-snapshot.types.ts +++ b/src/lib/listing-page-snapshot.types.ts @@ -98,6 +98,15 @@ export type SnapshotProductUpdate = { coverImageUrl: string | null; }; +/** A `team` entry with its Bluesky profile resolved at snapshot time. */ +export type SnapshotTeamMember = { + did: string; + role: string | null; + handle: string | null; + displayName: string | null; + avatarUrl: string | null; +}; + export type StoreListingPageSnapshotPayload = { version: typeof LISTING_PAGE_SNAPSHOT_VERSION; isStoreManaged: boolean; @@ -114,4 +123,6 @@ export type StoreListingPageSnapshotPayload = { relatedInCategory: Array; relatedByLexicon: Array; ecosystemChildren: Array | null; + /** Absent on snapshots built before the team section shipped. */ + team?: Array; }; diff --git a/src/routes/_header-layout._admin-layout.admin.add-listing.tsx b/src/routes/_header-layout._admin-layout.admin.add-listing.tsx index 8cafe7b..72ea3bb 100644 --- a/src/routes/_header-layout._admin-layout.admin.add-listing.tsx +++ b/src/routes/_header-layout._admin-layout.admin.add-listing.tsx @@ -59,6 +59,7 @@ function AdminAddListingPage() { categorySlug: values.categorySlug, productHandle: values.productHandle, links: values.links, + team: values.team, appTags: values.appTags, heroImage, iconImage, diff --git a/src/routes/_header-layout._admin-layout.admin.managed-listings.tsx b/src/routes/_header-layout._admin-layout.admin.managed-listings.tsx index d116289..aeb2ec9 100644 --- a/src/routes/_header-layout._admin-layout.admin.managed-listings.tsx +++ b/src/routes/_header-layout._admin-layout.admin.managed-listings.tsx @@ -357,6 +357,7 @@ function ManagedListingEditor({ categorySlug: values.categorySlug, productHandle: values.productHandle, links: values.links, + team: values.team, appTags: values.appTags, heroImage, iconImage, @@ -470,6 +471,7 @@ function ManagedListingEditor({ iconUrl: listing.iconUrl ?? null, screenshotUrls: listing.screenshots ?? [], links: listing.links ?? [], + team: listing.team ?? [], appTags: listing.appTags ?? [], }} onCancel={onClear} diff --git a/src/routes/_header-layout.products.$productId.edit.tsx b/src/routes/_header-layout.products.$productId.edit.tsx index fe93665..e90c3d8 100644 --- a/src/routes/_header-layout.products.$productId.edit.tsx +++ b/src/routes/_header-layout.products.$productId.edit.tsx @@ -163,6 +163,7 @@ function EditProductListingPage() { categorySlug: values.categorySlug, productHandle: values.productHandle, links: values.links, + team: values.team, appTags: values.appTags, }, }); @@ -284,6 +285,7 @@ function EditProductListingPage() { iconUrl: listing.iconUrl ?? null, screenshotUrls: listing.screenshots ?? [], links: listing.links ?? [], + team: listing.team ?? [], appTags: listing.appTags ?? [], }} onCancel={navigateAway} diff --git a/src/routes/_header-layout.products.$productId.index.tsx b/src/routes/_header-layout.products.$productId.index.tsx index 8a376a3..c71ac78 100644 --- a/src/routes/_header-layout.products.$productId.index.tsx +++ b/src/routes/_header-layout.products.$productId.index.tsx @@ -390,6 +390,7 @@ function ProductPage() { productId={productId} productSlug={productSlug} hasCompatibleApps={page.relatedByLexicon.length > 0} + teamProfiles={page.team} /> diff --git a/src/routes/_header-layout.products.create.tsx b/src/routes/_header-layout.products.create.tsx index 6001112..244bbdd 100644 --- a/src/routes/_header-layout.products.create.tsx +++ b/src/routes/_header-layout.products.create.tsx @@ -187,6 +187,7 @@ function CreateProductListingPage() { categorySlug: values.categorySlug, productHandle: values.productHandle, links: values.links, + team: values.team, appTags: values.appTags, ...(heroImage ? { heroImage } : {}), ...(iconImage ? { iconImage } : {}), diff --git a/src/routes/_header-layout.profile.$actor.tsx b/src/routes/_header-layout.profile.$actor.tsx index 8030fe1..60d3fec 100644 --- a/src/routes/_header-layout.profile.$actor.tsx +++ b/src/routes/_header-layout.profile.$actor.tsx @@ -15,8 +15,8 @@ import { Link as AriaLink } from "react-aria-components"; import { DirectoryListingReviewCard } from "../components/DirectoryListingReviewCard"; import { GermNetworkBadge } from "../components/GermNetworkBadge"; import { PersonAvatar } from "../components/shelf/account/PersonAvatar"; +import { ProfileWorkCard } from "../components/shelf/account/ProfileWorkCard"; import { ListingCard } from "../components/shelf/ListingCard"; -import { ListingRow } from "../components/shelf/ListingRow"; import { SectionHeader, ShelfSection } from "../components/shelf/Section"; import { Button } from "../design-system/button"; import { uiColor } from "../design-system/theme/color.stylex"; @@ -141,13 +141,15 @@ const styles = stylex.create({ }, rowGap: 16, }, - rows: { - columnGap: 40, + workCards: { + columnGap: 16, display: "grid", gridTemplateColumns: { default: "minmax(0, 1fr)", - [breakpoints.lg]: "repeat(2, minmax(0, 1fr))", + [breakpoints.sm]: "repeat(2, minmax(0, 1fr))", + [breakpoints.lg]: "repeat(3, minmax(0, 1fr))", }, + rowGap: 16, }, reviews: { alignItems: "start", @@ -345,12 +347,23 @@ function UserProfilePage() { {owned.length > 0 ? ( {owned.length}{" "} - {owned.length === 1 ? "product" : "products"} + {owned.length === 1 ? "project" : "projects"} ) : null} + {owned.length > 0 ? ( + + +
+ {owned.map((product) => ( + + ))} +
+
+ ) : null} + {favoriteProducts.length > 0 ? ( ) : null} - {owned.length > 0 ? ( - - -
- {owned.map((product) => ( - - ))} -
-
- ) : null} - {page.reviews.length > 0 ? ( diff --git a/src/server/atproto-xrpc/atstore-xrpc-handler.server.ts b/src/server/atproto-xrpc/atstore-xrpc-handler.server.ts index 321547f..12a3400 100644 --- a/src/server/atproto-xrpc/atstore-xrpc-handler.server.ts +++ b/src/server/atproto-xrpc/atstore-xrpc-handler.server.ts @@ -1,5 +1,8 @@ import type { DirectoryListingCardXrpc } from "#/integrations/tanstack-query/api-directory-listings.functions"; -import type { ListingLink } from "#/lib/atproto/listing-record"; +import type { + ListingLink, + ListingTeamMember, +} from "#/lib/atproto/listing-record"; import { db } from "#/db/index.server"; import * as schema from "#/db/schema"; @@ -217,6 +220,7 @@ function verifiedListingDetailSelect(table: typeof schema.storeListings) { ...LEGACY_DETAIL_SQL, appTags: table.appTags, links: table.links, + team: table.team, listingType: table.listingType, createdAt: table.createdAt, updatedAt: table.updatedAt, @@ -227,6 +231,7 @@ type VerifiedListingDetailRowForXrpc = Parameters< (typeof directoryListingXrpcHelpers)["toListingCardXrpc"] >[0] & { links: unknown; + team: unknown; repoDid: string | null; migratedFromAtUri: string | null; productAccountDid: string | null; @@ -240,8 +245,12 @@ type VerifiedListingDetailRowForXrpc = Parameters< }; async function listingDetailXrpcPayload(row: VerifiedListingDetailRowForXrpc) { - const { toListingCardXrpc, computeIsStoreManaged, normalizeListingLinks } = - directoryListingXrpcHelpers; + const { + toListingCardXrpc, + computeIsStoreManaged, + normalizeListingLinks, + normalizeListingTeam, + } = directoryListingXrpcHelpers; const listing = listingCardXrpcJson(toListingCardXrpc(row)); const isStoreManaged = await computeIsStoreManaged(row); @@ -266,6 +275,7 @@ async function listingDetailXrpcPayload(row: VerifiedListingDetailRowForXrpc) { ...(link.label ? { label: link.label } : {}), uri: link.url, })), + team: normalizeListingTeam(row.team as Array | null), }; }