feat(frontend): remove create brain step in onboarding when share brain (#2791)

# Description

Please include a summary of the changes and the related issue. Please
also include relevant motivation and context.

## Checklist before requesting a review

Please delete options that are not relevant.

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented hard-to-understand areas
- [ ] I have ideally added tests that prove my fix is effective or that
my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged

## Screenshots (if appropriate):
This commit is contained in:
Antoine Dewez 2024-07-01 16:00:08 +02:00 committed by GitHub
parent e15e10f8f1
commit ce5fce4d63
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 3 deletions

View File

@ -9,6 +9,7 @@ import { useTranslation } from "react-i18next";
import { BrainRoleType } from "@/app/studio/[brainId]/BrainManagementTabs/components/PeopleTab/BrainUsers/types";
import { useSubscriptionApi } from "@/lib/api/subscription/useSubscriptionApi";
import { useBrainContext } from "@/lib/context/BrainProvider/hooks/useBrainContext";
import { useOnboardingContext } from "@/lib/context/OnboardingProvider/hooks/useOnboardingContext";
import { useToast } from "@/lib/hooks";
import { useEventTracking } from "@/services/analytics/june/useEventTracking";
@ -21,6 +22,7 @@ export const useInvitation = () => {
const [brainName, setBrainName] = useState<string>("");
const [role, setRole] = useState<BrainRoleType | undefined>();
const [isProcessingRequest, setIsProcessingRequest] = useState(false);
const { setIsBrainCreated } = useOnboardingContext();
const { publish } = useToast();
const { track } = useEventTracking();
@ -63,6 +65,7 @@ export const useInvitation = () => {
}, [brainId]);
const handleAccept = async () => {
setIsBrainCreated(true);
setIsProcessingRequest(true);
try {
await acceptInvitation(brainId);

View File

@ -14,8 +14,11 @@ import { SingleSelector } from "../ui/SingleSelector/SingleSelector";
import { TextInput } from "../ui/TextInput/TextInput";
export const OnboardingModal = (): JSX.Element => {
const { isOnboardingModalOpened, setIsOnboardingModalOpened } =
useOnboardingContext();
const {
isOnboardingModalOpened,
setIsOnboardingModalOpened,
isBrainCreated,
} = useOnboardingContext();
const methods = useForm<OnboardingProps>({
defaultValues: {
@ -46,7 +49,7 @@ export const OnboardingModal = (): JSX.Element => {
await updateUserIdentity({
username: methods.getValues("username"),
company: methods.getValues("companyName"),
onboarded: false,
onboarded: isBrainCreated,
company_size: methods.getValues("companySize"),
usage_purpose: methods.getValues("usagePurpose") as
| UsagePurpose