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