mui-toolpad-extended-tuni 1.0.0 → 1.0.2
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.
- package/dist/EduMLToolpad/EduMLProvider.d.ts +20 -0
- package/dist/EduMLToolpad/components/Courses/CourseItem.d.ts +9 -0
- package/dist/EduMLToolpad/components/Courses/CourseList.d.ts +9 -0
- package/dist/EduMLToolpad/components/Courses/CourseSelector.d.ts +3 -0
- package/dist/EduMLToolpad/components/Courses/CourseTools.d.ts +3 -0
- package/dist/EduMLToolpad/components/Courses/LtiLoginUrlForm.d.ts +3 -0
- package/dist/EduMLToolpad/components/Courses/NoCoursesMessage.d.ts +3 -0
- package/dist/EduMLToolpad/components/DevelopmentTools.d.ts +3 -0
- package/dist/EduMLToolpad/components/Dialogs/DialogOpener.d.ts +10 -0
- package/dist/EduMLToolpad/components/Dialogs/FormDialog.d.ts +10 -0
- package/dist/EduMLToolpad/components/EduMLDialog.d.ts +9 -0
- package/dist/EduMLToolpad/components/Home.d.ts +3 -0
- package/dist/EduMLToolpad/components/IconWithBadge.d.ts +10 -0
- package/dist/EduMLToolpad/components/LoadingScreen.d.ts +2 -0
- package/dist/EduMLToolpad/components/Logo.d.ts +2 -0
- package/dist/EduMLToolpad/components/Notifications.d.ts +3 -0
- package/dist/EduMLToolpad/components/PageToolBar.d.ts +3 -0
- package/dist/EduMLToolpad/components/ToolSelector.d.ts +17 -0
- package/dist/EduMLToolpad/components/UserSwitcher.d.ts +3 -0
- package/dist/EduMLToolpad/components/sidebar/Footer.d.ts +3 -0
- package/dist/EduMLToolpad/components/toolbar/Account.d.ts +1 -0
- package/dist/EduMLToolpad/components/toolbar/Actions.d.ts +1 -0
- package/dist/EduMLToolpad/components/tools/addActions.d.ts +5 -0
- package/dist/EduMLToolpad/components/tools/addIcons.d.ts +2 -0
- package/dist/EduMLToolpad/components/tools/iconsByType.d.ts +6 -0
- package/dist/EduMLToolpad/components/tools/utils/ActionFCWrapper.d.ts +5 -0
- package/dist/EduMLToolpad/components/tools/utils/IconFCWrapper.d.ts +6 -0
- package/dist/EduMLToolpad/constants.d.ts +2 -0
- package/dist/EduMLToolpad/hooks/useCustomRouter.d.ts +6 -0
- package/dist/EduMLToolpad/interfaces.d.ts +1 -0
- package/dist/EduMLToolpad/layout/breadcrumbs/SizableContentHeader.d.ts +7 -0
- package/dist/EduMLToolpad/network/axiosConfig.d.ts +3 -0
- package/dist/EduMLToolpad/network/courses.d.ts +44 -0
- package/dist/EduMLToolpad/network/users.d.ts +5 -0
- package/dist/EduMLToolpad/store/useCourseStore.d.ts +15 -0
- package/dist/EduMLToolpad/store/useDialogStore.d.ts +3 -0
- package/dist/EduMLToolpad/store/useNavigationStore.d.ts +28 -0
- package/dist/EduMLToolpad/store/useNotificationsStore.d.ts +15 -0
- package/dist/EduMLToolpad/store/useUserStore.d.ts +26 -0
- package/dist/EduMLToolpad/theme/EduMLTheme.d.ts +2 -0
- package/dist/EduMLToolpad/tools/ErrorBoundary.d.ts +15 -0
- package/dist/EduMLToolpad/tools/NullStateWarning.d.ts +8 -0
- package/dist/EduMLToolpad/types/toolpad.d.ts +26 -0
- package/dist/EduMLToolpad/types/vite-env.d.ts +3 -0
- package/dist/EduMLToolpad/utils/caseConverter.d.ts +17 -0
- package/dist/EduMLToolpad/utils/slugify.d.ts +1 -0
- package/dist/index.cjs +327 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.es.js +23936 -0
- package/dist/mockServiceWorker.js +307 -0
- package/dist/static/images/educhat.ico +0 -0
- package/dist/static/images/educhat.png +0 -0
- package/dist/static/images/guest.png +0 -0
- package/dist/static/images/student.png +0 -0
- package/dist/static/images/teacher.png +0 -0
- package/dist/static/images/tuni/Tampere_University_logo.svg +34 -0
- package/dist/static/images/tuni/face-purple-small.png +0 -0
- package/dist/static/images/tuni/tuni.png +0 -0
- package/dist/vite-env.d.ts +1 -0
- package/dist/vite.svg +1 -0
- package/package.json +40 -14
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** @format */
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export interface EduMLProviderProps {
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* EduMLProvider must be wrapped in a Router component from react-router-dom
|
|
8
|
+
* Example:
|
|
9
|
+
* ```tsx
|
|
10
|
+
* import { BrowserRouter } from 'react-router-dom';
|
|
11
|
+
*
|
|
12
|
+
* <BrowserRouter>
|
|
13
|
+
* <EduMLProvider>
|
|
14
|
+
* {children}
|
|
15
|
+
* </EduMLProvider>
|
|
16
|
+
* </BrowserRouter>
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
declare const EduMLProvider: ({ children }: EduMLProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export default EduMLProvider;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** @format */
|
|
2
|
+
import { Course } from '../../store/useCourseStore';
|
|
3
|
+
type CourseItemProps = {
|
|
4
|
+
course: Course;
|
|
5
|
+
isSelected: boolean;
|
|
6
|
+
onSelect: (course: Course) => void;
|
|
7
|
+
};
|
|
8
|
+
declare const CourseItem: ({ course, isSelected, onSelect }: CourseItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default CourseItem;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** @format */
|
|
2
|
+
import { Course } from '../../store/useCourseStore';
|
|
3
|
+
type CourseListProps = {
|
|
4
|
+
courses: Course[];
|
|
5
|
+
selectedCourse?: Course | null;
|
|
6
|
+
onSelectCourse: (course: Course) => void;
|
|
7
|
+
};
|
|
8
|
+
declare const CourseList: ({ courses, selectedCourse, onSelectCourse, }: CourseListProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default CourseList;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** @format */
|
|
2
|
+
import { dialogType } from '../../store/useDialogStore';
|
|
3
|
+
type DialogOpenerProps = {
|
|
4
|
+
title: string;
|
|
5
|
+
dialogId: dialogType;
|
|
6
|
+
callOnOpen?: (event: React.MouseEvent<HTMLButtonElement | HTMLElement>) => void;
|
|
7
|
+
showTitle?: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare const DialogOpener: ({ title, dialogId, callOnOpen, showTitle, }: DialogOpenerProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export default DialogOpener;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** @format */
|
|
2
|
+
interface FormDialogProps {
|
|
3
|
+
onSubmit: (event: React.FormEvent<HTMLFormElement>) => void;
|
|
4
|
+
title: string;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
submitText?: string;
|
|
7
|
+
disableSubmit?: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare const FormDialog: React.FC<FormDialogProps>;
|
|
10
|
+
export default FormDialog;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** @format */
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
type EduMLDialogProps = {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
open: boolean;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
};
|
|
8
|
+
declare const EduMLDialog: ({ children, open, onClose, ...dialogProps }: EduMLDialogProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default EduMLDialog;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** @format */
|
|
2
|
+
import { SxProps, Theme } from '@mui/material/styles';
|
|
3
|
+
type IconWithBadgeProps = {
|
|
4
|
+
Icon: React.FC;
|
|
5
|
+
size: number;
|
|
6
|
+
title: string;
|
|
7
|
+
sx?: SxProps<Theme>;
|
|
8
|
+
};
|
|
9
|
+
declare const IconWithBadge: ({ Icon, size, title, sx }: IconWithBadgeProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export default IconWithBadge;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { NavigationPageStoreItem } from '../store/useNavigationStore';
|
|
2
|
+
export type ToolSelectorItem = {
|
|
3
|
+
path: string;
|
|
4
|
+
icon: JSX.Element;
|
|
5
|
+
label: string;
|
|
6
|
+
description: string;
|
|
7
|
+
forRoles?: string[];
|
|
8
|
+
};
|
|
9
|
+
type ToolSelectorProps = {
|
|
10
|
+
show: boolean;
|
|
11
|
+
title: string;
|
|
12
|
+
navigationItems?: ToolSelectorItem[];
|
|
13
|
+
navItems?: NavigationPageStoreItem[];
|
|
14
|
+
roleCheck?: boolean;
|
|
15
|
+
};
|
|
16
|
+
declare const ToolSelector: ({ show, title, navigationItems, navItems, roleCheck }: ToolSelectorProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export default ToolSelector;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ToolbarAccount: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function CustomActions(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type fetchState = "idle" | "loading" | "error" | "success";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/** @format */
|
|
2
|
+
import { Course, CourseRaw } from '../store/useCourseStore';
|
|
3
|
+
/**
|
|
4
|
+
* @description Helper function to make a GET request to retrieve the current course
|
|
5
|
+
* @returns Promise<Course> - The current course object
|
|
6
|
+
*/
|
|
7
|
+
export declare function getCurrentCourse(): Promise<Course>;
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @description Helper function to make a GET request to retrieve courses
|
|
11
|
+
* @returns Promise<Course[]> - The list of courses
|
|
12
|
+
*/
|
|
13
|
+
export declare function getCourses(): Promise<Course[]>;
|
|
14
|
+
/**
|
|
15
|
+
* @description Helper function to make a GET request to retrieve a course by ID
|
|
16
|
+
* @param courseId - The ID of the course to retrieve
|
|
17
|
+
* @returns Promise<Course> - The course object
|
|
18
|
+
*/
|
|
19
|
+
export declare function getCourseById(courseId: string): Promise<Course>;
|
|
20
|
+
/**
|
|
21
|
+
* @description Helper function to make a GET request to retrieve a course by URL
|
|
22
|
+
* @param url - The URL of the course to retrieve
|
|
23
|
+
* @returns Promise<Course> - The course object
|
|
24
|
+
*/
|
|
25
|
+
export declare function getCourseByUrl(url: string): Promise<Course>;
|
|
26
|
+
/**
|
|
27
|
+
* @description Helper function to make a POST request to add a new course
|
|
28
|
+
* **Should only be used by teachers or admins!**
|
|
29
|
+
* @param courseData - The course data to add
|
|
30
|
+
* @returns Added course object
|
|
31
|
+
*/
|
|
32
|
+
export declare function addCourse(courseData: CourseRaw): Promise<Course>;
|
|
33
|
+
/**
|
|
34
|
+
* @description Helper function to make a PUT request to update a course
|
|
35
|
+
* @param courseData - The course data to update
|
|
36
|
+
* @returns Updated course object
|
|
37
|
+
*/
|
|
38
|
+
export declare function updateCourse(courseData: Course): Promise<Course>;
|
|
39
|
+
/**
|
|
40
|
+
* @description Helper function to make a DELETE request to delete a course
|
|
41
|
+
* @param courseId - The ID of the course to delete
|
|
42
|
+
* @returns Deleted course object
|
|
43
|
+
*/
|
|
44
|
+
export declare function deleteCourse(courseId: string): Promise<Course>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** @format */
|
|
2
|
+
import { UserData } from '../store/useUserStore';
|
|
3
|
+
export declare const getCurrentUser: (courseId?: string) => Promise<UserData>;
|
|
4
|
+
export declare const getUsers: (courseId?: string) => Promise<UserData[]>;
|
|
5
|
+
export declare const logoutUser: () => Promise<void>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** @format */
|
|
2
|
+
export interface Course {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
description: string;
|
|
6
|
+
createdAt: string;
|
|
7
|
+
ltiLoginUrl: string;
|
|
8
|
+
updatedAt: string;
|
|
9
|
+
}
|
|
10
|
+
export interface CourseRaw {
|
|
11
|
+
title: string;
|
|
12
|
+
description: string;
|
|
13
|
+
}
|
|
14
|
+
declare const useCourseStore: any;
|
|
15
|
+
export default useCourseStore;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** @format */
|
|
2
|
+
import { SvgIconComponent } from '@mui/icons-material';
|
|
3
|
+
interface NavigationItemBase {
|
|
4
|
+
kind: 'header' | 'page';
|
|
5
|
+
title: string;
|
|
6
|
+
actionFC?: React.FC;
|
|
7
|
+
}
|
|
8
|
+
export interface ToolMetadata {
|
|
9
|
+
description?: string;
|
|
10
|
+
forRoles?: string[];
|
|
11
|
+
isRootTool?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface NavigationHeaderItem extends NavigationItemBase {
|
|
14
|
+
kind: 'header';
|
|
15
|
+
}
|
|
16
|
+
export interface NavigationPageStoreItem extends NavigationItemBase {
|
|
17
|
+
kind: 'page';
|
|
18
|
+
segment: string;
|
|
19
|
+
iconFC?: SvgIconComponent;
|
|
20
|
+
icon?: JSX.Element;
|
|
21
|
+
children?: NavigationPageStoreItem[];
|
|
22
|
+
action?: JSX.Element;
|
|
23
|
+
metadata?: ToolMetadata;
|
|
24
|
+
}
|
|
25
|
+
export type NavigationStoreItem = NavigationHeaderItem | NavigationPageStoreItem;
|
|
26
|
+
export declare const useNavigationStore: any;
|
|
27
|
+
export declare const filterNavigationByRole: (role: string) => NavigationStoreItem[];
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** @format */
|
|
2
|
+
export type NotificationRaw = {
|
|
3
|
+
type: string;
|
|
4
|
+
message: string;
|
|
5
|
+
singular?: boolean;
|
|
6
|
+
singularId?: string;
|
|
7
|
+
};
|
|
8
|
+
export type Notification = {
|
|
9
|
+
type: string;
|
|
10
|
+
message: string;
|
|
11
|
+
id: string;
|
|
12
|
+
singular?: boolean;
|
|
13
|
+
singularId?: string;
|
|
14
|
+
};
|
|
15
|
+
export declare const useNotificationStore: any;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** @format */
|
|
2
|
+
import { fetchState } from '../interfaces';
|
|
3
|
+
export type userId = string;
|
|
4
|
+
export type role = 'student' | 'teacher' | 'guest';
|
|
5
|
+
export interface UserData {
|
|
6
|
+
id: userId;
|
|
7
|
+
name: string;
|
|
8
|
+
email: string;
|
|
9
|
+
role: role;
|
|
10
|
+
image?: string;
|
|
11
|
+
color?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface UserState {
|
|
14
|
+
fetchState: fetchState;
|
|
15
|
+
user: UserData | null;
|
|
16
|
+
testUsers: UserData[];
|
|
17
|
+
users: UserData[];
|
|
18
|
+
setUser: (user: UserData) => void;
|
|
19
|
+
setTestUsers: (users: UserData[]) => void;
|
|
20
|
+
getUser: (courseId?: string) => void;
|
|
21
|
+
changeRole: (role: 'student' | 'teacher') => void;
|
|
22
|
+
clearUser: () => void;
|
|
23
|
+
getUsers: () => void;
|
|
24
|
+
logout: () => Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
export declare const useUserStore: any;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** @format */
|
|
2
|
+
import { Component, ErrorInfo, ReactNode } from 'react';
|
|
3
|
+
interface Props {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
interface State {
|
|
7
|
+
hasError: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare class ErrorBoundary extends Component<Props, State> {
|
|
10
|
+
state: State;
|
|
11
|
+
static getDerivedStateFromError(_: Error): State;
|
|
12
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
13
|
+
render(): import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
14
|
+
}
|
|
15
|
+
export default ErrorBoundary;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** @format */
|
|
2
|
+
|
|
3
|
+
import { ReactElement } from 'react';
|
|
4
|
+
import { SvgIconComponent } from '@mui/icons-material';
|
|
5
|
+
|
|
6
|
+
declare module '@toolpad/core' {
|
|
7
|
+
export interface NavigationStoreItem {
|
|
8
|
+
icon: ReactElement;
|
|
9
|
+
children?: NavigationStoreItem[];
|
|
10
|
+
kind: string;
|
|
11
|
+
segment: string;
|
|
12
|
+
iconFC?: SvgIconComponent;
|
|
13
|
+
action?: ReactElement;
|
|
14
|
+
metadata?: Record<string, unknown>;
|
|
15
|
+
title: string;
|
|
16
|
+
actionFC?: React.FC;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface NavigationPageStoreItem extends NavigationStoreItem {
|
|
20
|
+
kind: 'page';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface NavigationHeaderItem extends NavigationStoreItem {
|
|
24
|
+
kind: 'header';
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** @format */
|
|
2
|
+
/**
|
|
3
|
+
* Converts a camelCase string to underscore_case
|
|
4
|
+
*/
|
|
5
|
+
export declare const camelCaseToUnderscore: (str: string) => string;
|
|
6
|
+
/**
|
|
7
|
+
* Converts an underscore_case string to camelCase
|
|
8
|
+
*/
|
|
9
|
+
export declare const underscoreToCamelCase: (str: string) => string;
|
|
10
|
+
/**
|
|
11
|
+
* Deep converts object keys from camelCase to underscore_case
|
|
12
|
+
*/
|
|
13
|
+
export declare const convertObjectKeysToCamelCase: <T>(obj: T) => T;
|
|
14
|
+
/**
|
|
15
|
+
* Deep converts object keys from underscore_case to camelCase
|
|
16
|
+
*/
|
|
17
|
+
export declare const convertObjectKeysToUnderscore: <T>(obj: T) => T;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const slugify: (text: string) => string;
|