mirror of
https://github.com/StanGirard/quivr.git
synced 2024-09-11 13:15:41 +03:00
fix(frontend): onboarding bug (#2655)
# 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:
parent
9d1b2911a5
commit
e631fa897a
@ -11,6 +11,7 @@ import { UploadDocumentModal } from "@/lib/components/UploadDocumentModal/Upload
|
||||
import { MessageInfoBox } from "@/lib/components/ui/MessageInfoBox/MessageInfoBox";
|
||||
import QuivrButton from "@/lib/components/ui/QuivrButton/QuivrButton";
|
||||
import { SearchBar } from "@/lib/components/ui/SearchBar/SearchBar";
|
||||
import { useOnboardingContext } from "@/lib/context/OnboardingProvider/hooks/useOnboardingContext";
|
||||
import { useSupabase } from "@/lib/context/SupabaseProvider";
|
||||
import { useUserSettingsContext } from "@/lib/context/UserSettingsProvider/hooks/useUserSettingsContext";
|
||||
import { useUserData } from "@/lib/hooks/useUserData";
|
||||
@ -27,6 +28,7 @@ const Search = (): JSX.Element => {
|
||||
useBrainCreationContext();
|
||||
const { userIdentityData } = useUserData();
|
||||
const { isDarkMode } = useUserSettingsContext();
|
||||
const { isBrainCreated } = useOnboardingContext();
|
||||
|
||||
useEffect(() => {
|
||||
if (userIdentityData) {
|
||||
@ -84,6 +86,7 @@ const Search = (): JSX.Element => {
|
||||
</div>
|
||||
{!isBrainCreationModalOpened &&
|
||||
!userIdentityData?.onboarded &&
|
||||
!isBrainCreated &&
|
||||
!!isUserDataFetched && (
|
||||
<div className={styles.onboarding_overlay}>
|
||||
<div className={styles.main_message_wrapper}>
|
||||
|
@ -7,6 +7,7 @@ import QuivrButton from "@/lib/components/ui/QuivrButton/QuivrButton";
|
||||
import { TextAreaInput } from "@/lib/components/ui/TextAreaInput/TextAreaInput";
|
||||
import { TextInput } from "@/lib/components/ui/TextInput/TextInput";
|
||||
import { useKnowledgeToFeedContext } from "@/lib/context/KnowledgeToFeedProvider/hooks/useKnowledgeToFeedContext";
|
||||
import { useOnboardingContext } from "@/lib/context/OnboardingProvider/hooks/useOnboardingContext";
|
||||
import { useUserData } from "@/lib/hooks/useUserData";
|
||||
|
||||
import { BrainRecapCard } from "./BrainRecapCard/BrainRecapCard";
|
||||
@ -24,6 +25,7 @@ export const BrainRecapStep = (): JSX.Element => {
|
||||
const { updateUserIdentity } = useUserApi();
|
||||
const { userIdentityData } = useUserData();
|
||||
const { openedConnections } = useFromConnectionsContext();
|
||||
const { setIsBrainCreated } = useOnboardingContext();
|
||||
|
||||
const feed = async (): Promise<void> => {
|
||||
if (!userIdentityData?.onboarded) {
|
||||
@ -120,9 +122,12 @@ export const BrainRecapStep = (): JSX.Element => {
|
||||
iconName="add"
|
||||
onClick={async () => {
|
||||
await feed();
|
||||
setIsBrainCreated(true);
|
||||
}}
|
||||
disabled={
|
||||
knowledgeToFeed.length === 0 && !userIdentityData?.onboarded
|
||||
knowledgeToFeed.length === 0 &&
|
||||
!userIdentityData?.onboarded &&
|
||||
!openedConnections.length
|
||||
}
|
||||
isLoading={creating}
|
||||
important={true}
|
||||
|
@ -8,6 +8,10 @@
|
||||
padding-inline: Spacings.$spacing08;
|
||||
height: 100%;
|
||||
|
||||
.tutorial {
|
||||
padding-bottom: Spacings.$spacing05;
|
||||
}
|
||||
|
||||
.feed_brain {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
@ -45,11 +45,13 @@ export const FeedBrainStep = (): JSX.Element => {
|
||||
const renderFeedBrain = () => (
|
||||
<>
|
||||
{!userIdentityData?.onboarded && (
|
||||
<MessageInfoBox type="tutorial">
|
||||
<span>
|
||||
Upload documents or add URLs to add knowledges to your brain.
|
||||
</span>
|
||||
</MessageInfoBox>
|
||||
<div className={styles.tutorial}>
|
||||
<MessageInfoBox type="tutorial">
|
||||
<span>
|
||||
Upload documents or add URLs to add knowledges to your brain.
|
||||
</span>
|
||||
</MessageInfoBox>
|
||||
</div>
|
||||
)}
|
||||
<div className={styles.feed_brain}>
|
||||
<span className={styles.title}>Feed your brain</span>
|
||||
|
@ -5,6 +5,8 @@ import { useUserData } from "@/lib/hooks/useUserData";
|
||||
export type OnboardingContextType = {
|
||||
isOnboardingModalOpened: boolean;
|
||||
setIsOnboardingModalOpened: React.Dispatch<React.SetStateAction<boolean>>;
|
||||
isBrainCreated: boolean;
|
||||
setIsBrainCreated: React.Dispatch<React.SetStateAction<boolean>>;
|
||||
};
|
||||
|
||||
export const OnboardingContext = createContext<
|
||||
@ -17,6 +19,7 @@ export const OnboardingProvider = ({
|
||||
children: React.ReactNode;
|
||||
}): JSX.Element => {
|
||||
const [isOnboardingModalOpened, setIsOnboardingModalOpened] = useState(false);
|
||||
const [isBrainCreated, setIsBrainCreated] = useState(false);
|
||||
const { userIdentityData } = useUserData();
|
||||
|
||||
useEffect(() => {
|
||||
@ -30,6 +33,8 @@ export const OnboardingProvider = ({
|
||||
value={{
|
||||
isOnboardingModalOpened,
|
||||
setIsOnboardingModalOpened,
|
||||
isBrainCreated,
|
||||
setIsBrainCreated,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
|
Loading…
Reference in New Issue
Block a user