From 65f1b25413a0f0f320d509ecd2c39cbd8a390d68 Mon Sep 17 00:00:00 2001 From: Boris Arzentar Date: Sun, 26 May 2024 23:49:50 +0200 Subject: [PATCH] feat: implement cognee ui redesign --- cognee-frontend/package-lock.json | 46 +++- cognee-frontend/package.json | 2 +- cognee-frontend/src/app/globals.css | 2 +- cognee-frontend/src/app/page.module.css | 1 - cognee-frontend/src/app/page.tsx | 80 +++--- .../src/app/wizard/AddStep/AddStep.module.css | 8 + .../src/app/wizard/AddStep/AddStep.tsx | 97 ++++++++ .../src/app/wizard/AddStep/index.ts | 1 + .../app/wizard/CognifyStep/CognifyStep.tsx | 47 ++++ .../src/app/wizard/CognifyStep/index.ts | 1 + .../wizard/ConfigStep/ConfigStep.module.css | 0 .../src/app/wizard/ConfigStep/ConfigStep.tsx | 22 ++ .../src/app/wizard/ConfigStep/index.ts | 1 + .../wizard/ExploreStep/ExploreStep.module.css | 20 ++ .../app/wizard/ExploreStep/ExploreStep.tsx | 14 ++ .../src/app/wizard/ExploreStep/index.ts | 1 + .../src/app/wizard/WizardPage.module.css | 17 +- cognee-frontend/src/app/wizard/WizardPage.tsx | 227 +++++------------- cognee-frontend/src/app/wizard/page.tsx | 16 -- .../src/modules/app/Loading/index.ts | 1 - cognee-frontend/src/modules/app/Logo/index.ts | 2 - cognee-frontend/src/modules/app/index.ts | 3 - .../src/modules/exploration/index.ts | 1 + .../modules/ingestion/DataView/DataView.tsx | 14 +- .../DataView/RawDataPreview.module.css | 8 + .../ingestion/DataView/RawDataPreview.tsx | 15 +- .../DatasetsView/DatasetsView.module.css | 10 + .../ingestion/DatasetsView/DatasetsView.tsx | 117 ++------- .../CognifyLoadingIndicator.module.css | 56 +++++ .../CognifyLoadingIndicator.tsx | 16 ++ .../LoadingIndicator.module.css | 2 +- .../LoadingIndicator.tsx | 0 .../src/{modules/app => ui/App}/Logo/Logo.tsx | 0 .../App/Logo/TextLogo.v1.tsx} | 1 - .../src/ui/App/Logo/TextLogo.v2.tsx | 29 +++ cognee-frontend/src/ui/App/index.ts | 4 + .../src/ui/IFrameView/IFrameView.module.css | 12 - .../src/ui/IFrameView/IFrameView.tsx | 28 --- cognee-frontend/src/ui/Icons/SettingsIcon.tsx | 67 +----- .../src/ui/Layout/Divider/Divider.module.css | 5 + .../src/ui/Layout/Divider/Divider.tsx | 7 + cognee-frontend/src/ui/Layout/index.ts | 1 + .../ui/Partials/Explorer/Explorer.module.css | 21 ++ .../src/ui/Partials/Explorer/Explorer.tsx | 50 ++++ .../src/ui/Partials/Footer/Footer.tsx | 4 +- .../src/ui/Partials/IFrameView/IFrameView.tsx | 13 + .../Partials/SearchView/SearchView.module.css | 17 +- .../src/ui/Partials/SearchView/SearchView.tsx | 96 ++++---- .../ui/Partials/SettingsModal/Settings.tsx | 187 +++++++++++++++ .../Partials/SettingsModal/SettingsModal.tsx | 173 +------------ .../WizardContent/WizardContent.module.css | 23 ++ .../Wizard/WizardContent/WizardContent.tsx | 6 + .../src/ui/Partials/Wizard/WizardHeading.tsx | 11 + .../src/ui/Partials/Wizard/index.ts | 2 + cognee-frontend/src/ui/Partials/index.ts | 2 + cognee-frontend/src/ui/index.ts | 1 - cognee/api/client.py | 2 +- cognee/api/v1/cognify/cognify.py | 24 +- cognee/api/v1/datasets/datasets.py | 6 +- .../relational/duckdb/DuckDBAdapter.py | 4 + cognee/infrastructure/llm/__init__.py | 2 +- cognee/infrastructure/llm/config.py | 18 +- cognee/infrastructure/llm/get_llm_client.py | 4 +- cognee/modules/settings/get_settings.py | 4 +- cognee/modules/settings/save_llm_config.py | 4 +- cognee/modules/tasks/__init__.py | 1 + cognee/modules/tasks/get_task_status.py | 18 ++ poetry.lock | 21 +- pyproject.toml | 1 + 69 files changed, 998 insertions(+), 719 deletions(-) create mode 100644 cognee-frontend/src/app/wizard/AddStep/AddStep.module.css create mode 100644 cognee-frontend/src/app/wizard/AddStep/AddStep.tsx create mode 100644 cognee-frontend/src/app/wizard/AddStep/index.ts create mode 100644 cognee-frontend/src/app/wizard/CognifyStep/CognifyStep.tsx create mode 100644 cognee-frontend/src/app/wizard/CognifyStep/index.ts create mode 100644 cognee-frontend/src/app/wizard/ConfigStep/ConfigStep.module.css create mode 100644 cognee-frontend/src/app/wizard/ConfigStep/ConfigStep.tsx create mode 100644 cognee-frontend/src/app/wizard/ConfigStep/index.ts create mode 100644 cognee-frontend/src/app/wizard/ExploreStep/ExploreStep.module.css create mode 100644 cognee-frontend/src/app/wizard/ExploreStep/ExploreStep.tsx create mode 100644 cognee-frontend/src/app/wizard/ExploreStep/index.ts delete mode 100644 cognee-frontend/src/modules/app/Loading/index.ts delete mode 100644 cognee-frontend/src/modules/app/Logo/index.ts delete mode 100644 cognee-frontend/src/modules/app/index.ts create mode 100644 cognee-frontend/src/modules/exploration/index.ts create mode 100644 cognee-frontend/src/modules/ingestion/DataView/RawDataPreview.module.css create mode 100644 cognee-frontend/src/ui/App/Loading/CognifyLoadingIndicator/CognifyLoadingIndicator.module.css create mode 100644 cognee-frontend/src/ui/App/Loading/CognifyLoadingIndicator/CognifyLoadingIndicator.tsx rename cognee-frontend/src/{modules/app/Loading => ui/App/Loading/DefaultLoadingIndicator}/LoadingIndicator.module.css (85%) rename cognee-frontend/src/{modules/app/Loading => ui/App/Loading/DefaultLoadingIndicator}/LoadingIndicator.tsx (100%) rename cognee-frontend/src/{modules/app => ui/App}/Logo/Logo.tsx (100%) rename cognee-frontend/src/{modules/app/Logo/TextLogo.tsx => ui/App/Logo/TextLogo.v1.tsx} (99%) create mode 100644 cognee-frontend/src/ui/App/Logo/TextLogo.v2.tsx create mode 100644 cognee-frontend/src/ui/App/index.ts delete mode 100644 cognee-frontend/src/ui/IFrameView/IFrameView.module.css delete mode 100644 cognee-frontend/src/ui/IFrameView/IFrameView.tsx create mode 100644 cognee-frontend/src/ui/Layout/Divider/Divider.module.css create mode 100644 cognee-frontend/src/ui/Layout/Divider/Divider.tsx create mode 100644 cognee-frontend/src/ui/Layout/index.ts create mode 100644 cognee-frontend/src/ui/Partials/Explorer/Explorer.module.css create mode 100644 cognee-frontend/src/ui/Partials/Explorer/Explorer.tsx create mode 100644 cognee-frontend/src/ui/Partials/IFrameView/IFrameView.tsx create mode 100644 cognee-frontend/src/ui/Partials/SettingsModal/Settings.tsx create mode 100644 cognee-frontend/src/ui/Partials/Wizard/WizardContent/WizardContent.module.css create mode 100644 cognee-frontend/src/ui/Partials/Wizard/WizardContent/WizardContent.tsx create mode 100644 cognee-frontend/src/ui/Partials/Wizard/WizardHeading.tsx create mode 100644 cognee-frontend/src/ui/Partials/Wizard/index.ts delete mode 100644 cognee-frontend/src/ui/index.ts create mode 100644 cognee/modules/tasks/get_task_status.py diff --git a/cognee-frontend/package-lock.json b/cognee-frontend/package-lock.json index c3bf33f0b..b60eca154 100644 --- a/cognee-frontend/package-lock.json +++ b/cognee-frontend/package-lock.json @@ -10,7 +10,7 @@ "dependencies": { "classnames": "^2.5.1", "next": "14.2.3", - "ohmy-ui": "^0.0.2", + "ohmy-ui": "^0.0.3", "react": "^18", "react-dom": "^18", "uuid": "^9.0.1" @@ -25,6 +25,45 @@ "typescript": "^5" } }, + "../../../Guerrilla/ohmy-ui": { + "version": "0.0.3", + "extraneous": true, + "license": "MIT", + "dependencies": { + "classnames": "^2.3.2" + }, + "devDependencies": { + "@rollup/plugin-commonjs": "^25.0.7", + "@rollup/plugin-node-resolve": "^15.2.3", + "@rollup/plugin-terser": "^0.4.4", + "@rollup/plugin-typescript": "^11.1.6", + "@types/node": "^20", + "@types/react": "^18", + "@types/react-dom": "^18", + "eslint": "^8", + "eslint-config-next": "14.0.4", + "next": "14.0.4", + "postcss": "^8.4.32", + "postcss-custom-media": "^10.0.2", + "postcss-import": "^15.1.0", + "postcss-preset-env": "^9.3.0", + "rollup": "^4.17.2", + "rollup-plugin-dts": "^6.1.0", + "rollup-plugin-peer-deps-external": "^2.2.4", + "rollup-plugin-postcss": "^4.0.2", + "typescript": "^5" + }, + "peerDependencies": { + "@types/react": "^18", + "react": "^18", + "react-dom": "^18" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, "node_modules/@babel/runtime": { "version": "7.24.5", "dev": true, @@ -2853,8 +2892,9 @@ } }, "node_modules/ohmy-ui": { - "version": "0.0.2", - "license": "MIT", + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/ohmy-ui/-/ohmy-ui-0.0.3.tgz", + "integrity": "sha512-GXtTZxbL+sXdlT26+mcSrqvUPUIWNUiZOtKT+0lxK6DglGezB0Y/NVQHBcsoPCzmXHY3wi4UBaCH6//8DjHKXA==", "dependencies": { "classnames": "^2.3.2" }, diff --git a/cognee-frontend/package.json b/cognee-frontend/package.json index 7c0821ed9..4c8dfdc91 100644 --- a/cognee-frontend/package.json +++ b/cognee-frontend/package.json @@ -11,7 +11,7 @@ "dependencies": { "classnames": "^2.5.1", "next": "14.2.3", - "ohmy-ui": "^0.0.2", + "ohmy-ui": "^0.0.3", "react": "^18", "react-dom": "^18", "uuid": "^9.0.1" diff --git a/cognee-frontend/src/app/globals.css b/cognee-frontend/src/app/globals.css index f4bd77c0c..f06746bfd 100644 --- a/cognee-frontend/src/app/globals.css +++ b/cognee-frontend/src/app/globals.css @@ -1,6 +1,6 @@ :root { --max-width: 1100px; - --border-radius: 12px; + --border-radius: 2px; --font-mono: ui-monospace, Menlo, Monaco, "Cascadia Mono", "Segoe UI Mono", "Roboto Mono", "Oxygen Mono", "Ubuntu Monospace", "Source Code Pro", "Fira Mono", "Droid Sans Mono", "Courier New", monospace; diff --git a/cognee-frontend/src/app/page.module.css b/cognee-frontend/src/app/page.module.css index 23f40f61e..02878d478 100644 --- a/cognee-frontend/src/app/page.module.css +++ b/cognee-frontend/src/app/page.module.css @@ -1,7 +1,6 @@ .main { display: flex; flex-direction: column; - padding: 32px; min-height: 100vh; } .main.noData { diff --git a/cognee-frontend/src/app/page.tsx b/cognee-frontend/src/app/page.tsx index ed1c57039..c6a1ce5c7 100644 --- a/cognee-frontend/src/app/page.tsx +++ b/cognee-frontend/src/app/page.tsx @@ -2,17 +2,17 @@ import { useCallback, useEffect, useState } from 'react'; import styles from "./page.module.css"; -import { Notification, NotificationContainer, Text, useNotifications } from 'ohmy-ui'; +import { GhostButton, Notification, NotificationContainer, Spacer, Stack, Text, useBoolean, useNotifications } from 'ohmy-ui'; import useDatasets from '@/modules/ingestion/useDatasets'; import DataView, { Data } from '@/modules/ingestion/DataView'; import DatasetsView from '@/modules/ingestion/DatasetsView'; import classNames from 'classnames'; import addData from '@/modules/ingestion/addData'; import cognifyDataset from '@/modules/datasets/cognifyDataset'; -import deleteDataset from '@/modules/datasets/deleteDataset'; import getDatasetData from '@/modules/datasets/getDatasetData'; -import getExplorationGraphUrl from '@/modules/exploration/getExplorationGraphUrl'; -import { Footer } from '@/ui/Partials'; +import { Footer, SettingsModal } from '@/ui/Partials'; +import { TextLogo } from '@/ui/App'; +import { SettingsIcon } from '@/ui/Icons'; export default function Home() { const { @@ -60,45 +60,49 @@ export default function Home() { }); }, [showNotification]); - const onDatasetDelete = useCallback((dataset: { id: string }) => { - deleteDataset(dataset) - .then(() => { - showNotification(`Dataset "${dataset.id}" deleted.`, 5000); - refreshDatasets(); - }) - }, [refreshDatasets, showNotification]); - - const onDatasetExplore = useCallback((dataset: { id: string }) => { - return getExplorationGraphUrl(dataset); - }, []); + const { + value: isSettingsModalOpen, + setTrue: openSettingsModal, + setFalse: closeSettingsModal, + } = useBoolean(false); return (
-
-
0, - })}> - -
- {datasetData.length > 0 && selectedDataset && ( -
- + + + + + + + + + +
+
0, + })}> +
- )} -
-
+ {datasetData.length > 0 && selectedDataset && ( +
+ +
+ )} +
+ + +