Files
Tom MoorandClaude Opus 5 2dfda3cd8d feat: Choose which columns are visible in settings tables (#13326)
Tables that pass an id now offer column visibility options, both from a
context menu on the header row and from a button at its end, mirroring
the way Finder handles column headers. Preferences are persisted locally
per table and at least one data column must remain visible.

Also centralizes the avatar and name pairing that several tables render
for "Created by" style columns into UserLabel, which shows the profile
hover card for the name as well as the avatar.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-06 22:02:33 -04:00

46 lines
1.2 KiB
TypeScript

import { observer } from "mobx-react";
import type * as React from "react";
import Text from "@shared/components/Text";
import Avatar, { AvatarSize } from "~/components/Avatar/Avatar";
import { HStack } from "~/components/primitives/HStack";
import { UserHoverCard } from "~/components/UserHoverCard";
import type User from "~/models/User";
type Props = {
/** The user to display, nothing is rendered when undefined. */
user: User | null | undefined;
/** Whether the user is the primary content of the row, shown with a larger avatar. */
primary?: boolean;
/** Additional content displayed after the user's name. */
children?: React.ReactNode;
};
/**
* Displays a user's avatar alongside their name, with a card summarizing their
* profile shown on hover.
*/
export const UserLabel = observer(function UserLabel_({
user,
primary,
children,
}: Props) {
if (!user) {
return null;
}
return (
<UserHoverCard user={user}>
<HStack>
<Avatar
model={user}
size={primary ? AvatarSize.Large : AvatarSize.Small}
/>
<Text selectable ellipsis>
{user.name}
</Text>
{children}
</HStack>
</UserHoverCard>
);
});