Skip to content

Commit

Permalink
feat(chat): hide message templates for Isolated view and change order…
Browse files Browse the repository at this point in the history
… of header buttons (Issue #2814, #2815) (#2816)
  • Loading branch information
IlyaBondar authored Dec 13, 2024
1 parent 95c3aee commit 296f119
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 48 deletions.
102 changes: 54 additions & 48 deletions apps/chat/src/components/Chat/ChatHeader/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,28 +186,50 @@ export const ChatHeader = ({
data-qa="chat-header"
>
{isShowChatInfo && (
<Tooltip
tooltip={conversation.name}
triggerClassName={classNames(
'truncate text-center',
isChatFullWidth &&
'flex h-full max-w-full items-center justify-center lg:max-w-[90%]',
conversation.publicationInfo?.action === PublishActions.DELETE &&
'text-error',
)}
>
<span
className={classNames(
'truncate whitespace-pre text-center',
!isChatFullWidth &&
'block max-w-full md:max-w-[330px] lg:max-w-[425px]',
isConversationInvalid && 'text-secondary',
<>
<Tooltip
tooltip={conversation.name}
triggerClassName={classNames(
'truncate text-center',
isChatFullWidth &&
'flex h-full max-w-full items-center justify-center lg:max-w-[90%]',
conversation.publicationInfo?.action ===
PublishActions.DELETE && 'text-error',
)}
data-qa="chat-title"
>
{conversation.name}
</span>
</Tooltip>
<span
className={classNames(
'truncate whitespace-pre text-center',
!isChatFullWidth &&
'block max-w-full md:max-w-[330px] lg:max-w-[425px]',
isConversationInvalid && 'text-secondary',
)}
data-qa="chat-title"
>
{conversation.name}
</span>
</Tooltip>
{publicVersionGroupId && (
<span className="h-[18px] border-l border-l-primary pl-2">
{!isReviewEntity ? (
<PublicVersionSelector
publicVersionGroupId={publicVersionGroupId}
onChangeSelectedVersion={handleChangeSelectedVersion}
/>
) : (
<p
className={classNames(
conversation.publicationInfo?.action ===
PublishActions.DELETE && 'text-error',
)}
data-qa="version"
>
{t('v.')} {conversation.publicationInfo?.version}
</p>
)}
</span>
)}
</>
)}
<div className="flex lg:[&>*:first-child]:border-l lg:[&>*:not(:first-child)]:pl-2 [&>*:not(:last-child)]:border-r [&>*:not(:last-child)]:pr-2 [&>*]:border-x-primary [&>*]:pl-2">
{isShowChatInfo && (
Expand Down Expand Up @@ -365,34 +387,6 @@ export const ChatHeader = ({
</button>
</Tooltip>
)}
{isPlayback && !isExternal && (
<button
className="cursor-pointer text-accent-primary"
onClick={onCancelPlaybackMode}
data-qa="cancel-playback-mode"
>
{screenState === ScreenState.MOBILE
? t('Stop')
: t('Stop playback')}
</button>
)}
{publicVersionGroupId &&
(!isReviewEntity ? (
<PublicVersionSelector
publicVersionGroupId={publicVersionGroupId}
onChangeSelectedVersion={handleChangeSelectedVersion}
/>
) : (
<p
className={classNames(
conversation.publicationInfo?.action ===
PublishActions.DELETE && 'text-error',
)}
data-qa="version"
>
{t('v.')} {conversation.publicationInfo?.version}
</p>
))}

{isContextMenuVisible && (
<ConversationContextMenu
Expand All @@ -406,6 +400,18 @@ export const ChatHeader = ({
/>
)}

{isPlayback && !isExternal && (
<button
className="cursor-pointer text-accent-primary"
onClick={onCancelPlaybackMode}
data-qa="cancel-playback-mode"
>
{screenState === ScreenState.MOBILE
? t('Stop')
: t('Stop playback')}
</button>
)}

{isCompareMode && selectedConversationIds.length > 1 && (
<Tooltip
isTriggerClickable
Expand Down
1 change: 1 addition & 0 deletions apps/chat/src/utils/server/get-common-page-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { URL, URLSearchParams } from 'url';
const disabledFeaturesForIsolatedView = new Set([
Feature.ConversationsSection,
Feature.PromptsSection,
Feature.MessageTemplates,
]);

const hiddenFeaturesForIsolatedView = [
Expand Down

0 comments on commit 296f119

Please sign in to comment.