Skip to content

Commit

Permalink
fix: translations, profiles refetch
Browse files Browse the repository at this point in the history
  • Loading branch information
naumovski-filip committed Sep 6, 2023
1 parent 662cc18 commit fa22d1c
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 15 deletions.
3 changes: 1 addition & 2 deletions public/locales/en/user.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"cancel": "Cancel",
"confirm_password": "Confirm password",
"continue": "Continue",
"delete": "Delete",
"delete_account": {
"body": "Permanently delete your account and all of your content.",
"error": "An error occurred while deleting your account. Please try again.",
Expand Down Expand Up @@ -123,8 +124,6 @@
"delete_main": "The main profile cannot be deleted because it’s linked to your account's watch history and favorites.",
"description": "Profiles allow you to watch content and assemble your own personal collection of favorites.",
"form_error": "Something went wrong. Please try again later.",
"greeting": "Howdy",
"greeting_with_name": "Howdy, {{name}}",
"info": "Profile info",
"kids": "Kids",
"name": "User name",
Expand Down
3 changes: 1 addition & 2 deletions public/locales/es/user.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"cancel": "Cancelar",
"confirm_password": "Confirmar contraseña",
"continue": "Continuar",
"delete": "",
"delete_account": {
"body": "Elimine permanentemente su cuenta y todo su contenido.",
"error": "Ocurrió un error al eliminar su cuenta. Inténtalo de nuevo.",
Expand Down Expand Up @@ -124,8 +125,6 @@
"delete_main": "",
"description": "",
"form_error": "",
"greeting": "",
"greeting_with_name": "",
"info": "",
"kids": "",
"name": "",
Expand Down
3 changes: 1 addition & 2 deletions src/components/ProfileBox/ProfileBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ type Props = {
selected?: boolean;
};

const ProfileBox = ({ name, image, adult = true, editMode = false, onClick, onEdit, selected = false }: Props) => {
const ProfileBox = ({ name, image, editMode = false, onClick, onEdit, selected = false }: Props) => {
return (
<div className={styles.wrapper}>
<div className={classNames(styles.inner, selected && styles.selected)}>
<div onClick={onClick} className={styles.box}>
<img className={styles.image} src={image} alt="" />
{!adult && <span className={styles.kidsLabel}>Kids</span>}
</div>
{editMode && (
<IconButton aria-label="edit-profile-button" onClick={onEdit} className={styles.overlay}>
Expand Down
2 changes: 1 addition & 1 deletion src/containers/Layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const Layout = () => {
shallow,
);
const { updateSearchQuery, resetSearchQuery } = useSearchQueryUpdater();
const user = useAccountStore(({ user }) => user, shallow);
const user = useAccountStore(({ user }) => user);
const { profile } = useProfileStore();
const isLoggedIn = !!user;

Expand Down
4 changes: 2 additions & 2 deletions src/containers/Profiles/DeleteProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ const DeleteProfile = () => {
<p>{t('profile.delete_confirmation')}</p>
</div>
<div className={styles.deleteButtons}>
<Button label="Delete" color="delete" variant="contained" onClick={deleteHandler} />
<Button label="Cancel" variant="outlined" onClick={closeHandler} />
<Button label={t('account.delete')} color="delete" variant="contained" onClick={deleteHandler} />
<Button label={t('account.cancel')} variant="outlined" onClick={closeHandler} />
</div>
</div>
</Dialog>
Expand Down
2 changes: 1 addition & 1 deletion src/containers/Profiles/EditProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const EditProfile = ({ contained = false }: EditProfileProps) => {
<div className={styles.panelHeader}>
<h3>{t('profile.delete')}</h3>
</div>
<div className={profileStyles.profileInfo}>{t(`profile.delete_${profileDetails?.default ? 'main' : 'description'}`)}</div>
<div className={profileStyles.profileInfo}>{t(profileDetails?.default ? 'profile.delete_main' : 'profile.delete_description')}</div>
{!profileDetails?.default && (
<Button
onClick={() => navigate(addQueryParam(location, 'action', 'delete-profile'))}
Expand Down
10 changes: 5 additions & 5 deletions src/containers/Profiles/Profiles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ const Profiles = ({ editMode = false }: Props) => {
const breakpoint: Breakpoint = useBreakpoint();
const isMobile = breakpoint === Breakpoint.xs;

const { data, isLoading, isFetching, isError, refetch } = useListProfiles();
const { data, isLoading, isFetching, isError } = useListProfiles({
refetchOnMount: true,
staleTime: 0,
});

const activeProfiles = data?.responseData.collection.length || 0;
const canAddNew = activeProfiles < MAX_PROFILES;

useEffect(() => {
refetch();
}, [refetch]);

useEffect(() => {
if (!profilesEnabled || !user?.id || isError) {
navigate('/');
Expand Down

0 comments on commit fa22d1c

Please sign in to comment.