Compare commits

..

No commits in common. "451cbc394691df3634aa254ae156b24b17cd0263" and "c1cb1f22db821b50711bb58b60ce8273a12b7fbe" have entirely different histories.

6 changed files with 4 additions and 45 deletions

View File

@ -47,7 +47,7 @@ Current request is compiling and may take a few moments.
}, [compilationStatus]); }, [compilationStatus]);
useEffect(() => { useEffect(() => {
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'dev_stage') {
setIsVisible(true); setIsVisible(true);
setBadgeStyles(prev => ({ setBadgeStyles(prev => ({

View File

@ -10,7 +10,7 @@ type Props = {
isBorderless?: boolean isBorderless?: boolean
isTransparent?: boolean isTransparent?: boolean
hasTextareaHeight?: boolean hasTextareaHeight?: boolean
children?: ReactNode children: ReactNode
disabled?: boolean disabled?: boolean
borderButtom?: boolean borderButtom?: boolean
diversity?: boolean diversity?: boolean

View File

@ -2,7 +2,7 @@ import React, { ReactNode } from 'react'
import { containerMaxW } from '../config' import { containerMaxW } from '../config'
type Props = { type Props = {
children?: ReactNode children: ReactNode
} }
export default function SectionMain({ children }: Props) { export default function SectionMain({ children }: Props) {

View File

@ -192,7 +192,7 @@ function MyApp({ Component, pageProps }: AppPropsWithLayout) {
stepsEnabled={stepsEnabled} stepsEnabled={stepsEnabled}
onExit={handleExit} onExit={handleExit}
/> />
{(process.env.NODE_ENV === 'development') && <DevModeBadge />} {(process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'dev_stage') && <DevModeBadge />}
</> </>
)} )}
</Provider> </Provider>

View File

@ -12,12 +12,8 @@ import Link from "next/link";
import { hasPermission } from "../helpers/userPermissions"; import { hasPermission } from "../helpers/userPermissions";
import { fetchWidgets } from '../stores/roles/rolesSlice'; import { fetchWidgets } from '../stores/roles/rolesSlice';
import { fetch as fetchCourses } from '../stores/courses/coursesSlice';
import { WidgetCreator } from '../components/WidgetCreator/WidgetCreator'; import { WidgetCreator } from '../components/WidgetCreator/WidgetCreator';
import { SmartWidget } from '../components/SmartWidget/SmartWidget'; import { SmartWidget } from '../components/SmartWidget/SmartWidget';
import CardBox from '../components/CardBox';
import BaseButton from '../components/BaseButton';
import { useAppDispatch, useAppSelector } from '../stores/hooks'; import { useAppDispatch, useAppSelector } from '../stores/hooks';
const Dashboard = () => { const Dashboard = () => {
@ -36,15 +32,12 @@ const Dashboard = () => {
const [lessons, setLessons] = React.useState(loadingMessage); const [lessons, setLessons] = React.useState(loadingMessage);
const [enrollments, setEnrollments] = React.useState(loadingMessage); const [enrollments, setEnrollments] = React.useState(loadingMessage);
const [progress, setProgress] = React.useState(loadingMessage); const [progress, setProgress] = React.useState(loadingMessage);
const [isMounted, setIsMounted] = React.useState(false);
const [widgetsRole, setWidgetsRole] = React.useState({ const [widgetsRole, setWidgetsRole] = React.useState({
role: { value: '', label: '' }, role: { value: '', label: '' },
}); });
const { currentUser } = useAppSelector((state) => state.auth); const { currentUser } = useAppSelector((state) => state.auth);
const { courses: allCourses } = useAppSelector((state) => state.courses);
const { isFetchingQuery } = useAppSelector((state) => state.openAi); const { isFetchingQuery } = useAppSelector((state) => state.openAi);
const { rolesWidgets, loading } = useAppSelector((state) => state.roles); const { rolesWidgets, loading } = useAppSelector((state) => state.roles);
@ -82,8 +75,6 @@ const Dashboard = () => {
React.useEffect(() => { React.useEffect(() => {
if (!currentUser) return; if (!currentUser) return;
loadData().then(); loadData().then();
dispatch(fetchCourses({}));
setIsMounted(true);
setWidgetsRole({ role: { value: currentUser?.app_role?.id, label: currentUser?.app_role?.name } }); setWidgetsRole({ role: { value: currentUser?.app_role?.id, label: currentUser?.app_role?.name } });
}, [currentUser]); }, [currentUser]);
@ -343,37 +334,6 @@ const Dashboard = () => {
</div> </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> </SectionMain>
</> </>
) )

File diff suppressed because one or more lines are too long