Skip to content

Commit

Permalink
Добавлен Snackbar при оценивании решений
Browse files Browse the repository at this point in the history
  • Loading branch information
DedSec256 committed Dec 12, 2024
1 parent 9d1cb6a commit 862e9f3
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 20 deletions.
20 changes: 17 additions & 3 deletions hwproj.front/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions hwproj.front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"html-react-parser": "^1.2.8",
"jwt-decode": "^3.1.2",
"lowdb": "^1.0.0",
"notistack": "^3.0.1",
"portable-fetch": "^3.0.0",
"prop-types": "^15.7.2",
"qrcode.react": "^4.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {LoadingButton} from "@mui/lab";
import CheckIcon from '@mui/icons-material/Done';
import WarningIcon from '@mui/icons-material/Warning';
import CloseIcon from '@mui/icons-material/Close';
import {useSnackbar} from 'notistack';

interface ISolutionProps {
solution: GetSolutionModel | undefined,
Expand Down Expand Up @@ -58,6 +59,8 @@ const TaskSolutionComponent: FC<ISolutionProps> = (props) => {
const [rateInProgress, setRateInProgressState] = useState<boolean | undefined>(false)
const [solutionActuality, setSolutionActuality] = useState<SolutionActualityDto | undefined>(undefined)

const {enqueueSnackbar} = useSnackbar()

useEffect(() => {
setState(getDefaultState())
getAchievementState()
Expand Down Expand Up @@ -129,6 +132,7 @@ const TaskSolutionComponent: FC<ISolutionProps> = (props) => {
}
)
setState(prevState => ({...prevState, clickedForRate: false}))
enqueueSnackbar('Решение успешно оценено', {variant: "success", autoHideDuration: 1700});
props.onRateSolutionClick?.()
}

Expand Down
37 changes: 20 additions & 17 deletions hwproj.front/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,32 @@ import "./index.css";
import App from "./App";
import * as serviceWorker from "./serviceWorker";
import "bootstrap/dist/css/bootstrap.min.css";
import { BrowserRouter } from "react-router-dom";
import {BrowserRouter} from "react-router-dom";
import ThemeProvider from "@material-ui/styles/ThemeProvider";
import { createTheme } from "@material-ui/core/styles";
import {createTheme} from "@material-ui/core/styles";
import {SnackbarProvider} from "notistack";

const theme = createTheme({
typography: {
fontFamily: [
'Helvetica',
'Arial',
'sans-serif',
'Roboto',
'"Helvetica Neue"',
].join(','),
}
typography: {
fontFamily: [
'Helvetica',
'Arial',
'sans-serif',
'Roboto',
'"Helvetica Neue"',
].join(','),
}
});

ReactDOM.render(
<ThemeProvider theme={theme}>
<BrowserRouter>
<App />
</BrowserRouter>
</ThemeProvider>,
document.getElementById("root")
<ThemeProvider theme={theme}>
<SnackbarProvider maxSnack={3}>
<BrowserRouter>
<App/>
</BrowserRouter>
</SnackbarProvider>
</ThemeProvider>,
document.getElementById("root")
);

// If you want your app to work offline and load faster, you can change
Expand Down

0 comments on commit 862e9f3

Please sign in to comment.