From 8e9a49de1a097ea0616d5addda3907253fffc295 Mon Sep 17 00:00:00 2001 From: "Nolann B." <100787331+nolannbiron@users.noreply.github.com> Date: Wed, 8 Jul 2026 16:11:26 +0200 Subject: [PATCH] Separate prompt block actions (#4379) --- ...rnd-11847-separate-prompt-block-actions.md | 5 ++ .../components/DocumentView/Prompt/Prompt.tsx | 22 ++--- .../DocumentView/Prompt/PromptClient.tsx | 89 ++++++------------- packages/gitbook/src/intl/translations/ar.ts | 1 + packages/gitbook/src/intl/translations/bg.ts | 1 + packages/gitbook/src/intl/translations/cs.ts | 1 + packages/gitbook/src/intl/translations/da.ts | 1 + packages/gitbook/src/intl/translations/de.ts | 1 + packages/gitbook/src/intl/translations/el.ts | 1 + packages/gitbook/src/intl/translations/en.ts | 1 + packages/gitbook/src/intl/translations/es.ts | 1 + packages/gitbook/src/intl/translations/et.ts | 1 + packages/gitbook/src/intl/translations/fi.ts | 1 + packages/gitbook/src/intl/translations/fr.ts | 1 + packages/gitbook/src/intl/translations/he.ts | 1 + packages/gitbook/src/intl/translations/hi.ts | 1 + packages/gitbook/src/intl/translations/hr.ts | 1 + packages/gitbook/src/intl/translations/hu.ts | 1 + packages/gitbook/src/intl/translations/id.ts | 1 + packages/gitbook/src/intl/translations/it.ts | 1 + packages/gitbook/src/intl/translations/ja.ts | 1 + packages/gitbook/src/intl/translations/ko.ts | 1 + packages/gitbook/src/intl/translations/lt.ts | 1 + packages/gitbook/src/intl/translations/lv.ts | 1 + packages/gitbook/src/intl/translations/ms.ts | 1 + packages/gitbook/src/intl/translations/nl.ts | 1 + packages/gitbook/src/intl/translations/no.ts | 1 + packages/gitbook/src/intl/translations/pl.ts | 1 + .../gitbook/src/intl/translations/pt-br.ts | 1 + packages/gitbook/src/intl/translations/pt.ts | 1 + packages/gitbook/src/intl/translations/ro.ts | 1 + packages/gitbook/src/intl/translations/ru.ts | 1 + packages/gitbook/src/intl/translations/sk.ts | 1 + packages/gitbook/src/intl/translations/sl.ts | 1 + packages/gitbook/src/intl/translations/sv.ts | 1 + packages/gitbook/src/intl/translations/th.ts | 1 + packages/gitbook/src/intl/translations/tr.ts | 1 + packages/gitbook/src/intl/translations/uk.ts | 1 + packages/gitbook/src/intl/translations/vi.ts | 1 + packages/gitbook/src/intl/translations/yue.ts | 1 + .../gitbook/src/intl/translations/zh-tw.ts | 1 + packages/gitbook/src/intl/translations/zh.ts | 1 + 42 files changed, 76 insertions(+), 79 deletions(-) create mode 100644 .changeset/rnd-11847-separate-prompt-block-actions.md diff --git a/.changeset/rnd-11847-separate-prompt-block-actions.md b/.changeset/rnd-11847-separate-prompt-block-actions.md new file mode 100644 index 000000000..b93ee22c5 --- /dev/null +++ b/.changeset/rnd-11847-separate-prompt-block-actions.md @@ -0,0 +1,5 @@ +--- +"gitbook": patch +--- + +Separate the prompt block actions into a primary "Open in" dropdown and a secondary "Copy prompt" button, instead of a single combined button group, and align the block's design with the expandable block (bordered frame, left disclosure chevron, and subtle elevation when expanded). diff --git a/packages/gitbook/src/components/DocumentView/Prompt/Prompt.tsx b/packages/gitbook/src/components/DocumentView/Prompt/Prompt.tsx index b4c50f356..c1ecc4efb 100644 --- a/packages/gitbook/src/components/DocumentView/Prompt/Prompt.tsx +++ b/packages/gitbook/src/components/DocumentView/Prompt/Prompt.tsx @@ -1,4 +1,3 @@ -import { tcls } from '@/lib/tailwind'; import { CustomizationPageActionType, type DocumentBlockPrompt, @@ -15,21 +14,12 @@ export function Prompt(props: BlockProps) { block.data.icon && validateIconName(block.data.icon) ? block.data.icon : null; return ( -
- -
+ ); } diff --git a/packages/gitbook/src/components/DocumentView/Prompt/PromptClient.tsx b/packages/gitbook/src/components/DocumentView/Prompt/PromptClient.tsx index b768e99c7..cb2fbfe69 100644 --- a/packages/gitbook/src/components/DocumentView/Prompt/PromptClient.tsx +++ b/packages/gitbook/src/components/DocumentView/Prompt/PromptClient.tsx @@ -1,12 +1,6 @@ 'use client'; -import { - Button, - ButtonGroup, - DropdownMenu, - DropdownMenuItem, - ToggleChevron, -} from '@/components/primitives'; +import { Button, DropdownMenu, DropdownMenuItem, ToggleChevron } from '@/components/primitives'; import { getURLForLLM } from '@/components/utils'; import { tString, useLanguage } from '@/intl/client'; import { tcls } from '@/lib/tailwind'; @@ -26,10 +20,21 @@ export function PromptClient(props: { const language = useLanguage(); const promptId = React.useId(); const [open, setOpen] = React.useState(false); - const [headerHasFocus, setHeaderHasFocus] = React.useState(false); return ( - <> -
+
+
) : null} - - ); -} - -function PromptDisclosureIcon(props: { - contentIcon: IconName | null; - headerHasFocus: boolean; - open: boolean; -}) { - const { contentIcon, headerHasFocus, open } = props; - return ( - - {contentIcon ? ( - <> - - - - - - - - ) : ( - - )} - +
); } @@ -109,10 +75,10 @@ function PromptActions(props: { prompt: string; openInAIProviders: boolean }) { const { prompt, openInAIProviders } = props; return ( - +
{openInAIProviders ? : null} - +
); } @@ -140,11 +106,9 @@ function CopyPromptButton(props: { prompt: string }) { return (