From 7298252945bcccc1c061a89473120be8ca56caaf Mon Sep 17 00:00:00 2001 From: Basile Spaenlehauer Date: Tue, 14 Jan 2025 09:17:01 +0100 Subject: [PATCH] fix: code smells (#603) * fix: code smells * chore: remove todo * fix: code smells --- src/components/ui/Navigator/CurrentItemNavigation.tsx | 7 ++++--- src/components/ui/Navigator/common/CenterAlignWrapper.tsx | 8 -------- src/components/ui/Navigator/common/constants.ts | 1 - .../account/settings/publicProfile/EditPublicProfile.tsx | 1 - src/modules/landing/home/UserStoryButton.tsx | 5 ++++- src/modules/landing/support/SmallTutorialCard.tsx | 4 ++-- 6 files changed, 10 insertions(+), 16 deletions(-) delete mode 100644 src/components/ui/Navigator/common/CenterAlignWrapper.tsx delete mode 100644 src/components/ui/Navigator/common/constants.ts diff --git a/src/components/ui/Navigator/CurrentItemNavigation.tsx b/src/components/ui/Navigator/CurrentItemNavigation.tsx index 0e599dc03..f3ef30537 100644 --- a/src/components/ui/Navigator/CurrentItemNavigation.tsx +++ b/src/components/ui/Navigator/CurrentItemNavigation.tsx @@ -1,8 +1,9 @@ +import { Stack } from '@mui/material'; + import { DiscriminatedItem, ItemType } from '@graasp/sdk'; import { TypographyLink } from '../TypographyLink.js'; import ItemMenu, { ItemMenuProps } from './ItemMenu.js'; -import CenterAlignWrapper from './common/CenterAlignWrapper.js'; export type CurrentItemProps = { item: DiscriminatedItem; @@ -24,7 +25,7 @@ export function CurrentItemNavigation({ showArrow, }: Readonly): JSX.Element | null { return ( - + )} - + ); } diff --git a/src/components/ui/Navigator/common/CenterAlignWrapper.tsx b/src/components/ui/Navigator/common/CenterAlignWrapper.tsx deleted file mode 100644 index 96cc24ca1..000000000 --- a/src/components/ui/Navigator/common/CenterAlignWrapper.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { Box, styled } from '@mui/material'; - -const CenterAlignWrapper = styled('div')({ - display: 'flex', - alignItems: 'center', - justifyContent: 'center', -}) as typeof Box; -export default CenterAlignWrapper; diff --git a/src/components/ui/Navigator/common/constants.ts b/src/components/ui/Navigator/common/constants.ts deleted file mode 100644 index 34ee57d5b..000000000 --- a/src/components/ui/Navigator/common/constants.ts +++ /dev/null @@ -1 +0,0 @@ -export const ITEM_NAME_MAX_LENGTH = 15; diff --git a/src/modules/account/settings/publicProfile/EditPublicProfile.tsx b/src/modules/account/settings/publicProfile/EditPublicProfile.tsx index 3e3d483f8..a30de8ee6 100644 --- a/src/modules/account/settings/publicProfile/EditPublicProfile.tsx +++ b/src/modules/account/settings/publicProfile/EditPublicProfile.tsx @@ -61,7 +61,6 @@ export function EditPublicProfile({ mode: 'onChange', defaultValues: { bio: profile?.bio, - // TODO: sanitize links twitterID: profile?.twitterID, facebookID: profile?.facebookID, linkedinID: profile?.linkedinID, diff --git a/src/modules/landing/home/UserStoryButton.tsx b/src/modules/landing/home/UserStoryButton.tsx index a1d9702ef..6c01866f9 100644 --- a/src/modules/landing/home/UserStoryButton.tsx +++ b/src/modules/landing/home/UserStoryButton.tsx @@ -18,7 +18,10 @@ const StyledAnchor = styled('a')(({ theme }) => ({ padding: theme.spacing(2, 4), })); -export function UserStoryButton({ id, text }: { id: string; text: string }) { +export function UserStoryButton({ + id, + text, +}: Readonly<{ id: string; text: string }>) { return ( {text} diff --git a/src/modules/landing/support/SmallTutorialCard.tsx b/src/modules/landing/support/SmallTutorialCard.tsx index bbf179cf3..04cb81138 100644 --- a/src/modules/landing/support/SmallTutorialCard.tsx +++ b/src/modules/landing/support/SmallTutorialCard.tsx @@ -8,11 +8,11 @@ export function SmallTutorialCard({ title, description, link, -}: { +}: Readonly<{ title: string; description: string; link: string; -}) { +}>) { const { t } = useTranslation(NS.Landing, { keyPrefix: 'SUPPORT.TUTORIALS' }); return (