mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
b1989bae1b
* dev: implement layout skeleton loader and helper function * chore: implemented layout loader * chore: settings loader added * chore: cycle, module, view, pages, notification and projects loader added * chore: kanban loader improvement * chore: loader utils updated
36 lines
923 B
TypeScript
36 lines
923 B
TypeScript
import {
|
|
CalendarLayoutLoader,
|
|
GanttLayoutLoader,
|
|
KanbanLayoutLoader,
|
|
ListLayoutLoader,
|
|
SpreadsheetLayoutLoader,
|
|
} from "./layouts";
|
|
|
|
export const getRandomInt = (min: number, max: number) => Math.floor(Math.random() * (max - min + 1)) + min;
|
|
|
|
export const getRandomLength = (lengthArray: string[]) => {
|
|
const randomIndex = Math.floor(Math.random() * lengthArray.length);
|
|
return `${lengthArray[randomIndex]}`;
|
|
};
|
|
|
|
interface Props {
|
|
layout: string;
|
|
}
|
|
export const ActiveLoader: React.FC<Props> = (props) => {
|
|
const { layout } = props;
|
|
switch (layout) {
|
|
case "list":
|
|
return <ListLayoutLoader />;
|
|
case "kanban":
|
|
return <KanbanLayoutLoader />;
|
|
case "spreadsheet":
|
|
return <SpreadsheetLayoutLoader />;
|
|
case "calendar":
|
|
return <CalendarLayoutLoader />;
|
|
case "gantt_chart":
|
|
return <GanttLayoutLoader />;
|
|
default:
|
|
return <KanbanLayoutLoader />;
|
|
}
|
|
};
|