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
1 change: 0 additions & 1 deletion src/components/product-listing-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1955,7 +1955,6 @@ export function ProductListingForm({
<div key={row.id} {...stylex.props(styles.linkRow)}>
<div {...stylex.props(styles.teamActor)}>
<UserHandleAutocomplete
size="md"
aria-label="Team member's Bluesky handle"
placeholder="handle.bsky.social"
value={row.actor}
Expand Down
94 changes: 62 additions & 32 deletions src/components/shelf/listing/ListingTeamRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,45 @@ import type { SnapshotTeamMember } from "../../../lib/listing-page-snapshot.type

import { animationDuration } from "../../../design-system/theme/animations.stylex";
import { uiColor } from "../../../design-system/theme/color.stylex";
import { fontWeight } from "../../../design-system/theme/typography.stylex";
import { PersonAvatar } from "../account/PersonAvatar";
import { DetailRow } from "./ListingParts";

const styles = stylex.create({
list: {
margin: 0,
padding: 0,
listStyle: "none",
display: "flex",
flexBasis: "100%",
flexDirection: "column",
rowGap: 12,
minWidth: 0,
},
member: {
paddingBlock: 2,
alignItems: "center",
columnGap: 8,
columnGap: 10,
display: "flex",
minWidth: 0,
},
text: {
display: "flex",
flexDirection: "column",
rowGap: 1,
minWidth: 0,
},
link: {
name: {
borderRadius: 2,
overflow: "hidden",
color: uiColor.text2,
fontWeight: fontWeight.medium,
lineHeight: 1.3,
outlineColor: uiColor.text2,
outlineOffset: 2,
outlineStyle: { default: "none", ":focus-visible": "solid" },
outlineWidth: 2,
textDecorationColor: {
default: uiColor.border2,
default: "transparent",
":hover": uiColor.text2,
},
textDecorationLine: "underline",
Expand All @@ -35,11 +53,14 @@ const styles = stylex.create({
transitionDuration: animationDuration.default,
transitionProperty: "text-decoration-color",
whiteSpace: "nowrap",
minWidth: 0,
},
role: {
subtitle: {
overflow: "hidden",
color: uiColor.text1,
flexShrink: 0,
fontSize: 13,
lineHeight: 1.3,
textOverflow: "ellipsis",
whiteSpace: "nowrap",
},
});

Expand All @@ -48,10 +69,10 @@ function validHandle(handle: string | null | undefined): string | 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).
* Sidebar "Team" row: the people behind the listing, each with their role as
* a subtitle and 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,
Expand All @@ -64,27 +85,36 @@ export function ListingTeamRow({
const byDid = new Map((profiles ?? []).map((p) => [p.did, p]));

return (
<DetailRow term="Team" stack>
{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 (
<span key={member.did} {...stylex.props(styles.member)}>
<PersonAvatar name={name} src={profile?.avatarUrl} size={20} />
<RouterLink
to="/profile/$actor"
params={{ actor: handle ?? member.did }}
{...stylex.props(styles.link)}
>
{name}
</RouterLink>
{role ? <span {...stylex.props(styles.role)}>{role}</span> : null}
</span>
);
})}
<DetailRow term="Team">
<ul {...stylex.props(styles.list)}>
{team.map((member) => {
const profile = byDid.get(member.did);
const handle = validHandle(profile?.handle);
const handleLabel = handle ? `@${handle}` : null;
const name =
profile?.displayName?.trim() || handleLabel || member.did;
// Role when given; otherwise the handle, unless it is already the name.
const subtitle =
member.role?.trim() || (name === handleLabel ? null : handleLabel);
return (
<li key={member.did} {...stylex.props(styles.member)}>
<PersonAvatar name={name} src={profile?.avatarUrl} size={32} />
<span {...stylex.props(styles.text)}>
<RouterLink
to="/profile/$actor"
params={{ actor: handle ?? member.did }}
{...stylex.props(styles.name)}
>
{name}
</RouterLink>
{subtitle ? (
<span {...stylex.props(styles.subtitle)}>{subtitle}</span>
) : null}
</span>
</li>
);
})}
</ul>
</DetailRow>
);
}
Loading