Move group management to sub-page (#11755)

* chore: Move group management to sub-page

* refactor
This commit is contained in:
Tom Moor authored and GitHub committed 2026-03-14 16:00:33 -04:00
1 parent 36d555f3fb
commit 4bc0f15323
11 files changed
+507 -265

No files matched your search

+22 -17
View File
@@ -9,39 +9,44 @@ export interface LazyComponent<T extends React.ComponentType<any>> {
interface LazyLoadOptions {
retries?: number;
interval?: number;
/** If provided, picks this named export from the module instead of `default`. */
exportName?: string;
}
/**
* Creates a lazy-loaded component with preloading capability and automatic retries on failure.
* Supports both default and named exports.
*
* @param factory A function that returns a promise of a component (eg: () => import('./MyComponent'))
* @param options Optional configuration for retry behavior
* @returns An object containing the lazy Component and a preload function
* @param factory A function that returns a promise of a module.
* @param options Optional configuration for retry behavior and export name.
* @returns An object containing the lazy Component and a preload function.
*
* @example
* ```typescript
* // Default export
* const MyComponent = createLazyComponent(() => import('./MyComponent'));
*
* function App() {
* return (
* <Suspense fallback={<div>Loading...</div>}>
* <MyComponent.Component />
* </Suspense>
* );
* }
*
* // Preload when needed:
* MyComponent.preload();
* // Named export
* const MyComponent = createLazyComponent(() => import('./MyComponent'), {
* exportName: 'MyComponent',
* });
* ```
*/
export function createLazyComponent<T extends React.ComponentType<any>>(
factory: () => Promise<{ default: T }>,
factory: () => Promise<Record<string, T>>,
options: LazyLoadOptions = {}
): LazyComponent<T> {
const { retries, interval } = options;
const { retries, interval, exportName } = options;
const wrappedFactory = exportName
? () =>
factory().then((m) => ({
default: m[exportName],
}))
: (factory as () => Promise<{ default: T }>);
return {
Component: lazyWithRetry(factory, retries, interval),
preload: factory,
Component: lazyWithRetry(wrappedFactory, retries, interval),
preload: wrappedFactory,
};
}
+2 -1
View File
@@ -76,7 +76,8 @@ function SettingsSidebar() {
to={item.path}
onClickIntent={item.preload}
active={
item.path.startsWith(settingsPath("templates"))
item.path.startsWith(settingsPath("templates")) ||
item.path.startsWith(settingsPath("groups"))
? location.pathname.startsWith(item.path)
: undefined
}
@@ -152,7 +152,7 @@ function SidebarLink(
$isActiveDrop={isActiveDrop}
$isDraft={isDraft}
$disabled={disabled}
style={style}
style={active ? activeStyle : style}
activeStyle={isActiveDrop ? activeDropStyle : activeStyle}
onClick={handleClick}
onActiveClick={handleDisclosureClick}
+39 -20
View File
@@ -1,11 +1,11 @@
import * as React from "react";
import { EditIcon, GroupIcon, TrashIcon } from "outline-icons";
import { useTranslation } from "react-i18next";
import { useHistory } from "react-router-dom";
import type Group from "~/models/Group";
import {
DeleteGroupDialog,
EditGroupDialog,
ViewGroupMembersDialog,
} from "~/scenes/Settings/components/GroupDialogs";
import usePolicy from "~/hooks/usePolicy";
import useStores from "~/hooks/useStores";
@@ -16,27 +16,35 @@ import {
} from "~/actions";
import { GroupSection } from "~/actions/sections";
import { useMenuAction } from "~/hooks/useMenuAction";
import { settingsPath } from "~/utils/routeHelpers";
interface Options {
/** Whether to hide the "Members" navigation action. */
hideMembers?: boolean;
}
/**
* Hook that constructs the action menu for group management operations.
*
*
* @param targetGroup - the group to build actions for, or null to skip.
* @param options - optional configuration for the menu.
* @returns action with children for use in menus, or undefined if group is null.
*/
export function useGroupMenuActions(targetGroup: Group | null) {
export function useGroupMenuActions(
targetGroup: Group | null,
options?: Options
) {
const { t } = useTranslation();
const { dialogs } = useStores();
const history = useHistory();
const can = usePolicy(targetGroup ?? ({} as Group));
const openMembersDialog = React.useCallback(() => {
const navigateToMembers = React.useCallback(() => {
if (!targetGroup) {
return;
}
dialogs.openModal({
title: t("Group members"),
content: <ViewGroupMembersDialog group={targetGroup} />,
});
}, [t, targetGroup, dialogs]);
history.push(settingsPath("groups", targetGroup.id, "members"));
}, [targetGroup, history]);
const openEditDialog = React.useCallback(() => {
if (!targetGroup) {
@@ -45,7 +53,10 @@ export function useGroupMenuActions(targetGroup: Group | null) {
dialogs.openModal({
title: t("Edit group"),
content: (
<EditGroupDialog group={targetGroup} onSubmit={dialogs.closeAllModals} />
<EditGroupDialog
group={targetGroup}
onSubmit={dialogs.closeAllModals}
/>
),
});
}, [t, targetGroup, dialogs]);
@@ -57,7 +68,10 @@ export function useGroupMenuActions(targetGroup: Group | null) {
dialogs.openModal({
title: t("Delete group"),
content: (
<DeleteGroupDialog group={targetGroup} onSubmit={dialogs.closeAllModals} />
<DeleteGroupDialog
group={targetGroup}
onSubmit={dialogs.closeAllModals}
/>
),
});
}, [t, targetGroup, dialogs]);
@@ -67,14 +81,18 @@ export function useGroupMenuActions(targetGroup: Group | null) {
!targetGroup
? []
: [
createAction({
name: `${t("Members")}…`,
icon: <GroupIcon />,
section: GroupSection,
visible: !!(targetGroup && can.read),
perform: openMembersDialog,
}),
ActionSeparator,
...(options?.hideMembers
? []
: [
createAction({
name: t("Members"),
icon: <GroupIcon />,
section: GroupSection,
visible: !!(targetGroup && can.read),
perform: navigateToMembers,
}),
ActionSeparator,
]),
createAction({
name: `${t("Edit")}…`,
icon: <EditIcon />,
@@ -105,7 +123,8 @@ export function useGroupMenuActions(targetGroup: Group | null) {
can.read,
can.update,
can.delete,
openMembersDialog,
options?.hideMembers,
navigateToMembers,
openEditDialog,
openDeleteDialog,
]
+4 -2
View File
@@ -8,11 +8,13 @@ import { useGroupMenuActions } from "~/hooks/useGroupMenuActions";
type Props = {
group: Group;
/** Whether to hide the "Members" navigation action. */
hideMembers?: boolean;
};
function GroupMenu({ group }: Props) {
function GroupMenu({ group, hideMembers }: Props) {
const { t } = useTranslation();
const rootAction = useGroupMenuActions(group);
const rootAction = useGroupMenuActions(group, { hideMembers });
return (
<DropdownMenu
+12 -4
View File
@@ -1,12 +1,15 @@
import { Switch } from "react-router-dom";
import Error404 from "~/scenes/Errors/Error404";
import { createLazyComponent as lazy } from "~/components/LazyLoad";
import Route from "~/components/ProfiledRoute";
import useSettingsConfig from "~/hooks/useSettingsConfig";
import lazy from "~/utils/lazyWithRetry";
import { settingsPath } from "~/utils/routeHelpers";
import { observer } from "mobx-react";
const Application = lazy(() => import("~/scenes/Settings/Application"));
const GroupMembers = lazy(() => import("~/scenes/Settings/GroupMembers"), {
exportName: "GroupMembersScene",
});
const Template = lazy(() => import("~/scenes/Settings/Template"));
const TemplateNew = lazy(() => import("~/scenes/Settings/TemplateNew"));
@@ -24,20 +27,25 @@ function SettingsRoutes() {
/>
))}
{/* TODO: Refactor these exceptions into config? */}
<Route
exact
path={settingsPath("groups", ":id", "members")}
component={GroupMembers.Component}
/>
<Route
exact
path={settingsPath("applications", ":id")}
component={Application}
component={Application.Component}
/>
<Route
exact
path={settingsPath("templates", "new")}
component={TemplateNew}
component={TemplateNew.Component}
/>
<Route
exact
path={settingsPath("templates", ":id")}
component={Template}
component={Template.Component}
/>
<Route component={Error404} />
</Switch>
+219
View File
@@ -0,0 +1,219 @@
import type { ColumnSort } from "@tanstack/react-table";
import { observer } from "mobx-react";
import { GroupIcon, PlusIcon } from "outline-icons";
import { useCallback, useEffect, useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { useParams } from "react-router-dom";
import { useHistory, useLocation } from "react-router-dom";
import { toast } from "sonner";
import type User from "~/models/User";
import { Action } from "~/components/Actions";
import Breadcrumb from "~/components/Breadcrumb";
import Button from "~/components/Button";
import { ConditionalFade } from "~/components/Fade";
import Heading from "~/components/Heading";
import InputSearch from "~/components/InputSearch";
import LoadingIndicator from "~/components/LoadingIndicator";
import Scene from "~/components/Scene";
import Text from "~/components/Text";
import Error404 from "~/scenes/Errors/Error404";
import { createInternalLinkAction } from "~/actions";
import { NavigationSection } from "~/actions/sections";
import usePolicy from "~/hooks/usePolicy";
import useQuery from "~/hooks/useQuery";
import useRequest from "~/hooks/useRequest";
import useStores from "~/hooks/useStores";
import { useTableRequest } from "~/hooks/useTableRequest";
import type { FetchPageParams, PaginatedResponse } from "~/stores/base/Store";
import { PAGINATION_SYMBOL } from "~/stores/base/Store";
import GroupMenu from "~/menus/GroupMenu";
import { AddPeopleToGroupDialog } from "./components/GroupDialogs";
import { GroupMembersTable } from "./components/GroupMembersTable";
import { StickyFilters } from "./components/StickyFilters";
import { settingsPath } from "~/utils/routeHelpers";
/**
* Settings page that lists members of a specific group.
*/
function GroupMembers() {
const { id } = useParams<{ id: string }>();
const { groups } = useStores();
const group = groups.get(id);
const { request, error } = useRequest(() => groups.fetch(id));
useEffect(() => {
if (!group) {
void request();
}
}, [group, request]);
if (error) {
return <Error404 />;
}
if (!group) {
return <LoadingIndicator />;
}
return <GroupMembersPage groupId={group.id} />;
}
const GroupMembersPage = observer(function GroupMembersPage({
groupId,
}: {
groupId: string;
}) {
const { t } = useTranslation();
const { dialogs, groups, users, groupUsers } = useStores();
const group = groups.get(groupId)!;
const can = usePolicy(group);
const history = useHistory();
const location = useLocation();
const params = useQuery();
const [query, setQuery] = useState("");
const reqParams = useMemo(
() => ({
id: group.id,
query: params.get("query") || undefined,
sort: params.get("sort") || "name",
direction: (params.get("direction") || "asc").toUpperCase() as
| "ASC"
| "DESC",
}),
[params, group.id]
);
const sort: ColumnSort = useMemo(
() => ({
id: reqParams.sort,
desc: reqParams.direction === "DESC",
}),
[reqParams.sort, reqParams.direction]
);
const fetchMembers = useCallback(
async (fetchParams: FetchPageParams): Promise<PaginatedResponse<User>> => {
const response = await groupUsers.fetchPage(fetchParams);
const result = response.map((gu) => gu.user) as PaginatedResponse<User>;
result[PAGINATION_SYMBOL] = response[PAGINATION_SYMBOL];
return result;
},
[groupUsers]
);
const { data, error, loading, next } = useTableRequest({
data: users.inGroup(group.id, reqParams.query),
sort,
reqFn: fetchMembers,
reqParams,
});
const updateQuery = useCallback(
(value: string) => {
if (value) {
params.set("query", value);
} else {
params.delete("query");
}
history.replace({
pathname: location.pathname,
search: params.toString(),
});
},
[params, history, location.pathname]
);
const handleSearch = useCallback(
(event: React.ChangeEvent<HTMLInputElement>) => {
const { value } = event.target;
setQuery(value);
},
[]
);
const handleAddPeople = useCallback(() => {
dialogs.openModal({
title: t(`Add people to {{groupName}}`, {
groupName: group.name,
}),
content: <AddPeopleToGroupDialog group={group} />,
});
}, [t, group, dialogs]);
useEffect(() => {
if (error) {
toast.error(t("Could not load group members"));
}
}, [t, error]);
useEffect(() => {
const timeout = setTimeout(() => updateQuery(query), 250);
return () => clearTimeout(timeout);
}, [query, updateQuery]);
const breadcrumbActions = useMemo(
() => [
createInternalLinkAction({
name: t("Groups"),
section: NavigationSection,
icon: <GroupIcon />,
to: settingsPath("groups"),
}),
],
[t]
);
return (
<Scene
title={group.name}
left={<Breadcrumb actions={breadcrumbActions} />}
actions={
<>
{can.update && (
<Action>
<Button
type="button"
onClick={handleAddPeople}
icon={<PlusIcon />}
>
{`${t("Add people")}…`}
</Button>
</Action>
)}
<Action>
<GroupMenu group={group} hideMembers />
</Action>
</>
}
wide
>
<Heading>{group.name}</Heading>
<Text as="p" type="secondary">
{group.description || t("No description")}
</Text>
<StickyFilters>
<InputSearch
value={query}
placeholder={`${t("Filter")}…`}
onChange={handleSearch}
/>
</StickyFilters>
<ConditionalFade animate={!data}>
<GroupMembersTable
group={group}
data={data ?? []}
sort={sort}
loading={loading}
page={{
hasNext: !!next,
fetchNext: next,
}}
/>
</ConditionalFade>
</Scene>
);
});
export const GroupMembersScene = observer(GroupMembers);
+5 -197
View File
@@ -1,6 +1,5 @@
import debounce from "lodash/debounce";
import { observer } from "mobx-react";
import { PlusIcon } from "outline-icons";
import * as React from "react";
import { Trans, useTranslation } from "react-i18next";
import { toast } from "sonner";
@@ -16,8 +15,6 @@ import DelayedMount from "~/components/DelayedMount";
import Empty from "~/components/Empty";
import Flex from "~/components/Flex";
import Input from "~/components/Input";
import type { Item } from "~/components/InputSelect";
import { InputSelect } from "~/components/InputSelect";
import PlaceholderList from "~/components/List/Placeholder";
import PaginatedList from "~/components/PaginatedList";
import { ListItem } from "~/components/Sharing/components/ListItem";
@@ -34,6 +31,8 @@ import type { Permission } from "~/types";
import { EmptySelectValue } from "~/types";
import type GroupUser from "~/models/GroupUser";
import Switch from "~/components/Switch";
import history from "~/utils/history";
import { settingsPath } from "~/utils/routeHelpers";
type Props = {
group: Group;
@@ -63,17 +62,14 @@ export function CreateGroupDialog() {
try {
await group.save();
dialogs.closeAllModals();
dialogs.openModal({
title: t("Group members"),
content: <ViewGroupMembersDialog group={group} />,
});
history.push(settingsPath("groups", group.id, "members"));
} catch (err) {
toast.error(err.message);
} finally {
setIsSaving(false);
}
},
[t, dialogs, groups, name, description]
[dialogs, groups, name, description]
);
return (
@@ -225,195 +221,7 @@ export function DeleteGroupDialog({ group, onSubmit }: Props) {
);
}
export const ViewGroupMembersDialog = observer(function ({
group,
}: Pick<Props, "group">) {
const { dialogs, users, groupUsers } = useStores();
const { t } = useTranslation();
const can = usePolicy(group);
const [query, setQuery] = React.useState("");
const [permissionFilter, setPermissionFilter] = React.useState<
GroupPermission | "all"
>("all");
const handleAddPeople = React.useCallback(() => {
dialogs.openModal({
title: t(`Add people to {{groupName}}`, {
groupName: group.name,
}),
content: <AddPeopleToGroupDialog group={group} />,
replace: true,
});
}, [t, group, dialogs]);
const handleRemoveUser = React.useCallback(
async (user: User) => {
try {
await groupUsers.delete({
groupId: group.id,
userId: user.id,
});
toast.success(
t(`{{userName}} was removed from the group`, {
userName: user.name,
}),
{
icon: <Avatar model={user} size={AvatarSize.Toast} />,
}
);
} catch (_err) {
toast.error(t("Could not remove user"));
}
},
[t, groupUsers, group.id]
);
const handleFilter = React.useCallback(
(ev: React.ChangeEvent<HTMLInputElement>) => {
setQuery(ev.target.value);
},
[]
);
const handlePermissionFilterChange = React.useCallback((value: string) => {
setPermissionFilter(value as GroupPermission | "all");
}, []);
const permissionOptions: Item[] = React.useMemo(
() => [
{
type: "item",
label: t("All permissions"),
value: "all",
},
{
type: "item",
label: t("Group admin"),
value: GroupPermission.Admin,
},
{
type: "item",
label: t("Member"),
value: GroupPermission.Member,
},
],
[t]
);
const filteredUsers = React.useMemo(() => {
let result = users.inGroup(group.id, query);
if (permissionFilter !== "all") {
const groupUserMap = new Map(
groupUsers.orderedData
.filter((gu) => gu.groupId === group.id)
.map((gu) => [gu.userId, gu])
);
result = result.filter((user) => {
const groupUser = groupUserMap.get(user.id);
return groupUser?.permission === permissionFilter;
});
}
return result;
}, [users, group.id, query, permissionFilter, groupUsers.orderedData]);
const hasActiveFilters = query || permissionFilter !== "all";
return (
<Flex column>
{can.update ? (
<>
<Text as="p" type="secondary">
<Trans
defaults="Add and remove members to the <em>{{groupName}}</em> group. Members of the group will have access to any collections this group has been added to."
values={{
groupName: group.name,
}}
components={{
em: <strong />,
}}
/>
</Text>
{can.update && (
<span>
<Button
type="button"
onClick={handleAddPeople}
icon={<PlusIcon />}
neutral
>
{t("Add people")}…
</Button>
</span>
)}
<br />
</>
) : (
<Text as="p" type="secondary">
<Trans
defaults="Listing members of the <em>{{groupName}}</em> group."
values={{
groupName: group.name,
}}
components={{
em: <strong />,
}}
/>
</Text>
)}
{(filteredUsers.length || hasActiveFilters) && (
<Flex gap={8}>
<Input
type="search"
placeholder={`${t("Search by name")}…`}
value={query}
onChange={handleFilter}
label={t("Search members")}
labelHidden
flex
/>
<InputSelect
options={permissionOptions}
value={permissionFilter}
onChange={handlePermissionFilterChange}
label={t("Filter by permissions")}
hideLabel
short
/>
</Flex>
)}
<PaginatedList<User>
items={filteredUsers}
fetch={groupUsers.fetchPage}
options={{
id: group.id,
}}
empty={
hasActiveFilters ? (
<Empty>{t("No members matching your filters")}</Empty>
) : (
<Empty>{t("This group has no members.")}</Empty>
)
}
renderItem={(user) => (
<GroupMemberListItem
key={user.id}
user={user}
group={group}
groupUser={groupUsers.orderedData.find(
(gu) => gu.userId === user.id && gu.groupId === group.id
)}
onRemove={can.update ? () => handleRemoveUser(user) : undefined}
/>
)}
/>
</Flex>
);
});
const AddPeopleToGroupDialog = observer(function ({
export const AddPeopleToGroupDialog = observer(function ({
group,
}: Pick<Props, "group">) {
const { dialogs, users, groupUsers } = useStores();
@@ -0,0 +1,189 @@
import compact from "lodash/compact";
import { observer } from "mobx-react";
import { useMemo, useCallback } from "react";
import { useTranslation } from "react-i18next";
import { toast } from "sonner";
import { GroupPermission } from "@shared/types";
import type Group from "~/models/Group";
import type User from "~/models/User";
import { Avatar, AvatarSize } from "~/components/Avatar";
import Badge from "~/components/Badge";
import { HEADER_HEIGHT } from "~/components/Header";
import InputMemberPermissionSelect from "~/components/InputMemberPermissionSelect";
import {
type Props as TableProps,
SortableTable,
} from "~/components/SortableTable";
import { type Column as TableColumn } from "~/components/Table";
import Text from "~/components/Text";
import Time from "~/components/Time";
import usePolicy from "~/hooks/usePolicy";
import useStores from "~/hooks/useStores";
import type { Permission } from "~/types";
import { EmptySelectValue } from "~/types";
import { FILTER_HEIGHT } from "./StickyFilters";
import { HStack } from "~/components/primitives/HStack";
import { VStack } from "~/components/primitives/VStack";
const ROW_HEIGHT = 50;
const STICKY_OFFSET = HEADER_HEIGHT + FILTER_HEIGHT;
type Props = Omit<TableProps<User>, "columns" | "rowHeight"> & {
group: Group;
};
/**
* Table component for displaying group members with permission management.
*/
export const GroupMembersTable = observer(function GroupMembersTable({
group,
...rest
}: Props) {
const { t } = useTranslation();
const { groupUsers } = useStores();
const can = usePolicy(group);
const permissions = useMemo(
() =>
[
{
label: t("Group admin"),
value: GroupPermission.Admin,
},
{
label: t("Member"),
value: GroupPermission.Member,
},
{
divider: true,
label: t("Remove"),
value: EmptySelectValue,
},
] as Permission[],
[t]
);
const handlePermissionChange = useCallback(
async (
user: User,
permission: GroupPermission | typeof EmptySelectValue
) => {
try {
if (permission === EmptySelectValue) {
await groupUsers.delete({
userId: user.id,
groupId: group.id,
});
toast.success(
t(`{{userName}} was removed from the group`, {
userName: user.name,
}),
{
icon: <Avatar model={user} size={AvatarSize.Toast} />,
}
);
} else {
await groupUsers.update({
userId: user.id,
groupId: group.id,
permission,
});
}
} catch (err) {
toast.error((err as Error).message);
return false;
}
return true;
},
[t, groupUsers, group.id]
);
const columns = useMemo<TableColumn<User>[]>(
() =>
compact<TableColumn<User>>([
{
type: "data",
id: "name",
header: t("Name"),
accessor: (user) => user.name,
component: (user) => (
<HStack>
<Avatar model={user} size={AvatarSize.Large} />
<VStack align="flex-start" spacing={0}>
<Text selectable>{user.name}</Text>
<Text type="tertiary" size="small">
{user.email}
</Text>
</VStack>
{user.isAdmin && <Badge primary>{t("Admin")}</Badge>}
</HStack>
),
width: "3fr",
},
{
type: "data",
id: "lastActiveAt",
header: t("Last active"),
accessor: (user) => user.lastActiveAt,
component: (user) => (
<HStack spacing={4} wrap>
{user.lastActiveAt ? (
<Time dateTime={user.lastActiveAt} addSuffix />
) : (
<Text type="tertiary">{t("Never signed in")}</Text>
)}
{user.isInvited && <Badge>{t("Invited")}</Badge>}
</HStack>
),
width: "1fr",
},
can.update
? {
type: "data",
id: "permission",
header: t("Permission"),
accessor: (user) => {
const gu = groupUsers.orderedData.find(
(m) => m.userId === user.id && m.groupId === group.id
);
return gu?.permission ?? "";
},
component: (user: User) => (
<InputMemberPermissionSelect
permissions={permissions}
onChange={(permission) =>
handlePermissionChange(
user,
permission as GroupPermission | typeof EmptySelectValue
)
}
value={
groupUsers.orderedData.find(
(m) => m.userId === user.id && m.groupId === group.id
)?.permission
}
/>
),
width: "130px",
}
: undefined,
]),
[
t,
can.update,
group.id,
groupUsers.orderedData,
permissions,
handlePermissionChange,
]
);
return (
<SortableTable
columns={columns}
rowHeight={ROW_HEIGHT}
stickyOffset={STICKY_OFFSET}
{...rest}
/>
);
});
@@ -4,6 +4,7 @@ import { GroupIcon } from "outline-icons";
import * as React from "react";
import { useCallback, useMemo } from "react";
import { Trans, useTranslation } from "react-i18next";
import { useHistory } from "react-router-dom";
import styled from "styled-components";
import { MAX_AVATAR_DISPLAY } from "@shared/constants";
import { s, hover } from "@shared/styles";
@@ -20,13 +21,12 @@ import { ContextMenu } from "~/components/Menu/ContextMenu";
import { useGroupMenuActions } from "~/hooks/useGroupMenuActions";
import Text from "~/components/Text";
import Time from "~/components/Time";
import useStores from "~/hooks/useStores";
import GroupMenu from "~/menus/GroupMenu";
import { ViewGroupMembersDialog } from "./GroupDialogs";
import { FILTER_HEIGHT } from "./StickyFilters";
import NudeButton from "~/components/NudeButton";
import { AvatarSize } from "~/components/Avatar";
import { HStack } from "~/components/primitives/HStack";
import { settingsPath } from "~/utils/routeHelpers";
const ROW_HEIGHT = 60;
const STICKY_OFFSET = HEADER_HEIGHT + FILTER_HEIGHT;
@@ -52,16 +52,13 @@ const GroupRowContextMenu = observer(function GroupRowContextMenu({
export function GroupsTable(props: Props) {
const { t } = useTranslation();
const { dialogs } = useStores();
const history = useHistory();
const handleViewMembers = useCallback(
(group: Group) => {
dialogs.openModal({
title: t("Group members"),
content: <ViewGroupMembersDialog group={group} />,
});
history.push(settingsPath("groups", group.id, "members"));
},
[t, dialogs]
[history]
);
const applyContextMenu = useCallback(
+9 -15
View File
@@ -662,7 +662,6 @@
"Emoji deleted": "Emoji deleted",
"I'm sure – Delete": "I'm sure – Delete",
"Are you sure you want to delete the <em>{{emojiName}}</em> emoji? You will no longer be able to use it in your documents or collections.": "Are you sure you want to delete the <em>{{emojiName}}</em> emoji? You will no longer be able to use it in your documents or collections.",
"Group members": "Group members",
"Edit group": "Edit group",
"Delete group": "Delete group",
"Members": "Members",
@@ -1137,27 +1136,19 @@
"Disable mentions": "Disable mentions",
"Prevent this group from being mentionable in documents or comments": "Prevent this group from being mentionable in documents or comments",
"Are you sure about that? Deleting the <em>{{groupName}}</em> group will cause its members to lose access to collections and documents that it is associated with.": "Are you sure about that? Deleting the <em>{{groupName}}</em> group will cause its members to lose access to collections and documents that it is associated with.",
"Add people to {{groupName}}": "Add people to {{groupName}}",
"{{userName}} was removed from the group": "{{userName}} was removed from the group",
"All permissions": "All permissions",
"Group admin": "Group admin",
"Member": "Member",
"Add and remove members to the <em>{{groupName}}</em> group. Members of the group will have access to any collections this group has been added to.": "Add and remove members to the <em>{{groupName}}</em> group. Members of the group will have access to any collections this group has been added to.",
"Add people": "Add people",
"Listing members of the <em>{{groupName}}</em> group.": "Listing members of the <em>{{groupName}}</em> group.",
"Search by name": "Search by name",
"Search members": "Search members",
"Filter by permissions": "Filter by permissions",
"No members matching your filters": "No members matching your filters",
"This group has no members.": "This group has no members.",
"{{userName}} was added to the group": "{{userName}} was added to the group",
"Could not add user": "Could not add user",
"Add members below to give them access to the group. Need to add someone who’s not yet a member?": "Add members below to give them access to the group. Need to add someone who’s not yet a member?",
"Invite them to {{teamName}}": "Invite them to {{teamName}}",
"Ask an admin to invite them first": "Ask an admin to invite them first",
"Search by name": "Search by name",
"Search people": "Search people",
"No people matching your search": "No people matching your search",
"No people left to add": "No people left to add",
"Group admin": "Group admin",
"Member": "Member",
"{{userName}} was removed from the group": "{{userName}} was removed from the group",
"Last active": "Last active",
"Date created": "Date created",
"Crop Image": "Crop Image",
"Crop image": "Crop image",
@@ -1173,7 +1164,6 @@
"You can import a zip file that was previously exported from an Outline installation – collections, documents, and images will be imported. In Outline, open <em>Export</em> in the Settings sidebar and click on <em>Export Data</em>.": "You can import a zip file that was previously exported from an Outline installation – collections, documents, and images will be imported. In Outline, open <em>Export</em> in the Settings sidebar and click on <em>Export Data</em>.",
"Drag and drop the zip file from the Markdown export option in {{appName}}, or click to upload": "Drag and drop the zip file from the Markdown export option in {{appName}}, or click to upload",
"Configure": "Configure",
"Last active": "Last active",
"Role": "Role",
"Guest": "Guest",
"Never used": "Never used",
@@ -1238,6 +1228,10 @@
"Copy URL": "Copy URL",
"AI answers": "AI answers",
"Use AI to get direct answers to questions in search. This feature requires a paid license.": "Use AI to get direct answers to questions in search. This feature requires a paid license.",
"Add people to {{groupName}}": "Add people to {{groupName}}",
"Could not load group members": "Could not load group members",
"Add people": "Add people",
"No description": "No description",
"Create a group": "Create a group",
"Could not load groups": "Could not load groups",
"New group": "New group",