mirror of https://github.com/buster-so/buster.git
update how no datasets is presented
This commit is contained in:
parent
4a52fa6ddd
commit
d315d6f410
|
@ -15,6 +15,7 @@ import { useParams } from 'next/navigation';
|
||||||
import { useAppLayoutContextSelector } from '@/context/BusterAppLayout';
|
import { useAppLayoutContextSelector } from '@/context/BusterAppLayout';
|
||||||
import { BusterRoutes } from '@/routes';
|
import { BusterRoutes } from '@/routes';
|
||||||
import { useGetDatasets } from '@/api/buster_rest/datasets';
|
import { useGetDatasets } from '@/api/buster_rest/datasets';
|
||||||
|
import { NewDatasetModal } from '../NewDatasetModal';
|
||||||
|
|
||||||
const themeConfig: ThemeConfig = {
|
const themeConfig: ThemeConfig = {
|
||||||
components: {
|
components: {
|
||||||
|
@ -49,6 +50,7 @@ export const NewThreadModal = React.memo<{
|
||||||
const prompt = useBusterNewThreadsContextSelector((x) => x.prompt);
|
const prompt = useBusterNewThreadsContextSelector((x) => x.prompt);
|
||||||
const onBusterSearch = useBusterSearchContextSelector((x) => x.onBusterSearch);
|
const onBusterSearch = useBusterSearchContextSelector((x) => x.onBusterSearch);
|
||||||
const token = useAntToken();
|
const token = useAntToken();
|
||||||
|
const [openNewDatasetModal, setOpenNewDatasetModal] = useState(false);
|
||||||
const [suggestedPrompts, setSuggestedPrompts] = useState<BusterSearchResult[]>([]);
|
const [suggestedPrompts, setSuggestedPrompts] = useState<BusterSearchResult[]>([]);
|
||||||
const [activeItem, setActiveItem] = useState<number | null>(null);
|
const [activeItem, setActiveItem] = useState<number | null>(null);
|
||||||
const [defaultSuggestedPrompts, setDefaultSuggestedPrompts] = useState<BusterSearchResult[]>([]);
|
const [defaultSuggestedPrompts, setDefaultSuggestedPrompts] = useState<BusterSearchResult[]>([]);
|
||||||
|
@ -163,7 +165,9 @@ export const NewThreadModal = React.memo<{
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{!hasDatasets && <NoDatasets onClose={onClose} />}
|
{!hasDatasets && (
|
||||||
|
<NoDatasets onClose={onClose} setOpenNewDatasetModal={setOpenNewDatasetModal} />
|
||||||
|
)}
|
||||||
|
|
||||||
{hasDatasets && showSuggested && <Divider className="!m-0" />}
|
{hasDatasets && showSuggested && <Divider className="!m-0" />}
|
||||||
|
|
||||||
|
@ -178,6 +182,14 @@ export const NewThreadModal = React.memo<{
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
|
{!hasDatasets && (
|
||||||
|
<NewDatasetModal
|
||||||
|
open={openNewDatasetModal}
|
||||||
|
onClose={() => setOpenNewDatasetModal(false)}
|
||||||
|
afterCreate={onClose}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</ConfigProvider>
|
</ConfigProvider>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import React, { useState } from 'react';
|
import React from 'react';
|
||||||
import { Button } from 'antd';
|
import { Button } from 'antd';
|
||||||
import { Text, Title } from '@/components/text';
|
import { Text, Title } from '@/components/text';
|
||||||
import { AppMaterialIcons } from '@/components/icons';
|
import { AppMaterialIcons } from '@/components/icons';
|
||||||
import { NewDatasetModal } from '@appComponents/NewDatasetModal';
|
|
||||||
|
|
||||||
export const NoDatasets: React.FC<{ onClose: () => void }> = React.memo(({ onClose }) => {
|
|
||||||
const [openNewDatasetModal, setOpenNewDatasetModal] = useState(false);
|
|
||||||
|
|
||||||
|
export const NoDatasets: React.FC<{
|
||||||
|
onClose: () => void;
|
||||||
|
setOpenNewDatasetModal: (open: boolean) => void;
|
||||||
|
}> = React.memo(({ onClose, setOpenNewDatasetModal }) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="flex flex-col items-center space-y-3 p-3">
|
<div className="flex flex-col items-center space-y-3 p-3">
|
||||||
|
@ -17,6 +17,7 @@ export const NoDatasets: React.FC<{ onClose: () => void }> = React.memo(({ onClo
|
||||||
<Button
|
<Button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setOpenNewDatasetModal(true);
|
setOpenNewDatasetModal(true);
|
||||||
|
onClose();
|
||||||
}}
|
}}
|
||||||
type="default"
|
type="default"
|
||||||
icon={<AppMaterialIcons icon="table_view" />}>
|
icon={<AppMaterialIcons icon="table_view" />}>
|
||||||
|
@ -24,12 +25,6 @@ export const NoDatasets: React.FC<{ onClose: () => void }> = React.memo(({ onClo
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<NewDatasetModal
|
|
||||||
open={openNewDatasetModal}
|
|
||||||
onClose={() => setOpenNewDatasetModal(false)}
|
|
||||||
afterCreate={onClose}
|
|
||||||
/>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
import { Empty } from 'antd';
|
|
||||||
import React from 'react';
|
|
||||||
|
|
||||||
export const ThreadControllerEmptyState: React.FC<{
|
|
||||||
className?: string;
|
|
||||||
}> = ({ className = '' }) => {
|
|
||||||
return (
|
|
||||||
<div className={`flex h-full w-full items-center justify-center ${className}`}>
|
|
||||||
<Empty description="No thread selected" image={Empty.PRESENTED_IMAGE_SIMPLE} />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
Loading…
Reference in New Issue