Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 50bf5b31b6 | |||
| 5670a96696 | |||
| 3a13b68a3d | |||
| fc3366d52a | |||
| 99c95d0706 | |||
| 0bdae7fc23 |
@@ -12,7 +12,6 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
features: {
|
features: {
|
||||||
journal: {
|
journal: {
|
||||||
// add your features here in the format [featureName]: { value: string }
|
|
||||||
'lesson.bar': {
|
'lesson.bar': {
|
||||||
on: true,
|
on: true,
|
||||||
value: '',
|
value: '',
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "journal.pl",
|
"name": "journal.pl",
|
||||||
"version": "2.4.0",
|
"version": "2.4.3",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "journal.pl",
|
"name": "journal.pl",
|
||||||
"version": "2.4.0",
|
"version": "2.4.3",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@chakra-ui/icons": "^2.1.1",
|
"@chakra-ui/icons": "^2.1.1",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "journal.pl",
|
"name": "journal.pl",
|
||||||
"version": "2.4.0",
|
"version": "2.4.3",
|
||||||
"description": "inno-js platform journal ui repo",
|
"description": "inno-js platform journal ui repo",
|
||||||
"main": "./src/index.tsx",
|
"main": "./src/index.tsx",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -194,12 +194,13 @@ const LessonList = () => {
|
|||||||
const toastRef = useRef(null)
|
const toastRef = useRef(null)
|
||||||
const createdLessonRef = useRef(null)
|
const createdLessonRef = useRef(null)
|
||||||
const [editLesson, setEditLesson] = useState<Lesson>(null)
|
const [editLesson, setEditLesson] = useState<Lesson>(null)
|
||||||
|
const sorted = useMemo(() => [...(data?.body || [])]?.sort((a, b) => a.date > b.date ? 1 : -1), [data, data?.body])
|
||||||
|
|
||||||
const lessonCalc = useMemo(() => {
|
const lessonCalc = useMemo(() => {
|
||||||
if (!isSuccess) {
|
if (!isSuccess) {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|
||||||
const sorted = [...data?.body].sort((a, b) => a.date > b.date ? 1 : -1)
|
|
||||||
|
|
||||||
if (!groupByDate) {
|
if (!groupByDate) {
|
||||||
return [{ date: '', data: sorted }]
|
return [{ date: '', data: sorted }]
|
||||||
@@ -222,8 +223,8 @@ const LessonList = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return lessonsData
|
return lessonsData.sort((a, b) => a.date < b.date? 1 : -1)
|
||||||
}, [groupByDate, isSuccess])
|
}, [groupByDate, isSuccess, sorted])
|
||||||
|
|
||||||
const onSubmit = (lessonData) => {
|
const onSubmit = (lessonData) => {
|
||||||
toastRef.current = toast({
|
toastRef.current = toast({
|
||||||
@@ -404,10 +405,10 @@ const LessonList = () => {
|
|||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
{barFeature && (
|
{barFeature && sorted?.length && (
|
||||||
<Box height="300">
|
<Box height="300">
|
||||||
<Bar
|
<Bar
|
||||||
data={data?.body.map((lesson, index) => ({
|
data={sorted.map((lesson, index) => ({
|
||||||
lessonIndex: `#${index + 1}`,
|
lessonIndex: `#${index + 1}`,
|
||||||
count: lesson.students.length,
|
count: lesson.students.length,
|
||||||
}))}
|
}))}
|
||||||
|
|||||||
Reference in New Issue
Block a user