diff --git a/app/scenes/Login/Login.tsx b/app/scenes/Login/Login.tsx index f41ac04f4a..a4f03a4ca6 100644 --- a/app/scenes/Login/Login.tsx +++ b/app/scenes/Login/Login.tsx @@ -38,6 +38,7 @@ import { BackButton } from "./components/BackButton"; import { Background } from "./components/Background"; import { Centered } from "./components/Centered"; import { Notices } from "./components/Notices"; +import WorkspaceSetup from "./components/WorkspaceSetup"; import { getRedirectUrl, navigateToSubdomain } from "./urls"; type Props = { @@ -191,12 +192,18 @@ function Login({ children, onBack }: Props) { ); } + const firstRun = + config.providers.length === 0 && !isCloudHosted && !config.name; const hasMultipleProviders = config.providers.length > 1; const defaultProvider = find( config.providers, (provider) => provider.id === auth.lastSignedIn && !isCreate ); + if (firstRun) { + return ; + } + if (emailLinkSentTo) { return ( diff --git a/app/scenes/Login/components/WorkspaceSetup.tsx b/app/scenes/Login/components/WorkspaceSetup.tsx new file mode 100644 index 0000000000..dbda31f535 --- /dev/null +++ b/app/scenes/Login/components/WorkspaceSetup.tsx @@ -0,0 +1,77 @@ +import * as React from "react"; +import { useTranslation } from "react-i18next"; +import styled from "styled-components"; +import { s } from "@shared/styles"; +import ButtonLarge from "~/components/ButtonLarge"; +import ChangeLanguage from "~/components/ChangeLanguage"; +import Flex from "~/components/Flex"; +import Heading from "~/components/Heading"; +import Input from "~/components/Input"; +import Text from "~/components/Text"; +import { detectLanguage } from "~/utils/language"; +import { BackButton } from "./BackButton"; +import { Background } from "./Background"; +import { Centered } from "./Centered"; + +const WorkspaceSetup = ({ onBack }: { onBack?: () => void }) => { + const { t } = useTranslation(); + return ( + + + + + {t("Create workspace")} + + {t( + "Setup your workspace by providing a name and details for admin login. You can change these later." + )} + + + + + + + + {t("Continue")} → + + + + ); +}; + +const StyledHeading = styled(Heading)` + margin: 0; +`; + +const Content = styled(Text)` + color: ${s("textSecondary")}; + text-align: center; + margin-top: -8px; +`; + +export default WorkspaceSetup; diff --git a/server/scripts/seed.ts b/server/scripts/seed.ts deleted file mode 100644 index 1925ccef12..0000000000 --- a/server/scripts/seed.ts +++ /dev/null @@ -1,54 +0,0 @@ -import "./bootstrap"; -import { UserRole } from "@shared/types"; -import { parseEmail } from "@shared/utils/email"; -import teamCreator from "@server/commands/teamCreator"; -import env from "@server/env"; -import { Team, User } from "@server/models"; -import { sequelize } from "@server/storage/database"; - -const email = process.argv[2]; - -export default async function main(exit = false) { - const teamCount = await Team.count(); - if (teamCount === 0) { - const name = parseEmail(email).local; - const user = await sequelize.transaction(async (transaction) => { - const team = await teamCreator({ - name: "Wiki", - subdomain: "wiki", - authenticationProviders: [], - transaction, - ip: "127.0.0.1", - }); - - return await User.create( - { - teamId: team.id, - name, - email, - role: UserRole.Admin, - }, - { - transaction, - } - ); - }); - - console.log( - "email", - `✅ Seed done – sign-in link: ${ - env.URL - }/auth/email.callback?token=${user.getEmailSigninToken()}` - ); - } else { - console.log("Team already exists, aborting"); - } - - if (exit) { - process.exit(0); - } -} - -if (process.env.NODE_ENV !== "test") { - void main(true); -} diff --git a/shared/i18n/locales/en_US/translation.json b/shared/i18n/locales/en_US/translation.json index 9f6c7956fc..f808c62e1b 100644 --- a/shared/i18n/locales/en_US/translation.json +++ b/shared/i18n/locales/en_US/translation.json @@ -830,6 +830,11 @@ "Sorry, an unknown error occurred.": "Sorry, an unknown error occurred.", "Choose a workspace": "Choose a workspace", "Choose an {{ appName }} workspace or login to continue connecting this app": "Choose an {{ appName }} workspace or login to continue connecting this app", + "Create workspace": "Create workspace", + "Setup your workspace by providing a name and details for admin login. You can change these later.": "Setup your workspace by providing a name and details for admin login. You can change these later.", + "Workspace name": "Workspace name", + "Admin name": "Admin name", + "Admin email": "Admin email", "Login": "Login", "Error": "Error", "Failed to load configuration.": "Failed to load configuration.", @@ -1134,7 +1139,6 @@ "Confirmation code": "Confirmation code", "Deleting the <1>{{workspaceName}} workspace will destroy all collections, documents, users, and associated data. You will be immediately logged out of {{appName}}.": "Deleting the <1>{{workspaceName}} workspace will destroy all collections, documents, users, and associated data. You will be immediately logged out of {{appName}}.", "Please note that workspaces are completely separated. They can have a different domain, settings, users, and billing.": "Please note that workspaces are completely separated. They can have a different domain, settings, users, and billing.", - "Workspace name": "Workspace name", "You are creating a new workspace using your current account — {{email}}": "You are creating a new workspace using your current account — {{email}}", "To create a workspace under another email please sign up from the homepage": "To create a workspace under another email please sign up from the homepage", "Trash emptied": "Trash emptied",