mirror of
https://github.com/docmost/docmost.git
synced 2026-06-10 01:52:43 +08:00
feat(bases): dispatch kanban view through ViewRenderer
This commit is contained in:
@@ -267,6 +267,13 @@ export function BaseView({ pageId, embedded }: BaseViewProps) {
|
||||
updateViewMutation,
|
||||
]);
|
||||
|
||||
const handleCardClick = useCallback((rowId: string) => {
|
||||
// Phase 5 wires this to the URL-driven row detail modal.
|
||||
// Until then, noop — the click still registers and the focus ring
|
||||
// appears, but nothing opens.
|
||||
void rowId;
|
||||
}, []);
|
||||
|
||||
const handleRowReorder = useCallback(
|
||||
(rowId: string, targetRowId: string, dropPosition: "above" | "below") => {
|
||||
const remainingRows = rows.filter((r) => r.id !== rowId);
|
||||
@@ -358,6 +365,7 @@ export function BaseView({ pageId, embedded }: BaseViewProps) {
|
||||
onColumnReorder={handleColumnReorder}
|
||||
onResizeEnd={handleResizeEnd}
|
||||
onRowReorder={handleRowReorder}
|
||||
onCardClick={handleCardClick}
|
||||
persistViewConfig={persistViewConfig}
|
||||
scrollportRef={scrollportRef}
|
||||
stickyBandPrelude={
|
||||
@@ -395,6 +403,7 @@ export function BaseView({ pageId, embedded }: BaseViewProps) {
|
||||
onColumnReorder={handleColumnReorder}
|
||||
onResizeEnd={handleResizeEnd}
|
||||
onRowReorder={handleRowReorder}
|
||||
onCardClick={handleCardClick}
|
||||
persistViewConfig={persistViewConfig}
|
||||
scrollportRef={scrollportRef}
|
||||
/>
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
IBaseView,
|
||||
} from "@/features/base/types/base.types";
|
||||
import { BaseTable } from "@/features/base/components/base-table";
|
||||
import { BaseKanban } from "@/features/base/components/views/kanban/base-kanban";
|
||||
|
||||
type ViewRendererProps = {
|
||||
base: IBase;
|
||||
@@ -25,6 +26,7 @@ type ViewRendererProps = {
|
||||
targetRowId: string,
|
||||
dropPosition: "above" | "below",
|
||||
) => void;
|
||||
onCardClick: (rowId: string) => void;
|
||||
persistViewConfig: () => void;
|
||||
scrollportRef: React.RefObject<HTMLDivElement>;
|
||||
stickyBandPrelude?: React.ReactNode;
|
||||
@@ -33,11 +35,16 @@ type ViewRendererProps = {
|
||||
export function ViewRenderer(props: ViewRendererProps) {
|
||||
const viewType = props.effectiveView?.type ?? "table";
|
||||
|
||||
if (viewType === "table") {
|
||||
return <BaseTable {...props} />;
|
||||
if (viewType === "kanban") {
|
||||
return (
|
||||
<BaseKanban
|
||||
base={props.base}
|
||||
rows={props.rows}
|
||||
effectiveView={props.effectiveView}
|
||||
onCardClick={props.onCardClick}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
// Kanban added in a later task; until then, fall back to the table so
|
||||
// selecting a kanban view never produces a blank page.
|
||||
return <BaseTable {...props} />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user