Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow internal users to create teams without trials #10430

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/ui/components/shared/NewWorkspaceModal/NewWorkspaceModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { isValidTeamName, validateEmail } from "ui/utils/helpers";

import { useConfirm } from "../Confirm";
import { TextInput } from "../Forms";
import Checkbox from "../Forms/Checkbox";
import Modal from "../NewModal";
import { WorkspaceMembers } from "../WorkspaceSettingsModal/WorkspaceSettingsModal";
import InvitationLink from "./InvitationLink";
Expand Down Expand Up @@ -149,9 +150,11 @@ type SlideBodyProps = PropsFromRedux & {
};

function SlideBody1({ hideModal, setNewWorkspace, setCurrent, total, current }: SlideBodyProps) {
const user = hooks.useGetUserInfo();
const [inputValue, setInputValue] = useState<string>("");
const [inputError, setInputError] = useState<string | null>(null);
const [allowNext, setAllowNext] = useState<boolean>(false);
const [createInternalTeam, setCreateInternalTeam] = useState(true);
const textInputRef = useRef<HTMLInputElement>(null);

const createNewWorkspace = hooks.useCreateNewWorkspace(onNewWorkspaceCompleted);
Expand Down Expand Up @@ -182,7 +185,7 @@ function SlideBody1({ hideModal, setNewWorkspace, setCurrent, total, current }:
createNewWorkspace({
variables: {
name: inputValue,
planKey: "team-v1",
planKey: user.internal && createInternalTeam ? "team-internal-v1" : "team-v1",
},
});
};
Expand All @@ -194,12 +197,19 @@ function SlideBody1({ hideModal, setNewWorkspace, setCurrent, total, current }:
return (
<>
<SlideContent headerText="Team name">
{/* <form onSubmit={handleSave} className="flex flex-col space-y-4"> */}
<div className="flex flex-col py-3 px-0.5">
<TextInput value={inputValue} onChange={onChange} ref={textInputRef} />
{inputError ? <div className="text-red-500">{inputError}</div> : null}
</div>
{/* </form> */}
{user.internal ? (
<div className="flex flex-row items-center gap-3 px-0.5">
<Checkbox
checked={createInternalTeam}
onChange={e => setCreateInternalTeam(e.currentTarget.checked)}
/>
Create Internal Team without Trial
</div>
) : null}
</SlideContent>
<div className="grid">
{isValidTeamName(inputValue) ? (
Expand Down
Loading