diff --git a/cypress/e2e/account/homePage.cy.ts b/cypress/e2e/account/homePage.cy.ts index 6322c33f5..eaefbcfd3 100644 --- a/cypress/e2e/account/homePage.cy.ts +++ b/cypress/e2e/account/homePage.cy.ts @@ -9,7 +9,6 @@ import { ACCOUNT_HOME_PATH } from '../../../src/config/paths'; import { AVATAR_UPLOAD_ICON_ID, AVATAR_UPLOAD_INPUT_ID, - CARD_TIP_ID, CROP_MODAL_CONFIRM_BUTTON_ID, MEMBER_AVATAR_IMAGE_ID, MEMBER_CREATED_AT_ID, @@ -81,8 +80,6 @@ describe('Upload Avatar', () => { }); it('Upload a new thumbnail', () => { - // at first card element should exist - cy.get(`#${CARD_TIP_ID}`).should('exist'); // select the avatar image cy.get(`#${AVATAR_UPLOAD_INPUT_ID}`).selectFile( THUMBNAIL_MEDIUM_PATH, @@ -95,8 +92,6 @@ describe('Upload Avatar', () => { cy.get(`#${MEMBER_AVATAR_IMAGE_ID}`).should('be.visible'); }); cy.wait('@uploadAvatar'); - // card element should not exist - cy.get(`#${CARD_TIP_ID}`).should('not.exist'); }); }); @@ -108,7 +103,6 @@ describe('Image is not set', () => { it('Image is not set', () => { cy.wait('@getCurrentMember'); - cy.get(`#${CARD_TIP_ID}`).should('exist'); // uploader icon should be visible cy.get(`#${AVATAR_UPLOAD_ICON_ID}`).should('be.visible'); // image display element should not exist diff --git a/src/config/selectors.ts b/src/config/selectors.ts index 5d646185d..56bd94949 100644 --- a/src/config/selectors.ts +++ b/src/config/selectors.ts @@ -27,7 +27,6 @@ export const MEMBER_STORAGE_PARENT_FOLDER_ID = 'storage-parent-folder'; export const getCellId = (cellName: string, fileId: string): string => `${cellName}-${fileId}`; -export const CARD_TIP_ID = 'tip-card'; export const MEMBER_AVATAR_WRAPPER_ID = 'member-avatar'; export const MEMBER_AVATAR_IMAGE_ID = 'member-avatar-image'; export const MEMBER_CREATED_AT_ID = 'member-created-at'; diff --git a/src/locales/de/player.json b/src/locales/de/player.json index 99bd51d77..22170367e 100644 --- a/src/locales/de/player.json +++ b/src/locales/de/player.json @@ -31,8 +31,6 @@ "MAP_BUTTON_TEXT": "{{name}} auf der Karte anzeigen", "MAP_BUTTON_DISABLED_TEXT": "Dieser Artikel hat keine Geolokalisierung", "FROM_SHORTCUT_BUTTON_TEXT": "Zurück zu {{name}}", - "GUEST_LIMITATION_TEXT": "Sie verwenden Graasp derzeit mit dem Gastkonto <1>{{name}}. Um alle Funktionen von Graasp nutzen zu können, müssen Sie sich abmelden und ein Graasp-Konto erstellen.", - "GUEST_SIGN_OUT_BUTTON": "Melden Sie sich ab und erstellen Sie ein Graasp-Konto", "ENROLL_SCREEN_TITLE": "Melden Sie sich bei {{name}} an", "ENROLL_BUTTON_TEXT": "Einschreiben", "REQUEST_ACCESS_PENDING_TITLE": "Ihre Zugriffsanforderung steht noch aus", diff --git a/src/locales/en/player.json b/src/locales/en/player.json index 8368fe5b2..54114986b 100644 --- a/src/locales/en/player.json +++ b/src/locales/en/player.json @@ -13,7 +13,6 @@ "RECENT_ITEMS_TITLE": "Most Recent Items", "DRAWER_ARIAL_LABEL": "Open drawer", "ERROR_FETCHING_ITEM": "There was an error fetching the requested item", - "SIGN_IN_BUTTON_TEXT": "Sign In", "FALLBACK_TITLE": "Oops", "FALLBACK_TEXT": "Something went wrong. Please try again. If the issue persists contact us.", @@ -32,8 +31,6 @@ "MAP_BUTTON_TEXT": "See {{name}} on Map", "MAP_BUTTON_DISABLED_TEXT": "This item does not have a geolocation", "FROM_SHORTCUT_BUTTON_TEXT": "Back to {{name}}", - "GUEST_LIMITATION_TEXT": "You are currently using Graasp with the guest account <1>{{name}}. In order to use all features of Graasp, you have to log out and create a Graasp account.", - "GUEST_SIGN_OUT_BUTTON": "Log out and Create a Graasp account", "ENROLL_SCREEN_TITLE": "Enroll to {{name}}", "ENROLL_BUTTON_TEXT": "Enroll", "REQUEST_ACCESS_PENDING_TITLE": "Your access request is pending", diff --git a/src/locales/fr/player.json b/src/locales/fr/player.json index a63822906..adc39bf36 100644 --- a/src/locales/fr/player.json +++ b/src/locales/fr/player.json @@ -31,8 +31,6 @@ "MAP_BUTTON_TEXT": "Voir {{name}} sur la Carte", "MAP_BUTTON_DISABLED_TEXT": "Cet élément n'a pas de localisation", "FROM_SHORTCUT_BUTTON_TEXT": "Retourner vers {{name}}", - "GUEST_LIMITATION_TEXT": "Vous utilisez actuellement Graasp avec le compte invité <1>{{name}}. Pour pouvoir utiliser toutes les fonctionnalités de Graasp, vous devez vous déconnecter et créer un compte Graasp.", - "GUEST_SIGN_OUT_BUTTON": "Déconnectez-vous et créez un compte Graasp", "ENROLL_SCREEN_TITLE": "Inscrivez-vous à {{name}}", "ENROLL_BUTTON_TEXT": "S'inscrire", "REQUEST_ACCESS_PENDING_TITLE": "Votre demande d'accès est en attente", diff --git a/src/locales/it/player.json b/src/locales/it/player.json index 4d4beb153..db87a2ac2 100644 --- a/src/locales/it/player.json +++ b/src/locales/it/player.json @@ -31,8 +31,6 @@ "MAP_BUTTON_TEXT": "Vedi {{name}} sulla mappa", "MAP_BUTTON_DISABLED_TEXT": "Questo articolo non ha una geolocalizzazione", "FROM_SHORTCUT_BUTTON_TEXT": "Torna a {{nome}}", - "GUEST_LIMITATION_TEXT": "Al momento stai utilizzando Graasp con l'account ospite <1>{{name}}. Per utilizzare tutte le funzionalità di Graasp, devi effettuare il logout e creare un account Graasp.", - "GUEST_SIGN_OUT_BUTTON": "Esci e crea un account Graasp", "ENROLL_SCREEN_TITLE": "Iscriviti a {{name}}", "ENROLL_BUTTON_TEXT": "Iscriversi", "REQUEST_ACCESS_PENDING_TITLE": "La tua richiesta di accesso è in sospeso", diff --git a/src/modules/account/home/TipCard.tsx b/src/modules/account/home/TipCard.tsx deleted file mode 100644 index 4b41ccb89..000000000 --- a/src/modules/account/home/TipCard.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import { useTranslation } from 'react-i18next'; - -import { - Box, - Card, - CardContent, - CardHeader, - Grid2 as Grid, - Typography, -} from '@mui/material'; - -import { ImageUp } from 'lucide-react'; - -import { NS } from '@/config/constants'; -import { hooks } from '@/config/queryClient'; -import { CARD_TIP_ID } from '@/config/selectors'; - -export function TipCard(): JSX.Element | null { - const { t } = useTranslation(NS.Account); - - const { data: member } = hooks.useCurrentMember(); - - const { data: avatarUrl } = hooks.useAvatarUrl({ - id: member?.id, - }); - - if (avatarUrl) { - return null; - } - return ( - - - - - - {t('PERSONALIZATION_TITLE')} - - } - /> - - - {t('PERSONALIZATION_INFORMATION')} - - - - - - ); -} diff --git a/src/modules/analytics/context/DataProvider.tsx b/src/modules/analytics/context/DataProvider.tsx index 63c3b3fa8..5da629322 100644 --- a/src/modules/analytics/context/DataProvider.tsx +++ b/src/modules/analytics/context/DataProvider.tsx @@ -157,6 +157,8 @@ const DataProvider = ({ children, itemId }: Props): JSX.Element => { const { data: itemChildren } = hooks.useChildren(itemId, undefined, { enabled: itemData?.type === ItemType.FOLDER, }); + // TODO: fix issue by refactoring code depending on this + // eslint-disable-next-line react-hooks/exhaustive-deps const descendantApps = itemData?.type === ItemType.APP ? [itemData, ...appDescendants] @@ -164,16 +166,24 @@ const DataProvider = ({ children, itemId }: Props): JSX.Element => { useEffect(() => { if (itemIsError) { + // TODO: fix this issue + // eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect setError(true); } }, [itemIsError]); useEffect(() => { if (enabledArray[Context.Builder]) { + // TODO: fix this issue + // eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect setIsLoading(builderIsLoading); } else if (enabledArray[Context.Player]) { + // TODO: fix this issue + // eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect setIsLoading(playerIsLoading); } else if (enabledArray[Context.Library]) { + // TODO: fix this issue + // eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect setIsLoading(explorerIsLoading); } }, [ @@ -189,6 +199,8 @@ const DataProvider = ({ children, itemId }: Props): JSX.Element => { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore if (!enabledArray[view]) { + // TODO: fix this issue + // eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect setEnabledArray({ ...enabledArray, [view]: true }); } }, [view, enabledArray]); @@ -199,8 +211,14 @@ const DataProvider = ({ children, itemId }: Props): JSX.Element => { view === Context.Builder && actions.length !== builderData?.actions?.length ) { + // TODO: fix this issue + // eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect setActions(builderData?.actions ?? []); + // TODO: fix this issue + // eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect setAllMembers(builderData?.members ?? []); + // TODO: fix this issue + // eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect setError(builderIsError); } }, [builderData, view, actions, builderIsError]); @@ -211,8 +229,14 @@ const DataProvider = ({ children, itemId }: Props): JSX.Element => { view === Context.Player && actions.length !== playerData?.actions?.length ) { + // TODO: fix this issue + // eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect setActions(playerData?.actions ?? []); + // TODO: fix this issue + // eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect setAllMembers(playerData?.members ?? []); + // TODO: fix this issue + // eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect setError(playerIsError); } }, [playerData, view, actions, playerIsError]); @@ -223,8 +247,14 @@ const DataProvider = ({ children, itemId }: Props): JSX.Element => { view === Context.Library && actions.length !== explorerData?.actions?.length ) { + // TODO: fix this issue + // eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect setActions(explorerData?.actions ?? []); + // TODO: fix this issue + // eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect setAllMembers(explorerData?.members ?? []); + // TODO: fix this issue + // eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect setError(explorerIsError); } }, [explorerData, view, actions, explorerIsError]); diff --git a/src/modules/player/contexts/LayoutContext.tsx b/src/modules/player/contexts/LayoutContext.tsx index 362935aa0..e8ace123a 100644 --- a/src/modules/player/contexts/LayoutContext.tsx +++ b/src/modules/player/contexts/LayoutContext.tsx @@ -54,6 +54,8 @@ export const LayoutContextProvider = ({ children }: Props): JSX.Element => { const [isFullscreen, setIsFullscreen] = useState(false); useEffect(() => { + // TODO: fix this issue + // eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect setIsPinnedOpen(!isMobile); }, [isMobile]); diff --git a/src/routes/account/index.tsx b/src/routes/account/index.tsx index 228ae2405..48d9eee97 100644 --- a/src/routes/account/index.tsx +++ b/src/routes/account/index.tsx @@ -3,7 +3,6 @@ import { Divider, Stack } from '@mui/material'; import { createFileRoute } from '@tanstack/react-router'; import { MemberCard } from '~account/home/MemberCard'; -import { TipCard } from '~account/home/TipCard'; import { RecentItems } from '~account/home/recentItems/RecentItems'; export const Route = createFileRoute('/account/')({ @@ -14,7 +13,6 @@ function HomeRoute() { return ( - diff --git a/src/routes/player/index.tsx b/src/routes/player/index.tsx index 2d76d8380..f5f17c648 100644 --- a/src/routes/player/index.tsx +++ b/src/routes/player/index.tsx @@ -1,74 +1,9 @@ -import { Trans, useTranslation } from 'react-i18next'; - -import { - Alert, - Box, - Button, - Container, - Stack, - Typography, -} from '@mui/material'; - -import { AccountType } from '@graasp/sdk'; - import { createFileRoute, redirect } from '@tanstack/react-router'; -import { ClipboardPenIcon } from 'lucide-react'; - -import { useAuth } from '@/AuthContext'; -import { NS } from '@/config/constants'; -import { LOG_IN_PAGE_PATH } from '@/config/paths'; -import { PREVENT_GUEST_MESSAGE_ID } from '@/config/selectors'; export const Route = createFileRoute('/player/')({ - beforeLoad: ({ context }) => { - // check if the user is authenticated. - // if not, redirect to `/auth/login` so the user can log in their account - if (!context.auth.isAuthenticated) { - throw redirect({ - to: LOG_IN_PAGE_PATH, - search: { - url: window.location.href, - }, - }); - } + beforeLoad: () => { + throw redirect({ + to: '/account', + }); }, - component: HomePage, }); - -function HomePage(): JSX.Element { - const { isAuthenticated, user, logout } = useAuth(); - const { t } = useTranslation(NS.Player); - if (isAuthenticated && user.type === AccountType.Guest) { - return ( - - - - - { - }} - /> - } - - - - - - - - ); - } - return ; -}