Compare commits
No commits in common. "451cbc394691df3634aa254ae156b24b17cd0263" and "c1cb1f22db821b50711bb58b60ce8273a12b7fbe" have entirely different histories.
451cbc3946
...
c1cb1f22db
@ -47,7 +47,7 @@ Current request is compiling and may take a few moments.
|
||||
}, [compilationStatus]);
|
||||
|
||||
useEffect(() => {
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
if (process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'dev_stage') {
|
||||
setIsVisible(true);
|
||||
|
||||
setBadgeStyles(prev => ({
|
||||
|
||||
@ -10,7 +10,7 @@ type Props = {
|
||||
isBorderless?: boolean
|
||||
isTransparent?: boolean
|
||||
hasTextareaHeight?: boolean
|
||||
children?: ReactNode
|
||||
children: ReactNode
|
||||
disabled?: boolean
|
||||
borderButtom?: boolean
|
||||
diversity?: boolean
|
||||
|
||||
@ -2,7 +2,7 @@ import React, { ReactNode } from 'react'
|
||||
import { containerMaxW } from '../config'
|
||||
|
||||
type Props = {
|
||||
children?: ReactNode
|
||||
children: ReactNode
|
||||
}
|
||||
|
||||
export default function SectionMain({ children }: Props) {
|
||||
|
||||
@ -192,7 +192,7 @@ function MyApp({ Component, pageProps }: AppPropsWithLayout) {
|
||||
stepsEnabled={stepsEnabled}
|
||||
onExit={handleExit}
|
||||
/>
|
||||
{(process.env.NODE_ENV === 'development') && <DevModeBadge />}
|
||||
{(process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'dev_stage') && <DevModeBadge />}
|
||||
</>
|
||||
)}
|
||||
</Provider>
|
||||
|
||||
@ -12,12 +12,8 @@ import Link from "next/link";
|
||||
|
||||
import { hasPermission } from "../helpers/userPermissions";
|
||||
import { fetchWidgets } from '../stores/roles/rolesSlice';
|
||||
import { fetch as fetchCourses } from '../stores/courses/coursesSlice';
|
||||
import { WidgetCreator } from '../components/WidgetCreator/WidgetCreator';
|
||||
import { SmartWidget } from '../components/SmartWidget/SmartWidget';
|
||||
import CardBox from '../components/CardBox';
|
||||
import BaseButton from '../components/BaseButton';
|
||||
|
||||
|
||||
import { useAppDispatch, useAppSelector } from '../stores/hooks';
|
||||
const Dashboard = () => {
|
||||
@ -36,15 +32,12 @@ const Dashboard = () => {
|
||||
const [lessons, setLessons] = React.useState(loadingMessage);
|
||||
const [enrollments, setEnrollments] = React.useState(loadingMessage);
|
||||
const [progress, setProgress] = React.useState(loadingMessage);
|
||||
const [isMounted, setIsMounted] = React.useState(false);
|
||||
|
||||
|
||||
|
||||
const [widgetsRole, setWidgetsRole] = React.useState({
|
||||
role: { value: '', label: '' },
|
||||
});
|
||||
const { currentUser } = useAppSelector((state) => state.auth);
|
||||
const { courses: allCourses } = useAppSelector((state) => state.courses);
|
||||
const { isFetchingQuery } = useAppSelector((state) => state.openAi);
|
||||
|
||||
const { rolesWidgets, loading } = useAppSelector((state) => state.roles);
|
||||
@ -82,8 +75,6 @@ const Dashboard = () => {
|
||||
React.useEffect(() => {
|
||||
if (!currentUser) return;
|
||||
loadData().then();
|
||||
dispatch(fetchCourses({}));
|
||||
setIsMounted(true);
|
||||
setWidgetsRole({ role: { value: currentUser?.app_role?.id, label: currentUser?.app_role?.name } });
|
||||
}, [currentUser]);
|
||||
|
||||
@ -343,37 +334,6 @@ const Dashboard = () => {
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
{isMounted && hasPermission(currentUser, 'READ_COURSES') && allCourses.length > 0 && (
|
||||
<>
|
||||
<SectionTitleLineWithButton
|
||||
icon={icon.mdiBookOpenPageVariant}
|
||||
title='Recent Courses'
|
||||
>
|
||||
{''}
|
||||
</SectionTitleLineWithButton>
|
||||
<div className='grid grid-cols-1 gap-6 lg:grid-cols-3 mb-6'>
|
||||
{allCourses.slice(0, 5).map((course) => (
|
||||
<CardBox key={course.id}>
|
||||
<div className='p-6'>
|
||||
<h3 className='text-xl font-semibold mb-2'>{course.title}</h3>
|
||||
<p className='text-gray-500 dark:text-gray-400'>{course.description}</p>
|
||||
</div>
|
||||
<div className='p-6 border-t border-gray-100 dark:border-dark-700'>
|
||||
<BaseButton
|
||||
href={`/courses/${course.id}`}
|
||||
label='View Course'
|
||||
color='info'
|
||||
size='md'
|
||||
className='w-full'
|
||||
/>
|
||||
</div>
|
||||
</CardBox>
|
||||
))}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
</SectionMain>
|
||||
</>
|
||||
)
|
||||
|
||||
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user