Skip to content

Commit

Permalink
fix: mui imports to first level (#590)
Browse files Browse the repository at this point in the history
* feat: wip for SSR with tanstack/start

chore: change folder name

chore: add back the old files

fix: package and scripts

* fix: remove start entrypoints

* fix: imports and icon

* fix: small changes

* fix: re-enable helmet

* fix: re-enable helmet for auth captcha
  • Loading branch information
spaenleh authored Jan 13, 2025
1 parent 024881e commit 896be8b
Show file tree
Hide file tree
Showing 21 changed files with 70 additions and 64 deletions.
3 changes: 3 additions & 0 deletions src/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@
U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191,
U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
html {
font-family: 'Nunito', sans-serif;
}
3 changes: 1 addition & 2 deletions src/modules/account/MainMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useTranslation } from 'react-i18next';

import { Stack } from '@mui/material';
import List from '@mui/material/List';
import { List, Stack } from '@mui/material';

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

Expand Down
13 changes: 8 additions & 5 deletions src/modules/account/settings/DeleteMemberDialogContent.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { useState } from 'react';
import { useTranslation } from 'react-i18next';

import { Stack, TextField } from '@mui/material';
import DialogActions from '@mui/material/DialogActions';
import DialogContent from '@mui/material/DialogContent';
import DialogContentText from '@mui/material/DialogContentText';
import DialogTitle from '@mui/material/DialogTitle';
import {
DialogActions,
DialogContent,
DialogContentText,
DialogTitle,
Stack,
TextField,
} from '@mui/material';

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

Expand Down
3 changes: 1 addition & 2 deletions src/modules/account/settings/password/CreatePassword.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import { FieldError, SubmitHandler, useForm } from 'react-hook-form';
import { useTranslation } from 'react-i18next';

import { LoadingButton } from '@mui/lab';
import { Alert, Button, Stack } from '@mui/material';
import Typography from '@mui/material/Typography';
import { Alert, Button, Stack, Typography } from '@mui/material';

import { isPasswordStrong } from '@graasp/sdk';
import { FAILURE_MESSAGES } from '@graasp/translations';
Expand Down
3 changes: 1 addition & 2 deletions src/modules/account/settings/password/EditPassword.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import { SubmitHandler, useForm } from 'react-hook-form';
import { useTranslation } from 'react-i18next';

import { LoadingButton } from '@mui/lab';
import { Alert, Box, Button, Stack } from '@mui/material';
import Typography from '@mui/material/Typography';
import { Alert, Box, Button, Stack, Typography } from '@mui/material';

import { isPasswordStrong } from '@graasp/sdk';
import { FAILURE_MESSAGES } from '@graasp/translations';
Expand Down
5 changes: 2 additions & 3 deletions src/modules/analytics/charts-layout/ChartsAlerts.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { useContext } from 'react';
import { useTranslation } from 'react-i18next';

import Info from '@mui/icons-material/Info';
import Tooltip from '@mui/material/Tooltip';
import { styled } from '@mui/material/styles';
import { Info } from '@mui/icons-material';
import { Tooltip, styled } from '@mui/material';

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

Expand Down
2 changes: 1 addition & 1 deletion src/modules/analytics/charts-layout/ItemsAnalytics.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Grid from '@mui/material/Grid';
import { Grid } from '@mui/material';

import ItemsByActionChart from '../charts/ItemsByActionChart';
import ItemsByUserChart from '../charts/ItemsByUserChart';
Expand Down
3 changes: 1 addition & 2 deletions src/modules/analytics/charts/ActionsByVerbChart.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { useContext } from 'react';
import { useTranslation } from 'react-i18next';

import Typography from '@mui/material/Typography';
import { styled } from '@mui/material/styles';
import { Typography, styled } from '@mui/material';

import { ActionTriggers } from '@graasp/sdk';

Expand Down
2 changes: 1 addition & 1 deletion src/modules/analytics/charts/ActionsMap.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useContext, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';

import { useTheme } from '@mui/material/styles';
import { useTheme } from '@mui/material';

import GoogleMapReact from 'google-map-react';
import useSupercluster from 'use-supercluster';
Expand Down
43 changes: 24 additions & 19 deletions src/modules/analytics/common/ChartTitle.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
import InfoIcon from '@mui/icons-material/Info';
import { Stack, Tooltip } from '@mui/material';
import Typography from '@mui/material/Typography';
import { Stack, Tooltip, Typography } from '@mui/material';

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

import { Info } from 'lucide-react';

const ChartTitle = ({
title,
description = title,
}: {
title: string;
description?: string;
}): JSX.Element => (
<Stack
spacing={1}
pt={2}
direction="row"
alignItems="center"
justifyContent="center"
>
<Typography variant="h6" align="center">
{title}
</Typography>
<Tooltip title={description}>
<InfoIcon color="primary" />
</Tooltip>
</Stack>
);
}): JSX.Element => {
const { color } = useButtonColor('primary');
return (
<Stack
spacing={1}
pt={2}
direction="row"
alignItems="center"
justifyContent="center"
>
<Typography variant="h6" align="center">
{title}
</Typography>
<Tooltip title={description}>
<Info color={color} />
</Tooltip>
</Stack>
);
};

export default ChartTitle;
3 changes: 1 addition & 2 deletions src/modules/analytics/common/SectionTitle.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Stack } from '@mui/material';
import Typography from '@mui/material/Typography';
import { Stack, Typography } from '@mui/material';

