Skip to content

Commit

Permalink
feat(frontend): remove create brain step in onboarding when share bra…
Browse files Browse the repository at this point in the history
…in (#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):
  • Loading branch information
Zewed authored Jul 1, 2024
1 parent e15e10f commit ce5fce4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions frontend/app/invitation/[brainId]/hooks/useInvitation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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();
Expand Down Expand Up @@ -63,6 +65,7 @@ export const useInvitation = () => {
}, [brainId]);

const handleAccept = async () => {
setIsBrainCreated(true);
setIsProcessingRequest(true);
try {
await acceptInvitation(brainId);
Expand Down
9 changes: 6 additions & 3 deletions frontend/lib/components/OnboardingModal/OnboardingModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ce5fce4

Please sign in to comment.