diff --git a/app/actions/definitions/teams.tsx b/app/actions/definitions/teams.tsx
index 799c6a522..06bcbbbb7 100644
--- a/app/actions/definitions/teams.tsx
+++ b/app/actions/definitions/teams.tsx
@@ -1,40 +1,64 @@
+import { PlusIcon } from "outline-icons";
import * as React from "react";
import styled from "styled-components";
+import TeamNew from "~/scenes/TeamNew";
import { createAction } from "~/actions";
import { loadSessionsFromCookie } from "~/hooks/useSessions";
+import { TeamSection } from "../sections";
-export const changeTeam = createAction({
- name: ({ t }) => t("Switch team"),
- placeholder: ({ t }) => t("Select a team"),
- keywords: "change workspace organization",
- section: "Account",
- visible: ({ currentTeamId }) => {
- const sessions = loadSessionsFromCookie();
- const otherSessions = sessions.filter(
- (session) => session.teamId !== currentTeamId
- );
- return otherSessions.length > 0;
+export const switchTeamList = getSessions().map((session) => {
+ return createAction({
+ name: session.name,
+ section: TeamSection,
+ keywords: "change switch workspace organization team",
+ icon: () => ,
+ visible: ({ currentTeamId }) => currentTeamId !== session.teamId,
+ perform: () => (window.location.href = session.url),
+ });
+});
+
+const switchTeam = createAction({
+ name: ({ t }) => t("Switch workspace"),
+ placeholder: ({ t }) => t("Select a workspace"),
+ keywords: "change switch workspace organization team",
+ section: TeamSection,
+ visible: ({ currentTeamId }) =>
+ getSessions({ exclude: currentTeamId }).length > 0,
+ children: switchTeamList,
+});
+
+export const createTeam = createAction({
+ name: ({ t }) => `${t("New workspace")}…`,
+ keywords: "create change switch workspace organization team",
+ section: TeamSection,
+ icon: ,
+ visible: ({ stores, currentTeamId }) => {
+ return stores.policies.abilities(currentTeamId ?? "").createTeam;
},
- children: ({ currentTeamId }) => {
- const sessions = loadSessionsFromCookie();
- const otherSessions = sessions.filter(
- (session) => session.teamId !== currentTeamId
- );
-
- return otherSessions.map((session) => ({
- id: session.url,
- name: session.name,
- section: "Account",
- icon: ,
- perform: () => (window.location.href = session.url),
- }));
+ perform: ({ t, event, stores }) => {
+ event?.preventDefault();
+ event?.stopPropagation();
+ const { user } = stores.auth;
+ user &&
+ stores.dialogs.openModal({
+ title: t("Create a workspace"),
+ content: ,
+ });
},
});
+function getSessions(params?: { exclude?: string }) {
+ const sessions = loadSessionsFromCookie();
+ const otherSessions = sessions.filter(
+ (session) => session.teamId !== params?.exclude
+ );
+ return otherSessions;
+}
+
const Logo = styled("img")`
border-radius: 2px;
width: 24px;
height: 24px;
`;
-export const rootTeamActions = [changeTeam];
+export const rootTeamActions = [switchTeam, createTeam];
diff --git a/app/actions/definitions/users.tsx b/app/actions/definitions/users.tsx
index cb10834c2..dbfd08b77 100644
--- a/app/actions/definitions/users.tsx
+++ b/app/actions/definitions/users.tsx
@@ -8,7 +8,7 @@ import { UserSection } from "~/actions/sections";
export const inviteUser = createAction({
name: ({ t }) => `${t("Invite people")}…`,
icon: ,
- keywords: "team member user",
+ keywords: "team member workspace user",
section: UserSection,
visible: ({ stores }) =>
stores.policies.abilities(stores.auth.team?.id || "").inviteUser,
diff --git a/app/actions/sections.ts b/app/actions/sections.ts
index fb1dee52a..331228096 100644
--- a/app/actions/sections.ts
+++ b/app/actions/sections.ts
@@ -14,5 +14,7 @@ export const NavigationSection = ({ t }: ActionContext) => t("Navigation");
export const UserSection = ({ t }: ActionContext) => t("People");
+export const TeamSection = ({ t }: ActionContext) => t("Workspace");
+
export const RecentSearchesSection = ({ t }: ActionContext) =>
t("Recent searches");
diff --git a/app/menus/OrganizationMenu.tsx b/app/menus/OrganizationMenu.tsx
index ce51e4ce4..f7778b32f 100644
--- a/app/menus/OrganizationMenu.tsx
+++ b/app/menus/OrganizationMenu.tsx
@@ -5,7 +5,7 @@ import { MenuButton, useMenuState } from "reakit/Menu";
import ContextMenu from "~/components/ContextMenu";
import Template from "~/components/ContextMenu/Template";
import { navigateToSettings, logout } from "~/actions/definitions/navigation";
-import { changeTeam } from "~/actions/definitions/teams";
+import { createTeam, switchTeamList } from "~/actions/definitions/teams";
import useCurrentTeam from "~/hooks/useCurrentTeam";
import usePrevious from "~/hooks/usePrevious";
import useSessions from "~/hooks/useSessions";
@@ -34,7 +34,13 @@ const OrganizationMenu: React.FC = ({ children }) => {
// NOTE: it's useful to memoize on the team id and session because the action
// menu is not cached at all.
const actions = React.useMemo(() => {
- return [navigateToSettings, separator(), changeTeam, logout];
+ return [
+ ...switchTeamList,
+ createTeam,
+ separator(),
+ navigateToSettings,
+ logout,
+ ];
}, [team.id, sessions]);
return (
diff --git a/app/scenes/CollectionPermissions/index.tsx b/app/scenes/CollectionPermissions/index.tsx
index 627276016..3f2c9e950 100644
--- a/app/scenes/CollectionPermissions/index.tsx
+++ b/app/scenes/CollectionPermissions/index.tsx
@@ -213,7 +213,7 @@ function CollectionPermissions({ collectionId }: Props) {
{!collection.permission && (
{isEmpty && (
-
- Add specific access for individual groups and team members
-
+ Add additional access for individual members and groups
)}
{share?.published
? t("Anyone with the link can view this document")
- : t("Only team members with permission can view")}
+ : t("Only members with permission can view")}
{share?.lastAccessedAt && (
<>
.{" "}
@@ -185,7 +185,7 @@ function SharePopover({
) : (
- {t("Only team members with permission can view")}
+ {t("Only members with permission can view")}
)}
diff --git a/app/scenes/DocumentReparent.tsx b/app/scenes/DocumentReparent.tsx
index 61125dc97..080549392 100644
--- a/app/scenes/DocumentReparent.tsx
+++ b/app/scenes/DocumentReparent.tsx
@@ -71,7 +71,7 @@ function DocumentReparent({ collection, item, onSubmit, onCancel }: Props) {