apps/nextjs-app/src/features/app/blocks/view/View.tsx
import { ViewType } from '@teable/core';
import { useView } from '@teable/sdk';
import { FormView } from './form/FormView';
import { GridView } from './grid/GridView';
import { KanbanView } from './kanban/KanbanView';
import { PluginView } from './plugin/PluginView';
import type { IViewBaseProps } from './types';
export const View = (props: IViewBaseProps) => {
const view = useView();
const viewType = view?.type;
const getViewComponent = () => {
switch (viewType) {
case ViewType.Grid:
return <GridView {...props} />;
case ViewType.Form:
return <FormView />;
case ViewType.Kanban:
return <KanbanView />;
case ViewType.Plugin:
return <PluginView />;
default:
return null;
}
};
return getViewComponent();
};