@selfcommunity/react-templates 0.4.5-courses.159 → 0.4.5-courses.160

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,6 +14,7 @@ const react_ui_1 = require("@selfcommunity/react-ui");
14
14
  const api_services_1 = require("@selfcommunity/api-services");
15
15
  const react_intl_1 = require("react-intl");
16
16
  const lab_1 = require("@mui/lab");
17
+ const notistack_1 = require("notistack");
17
18
  const classes = {
18
19
  root: `${constants_1.PREFIX}-root`,
19
20
  containerRoot: `${constants_1.PREFIX}-container-root`,
@@ -47,6 +48,7 @@ function Lesson(inProps) {
47
48
  const [_sectionId, setSectionId] = (0, react_1.useState)(sectionId);
48
49
  const { scLesson, setSCLesson } = (0, react_core_1.useSCFetchLesson)({ id: _lessonId, courseId, sectionId: _sectionId });
49
50
  const { scCourse, setSCCourse } = (0, react_core_1.useSCFetchCourse)({ id: courseId, params: { view: isEditor ? api_services_1.CourseInfoViewType.EDIT : api_services_1.CourseInfoViewType.USER } });
51
+ const { enqueueSnackbar } = (0, notistack_1.useSnackbar)();
50
52
  // STATE
51
53
  const [activePanel, setActivePanel] = (0, react_1.useState)(null);
52
54
  const [settings, setSettings] = (0, react_1.useState)(null);
@@ -116,9 +118,17 @@ function Lesson(inProps) {
116
118
  .then((data) => {
117
119
  setUpdating(false);
118
120
  setSCLesson(data);
121
+ enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.lesson.save.success", defaultMessage: "templates.lesson.save.success" }), {
122
+ variant: 'success',
123
+ autoHideDuration: 3000
124
+ });
119
125
  })
120
126
  .catch((error) => {
121
127
  setUpdating(false);
128
+ enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.lesson.save.error", defaultMessage: "templates.lesson.save.error" }), {
129
+ variant: 'error',
130
+ autoHideDuration: 3000
131
+ });
122
132
  console.log(error);
123
133
  });
124
134
  };
@@ -12,6 +12,7 @@ import { CourseCompletedDialog, getCurrentSectionAndLessonIndex, HiddenPlacehold
12
12
  import { CourseInfoViewType, CourseService } from '@selfcommunity/api-services';
13
13
  import { FormattedMessage } from 'react-intl';
14
14
  import { LoadingButton } from '@mui/lab';
15
+ import { useSnackbar } from 'notistack';
15
16
  const classes = {
16
17
  root: `${PREFIX}-root`,
17
18
  containerRoot: `${PREFIX}-container-root`,
@@ -45,6 +46,7 @@ export default function Lesson(inProps) {
45
46
  const [_sectionId, setSectionId] = useState(sectionId);
46
47
  const { scLesson, setSCLesson } = useSCFetchLesson({ id: _lessonId, courseId, sectionId: _sectionId });
47
48
  const { scCourse, setSCCourse } = useSCFetchCourse({ id: courseId, params: { view: isEditor ? CourseInfoViewType.EDIT : CourseInfoViewType.USER } });
49
+ const { enqueueSnackbar } = useSnackbar();
48
50
  // STATE
49
51
  const [activePanel, setActivePanel] = useState(null);
50
52
  const [settings, setSettings] = useState(null);
@@ -114,9 +116,17 @@ export default function Lesson(inProps) {
114
116
  .then((data) => {
115
117
  setUpdating(false);
116
118
  setSCLesson(data);
119
+ enqueueSnackbar(_jsx(FormattedMessage, { id: "templates.lesson.save.success", defaultMessage: "templates.lesson.save.success" }), {
120
+ variant: 'success',
121
+ autoHideDuration: 3000
122
+ });
117
123
  })
118
124
  .catch((error) => {
119
125
  setUpdating(false);
126
+ enqueueSnackbar(_jsx(FormattedMessage, { id: "templates.lesson.save.error", defaultMessage: "templates.lesson.save.error" }), {
127
+ variant: 'error',
128
+ autoHideDuration: 3000
129
+ });
120
130
  console.log(error);
121
131
  });
122
132
  };