Skip to content

Commit

Permalink
Merge pull request #1030 from internxt/release/BR-156-message-lets-up…
Browse files Browse the repository at this point in the history
…load-file-appears

[BR-156] bugfix/After uploading a file, the message "Let's get started...upload a file..." continues to appear
  • Loading branch information
sg-gs authored Feb 16, 2024
2 parents 130911c + 14e7d17 commit 6ed9390
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 13 deletions.
2 changes: 0 additions & 2 deletions src/app/auth/components/SignUp/SignUp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,6 @@ function SignUp(props: SignUpProps): JSX.Element {
? await doRegister(email, password, token)
: await updateInfo(email, password);

localStorageService.removeItem(STORAGE_KEYS.SIGN_UP_TUTORIAL_COMPLETED);

localStorageService.clear();

localStorageService.set('xToken', xToken);
Expand Down
6 changes: 4 additions & 2 deletions src/app/banners/BannerWrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import localStorageService, { STORAGE_KEYS } from '../core/services/local-storage.service';
import localStorageService from '../core/services/local-storage.service';
import { RootState } from '../store';
import { useAppSelector } from '../store/hooks';
import { PlanState } from '../store/slices/plan';
import { userSelectors } from '../store/slices/user';
import { useEffect, useState } from 'react';
import { useSelector } from 'react-redux';
import FeaturesBanner from './FeaturesBanner';
import { UserSettings } from '@internxt/sdk/dist/shared/types/userSettings';

const SHOW_BANNER_COOKIE_NAME = 'show_valentines_banner_sale';
const OFFER_OFF_DAY = new Date('2024-02-25');

const BannerWrapper = (): JSX.Element => {
const [showBanner, setShowBanner] = useState(false);
const user = useSelector((state: RootState) => state.user.user) as UserSettings;
const plan = useSelector<RootState, PlanState>((state) => state.plan);
const isTutorialCompleted = localStorageService.get(STORAGE_KEYS.SIGN_UP_TUTORIAL_COMPLETED);
const isTutorialCompleted = localStorageService.hasCompletedTutorial(user.userId);
const userPlan = plan.subscription?.type;
const isNewAccount = useAppSelector(userSelectors.hasSignedToday);
const isLocalStorage = localStorageService.get(SHOW_BANNER_COOKIE_NAME);
Expand Down
9 changes: 4 additions & 5 deletions src/app/core/services/local-storage.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { TeamsSettings } from '../../teams/types';
import { Workspace } from '../types';

export const STORAGE_KEYS = {
SIGN_UP_TUTORIAL_COMPLETED: 'signUpTutorialCompleted',
TUTORIAL_COMPLETED_ID: 'signUpTutorialCompleted',
};

function get(key: string): string | null {
Expand Down Expand Up @@ -38,8 +38,8 @@ function exists(key: string): boolean {
return !!localStorage.getItem(key);
}

function getIsSignUpTutorialCompleted(): boolean {
return localStorage.getItem(STORAGE_KEYS.SIGN_UP_TUTORIAL_COMPLETED) === 'true';
function hasCompletedTutorial(id?: string): boolean {
return localStorage.getItem(STORAGE_KEYS.TUTORIAL_COMPLETED_ID) === id;
}

function clear(): void {
Expand All @@ -51,7 +51,6 @@ function clear(): void {
localStorage.removeItem('xTokenTeam');
localStorage.removeItem('workspace');
localStorage.removeItem('language');
localStorage.removeItem(STORAGE_KEYS.SIGN_UP_TUTORIAL_COMPLETED);
localStorage.removeItem('showSummerBanner');
localStorage.removeItem('xInvitedToken');
localStorage.removeItem('xResourcesToken');
Expand All @@ -63,7 +62,7 @@ const localStorageService = {
getUser,
getTeams,
getWorkspace,
getIsSignUpTutorialCompleted,
hasCompletedTutorial,
removeItem,
exists,
clear,
Expand Down
5 changes: 3 additions & 2 deletions src/app/drive/components/DriveExplorer/DriveExplorer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ const DriveExplorer = (props: DriveExplorerProps): JSX.Element => {
filesOnTrashLength,
hasMoreFolders,
hasMoreFiles,
user,
} = props;
const dispatch = useAppDispatch();
const { translate } = useTranslationContext();
Expand Down Expand Up @@ -175,7 +176,7 @@ const DriveExplorer = (props: DriveExplorerProps): JSX.Element => {
const [currentTutorialStep, setCurrentTutorialStep] = useState(0);
const [showSecondTutorialStep, setShowSecondTutorialStep] = useState(false);
const stepOneTutorialRef = useRef(null);
const isSignUpTutorialCompleted = localStorageService.getIsSignUpTutorialCompleted();
const isSignUpTutorialCompleted = localStorageService.hasCompletedTutorial(user?.userId);
const successNotifications = useTaskManagerGetNotifications({
status: [TaskStatus.Success],
});
Expand All @@ -197,7 +198,7 @@ const DriveExplorer = (props: DriveExplorerProps): JSX.Element => {
{
onNextStepClicked: () => {
passToNextStep();
localStorageService.set(STORAGE_KEYS.SIGN_UP_TUTORIAL_COMPLETED, 'true');
localStorageService.set(STORAGE_KEYS.TUTORIAL_COMPLETED_ID, user?.userId as string);
},
},
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,6 @@ function ShareGuestSingUpView(): JSX.Element {
const { email, password, token } = formData;
const { xUser, xToken, mnemonic } = await doRegisterPreCreatedUser(email, password, invitationId ?? '', token);

localStorageService.removeItem(STORAGE_KEYS.SIGN_UP_TUTORIAL_COMPLETED);

localStorageService.clear();

localStorageService.set('xToken', xToken);
Expand Down

0 comments on commit 6ed9390

Please sign in to comment.