diff --git a/public/locales/en/user.json b/public/locales/en/user.json index 99cbf356f..73537b863 100644 --- a/public/locales/en/user.json +++ b/public/locales/en/user.json @@ -105,7 +105,6 @@ "adult": "Adult", "avatar": "Avatar", "content_rating": "Content rating", - "content_rating_helper": "Content 12+ will not be available for kids profiles", "create": "Create profile", "delete": "Delete profile", "delete_description": "Permanently delete your profile along with all of your watch history and favorites.", diff --git a/public/locales/es/user.json b/public/locales/es/user.json index bcb7aeda5..301d9189c 100644 --- a/public/locales/es/user.json +++ b/public/locales/es/user.json @@ -106,7 +106,6 @@ "adult": "", "avatar": "", "content_rating": "", - "content_rating_helper": "", "create": "", "delete": "", "delete_description": "", diff --git a/src/components/ProfileBox/ProfileBox.module.scss b/src/components/ProfileBox/ProfileBox.module.scss index 80b06a529..c9f05f599 100644 --- a/src/components/ProfileBox/ProfileBox.module.scss +++ b/src/components/ProfileBox/ProfileBox.module.scss @@ -40,7 +40,7 @@ position: relative; transition: all 0.5s ease; } - .kids { + .kidsLabel { position: absolute; top: 5px; right: 5px; diff --git a/src/components/ProfileBox/ProfileBox.tsx b/src/components/ProfileBox/ProfileBox.tsx index 72b4bd15c..a2eedef81 100644 --- a/src/components/ProfileBox/ProfileBox.tsx +++ b/src/components/ProfileBox/ProfileBox.tsx @@ -21,7 +21,7 @@ const ProfileBox = ({ name, image, adult = true, editMode = false, onClick, onEd
- {!adult && Kids} + {!adult && Kids}
{editMode && (
diff --git a/src/components/Root/Root.tsx b/src/components/Root/Root.tsx index faa7b1b0d..beb9615ea 100644 --- a/src/components/Root/Root.tsx +++ b/src/components/Root/Root.tsx @@ -46,7 +46,7 @@ const Root: FC = () => { registerCustomScreens(); }, []); - const userData = useAccountStore((s) => ({ loading: s.loading, user: s.user })); + const userData = useAccountStore((s) => ({ loading: s.loading, user: s.user, profile: s.profile })); if (userData.user && !userData.loading && window.location.href.includes('#token')) { return ; // component instead of hook to prevent extra re-renders @@ -59,6 +59,10 @@ const Root: FC = () => { return ; } + if (!userData.profile) { + return ; + } + if (settingsQuery.isError) { return ( { const { data, isFetching } = useListProfiles(); const profiles = data?.responseData.collection; + if (!profiles?.length) { + unpersistProfile(); + navigate('/u/profiles'); + } + const selectProfile = useSelectProfile(); const onLogout = useCallback(async () => { diff --git a/src/containers/Profiles/Form.tsx b/src/containers/Profiles/Form.tsx index edc0d4bdc..e09cc5752 100644 --- a/src/containers/Profiles/Form.tsx +++ b/src/containers/Profiles/Form.tsx @@ -79,7 +79,6 @@ const Form = ({ initialValues, formHandler, setFullName, selectedAvatar, showCan required name="adult" label={t('profile.content_rating')} - helperText={t('profile.content_rating_helper')} className={styles.dropdown} options={options} value={values?.adult?.toString() || 'true'} diff --git a/src/hooks/useProfiles.ts b/src/hooks/useProfiles.ts index a916310d4..bf9dc0418 100644 --- a/src/hooks/useProfiles.ts +++ b/src/hooks/useProfiles.ts @@ -15,6 +15,11 @@ type ProfileSelectionPayload = { navigate: (path: string) => void; }; +export const unpersistProfile = () => { + persist.removeItem(PERSIST_PROFILE); + persist.removeItem(PERSIST_KEY_ACCOUNT); +}; + const handleProfileSelection = async ({ id, navigate }: ProfileSelectionPayload) => { try { useAccountStore.setState({ loading: true });