fix: UI improvements

This commit is contained in:
Boris Arzentar 2025-09-08 17:10:40 +02:00
parent 711f3fe070
commit 83f8992777
No known key found for this signature in database
GPG key ID: D5CC274C784807B7
11 changed files with 128 additions and 87 deletions

View file

@ -1,22 +1,29 @@
"use client";
import Link from "next/link";
import { BackIcon } from "@/ui/Icons";
import { CTAButton } from "@/ui/elements";
import Header from "@/ui/Layout/Header";
import { useAuthenticatedUser } from "@/modules/auth";
export default function Account() {
const { user } = useAuthenticatedUser();
const account = {
name: "John Doe",
name: user ? user.name || user.email : "NN",
};
return (
<>
<div className="absolute top-0 right-0 bottom-0 left-0 flex flex-row gap-2.5">
<div className="flex-1/5 bg-gray-100 h-full"></div>
<div className="flex-1/5 bg-gray-100 h-full"></div>
<div className="flex-1/5 bg-gray-100 h-full"></div>
<div className="flex-1/5 bg-gray-100 h-full"></div>
<div className="flex-1/5 bg-gray-100 h-full"></div>
</div>
<div className="bg-gray-200 h-full max-w-[1920px] mx-auto">
<video
autoPlay
loop
muted
playsInline
className="fixed inset-0 z-0 object-cover w-full h-full"
>
<source src="/videos/background-video-blur.mp4" type="video/mp4" />
Your browser does not support the video tag.
</video>
<Header />
@ -46,6 +53,6 @@ export default function Account() {
<div className="flex-1/5 py-4 px-5 rounded-xl">
</div>
</div>
</>
</div>
);
}

View file

@ -1,10 +1,11 @@
import { FormEvent, useCallback, useState } from "react";
import { CloseIcon, PlusIcon } from "@/ui/Icons";
import { useModal } from "@/ui/elements/Modal";
import { CTAButton, GhostButton, IconButton, Modal, Select } from "@/ui/elements";
import { CTAButton, GhostButton, IconButton, Modal, NeutralButton, Select } from "@/ui/elements";
import addData from "@/modules/ingestion/addData";
import { Dataset } from "@/modules/ingestion/useDatasets";
import cognifyDataset from "@/modules/datasets/cognifyDataset";
interface AddDataToCogneeProps {
datasets: Dataset[];
@ -39,9 +40,16 @@ export default function AddDataToCognee({ datasets, refreshDatasets }: AddDataTo
},
Array.from(filesForUpload)
)
.then(() => {
.then(({ dataset_id, dataset_name }) => {
refreshDatasets();
setFilesForUpload(null);
return cognifyDataset({
id: dataset_id,
name: dataset_name,
data: [], // not important, just to mimick Dataset
status: "", // not important, just to mimick Dataset
});
});
}, [filesForUpload, refreshDatasets]);
@ -64,20 +72,22 @@ export default function AddDataToCognee({ datasets, refreshDatasets }: AddDataTo
<div className="w-full max-w-2xl">
<div className="flex flex-row items-center justify-between">
<span className="text-2xl">Add new data to a dataset?</span>
<IconButton onClick={closeAddDataModal}><CloseIcon /></IconButton>
<IconButton disabled={isProcessingDataWithCognee} onClick={closeAddDataModal}><CloseIcon /></IconButton>
</div>
<div className="mt-8 mb-6">Please select a dataset to add data in.<br/> If you don&apos;t have any, don&apos;t worry, we will create one for you.</div>
<form onSubmit={submitDataToCognee}>
<div className="max-w-md flex flex-col gap-4">
<Select name="datasetName">
<option value="">select a dataset</option>
{datasets.map((dataset: Dataset) => <option key={dataset.id} value={dataset.id}>{dataset.name}</option>)}
{!datasets.length && <option value="">main_dataset</option>}
{datasets.map((dataset: Dataset, index) => (
<option selected={index===0} key={dataset.id} value={dataset.id}>{dataset.name}</option>
))}
</Select>
<GhostButton className="w-full relative justify-start pl-4">
<NeutralButton className="w-full relative justify-start pl-4">
<input onChange={prepareFiles} required name="files" tabIndex={-1} type="file" multiple className="absolute w-full h-full cursor-pointer opacity-0" />
<span>select files</span>
</GhostButton>
</NeutralButton>
{filesForUpload?.length && (
<div className="pt-4 mt-4 border-t-1 border-t-gray-100">
@ -91,7 +101,7 @@ export default function AddDataToCognee({ datasets, refreshDatasets }: AddDataTo
)}
</div>
<div className="flex flex-row gap-4 mt-4 justify-end">
<GhostButton type="button" onClick={() => closeAddDataModal()}>cancel</GhostButton>
<GhostButton disabled={isProcessingDataWithCognee} type="button" onClick={() => closeAddDataModal()}>cancel</GhostButton>
<CTAButton disabled={isProcessingDataWithCognee} type="submit">
{isProcessingDataWithCognee ? "processing..." : "add"}
</CTAButton>

View file

@ -93,6 +93,17 @@ export default function Dashboard() {
return (
<div className="h-full flex flex-col bg-gray-200">
<video
autoPlay
loop
muted
playsInline
className="fixed inset-0 z-0 object-cover w-full h-full"
>
<source src="/videos/background-video-blur.mp4" type="video/mp4" />
Your browser does not support the video tag.
</video>
<Header />
<div className="relative flex-1 flex flex-row gap-2.5 items-start w-full max-w-[1920px] max-h-[calc(100% - 3.5rem)] overflow-hidden mx-auto px-2.5 py-2.5">

View file

@ -8,8 +8,8 @@ import { CloseIcon, DatasetIcon, MinusIcon, PlusIcon } from "@/ui/Icons";
import useDatasets, { Dataset } from "@/modules/ingestion/useDatasets";
import addData from "@/modules/ingestion/addData";
import cognifyDataset from "@/modules/datasets/cognifyDataset";
import { DataFile } from '@/modules/ingestion/useData';
import { LoadingIndicator } from '@/ui/App';
import { DataFile } from "@/modules/ingestion/useData";
import { LoadingIndicator } from "@/ui/App";
interface DatasetsChangePayload {
datasets: Dataset[]
@ -156,20 +156,16 @@ export default function DatasetsAccordion({
}
};
const {
value: isProcessingFiles,
setTrue: setProcessingFilesInProgress,
setFalse: setProcessingFilesDone,
} = useBoolean(false);
const [datasetInProcessing, setProcessingDataset] = useState<Dataset | null>(null);
const handleAddFiles = (dataset: Dataset, event: ChangeEvent<HTMLInputElement>) => {
event.stopPropagation();
if (isProcessingFiles) {
if (datasetInProcessing) {
return;
}
setProcessingFilesInProgress();
setProcessingDataset(dataset);
if (!event.target.files) {
return;
@ -184,12 +180,10 @@ export default function DatasetsAccordion({
return addData(dataset, files)
.then(async () => {
await getDatasetData(dataset.id);
const onUpdate = () => {};
return cognifyDataset(dataset, onUpdate)
return cognifyDataset(dataset)
.finally(() => {
setProcessingFilesDone();
setProcessingDataset(null);
});
});
};
@ -230,7 +224,12 @@ export default function DatasetsAccordion({
isOpen={isDatasetsPanelOpen}
openAccordion={openDatasetsPanel}
closeAccordion={closeDatasetsPanel}
tools={tools || <IconButton onClick={handleDatasetAdd}><PlusIcon /></IconButton>}
tools={(
<div className="flex flex-row gap-4 items-center">
{tools}
<IconButton onClick={handleDatasetAdd}><PlusIcon /></IconButton>
</div>
)}
switchCaretPosition={switchCaretPosition}
className={className}
contentClassName={contentClassName}
@ -247,7 +246,7 @@ export default function DatasetsAccordion({
key={dataset.id}
title={(
<div className="flex flex-row gap-2 items-center py-1.5 cursor-pointer">
{isProcessingFiles ? <LoadingIndicator /> : <DatasetIcon />}
{datasetInProcessing?.id == dataset.id ? <LoadingIndicator /> : <DatasetIcon />}
<span className="text-xs">{dataset.name}</span>
</div>
)}

View file

@ -5,16 +5,17 @@ import Header from "@/ui/Layout/Header";
export default function Plan() {
return (
<>
<div className="absolute top-0 right-0 bottom-0 left-0 flex flex-row gap-2.5">
<div className="flex-1/5 bg-gray-100 h-full"></div>
<div className="flex-3/5 h-full flex flex-row gap-2.5">
<div className="flex-1/3 bg-gray-100 h-full"></div>
<div className="flex-1/3 bg-gray-100 h-full"></div>
<div className="flex-1/3 bg-gray-100 h-full"></div>
</div>
<div className="flex-1/5 bg-gray-100 h-full"></div>
</div>
<div className="bg-gray-200 h-full max-w-[1920px] mx-auto">
<video
autoPlay
loop
muted
playsInline
className="fixed inset-0 z-0 object-cover w-full h-full"
>
<source src="/videos/background-video-blur.mp4" type="video/mp4" />
Your browser does not support the video tag.
</video>
<Header />
@ -27,25 +28,29 @@ export default function Plan() {
</div>
<div className="flex-3/5">
<div className="bg-[rgba(255,255,255,0.7)] rounded-xl px-5 py-4 mb-2">
Affordable and transparent pricing
</div>
<div className="grid grid-cols-3 gap-x-2.5">
<div className="pt-13 py-4 px-5 mb-2.5 rounded-tl-xl rounded-tr-xl bg-white h-full">
<div className="pt-13 py-4 px-5 mb-2.5 rounded-tl-xl rounded-tr-xl bg-[rgba(255,255,255,0.7)] h-full">
<div>Basic</div>
<div className="text-3xl mb-4 font-bold">Free</div>
</div>
<div className="pt-13 py-4 px-5 mb-2.5 rounded-tl-xl rounded-tr-xl bg-white h-full">
<div className="pt-13 py-4 px-5 mb-2.5 rounded-tl-xl rounded-tr-xl bg-[rgba(255,255,255,0.7)] h-full">
<div>On-prem Subscription</div>
<div className="mb-4"><span className="text-3xl font-bold">$2470</span><span className="text-gray-400"> /per month</span></div>
<div className="mb-9"><span className="font-bold">Save 20% </span>yearly</div>
</div>
<div className="pt-13 py-4 px-5 mb-2.5 rounded-tl-xl rounded-tr-xl bg-white h-full">
<div className="pt-13 py-4 px-5 mb-2.5 rounded-tl-xl rounded-tr-xl bg-[rgba(255,255,255,0.7)] h-full">
<div>Cloud Subscription</div>
<div className="mb-4"><span className="text-3xl font-bold">$25</span><span className="text-gray-400"> /per month</span></div>
<div className="mb-9 text-gray-400">(beta pricing)</div>
</div>
<div className="bg-white rounded-bl-xl rounded-br-xl h-full">
<div className="bg-[rgba(255,255,255,0.7)] rounded-bl-xl rounded-br-xl h-full py-4 px-5">
<div className="mb-1 invisible">Everything in the free plan, plus...</div>
<div className="flex flex-col gap-3 mb-28">
<div className="flex flex-row gap-2"><CheckIcon className="mt-1 shrink-0" />License to use Cognee open source</div>
@ -56,7 +61,7 @@ export default function Plan() {
</div>
</div>
<div className="bg-white rounded-bl-xl rounded-br-xl h-full">
<div className="bg-[rgba(255,255,255,0.7)] rounded-bl-xl rounded-br-xl h-full py-4 px-5">
<div className="mb-1 text-gray-400">Everything in the free plan, plus...</div>
<div className="flex flex-col gap-3 mb-10">
<div className="flex flex-row gap-2"><CheckIcon className="mt-1 shrink-0" />License to use Cognee open source and Cognee Platform</div>
@ -69,7 +74,7 @@ export default function Plan() {
</div>
</div>
<div className="bg-white rounded-bl-xl rounded-br-xl h-full">
<div className="bg-[rgba(255,255,255,0.7)] rounded-bl-xl rounded-br-xl h-full py-4 px-5">
<div className="mb-1 text-gray-400">Everything in the free plan, plus...</div>
<div className="flex flex-col gap-3 mb-10">
<div className="flex flex-row gap-2"><CheckIcon className="mt-1 shrink-0" />Fully hosted cloud platform</div>
@ -83,24 +88,25 @@ export default function Plan() {
</div>
<div className="pt-4 pb-14 mb-2.5">
<NeutralButton>Try for free</NeutralButton>
<NeutralButton className="w-full">Try for free</NeutralButton>
</div>
<div className="pt-4 pb-14 mb-2.5">
<CTAButton>Talk to us</CTAButton>
<CTAButton className="w-full">Talk to us</CTAButton>
</div>
<div className="pt-4 pb-14 mb-2.5">
<NeutralButton>Sign up for Cogwit Beta</NeutralButton>
<NeutralButton className="w-full">Sign up for Cogwit Beta</NeutralButton>
</div>
</div>
<div className="grid grid-cols-4 py-4 px-5 bg-[rgba(255,255,255,0.5)] mb-12">
<div className="grid grid-cols-4 py-4 px-5 mb-4">
<div>Feature Comparison</div>
<div className="text-center">Basic</div>
<div className="text-center">On-prem</div>
<div className="text-center">Cloud</div>
</div>
<div className="grid grid-cols-4 py-1 px-5 mb-12 bg-[rgba(255,255,255,0.7)] rounded-xl">
<div className="border-b-[1px] border-b-gray-100 py-3">Data Sources</div>
<div className="text-center border-b-[1px] border-b-gray-100 py-3">28+</div>
<div className="text-center border-b-[1px] border-b-gray-100 py-3">28+</div>
@ -121,37 +127,39 @@ export default function Plan() {
<div className="text-center border-b-[1px] border-b-gray-100 py-3">Hands-on</div>
<div className="text-center border-b-[1px] border-b-gray-100 py-3">Priority</div>
<div className="border-b-[1px] border-b-gray-100 py-3">SLA</div>
<div className="text-center border-b-[1px] border-b-gray-100 py-3"></div>
<div className="text-center border-b-[1px] border-b-gray-100 py-3">1 day</div>
<div className="text-center border-b-[1px] border-b-gray-100 py-3">Standard</div>
<div className="py-3">SLA</div>
<div className="text-center py-3"></div>
<div className="text-center py-3">1 day</div>
<div className="text-center py-3">Standard</div>
</div>
<div className="grid grid-cols-2 gap-x-2.5 gap-y-2.5 mb-12">
<div className="bg-[rgba(255,255,255,0.5)] py-4 px-5">
<div className="bg-[rgba(255,255,255,0.5)] py-4 px-5 rounded-xl">
<div>Can I change my plan anytime?</div>
<div className="text-gray-500 mt-6">Yes, you can upgrade or downgrade your plan at any time. Changes take effect immediately.</div>
</div>
<div className="bg-[rgba(255,255,255,0.5)] py-4 px-5">
<div className="bg-[rgba(255,255,255,0.5)] py-4 px-5 rounded-xl">
<div>What happens to my data if I downgrade?</div>
<div className="text-gray-500 mt-6">Your data is preserved, but features may be limited based on your new plan constraints.</div>
</div>
<div className="bg-[rgba(255,255,255,0.5)] py-4 px-5">
<div className="bg-[rgba(255,255,255,0.5)] py-4 px-5 rounded-xl">
<div>Do you offer educational discounts?</div>
<div className="text-gray-500 mt-6">Yes, we offer special pricing for educational institutions and students. Contact us for details.</div>
</div>
<div className="bg-[rgba(255,255,255,0.5)] py-4 px-5">
<div className="bg-[rgba(255,255,255,0.5)] py-4 px-5 rounded-xl">
<div>Is there a free trial for paid plans?</div>
<div className="text-gray-500 mt-6">All new accounts start with a 14-day free trial of our Pro plan features.</div>
</div>
</div>
</div>
<div className="flex-1/5 h-full text-center flex flex-col self-end mb-12">
<span className="text-sm mb-2">Need a custom solution?</span>
<CTAButton>Contact us</CTAButton>
<div className="flex-1/5 h-full text-center flex flex-col self-end mb-12 max-w-[1920px]">
<div className="fixed bottom-6 w-[calc(min(1920px,100%)/5)] mx-auto">
<div className="text-sm mb-2">Need a custom solution?</div>
<CTAButton className="w-full">Contact us</CTAButton>
</div>
</div>
</div>
</>
</div>
);
}

View file

@ -1,13 +1,13 @@
import { fetch } from "@/utils";
import getDatasetGraph from "./getDatasetGraph";
// import getDatasetGraph from "./getDatasetGraph";
import { Dataset } from "../ingestion/useDatasets";
interface GraphData {
nodes: { id: string; label: string; properties?: object }[];
edges: { source: string; target: string; label: string }[];
}
// interface GraphData {
// nodes: { id: string; label: string; properties?: object }[];
// edges: { source: string; target: string; label: string }[];
// }
export default async function cognifyDataset(dataset: Dataset, onUpdate: (data: GraphData) => void) {
export default async function cognifyDataset(dataset: Dataset) {
// const data = await (
return fetch("/v1/cognify", {
method: "POST",
@ -19,16 +19,16 @@ export default async function cognifyDataset(dataset: Dataset, onUpdate: (data:
runInBackground: false,
}),
})
.then((response) => response.json())
.then(() => {
return getDatasetGraph(dataset)
.then((data) => {
onUpdate({
nodes: data.nodes,
edges: data.edges,
});
});
});
.then((response) => response.json());
// .then(() => {
// return getDatasetGraph(dataset)
// .then((data) => {
// onUpdate({
// nodes: data.nodes,
// edges: data.edges,
// });
// });
// });
// )
// const websocket = new WebSocket(`ws://localhost:8000/api/v1/cognify/subscribe/${data.pipeline_run_id}`);

View file

@ -27,10 +27,10 @@ export default function Header() {
return (
<>
<header className="relative bg-[rgba(244,244,244,0.5)] flex flex-row h-14 min-h-14 px-5 items-center justify-between w-full max-w-[1920px] mx-auto">
<header className="relative bg-[rgba(244,244,244,0.3)] flex flex-row h-14 min-h-14 px-5 items-center justify-between w-full max-w-[1920px] mx-auto">
<div className="flex flex-row gap-4 items-center">
<CogneeIcon />
<div className="text-lg">Cognee Graph Interface</div>
<div className="text-lg">Cognee Local</div>
</div>
<div className="flex flex-row items-center gap-2.5">

View file

@ -36,7 +36,9 @@ def get_notebooks_router():
async def create_notebook_endpoint(
notebook_data: NotebookData, user: User = Depends(get_authenticated_user)
):
return await create_notebook(user.id, notebook_data.name, notebook_data.cells)
return await create_notebook(
user.id, notebook_data.name, notebook_data.cells, deletable=True
)
@router.put("/{notebook_id}")
async def update_notebook_endpoint(

View file

@ -15,7 +15,9 @@ async def create_notebook(
deletable: Optional[bool],
session: AsyncSession,
) -> Notebook:
notebook = Notebook(name=notebook_name, owner_id=user_id, cells=cells, deletable=deletable)
notebook = Notebook(
name=notebook_name, owner_id=user_id, cells=cells, deletable=deletable or True
)
session.add(notebook)

View file

@ -29,7 +29,9 @@ async def get_default_user() -> SimpleNamespace:
# We return a SimpleNamespace to have the same user type as our SaaS
# SimpleNamespace is just a dictionary which can be accessed through attributes
auth_data = SimpleNamespace(id=user.id, tenant_id=user.tenant_id, roles=[])
auth_data = SimpleNamespace(
id=user.id, email=user.email, tenant_id=user.tenant_id, roles=[]
)
return auth_data
except Exception as error:
if "principals" in str(error.args):