diff --git a/app/components/LocaleTime.tsx b/app/components/LocaleTime.tsx index d1bd6a09d6..802a798eab 100644 --- a/app/components/LocaleTime.tsx +++ b/app/components/LocaleTime.tsx @@ -10,15 +10,24 @@ export type Props = { shorten?: boolean; relative?: boolean; format?: Partial>; + /** Additional content shown below the date in the tooltip. */ + tooltipDetail?: React.ReactNode; }; -const LocaleTime: React.FC = ({ children, ...rest }: Props) => { +const LocaleTime: React.FC = ({ + children, + tooltipDetail, + ...rest +}: Props) => { const { tooltipContent, content } = useLocaleTime(rest); const [isInteractive, setIsInteractive] = React.useState(false); + // Detail is only available in the tooltip, so it must be reachable by keyboard. + const hasDetail = !!tooltipDetail; const time = ( ); - return isInteractive ? ( - + return isInteractive || hasDetail ? ( + + {tooltipContent} +
+ {tooltipDetail} + + ) : ( + tooltipContent + ) + } + placement="bottom" + > {time}
) : ( diff --git a/app/models/GroupUser.ts b/app/models/GroupUser.ts index 43fc93589b..12f0a9bfa8 100644 --- a/app/models/GroupUser.ts +++ b/app/models/GroupUser.ts @@ -31,6 +31,13 @@ class GroupUser extends Model { @Relation(() => Group, { onDelete: "cascade" }) group: Group; + /** The ID of the user that added the user to the group. */ + createdById: string; + + /** The user that added the user to the group. */ + @Relation(() => User, { onDelete: "null" }) + createdBy?: User; + /** The permission of the user in the group. */ @Field @observable diff --git a/app/scenes/Settings/components/GroupMembersTable.tsx b/app/scenes/Settings/components/GroupMembersTable.tsx index 4c08d7ed89..9360c0c62e 100644 --- a/app/scenes/Settings/components/GroupMembersTable.tsx +++ b/app/scenes/Settings/components/GroupMembersTable.tsx @@ -117,6 +117,36 @@ export const GroupMembersTable = observer(function GroupMembersTable({ ), width: "1fr", }, + { + type: "data", + id: "addedAt", + header: t("Added"), + sortable: false, + accessor: (user) => + groupUsers.membership(group.id, user.id)?.createdAt ?? "", + component: (user) => { + const membership = groupUsers.membership(group.id, user.id); + if (!membership?.createdAt) { + return null; + } + return ( +