From 5d881e91d40f9032b0a3d115159252f4b92fa4d6 Mon Sep 17 00:00:00 2001 From: Aviv Keller Date: Thu, 13 Nov 2025 19:03:45 -0500 Subject: [PATCH 1/8] chore(orama): move some components to ui-components --- .../Common/Searchbox/ChatMessage/index.tsx | 2 +- .../Common/Searchbox/EmptyResults/index.tsx | 65 --------- .../InnerSearchboxModal/index.module.css | 19 --- .../Searchbox/InnerSearchboxModal/index.tsx | 68 ---------- .../Searchbox/MobileTopBar/index.module.css | 67 ---------- .../Common/Searchbox/MobileTopBar/index.tsx | 63 --------- .../Common/Searchbox/Search/index.module.css | 78 ----------- .../Common/Searchbox/Search/index.tsx | 50 ------- .../Common/Searchbox/Search/utils.ts | 11 -- .../Common/Searchbox/SearchItem/index.tsx | 53 ++++---- .../Common/Searchbox/SearchResults/index.tsx | 126 ------------------ .../Searchbox/SlidingChatPanel/index.tsx | 12 +- .../components/Common/Searchbox/index.tsx | 86 ++++++------ apps/site/providers/searchboxProvider.tsx | 37 ----- apps/site/reducers/searchboxReducer.ts | 54 -------- apps/site/types/index.ts | 1 - apps/site/types/searchbox.ts | 24 ---- packages/ui-components/package.json | 2 + .../Search/Chat/Actions}/index.module.css | 0 .../src/Common/Search/Chat/Actions}/index.tsx | 4 +- .../Search/Chat/Input}/index.module.css | 4 +- .../src/Common/Search/Chat/Input}/index.tsx | 40 +++--- .../src/Common/Search/Input/index.module.css | 32 +++++ .../src/Common/Search/Input/index.tsx | 31 +++++ .../src/Common/Search/Modal}/index.module.css | 32 ++--- .../src/Common/Search/Modal/index.tsx | 47 +++++++ .../Search/Results/Empty}/index.module.css | 0 .../src/Common/Search/Results/Empty/index.tsx | 40 ++++++ .../Search/Results/Skeleton/index.module.css | 43 ++++++ .../Common/Search/Results/Skeleton/index.tsx | 35 +++++ .../Search/Results/Tabs/index.module.css | 50 +++++++ .../src/Common/Search/Results/Tabs/index.tsx | 39 ++++++ .../Common/Search/Results}/index.module.css | 99 +------------- .../src/Common/Search/Results/index.tsx | 91 +++++++++++++ .../ui-components/src/Common/Search/index.tsx | 22 +++ pnpm-lock.yaml | 6 + 36 files changed, 555 insertions(+), 878 deletions(-) delete mode 100644 apps/site/components/Common/Searchbox/EmptyResults/index.tsx delete mode 100644 apps/site/components/Common/Searchbox/InnerSearchboxModal/index.module.css delete mode 100644 apps/site/components/Common/Searchbox/InnerSearchboxModal/index.tsx delete mode 100644 apps/site/components/Common/Searchbox/MobileTopBar/index.module.css delete mode 100644 apps/site/components/Common/Searchbox/MobileTopBar/index.tsx delete mode 100644 apps/site/components/Common/Searchbox/Search/index.module.css delete mode 100644 apps/site/components/Common/Searchbox/Search/index.tsx delete mode 100644 apps/site/components/Common/Searchbox/Search/utils.ts delete mode 100644 apps/site/components/Common/Searchbox/SearchResults/index.tsx delete mode 100644 apps/site/providers/searchboxProvider.tsx delete mode 100644 apps/site/reducers/searchboxReducer.ts delete mode 100644 apps/site/types/searchbox.ts rename {apps/site/components/Common/Searchbox/ChatActions => packages/ui-components/src/Common/Search/Chat/Actions}/index.module.css (100%) rename {apps/site/components/Common/Searchbox/ChatActions => packages/ui-components/src/Common/Search/Chat/Actions}/index.tsx (94%) rename {apps/site/components/Common/Searchbox/ChatInput => packages/ui-components/src/Common/Search/Chat/Input}/index.module.css (97%) rename {apps/site/components/Common/Searchbox/ChatInput => packages/ui-components/src/Common/Search/Chat/Input}/index.tsx (71%) create mode 100644 packages/ui-components/src/Common/Search/Input/index.module.css create mode 100644 packages/ui-components/src/Common/Search/Input/index.tsx rename {apps/site/components/Common/Searchbox => packages/ui-components/src/Common/Search/Modal}/index.module.css (78%) create mode 100644 packages/ui-components/src/Common/Search/Modal/index.tsx rename {apps/site/components/Common/Searchbox/EmptyResults => packages/ui-components/src/Common/Search/Results/Empty}/index.module.css (100%) create mode 100644 packages/ui-components/src/Common/Search/Results/Empty/index.tsx create mode 100644 packages/ui-components/src/Common/Search/Results/Skeleton/index.module.css create mode 100644 packages/ui-components/src/Common/Search/Results/Skeleton/index.tsx create mode 100644 packages/ui-components/src/Common/Search/Results/Tabs/index.module.css create mode 100644 packages/ui-components/src/Common/Search/Results/Tabs/index.tsx rename {apps/site/components/Common/Searchbox/SearchResults => packages/ui-components/src/Common/Search/Results}/index.module.css (52%) create mode 100644 packages/ui-components/src/Common/Search/Results/index.tsx create mode 100644 packages/ui-components/src/Common/Search/index.tsx diff --git a/apps/site/components/Common/Searchbox/ChatMessage/index.tsx b/apps/site/components/Common/Searchbox/ChatMessage/index.tsx index 8b94f31ef9f96..8fb1d537ccfdb 100644 --- a/apps/site/components/Common/Searchbox/ChatMessage/index.tsx +++ b/apps/site/components/Common/Searchbox/ChatMessage/index.tsx @@ -1,8 +1,8 @@ +import ChatActions from '@node-core/ui-components/Common/Search/Chat/Actions'; import type { Interaction } from '@orama/core'; import { ChatInteractions } from '@orama/ui/components'; import type { FC } from 'react'; -import { ChatActions } from '../ChatActions'; import ChatSources from '../ChatSources'; import styles from './index.module.css'; diff --git a/apps/site/components/Common/Searchbox/EmptyResults/index.tsx b/apps/site/components/Common/Searchbox/EmptyResults/index.tsx deleted file mode 100644 index 9671ed04ae32f..0000000000000 --- a/apps/site/components/Common/Searchbox/EmptyResults/index.tsx +++ /dev/null @@ -1,65 +0,0 @@ -'use client'; - -import { SparklesIcon } from '@heroicons/react/24/outline'; -import { SearchResults, Suggestions } from '@orama/ui/components'; -import { useTranslations } from 'next-intl'; -import { type FC } from 'react'; - -import { useSearchbox } from '#site/providers/searchboxProvider'; - -import styles from './index.module.css'; - -export const EmptyResults: FC = () => { - const t = useTranslations(); - const searchbox = useSearchbox(); - const isSearchMode = searchbox?.mode === 'search'; - - return ( - - {term => ( - <> - {term ? ( -
-

- {t('components.search.noResultsFoundFor')} "{term}" -

-
- ) : ( - -

- {t('components.search.suggestions')} -

- searchbox?.switchTo('chat')} - tabIndex={isSearchMode ? 0 : -1} - aria-hidden={!isSearchMode} - className={styles.suggestionItem} - > - - {t('components.search.suggestionOne')} - - searchbox?.switchTo('chat')} - tabIndex={isSearchMode ? 0 : -1} - aria-hidden={!isSearchMode} - className={styles.suggestionItem} - > - - {t('components.search.suggestionTwo')} - - searchbox?.switchTo('chat')} - className={styles.suggestionItem} - > - - {t('components.search.suggestionThree')} - -
- )} - - )} -
- ); -}; diff --git a/apps/site/components/Common/Searchbox/InnerSearchboxModal/index.module.css b/apps/site/components/Common/Searchbox/InnerSearchboxModal/index.module.css deleted file mode 100644 index 211eedd672b8d..0000000000000 --- a/apps/site/components/Common/Searchbox/InnerSearchboxModal/index.module.css +++ /dev/null @@ -1,19 +0,0 @@ -@reference "../../../../styles/index.css"; - -.mobileChatContainer { - @apply flex - grow - flex-col - overflow-hidden - px-4 - pb-4; -} - -.mobileChatTop { - @apply grow - overflow-hidden; -} - -.mobileChatBottom { - @apply mt-4; -} diff --git a/apps/site/components/Common/Searchbox/InnerSearchboxModal/index.tsx b/apps/site/components/Common/Searchbox/InnerSearchboxModal/index.tsx deleted file mode 100644 index 99b3385250a70..0000000000000 --- a/apps/site/components/Common/Searchbox/InnerSearchboxModal/index.tsx +++ /dev/null @@ -1,68 +0,0 @@ -'use client'; -import type { FC, PropsWithChildren } from 'react'; -import { useEffect, useState, useRef } from 'react'; - -import { useSearchbox } from '#site/providers/searchboxProvider'; - -import { ChatInput } from '../ChatInput'; -import { ChatInteractionsContainer } from '../ChatInteractions'; -import { Footer } from '../Footer'; -import { MobileTopBar } from '../MobileTopBar'; -import { Search } from '../Search'; -import { SlidingChatPanel } from '../SlidingChatPanel'; -import styles from './index.module.css'; - -export const InnerSearchboxModal: FC = () => { - const searchbox = useSearchbox(); - const [isMobileScreen, setIsMobileScreen] = useState(false); - const searchInputRef = useRef(null); - - const displaySearch = - !isMobileScreen || (isMobileScreen && searchbox?.mode === 'search'); - - useEffect(() => { - const checkScreenSize = () => { - setIsMobileScreen(window.innerWidth < 1024); - }; - checkScreenSize(); - window.addEventListener('resize', checkScreenSize); - return () => { - window.removeEventListener('resize', checkScreenSize); - }; - }, []); - - return ( - <> - {isMobileScreen && ( - - )} - {displaySearch && } - {isMobileScreen && searchbox?.mode === 'chat' && ( - <> -
-
- -
-
- -
-
-