diff --git a/.github/workflows/sync-orama.yml b/.github/workflows/sync-orama.yml deleted file mode 100644 index c094f8c25971f..0000000000000 --- a/.github/workflows/sync-orama.yml +++ /dev/null @@ -1,52 +0,0 @@ -# Security Notes -# This workflow uses `pull_request_target`, so will run against all PRs automatically (without approval), be careful with allowing any user-provided code to be run here -# Only selected Actions are allowed within this repository. Please refer to (https://github.com/nodejs/nodejs.org/settings/actions) -# for the full list of available actions. If you want to add a new one, please reach out a maintainer with Admin permissions. -# REVIEWERS, please always double-check security practices before merging a PR that contains Workflow changes!! -# AUTHORS, please only use actions with explicit SHA references, and avoid using `@master` or `@main` references or `@version` tags. -# MERGE QUEUE NOTE: This Workflow does not run on `merge_group` trigger, as this Workflow is not required for Merge Queue's - -name: Sync Orama Cloud - -on: - workflow_dispatch: - push: - branches: - - main - pull_request_target: - branches: - - main - types: - - labeled - -permissions: - contents: read - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ github.event_name != 'push' }} - -jobs: - sync-orama-cloud: - name: Sync Orama Cloud - runs-on: ubuntu-latest - - # This Job should run either on non-`pull_request_target` events, - # or `pull_request_target` event with a `labeled` action with a label named `github_actions:pull-request` - # since we want to run Website Builds on all these occasions. As this allows us to be certain the that builds are passing - if: github.event_name != 'pull_request_target' || github.event.label.name == 'github_actions:pull-request' - - steps: - - uses: nodejs/web-team/actions/setup-environment@9f3c83af227d721768d9dbb63009a47ed4f4282f - with: - pnpm: true - use-version-file: true - - - name: Sync Orama Cloud - working-directory: apps/site - run: node --run sync-orama - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NEW_ORAMA_PROJECT_ID: ${{ github.event_name == 'push' && secrets.NEW_ORAMA_PRODUCTION_PROJECT_ID || secrets.NEW_ORAMA_PROJECT_ID }} - NEW_ORAMA_PRIVATE_API_KEY: ${{ github.event_name == 'push' && secrets.NEW_ORAMA_PRODUCTION_PRIVATE_API_KEY || secrets.NEW_ORAMA_PRIVATE_API_KEY }} - NEW_ORAMA_DATASOURCE_ID: ${{ github.event_name == 'push' && secrets.NEW_ORAMA_PRODUCTION_DATASOURCE_ID || secrets.NEW_ORAMA_DATASOURCE_ID }} diff --git a/apps/site/components/Common/Searchbox/ChatInteractions/index.module.css b/apps/site/components/Common/Searchbox/ChatInteractions/index.module.css deleted file mode 100644 index 01ed9a85fa432..0000000000000 --- a/apps/site/components/Common/Searchbox/ChatInteractions/index.module.css +++ /dev/null @@ -1,65 +0,0 @@ -@reference "../../../../styles/index.css"; - -.chatInteractionsContainer { - @apply relative - mb-6 - flex - h-full - w-[95%] - flex-1 - flex-col - items-start - self-center - overflow-auto - px-1; - - &::-webkit-scrollbar { - @apply size-1.5; - } - - &::-webkit-scrollbar-track { - @apply rounded-md - bg-transparent; - } - - &::-webkit-scrollbar-thumb { - @apply rounded-md - bg-neutral-900; - } -} - -.chatInteractionsWrapper { - @apply flex - w-full - flex-wrap - gap-6; - - > div { - @apply w-full; - } -} - -.scrollDownButton { - @apply absolute - bottom-36 - left-1/2 - inline-flex - -translate-x-1/2 - items-center - justify-center - rounded-xl - bg-neutral-200 - p-2 - text-neutral-900 - focus:bg-neutral-300 - focus:outline-none - motion-safe:transition-colors - lg:bottom-28 - dark:bg-neutral-900 - dark:text-neutral-200 - focus:dark:bg-neutral-800; - - svg { - @apply size-4; - } -} diff --git a/apps/site/components/Common/Searchbox/ChatInteractions/index.tsx b/apps/site/components/Common/Searchbox/ChatInteractions/index.tsx deleted file mode 100644 index 50e00fbf643d8..0000000000000 --- a/apps/site/components/Common/Searchbox/ChatInteractions/index.tsx +++ /dev/null @@ -1,48 +0,0 @@ -'use client'; - -import { ArrowDownIcon } from '@heroicons/react/24/solid'; -import { ChatInteractions } from '@orama/ui/components'; -import { useScrollableContainer } from '@orama/ui/hooks/useScrollableContainer'; -import { useTranslations } from 'next-intl'; - -import type { Interaction } from '@orama/core'; - -import { ChatMessage } from '../ChatMessage'; - -import styles from './index.module.css'; - -export const ChatInteractionsContainer = () => { - const t = useTranslations(); - const { - containerRef, - scrollToBottom, - recalculateGoToBottomButton, - showGoToBottomButton, - } = useScrollableContainer(); - - return ( - <> -
- scrollToBottom({ animated: true })} - className={styles.chatInteractionsWrapper} - > - {(interaction: Interaction) => ( - - )} - -
- {showGoToBottomButton && ( - - )} - - ); -}; diff --git a/apps/site/components/Common/Searchbox/ChatMessage/index.module.css b/apps/site/components/Common/Searchbox/ChatMessage/index.module.css deleted file mode 100644 index 792c1857f9b8c..0000000000000 --- a/apps/site/components/Common/Searchbox/ChatMessage/index.module.css +++ /dev/null @@ -1,50 +0,0 @@ -@reference "../../../../styles/index.css"; - -.chatUserPrompt { - @apply py-3; - - p { - @apply max-w-2xl - rounded-xl - text-neutral-900 - dark:text-neutral-200; - } -} - -.chatAssistantMessageWrapper { - @apply my-2 - rounded-xl - bg-neutral-100 - px-4 - py-1 - text-neutral-900 - empty:hidden - dark:bg-neutral-950 - dark:text-neutral-200; -} - -.typingIndicator { - @apply flex - items-center - gap-1 - rounded-xl - bg-neutral-200 - p-4 - dark:bg-neutral-950; -} - -.typingDot { - @apply animate-dot-move - size-1 - rounded-full - bg-neutral-500 - dark:bg-neutral-400; - - &:nth-child(2) { - @apply animate-dot-move-delay-200; - } - - &:nth-child(3) { - @apply animate-dot-move-delay-400; - } -} diff --git a/apps/site/components/Common/Searchbox/ChatMessage/index.tsx b/apps/site/components/Common/Searchbox/ChatMessage/index.tsx deleted file mode 100644 index 1f468d43cf10c..0000000000000 --- a/apps/site/components/Common/Searchbox/ChatMessage/index.tsx +++ /dev/null @@ -1,73 +0,0 @@ -import ChatActions from '@node-core/ui-components/Common/Search/Chat/Actions'; -import { ChatInteractions } from '@orama/ui/components'; - -import type { Interaction } from '@orama/core'; -import type { FC } from 'react'; - -import ChatSources from '../ChatSources'; - -import styles from './index.module.css'; - -type ChatMessageProps = { - interaction: Interaction; -}; - -const TypingIndicator: FC = () => ( -
- - - -
-); - -export const ChatMessage: FC = ({ interaction }) => { - if (!interaction) { - return null; - } - - return ( - <> - -

{interaction?.query}

-
- - - - -
- -
-
- - {interaction.response && ( -
- - {interaction.response || ''} - - -
- )} - - ); -}; diff --git a/apps/site/components/Common/Searchbox/ChatSources/index.module.css b/apps/site/components/Common/Searchbox/ChatSources/index.module.css deleted file mode 100644 index b5e63af20653e..0000000000000 --- a/apps/site/components/Common/Searchbox/ChatSources/index.module.css +++ /dev/null @@ -1,53 +0,0 @@ -@reference "../../../../styles/index.css"; - -.chatSources { - @apply mb-4 - flex - flex-nowrap - items-center - gap-3 - overflow-x-scroll - scroll-smooth - [-ms-overflow-style:none] - [scrollbar-width:none]; - - &::-webkit-scrollbar { - @apply hidden; - } -} - -.chatSource { - @apply flex - max-w-full - items-center - gap-2 - text-base; -} - -.chatSourceLink { - @apply w-3xs - rounded-xl - bg-white - px-4 - py-2 - text-neutral-900 - hover:bg-neutral-200 - focus:bg-neutral-200 - focus:outline-none - motion-safe:transition-colors - lg:bg-neutral-100 - dark:bg-neutral-950 - dark:text-neutral-200 - hover:dark:bg-neutral-900 - focus:dark:bg-neutral-900; -} - -.chatSourceTitle { - @apply max-w-full - truncate - overflow-hidden - text-sm - font-semibold - text-ellipsis - whitespace-nowrap; -} diff --git a/apps/site/components/Common/Searchbox/ChatSources/index.tsx b/apps/site/components/Common/Searchbox/ChatSources/index.tsx deleted file mode 100644 index 11a177a98c35b..0000000000000 --- a/apps/site/components/Common/Searchbox/ChatSources/index.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import { ChatInteractions } from '@orama/ui/components'; - -import type { Document } from '../DocumentLink'; -import type { Interaction, AnyObject } from '@orama/core'; -import type { FC } from 'react'; - -import { DocumentLink } from '../DocumentLink'; - -import styles from './index.module.css'; - -type ChatSourcesProps = { - interaction: Interaction; -}; - -const ChatSources: FC = ({ interaction }) => { - if (!interaction?.sources) { - return null; - } - - return ( - - {(document: AnyObject, index: number) => ( -
- {!!document.pageSectionTitle && - typeof document.pageSectionTitle === 'string' && ( - - - {document.pageSectionTitle && - document.pageSectionTitle.length > 25 - ? `${document.pageSectionTitle.substring(0, 25)}...` - : document.pageSectionTitle} - - - )} -
- )} -
- ); -}; - -export default ChatSources; diff --git a/apps/site/components/Common/Searchbox/DocumentLink/index.tsx b/apps/site/components/Common/Searchbox/DocumentLink/index.tsx deleted file mode 100644 index 1a7c1f8ad5492..0000000000000 --- a/apps/site/components/Common/Searchbox/DocumentLink/index.tsx +++ /dev/null @@ -1,43 +0,0 @@ -'use client'; - -import styles from '@node-core/ui-components/Common/Search/Results/Hit/index.module.css'; -import Link from 'next/link'; -import { useLocale } from 'next-intl'; - -import type { FC } from 'react'; - -import { getDocumentHref } from '../SearchItem/utils'; - -export type Document = { - path: string; - siteSection: string; - pageSectionTitle?: string; -}; - -type DocumentLinkProps = { - document: Document; - className?: string; - children?: React.ReactNode; - 'data-focus-on-arrow-nav'?: boolean; -} & React.AnchorHTMLAttributes; - -export const DocumentLink: FC = ({ - document, - className = styles.link, - children, - 'data-focus-on-arrow-nav': dataFocusOnArrowNav, - ...props -}) => { - const locale = useLocale(); - - return ( - - {children} - - ); -}; diff --git a/apps/site/components/Common/Searchbox/Footer/index.tsx b/apps/site/components/Common/Searchbox/Footer/index.tsx deleted file mode 100644 index abe61775ac964..0000000000000 --- a/apps/site/components/Common/Searchbox/Footer/index.tsx +++ /dev/null @@ -1,67 +0,0 @@ -'use client'; - -import { - ArrowTurnDownLeftIcon, - ArrowDownIcon, - ArrowUpIcon, -} from '@heroicons/react/24/solid'; -import Image from 'next/image'; -import { useTranslations } from 'next-intl'; -import { useTheme } from 'next-themes'; - -import styles from './index.module.css'; - -export const Footer = () => { - const t = useTranslations(); - const { resolvedTheme } = useTheme(); - - const oramaLogo = `https://website-assets.oramasearch.com/orama-when-${resolvedTheme}.svg`; - - return ( -
-
-
- - - - - {t('components.search.keyboardShortcuts.select')} - -
-
- - - - - - - - {t('components.search.keyboardShortcuts.navigate')} - -
-
- esc - - {t('components.search.keyboardShortcuts.close')} - -
-
- -
- ); -}; diff --git a/apps/site/components/Common/Searchbox/SearchItem/index.tsx b/apps/site/components/Common/Searchbox/SearchItem/index.tsx deleted file mode 100644 index a69775b0a8076..0000000000000 --- a/apps/site/components/Common/Searchbox/SearchItem/index.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import SearchHit from '@node-core/ui-components/Common/Search/Results/Hit'; -import Link from 'next/link'; -import { useLocale } from 'next-intl'; - -import type { Document } from '../DocumentLink'; -import type { LinkLike } from '@node-core/ui-components/types'; -import type { ComponentProps, FC } from 'react'; - -import { getDocumentHref, getFormattedPath } from './utils'; - -type SearchItemProps = Omit< - ComponentProps, - 'document' | 'as' -> & { - document: Document; -}; - -const SearchItem: FC = ({ document, ...props }) => { - const locale = useLocale(); - - return ( - - ); -}; - -export default SearchItem; diff --git a/apps/site/components/Common/Searchbox/SearchItem/utils.ts b/apps/site/components/Common/Searchbox/SearchItem/utils.ts deleted file mode 100644 index ad4a9a4cc63bb..0000000000000 --- a/apps/site/components/Common/Searchbox/SearchItem/utils.ts +++ /dev/null @@ -1,18 +0,0 @@ -import type { Document } from '../DocumentLink'; - -export const uppercaseFirst = (word: string) => - word.charAt(0).toUpperCase() + word.slice(1); - -export const getFormattedPath = (path: string, title: string) => - `${path - .replace(/#.+$/, '') - .split('/') - .map(element => element.replaceAll('-', ' ')) - .map(element => uppercaseFirst(element)) - .filter(Boolean) - .join(' > ')} — ${title}`; - -export const getDocumentHref = (document: Document, locale: string) => - document.siteSection?.toLowerCase() === 'docs' - ? `/${document.path}` - : `/${locale}/${document.path}`; diff --git a/apps/site/components/Common/Searchbox/SlidingChatPanel/index.module.css b/apps/site/components/Common/Searchbox/SlidingChatPanel/index.module.css deleted file mode 100644 index 4e9612bb55082..0000000000000 --- a/apps/site/components/Common/Searchbox/SlidingChatPanel/index.module.css +++ /dev/null @@ -1,58 +0,0 @@ -@reference "../../../../styles/index.css"; - -.slidingPanelCloseButton { - @apply absolute - top-2 - right-6 - z-20 - cursor-pointer - rounded-full - p-2 - text-neutral-700 - duration-300 - hover:bg-white/20 - focus:bg-white/20 - focus:outline-none - motion-safe:transition-colors - dark:text-white; - - svg { - @apply size-5; - } -} - -.slidingPanelContentWrapper { - @apply fixed - bottom-0 - left-0 - box-border - h-[95vh] - w-full - justify-self-center - overflow-hidden - rounded-lg - border - border-neutral-300 - bg-white - p-0 - text-white - duration-300 - motion-safe:ease-in-out - dark:border-neutral-900 - dark:bg-zinc-950; -} - -.slidingPanelInner { - @apply relative - mx-auto - flex - h-full - max-w-4xl - flex-col - justify-between - py-6; -} - -.slidingPanelBottom { - @apply relative; -} diff --git a/apps/site/components/Common/Searchbox/SlidingChatPanel/index.tsx b/apps/site/components/Common/Searchbox/SlidingChatPanel/index.tsx deleted file mode 100644 index 5e1d89fbe8c3f..0000000000000 --- a/apps/site/components/Common/Searchbox/SlidingChatPanel/index.tsx +++ /dev/null @@ -1,57 +0,0 @@ -'use client'; - -import { XMarkIcon } from '@heroicons/react/24/solid'; -import ChatInput from '@node-core/ui-components/Common/Search/Chat/Input'; -import { SlidingPanel } from '@orama/ui/components'; -import { useTranslations } from 'next-intl'; - -import type { FC, PropsWithChildren } from 'react'; - -import { ChatInteractionsContainer } from '../ChatInteractions'; - -import styles from './index.module.css'; - -type SlidingChatPanelProps = PropsWithChildren<{ - open: boolean; - onClose: () => void; -}>; - -export const SlidingChatPanel: FC = ({ - open, - onClose, -}) => { - const t = useTranslations(); - - return ( - <> - - - - - - -
- -
- -
-
-
-
- - ); -}; diff --git a/apps/site/components/Common/Searchbox/index.module.css b/apps/site/components/Common/Searchbox/index.module.css deleted file mode 100644 index 207d7ab262ae6..0000000000000 --- a/apps/site/components/Common/Searchbox/index.module.css +++ /dev/null @@ -1,8 +0,0 @@ -@reference "../../../styles/index.css"; - -.searchResultsContainer { - @apply flex - grow - flex-col - overflow-y-auto; -} diff --git a/apps/site/components/Common/Searchbox/index.tsx b/apps/site/components/Common/Searchbox/index.tsx deleted file mode 100644 index 340a1fec8673c..0000000000000 --- a/apps/site/components/Common/Searchbox/index.tsx +++ /dev/null @@ -1,68 +0,0 @@ -'use client'; - -import ChatTrigger from '@node-core/ui-components/Common/Search/Chat/Trigger'; -import SearchModal from '@node-core/ui-components/Common/Search/Modal'; -import SearchResults from '@node-core/ui-components/Common/Search/Results'; -import SearchSuggestions from '@node-core/ui-components/Common/Search/Suggestions'; -import { useTranslations } from 'next-intl'; -import { useState } from 'react'; - -import { DEFAULT_ORAMA_QUERY_PARAMS } from '#site/next.constants.mjs'; - -import type { Document } from './DocumentLink'; -import type { FC } from 'react'; - -import { Footer } from './Footer'; -import { oramaClient } from './orama-client'; -import SearchItem from './SearchItem'; -import { SlidingChatPanel } from './SlidingChatPanel'; - -import styles from './index.module.css'; - -const Searchbox: FC = () => { - const t = useTranslations(); - const [mode, setMode] = useState<'chat' | 'search'>('search'); - - const sharedProps = { - searchParams: DEFAULT_ORAMA_QUERY_PARAMS, - tabIndex: mode === 'search' ? 0 : -1, - 'aria-hidden': mode === 'chat', - }; - - return ( - -
- setMode('chat')}> - {t('components.search.chatButtonLabel')} - - ( - - )} - {...sharedProps} - > - setMode('chat')} - /> - -
-