Skip to content

Commit

Permalink
fix: code smells (#497)
Browse files Browse the repository at this point in the history
* fix: code smells

* fix: revert change to use isValid from react-hook-form
  • Loading branch information
spaenleh authored Nov 28, 2024
1 parent c623f4b commit 2408533
Show file tree
Hide file tree
Showing 26 changed files with 123 additions and 433 deletions.
2 changes: 1 addition & 1 deletion src/components/layout/BorderedSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function BorderedSection({
title,
topActions,
children,
}: BorderedSectionProps): JSX.Element {
}: Readonly<BorderedSectionProps>): JSX.Element {
return (
<RoundedStack id={id}>
<Stack direction="row" justifyContent="space-between">
Expand Down
39 changes: 20 additions & 19 deletions src/components/layout/CenteredContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,25 @@ import { Container, Stack } from '@mui/material';

import { DEFAULT_BACKGROUND_COLOR } from '@graasp/ui';

const CenteredContainer = ({
export function CenteredContainer({
children,
}: {
}: Readonly<{
children: ReactNode;
}): JSX.Element => (
<Stack height="100vh" bgcolor={DEFAULT_BACKGROUND_COLOR}>
<Container sx={{ my: 5, height: '100%' }}>
<Stack
height="100%"
direction="column"
alignItems="center"
justifyContent="center"
flexGrow={1}
gap={2}
>
{children}
</Stack>
</Container>
</Stack>
);
export default CenteredContainer;
}>): JSX.Element {
return (
<Stack height="100vh" bgcolor={DEFAULT_BACKGROUND_COLOR}>
<Container sx={{ my: 5, height: '100%' }}>
<Stack
height="100%"
direction="column"
alignItems="center"
justifyContent="center"
flexGrow={1}
gap={2}
>
{children}
</Stack>
</Container>
</Stack>
);
}
1 change: 0 additions & 1 deletion src/config/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ export const USER_SWITCH_ID = 'userSwitch';
export const SUCCESS_CONTENT_ID = 'successContent';
export const BACK_BUTTON_ID = 'backButtonId';
export const RESEND_EMAIL_BUTTON_ID = 'resendEmailButton';
export const buildMemberMenuItemId = (id: string) => `memberMenuItemId-${id}`;
export const PASSWORD_SUCCESS_ALERT = 'passwordSuccessAlert';

export const PLATFORM_ADVERTISEMENT_CONTAINER_ID =
Expand Down
245 changes: 0 additions & 245 deletions src/modules/auth/components/requestPasswordReset/ResetPassword.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion src/modules/player/Chatbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const {
type Props = {
item: DiscriminatedItem;
};
// todo: add chatbox in the project

const Chatbox = ({ item }: Props): JSX.Element => {
const { data: messages, isLoading: isChatLoading } = useItemChat(item.id);
const { data: itemPermissions, isLoading: isLoadingItemPermissions } =
Expand Down
2 changes: 1 addition & 1 deletion src/modules/player/ItemNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { NS } from '@/config/constants.ts';
import { axios, hooks } from '@/config/queryClient';
import { MAIN_MENU_ID, TREE_VIEW_ID } from '@/config/selectors';

import LoadingTree from './tree/LoadingTree.tsx';
import { LoadingTree } from './tree/LoadingTree.tsx';
import { TreeView } from './tree/TreeView.tsx';
import { combineUuids, shuffleAllButLastItemInArray } from './utils/shuffle.ts';

Expand Down
29 changes: 0 additions & 29 deletions src/modules/player/config/selectors.ts

This file was deleted.

6 changes: 2 additions & 4 deletions src/modules/player/errors/FallbackComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Box, Stack, Typography } from '@mui/material';
import { ButtonLink } from '@/components/ui/ButtonLink';
import { NS } from '@/config/constants';

const FallbackComponent = (): JSX.Element => {
export function FallbackComponent(): JSX.Element {
const { t: translateBuilder } = useTranslation(NS.Player);

return (
Expand Down Expand Up @@ -41,6 +41,4 @@ const FallbackComponent = (): JSX.Element => {
/>
</Stack>
);
};

export default FallbackComponent;
}
5 changes: 3 additions & 2 deletions src/modules/player/errors/NetworkErrorAlert.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useTranslation } from 'react-i18next';

import Refresh from '@mui/icons-material/Refresh';
import {
Alert,
AlertTitle,
Expand All @@ -10,6 +9,8 @@ import {
Typography,
} from '@mui/material';

import { RefreshCwIcon } from 'lucide-react';

import { NS } from '@/config/constants';

export function NetworkErrorAlert(): JSX.Element {
Expand All @@ -29,7 +30,7 @@ export function NetworkErrorAlert(): JSX.Element {
<Tooltip title="Reload">
<span>
<IconButton onClick={() => window.location.reload()}>
<Refresh />
<RefreshCwIcon />
</IconButton>
</span>
</Tooltip>
Expand Down
Loading

0 comments on commit 2408533

Please sign in to comment.