diff --git a/.changeset/thick-deers-mix.md b/.changeset/thick-deers-mix.md new file mode 100644 index 000000000..e50de5b3b --- /dev/null +++ b/.changeset/thick-deers-mix.md @@ -0,0 +1,5 @@ +--- +"gitbook": patch +--- + +Tweaks to AI Chat and AI Actions Dropdown diff --git a/packages/gitbook/src/components/AI/server-actions/AIMessageView.tsx b/packages/gitbook/src/components/AI/server-actions/AIMessageView.tsx index b7c9eb21f..e300e862d 100644 --- a/packages/gitbook/src/components/AI/server-actions/AIMessageView.tsx +++ b/packages/gitbook/src/components/AI/server-actions/AIMessageView.tsx @@ -23,7 +23,7 @@ export function AIMessageView(
0 ? 'has-content' : '' )} > diff --git a/packages/gitbook/src/components/AI/server-actions/AIToolCallsSummary.tsx b/packages/gitbook/src/components/AI/server-actions/AIToolCallsSummary.tsx index 9a59d1c2f..bda59047b 100644 --- a/packages/gitbook/src/components/AI/server-actions/AIToolCallsSummary.tsx +++ b/packages/gitbook/src/components/AI/server-actions/AIToolCallsSummary.tsx @@ -38,7 +38,7 @@ function ToolCallSummary(props: { toolCall: AIToolCall; context: GitBookSiteCont const { toolCall, context } = props; return ( -
+
-
+

{t(language, 'searched_for', {toolCall.query})}

-

+

{hasResults ? t(language, 'search_results_count', toolCall.results.length) : t(language, 'search_no_results')} @@ -175,12 +175,12 @@ async function DescriptionForSearchToolCall(props: { ) : null}

{hasResults ? ( -
+
    {searchResultsWithHrefs.map((result, index) => (
  1. -
    +
    {}} iconOnly icon="ellipsis" - label={tString(language, 'more')} + label={tString(language, 'actions')} className="!px-2" variant="blank" size="default" @@ -162,7 +162,10 @@ export function AIChatWindow(props: { }} disabled={isEmpty} > - + {t(language, 'ai_chat_clear_conversation')} @@ -186,7 +189,7 @@ export function AIChatWindow(props: { > {isEmpty ? (
    -
    +
    {/* Display an error banner when something went wrong. */} {chat.error ? : null} diff --git a/packages/gitbook/src/components/AIChat/AIChatMessages.tsx b/packages/gitbook/src/components/AIChat/AIChatMessages.tsx index 932864f25..01379519b 100644 --- a/packages/gitbook/src/components/AIChat/AIChatMessages.tsx +++ b/packages/gitbook/src/components/AIChat/AIChatMessages.tsx @@ -24,7 +24,7 @@ export function AIChatMessages(props: {
    +
    {Array.from({ length: 7 }).map((_, index) => (
    {rating !== null ? ( {t(language, 'was_this_helpful_thank_you')} diff --git a/packages/gitbook/src/components/AIChat/AiChatFollowupSuggestions.tsx b/packages/gitbook/src/components/AIChat/AiChatFollowupSuggestions.tsx index 856cc9416..33eb6b29e 100644 --- a/packages/gitbook/src/components/AIChat/AiChatFollowupSuggestions.tsx +++ b/packages/gitbook/src/components/AIChat/AiChatFollowupSuggestions.tsx @@ -23,7 +23,7 @@ export function AIChatFollowupSuggestions(props: { chatController.postMessage({ message: suggestion }); }} label={suggestion} - className="max-w-[80%] animate-[present_500ms_both] whitespace-normal text-left ring-1 ring-tint-subtle" + className="animate-[present_500ms_both] whitespace-normal text-left ring-1 ring-tint-subtle" size="medium" variant="blank" style={{ diff --git a/packages/gitbook/src/components/PageAside/PageAside.tsx b/packages/gitbook/src/components/PageAside/PageAside.tsx index 38f2b3fa1..1bbe2a034 100644 --- a/packages/gitbook/src/components/PageAside/PageAside.tsx +++ b/packages/gitbook/src/components/PageAside/PageAside.tsx @@ -95,8 +95,9 @@ export function PageAside(props: { 'page-api-block:xl:max-2xl:dark:hover:shadow-tint-1/1', 'page-api-block:xl:max-2xl:rounded-md', 'page-api-block:xl:max-2xl:h-auto', - 'page-api-block:xl:max-2xl:my-4', - 'page-api-block:p-2' + 'page-api-block:xl:max-2xl:my-9', + 'page-api-block:px-2', + 'page-api-block:py-1.5' )} > {page.layout.outline ? ( diff --git a/packages/gitbook/src/components/PageBody/PageHeader.tsx b/packages/gitbook/src/components/PageBody/PageHeader.tsx index 6b96faac0..5c94ffa1a 100644 --- a/packages/gitbook/src/components/PageBody/PageHeader.tsx +++ b/packages/gitbook/src/components/PageBody/PageHeader.tsx @@ -45,7 +45,7 @@ export async function PageHeader(props: { (withAIChat || pageActions.markdown || pageActions.externalAI) ? (
    0 ? '-mt-2' : 'xs:mt-2' )} > diff --git a/packages/gitbook/src/components/primitives/Tooltip.tsx b/packages/gitbook/src/components/primitives/Tooltip.tsx index fcca2dad0..d7f6bf13a 100644 --- a/packages/gitbook/src/components/primitives/Tooltip.tsx +++ b/packages/gitbook/src/components/primitives/Tooltip.tsx @@ -1,5 +1,9 @@ +'use client'; + import { tcls } from '@/lib/tailwind'; import * as RadixTooltip from '@radix-ui/react-tooltip'; +import { useState } from 'react'; +import { useIsMobile } from '../hooks/useIsMobile'; export function Tooltip(props: { children: React.ReactNode; @@ -22,10 +26,24 @@ export function Tooltip(props: { className, } = props; + const isMobile = useIsMobile(); + const [open, setOpen] = useState(false); + return ( - - + setOpen(e)} {...rootProps}> + { + event.preventDefault(); + if (isMobile) { + setOpen(true); + } + setOpen(true); + }} + onPointerDown={(event) => event.preventDefault()} + {...triggerProps} + > {children} @@ -35,6 +53,12 @@ export function Tooltip(props: { 'z-50 max-w-xs animate-scaleIn circular-corners:rounded-2xl rounded-corners:rounded-md bg-tint-12 px-2 py-1 text-contrast-tint-12 text-sm', className )} + onPointerDownOutside={(event) => { + event.preventDefault(); + if (isMobile) { + setOpen(false); + } + }} {...contentProps} > {label} diff --git a/packages/gitbook/src/components/primitives/styles.ts b/packages/gitbook/src/components/primitives/styles.ts index 6d84e4770..604aae6a2 100644 --- a/packages/gitbook/src/components/primitives/styles.ts +++ b/packages/gitbook/src/components/primitives/styles.ts @@ -8,7 +8,7 @@ export const ButtonStyles = [ 'gap-2', 'rounded-md', 'straight-corners:rounded-none', - 'circular-corners:rounded-full', + 'circular-corners:rounded-3xl', 'border', 'border-tint', diff --git a/packages/gitbook/src/intl/translations/de.ts b/packages/gitbook/src/intl/translations/de.ts index 48bfac52c..c04de6b88 100644 --- a/packages/gitbook/src/intl/translations/de.ts +++ b/packages/gitbook/src/intl/translations/de.ts @@ -88,6 +88,7 @@ export const de = { ai_chat_context_disclaimer: 'KI-Antworten können Fehler enthalten.', ai_chat_input_placeholder: 'Fragen, suchen oder Aktion ausführen...', send: 'Senden', + actions: 'Aktionen', ai_chat_suggested_questions_title: 'Vorgeschlagene Fragen', ai_chat_suggested_questions_about_this_page: 'Worum geht es auf dieser Seite?', ai_chat_suggested_questions_read_next: 'Was sollte ich als nächstes lesen?', diff --git a/packages/gitbook/src/intl/translations/en.ts b/packages/gitbook/src/intl/translations/en.ts index 92dc6e72f..8102b9602 100644 --- a/packages/gitbook/src/intl/translations/en.ts +++ b/packages/gitbook/src/intl/translations/en.ts @@ -86,6 +86,7 @@ export const en = { ai_chat_context_disclaimer: 'AI responses may contain mistakes.', ai_chat_input_placeholder: 'Ask, search, or take action...', send: 'Send', + actions: 'Actions', ai_chat_suggested_questions_title: 'Suggested questions', ai_chat_suggested_questions_about_this_page: 'What is this page about?', ai_chat_suggested_questions_read_next: 'What should I read next?', diff --git a/packages/gitbook/src/intl/translations/es.ts b/packages/gitbook/src/intl/translations/es.ts index 34c44c9f6..a07ea7d28 100644 --- a/packages/gitbook/src/intl/translations/es.ts +++ b/packages/gitbook/src/intl/translations/es.ts @@ -90,6 +90,7 @@ export const es: TranslationLanguage = { ai_chat_context_disclaimer: 'Las respuestas de IA pueden contener errores.', ai_chat_input_placeholder: 'Pregunta, busca o realiza una acción...', send: 'Enviar', + actions: 'Acciones', ai_chat_suggested_questions_title: 'Preguntas sugeridas', ai_chat_suggested_questions_about_this_page: '¿De qué trata esta página?', ai_chat_suggested_questions_read_next: '¿Qué debería leer después?', diff --git a/packages/gitbook/src/intl/translations/fr.ts b/packages/gitbook/src/intl/translations/fr.ts index f4759604f..b4eb8fde7 100644 --- a/packages/gitbook/src/intl/translations/fr.ts +++ b/packages/gitbook/src/intl/translations/fr.ts @@ -88,6 +88,7 @@ export const fr: TranslationLanguage = { ai_chat_context_disclaimer: "Les réponses de l'IA peuvent contenir des erreurs.", ai_chat_input_placeholder: 'Demander, rechercher ou effectuer une action...', send: 'Envoyer', + actions: 'Actions', ai_chat_suggested_questions_title: 'Questions suggérées', ai_chat_suggested_questions_about_this_page: 'De quoi parle cette page ?', ai_chat_suggested_questions_read_next: 'Que devrais-je lire ensuite ?', diff --git a/packages/gitbook/src/intl/translations/ja.ts b/packages/gitbook/src/intl/translations/ja.ts index 1116efc21..dec877965 100644 --- a/packages/gitbook/src/intl/translations/ja.ts +++ b/packages/gitbook/src/intl/translations/ja.ts @@ -88,6 +88,7 @@ export const ja: TranslationLanguage = { ai_chat_context_disclaimer: 'AIの回答には誤りが含まれる場合があります。', ai_chat_input_placeholder: '質問、検索、またはアクションを実行...', send: '送信', + actions: 'アクション', ai_chat_suggested_questions_title: 'おすすめの質問', ai_chat_suggested_questions_about_this_page: 'このページは何について説明していますか?', ai_chat_suggested_questions_read_next: '次に何を読むべきですか?', diff --git a/packages/gitbook/src/intl/translations/nl.ts b/packages/gitbook/src/intl/translations/nl.ts index 810054d33..852b54830 100644 --- a/packages/gitbook/src/intl/translations/nl.ts +++ b/packages/gitbook/src/intl/translations/nl.ts @@ -88,6 +88,7 @@ export const nl: TranslationLanguage = { ai_chat_context_disclaimer: 'AI-antwoorden kunnen fouten bevatten.', ai_chat_input_placeholder: 'Vraag, zoek of voer een actie uit...', send: 'Versturen', + actions: 'Acties', ai_chat_suggested_questions_title: 'Voorgestelde vragen', ai_chat_suggested_questions_about_this_page: 'Waar gaat deze pagina over?', ai_chat_suggested_questions_read_next: 'Wat moet ik hierna lezen?', diff --git a/packages/gitbook/src/intl/translations/no.ts b/packages/gitbook/src/intl/translations/no.ts index 04ccf1c5a..93f8f75ef 100644 --- a/packages/gitbook/src/intl/translations/no.ts +++ b/packages/gitbook/src/intl/translations/no.ts @@ -88,6 +88,7 @@ export const no: TranslationLanguage = { ai_chat_context_disclaimer: 'AI-svar kan inneholde feil.', ai_chat_input_placeholder: 'Spør, søk eller utfør en handling...', send: 'Send', + actions: 'Handlinger', ai_chat_suggested_questions_title: 'Foreslåtte spørsmål', ai_chat_suggested_questions_about_this_page: 'Hva handler denne siden om?', ai_chat_suggested_questions_read_next: 'Hva bør jeg lese neste?', diff --git a/packages/gitbook/src/intl/translations/pt-br.ts b/packages/gitbook/src/intl/translations/pt-br.ts index b4f33d30c..a341508bf 100644 --- a/packages/gitbook/src/intl/translations/pt-br.ts +++ b/packages/gitbook/src/intl/translations/pt-br.ts @@ -88,6 +88,7 @@ export const pt_br = { ai_chat_context_disclaimer: 'Respostas de IA podem conter erros.', ai_chat_input_placeholder: 'Pergunte, pesquise ou execute uma ação...', send: 'Enviar', + actions: 'Ações', ai_chat_suggested_questions_title: 'Perguntas sugeridas', ai_chat_suggested_questions_about_this_page: 'Sobre o que é esta página?', ai_chat_suggested_questions_read_next: 'O que devo ler em seguida?', diff --git a/packages/gitbook/src/intl/translations/zh.ts b/packages/gitbook/src/intl/translations/zh.ts index 41dd7d1fb..dd12a1da1 100644 --- a/packages/gitbook/src/intl/translations/zh.ts +++ b/packages/gitbook/src/intl/translations/zh.ts @@ -85,6 +85,7 @@ export const zh: TranslationLanguage = { ai_chat_context_disclaimer: '人工智能的回答可能包含错误。', ai_chat_input_placeholder: '询问、搜索或执行操作...', send: '发送', + actions: '操作', ai_chat_suggested_questions_title: '建议的问题', ai_chat_suggested_questions_about_this_page: '这个页面讲的是什么?', ai_chat_suggested_questions_read_next: '我接下来应该读什么?', diff --git a/packages/gitbook/tailwind.config.ts b/packages/gitbook/tailwind.config.ts index fa5266945..22e9e3098 100644 --- a/packages/gitbook/tailwind.config.ts +++ b/packages/gitbook/tailwind.config.ts @@ -298,10 +298,16 @@ const config: Config = { }, animation: { present: 'present 200ms cubic-bezier(0.25, 1, 0.5, 1) both', + 'present-slow': 'present 500ms cubic-bezier(0.25, 1, 0.5, 1) both', scaleIn: 'scaleIn 200ms ease both', + 'scaleIn-slow': 'scaleIn 500ms ease both', scaleOut: 'scaleOut 200ms ease both', + 'scaleOut-slow': 'scaleOut 500ms ease both', fadeIn: 'fadeIn 200ms ease both', + 'fadeIn-slow': 'fadeIn 500ms ease both', fadeOut: 'fadeOut 200ms ease both', + 'fadeOut-slow': 'fadeOut 500ms ease both', + enterFromLeft: 'enterFromLeft 250ms cubic-bezier(0.83, 0, 0.17, 1) both', enterFromRight: 'enterFromRight 250ms cubic-bezier(0.83, 0, 0.17, 1) both', exitToLeft: 'exitToLeft 250ms cubic-bezier(0.83, 0, 0.17, 1) both',