const SectionTitle = ({
title,
Expand Down
9 changes: 6 additions & 3 deletions src/modules/analytics/functionality/ViewSelect.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import { useContext } from 'react';
import { useTranslation } from 'react-i18next';

import InfoIcon from '@mui/icons-material/Info';
import {
FormControl,
InputLabel,
MenuItem,
Select,
Stack,
Tooltip,
} from '@mui/material';
import Tooltip from '@mui/material/Tooltip';

import { Context } from '@graasp/sdk';
import { useButtonColor } from '@graasp/ui';

import { Info } from 'lucide-react';

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

Expand All @@ -29,6 +31,7 @@ import { ViewDataContext } from '~analytics/context/ViewDataProvider';
const ViewSelect = (): JSX.Element => {
const { t } = useTranslation(NS.Analytics);
const { t: enumT } = useTranslation(NS.Enums);
const { color } = useButtonColor('primary');

const { view, setView } = useContext(ViewDataContext);

Expand Down Expand Up @@ -92,7 +95,7 @@ const ViewSelect = (): JSX.Element => {
</Select>
</FormControl>
<Tooltip title={viewMessage}>
<InfoIcon color="primary" />
<Info color={color} />
</Tooltip>
</Stack>
);
Expand Down
3 changes: 1 addition & 2 deletions src/modules/auth/components/common/StyledTextField.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { styled } from '@mui/material';
import TextField from '@mui/material/TextField';
import { TextField, styled } from '@mui/material';

const FORM_INPUT_MIN_WIDTH = 300;

Expand Down
12 changes: 8 additions & 4 deletions src/modules/landing/support/Faq.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { useTranslation } from 'react-i18next';

import { Box, Stack, Typography } from '@mui/material';
import Accordion from '@mui/material/Accordion';
import AccordionDetails from '@mui/material/AccordionDetails';
import AccordionSummary from '@mui/material/AccordionSummary';
import {
Accordion,
AccordionDetails,
AccordionSummary,
Box,
Stack,
Typography,
} from '@mui/material';

import { ChevronDown } from 'lucide-react';

Expand Down
Binary file removed src/modules/player/.DS_Store
Binary file not shown.
6 changes: 3 additions & 3 deletions src/modules/player/ItemNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ 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 { TreeView } from './tree/TreeView.tsx';
import { combineUuids, shuffleAllButLastItemInArray } from './utils/shuffle.ts';
import { LoadingTree } from './tree/LoadingTree';
import { TreeView } from './tree/TreeView';
import { combineUuids, shuffleAllButLastItemInArray } from './utils/shuffle';

const { useItem, useDescendants } = hooks;
const playerRoute = getRouteApi('/player/$rootId/$itemId');
Expand Down
4 changes: 1 addition & 3 deletions src/modules/player/common/ItemCard.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { useTranslation } from 'react-i18next';

import { Box, Stack } from '@mui/material';
import Card from '@mui/material/Card';
import Typography from '@mui/material/Typography';
import { Box, Card, Stack, Typography } from '@mui/material';

import { PackedItem, formatDate } from '@graasp/sdk';
import { AnalyticsIcon, PlayIcon } from '@graasp/ui';
Expand Down
8 changes: 3 additions & 5 deletions src/modules/player/rightPanel/SideContent.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import Fullscreen from 'react-fullscreen-crossbrowser';
import { useTranslation } from 'react-i18next';

import EnterFullscreenIcon from '@mui/icons-material/Fullscreen';
import ExitFullscreenIcon from '@mui/icons-material/FullscreenExit';
import { Stack, Tooltip, styled } from '@mui/material';
import IconButton from '@mui/material/IconButton';
import { IconButton, Stack, Tooltip, styled } from '@mui/material';

import { DiscriminatedItem } from '@graasp/sdk';
import { useMobileView } from '@graasp/ui';

import { useParams, useSearch } from '@tanstack/react-router';
import { ExpandIcon, ShrinkIcon } from 'lucide-react';

import { NS } from '@/config/constants';
import { hooks } from '@/config/queryClient';
Expand Down Expand Up @@ -121,7 +119,7 @@ const SideContent = ({ content, item }: Props): JSX.Element | null => {
}
onClick={toggleFullscreen}
>
{isFullscreen ? <ExitFullscreenIcon /> : <EnterFullscreenIcon />}
{isFullscreen ? <ShrinkIcon /> : <ExpandIcon />}
</StyledIconButton>
</Tooltip>
);
Expand Down
5 changes: 2 additions & 3 deletions src/modules/player/tree/Node.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { IBranchProps, INode, LeafProps } from 'react-accessible-treeview';

import { Box, IconButton, Typography } from '@mui/material';
import { deepPurple } from '@mui/material/colors';
import { Box, IconButton, Typography, colors } from '@mui/material';

import { UUID } from '@graasp/sdk';
import { ItemIcon } from '@graasp/ui';
Expand Down Expand Up @@ -41,7 +40,7 @@ export function TreeNode({
sx={{
width: '100%',
pl: 1,
background: isSelected ? deepPurple[50] : 'none',
background: isSelected ? colors.deepPurple[50] : 'none',
}}
>
{/* icon type for root level items */}
Expand Down
2 changes: 1 addition & 1 deletion src/modules/player/utils/shuffle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
combineUuids,
getRandomValue,
shuffleAllButLastItemInArray,
} from './shuffle.ts';
} from './shuffle';

describe('shuffleAllButLastItemInArray', () => {
// check if the function shuffles all items except the last one with different UUID seeds
Expand Down
2 changes: 1 addition & 1 deletion src/routes/auth/reset-password.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import {
FormControlLabel,
Stack,
TextField,
Typography,
} from '@mui/material';
import Typography from '@mui/material/Typography';

import { isPasswordStrong } from '@graasp/sdk';

Expand Down

0 comments on commit 896be8b

Please sign in to comment.