mirror of https://github.com/buster-so/buster.git
chat file layout update
This commit is contained in:
parent
9304e3f8a6
commit
83e9b0b1b5
|
@ -0,0 +1,15 @@
|
||||||
|
import { MetricController } from '@/controllers/MetricController';
|
||||||
|
import { AppAssetCheckLayout } from '@/layouts/AppAssetCheckLayout';
|
||||||
|
|
||||||
|
export default async function MetricPage(props: {
|
||||||
|
params: Promise<{ metricId: string; dashboardId: string }>;
|
||||||
|
}) {
|
||||||
|
const params = await props.params;
|
||||||
|
const { metricId, dashboardId } = params;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<AppAssetCheckLayout assetId={metricId} type="metric">
|
||||||
|
<MetricController metricId={metricId} />
|
||||||
|
</AppAssetCheckLayout>
|
||||||
|
);
|
||||||
|
}
|
|
@ -1,10 +1,7 @@
|
||||||
import { MetricController } from '@/controllers/MetricController';
|
import { MetricController } from '@/controllers/MetricController';
|
||||||
import { AppAssetCheckLayout } from '@/layouts/AppAssetCheckLayout';
|
import { AppAssetCheckLayout } from '@/layouts/AppAssetCheckLayout';
|
||||||
|
|
||||||
export default async function MetricPage(props: {
|
export default async function MetricPage(props: { params: Promise<{ metricId: string }> }) {
|
||||||
params: Promise<{ metricId: string }>;
|
|
||||||
searchParams: Promise<{ embed?: string }>;
|
|
||||||
}) {
|
|
||||||
const params = await props.params;
|
const params = await props.params;
|
||||||
const { metricId } = params;
|
const { metricId } = params;
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ import {
|
||||||
DragStartEvent,
|
DragStartEvent,
|
||||||
DragEndEvent
|
DragEndEvent
|
||||||
} from '@dnd-kit/core';
|
} from '@dnd-kit/core';
|
||||||
|
import { restrictToVerticalAxis } from '@dnd-kit/modifiers';
|
||||||
import {
|
import {
|
||||||
arrayMove,
|
arrayMove,
|
||||||
SortableContext,
|
SortableContext,
|
||||||
|
@ -31,6 +32,8 @@ import {
|
||||||
import { CSS } from '@dnd-kit/utilities';
|
import { CSS } from '@dnd-kit/utilities';
|
||||||
import { useMemoizedFn } from '@/hooks';
|
import { useMemoizedFn } from '@/hooks';
|
||||||
|
|
||||||
|
const modifiers = [restrictToVerticalAxis];
|
||||||
|
|
||||||
interface SidebarTriggerProps {
|
interface SidebarTriggerProps {
|
||||||
label: string;
|
label: string;
|
||||||
isOpen: boolean;
|
isOpen: boolean;
|
||||||
|
@ -181,7 +184,8 @@ export const SidebarCollapsible: React.FC<
|
||||||
sensors={sensors}
|
sensors={sensors}
|
||||||
collisionDetection={closestCenter}
|
collisionDetection={closestCenter}
|
||||||
onDragStart={handleDragStart}
|
onDragStart={handleDragStart}
|
||||||
onDragEnd={handleDragEnd}>
|
onDragEnd={handleDragEnd}
|
||||||
|
modifiers={modifiers}>
|
||||||
<SortableContext
|
<SortableContext
|
||||||
items={sortedItems.map((item) => item.id)}
|
items={sortedItems.map((item) => item.id)}
|
||||||
strategy={verticalListSortingStrategy}>
|
strategy={verticalListSortingStrategy}>
|
||||||
|
|
|
@ -45,7 +45,7 @@ export const MetricTitle: React.FC<{
|
||||||
}, [title, useEllipsis]);
|
}, [title, useEllipsis]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Link className="flex px-4" href={metricLink}>
|
<Link className="flex px-4" href={metricLink} prefetch>
|
||||||
<div
|
<div
|
||||||
{...attributes}
|
{...attributes}
|
||||||
{...listeners}
|
{...listeners}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
'use client';
|
||||||
|
|
||||||
import { FileType } from '@/api/asset_interfaces';
|
import { FileType } from '@/api/asset_interfaces';
|
||||||
import { useMemo, useState } from 'react';
|
import { useMemo, useState } from 'react';
|
||||||
import { FileConfig, FileView, FileViewConfig, FileViewSecondary } from './interfaces';
|
import { FileConfig, FileView, FileViewConfig, FileViewSecondary } from './interfaces';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { useMemo, useState, useTransition } from 'react';
|
import { useEffect, useMemo, useState, useTransition } from 'react';
|
||||||
import type { ChatLayoutView, SelectedFile } from '../../interfaces';
|
import type { ChatLayoutView, SelectedFile } from '../../interfaces';
|
||||||
import { usePathname } from 'next/navigation';
|
import { usePathname } from 'next/navigation';
|
||||||
import { parsePathnameSegments } from './parsePathnameSegments';
|
import { parsePathnameSegments } from './parsePathnameSegments';
|
||||||
|
@ -73,6 +73,10 @@ export const useSelectedFileAndLayout = ({
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setSelectedFile(initializeSelectedFile(params));
|
||||||
|
}, [Object.keys(params).join('')]);
|
||||||
|
|
||||||
return useMemo(
|
return useMemo(
|
||||||
() => ({
|
() => ({
|
||||||
onSetSelectedFile,
|
onSetSelectedFile,
|
||||||
|
|
Loading…
Reference in New Issue