Skip to content

Commit

Permalink
close button
Browse files Browse the repository at this point in the history
  • Loading branch information
petemill committed Oct 22, 2024
1 parent 9c1eae2 commit c75488f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
1 change: 1 addition & 0 deletions components/ai_chat/core/browser/constants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ base::span<const webui::LocalizedString> GetLocalizedStrings() {
{"modelCategory-chat", IDS_CHAT_UI_MODEL_CATEGORY_CHAT},
{"menuNewChat", IDS_CHAT_UI_MENU_NEW_CHAT},
{"openFullPageLabel", IDS_CHAT_UI_LABEL_OPEN_FULL_PAGE},
{"closeLabel", IDS_CHAT_UI_LABEL_CLOSE},
{"menuGoPremium", IDS_CHAT_UI_MENU_GO_PREMIUM},
{"menuManageSubscription", IDS_CHAT_UI_MENU_MANAGE_SUBSCRIPTION},
{"menuSettings", IDS_CHAT_UI_MENU_SETTINGS},
Expand Down
23 changes: 13 additions & 10 deletions components/ai_chat/resources/page/components/header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const getTitle = (activeConversation?: Conversation) => activeConversation?.titl


const newChatButtonLabel = getLocale('newChatButtonLabel')
const closeButtonLabel = getLocale('closeLabel')
const openFullPageButtonLabel = getLocale('openFullPageLabel')

export const PageTitleHeader = React.forwardRef(function (props: FeatureButtonMenuProps, ref: React.Ref<HTMLDivElement>) {
Expand Down Expand Up @@ -86,16 +87,18 @@ export const PageTitleHeader = React.forwardRef(function (props: FeatureButtonMe
<Icon name='expand' />
</Button>}
<FeatureButtonMenu {...props} />
<Button
fab
kind='plain-faint'
aria-label='Close'
title='Close'
className={styles.closeButton}
onClick={() => getAPI().UIHandler.closeUI()}
>
<Icon name='close' />
</Button>
{ !aiChatContext.isStandalone &&
<Button
fab
kind='plain-faint'
aria-label={closeButtonLabel}
title={closeButtonLabel}
className={styles.closeButton}
onClick={() => getAPI().UIHandler.closeUI()}
>
<Icon name='close' />
</Button>
}
</>
)}
</div>
Expand Down
3 changes: 3 additions & 0 deletions components/resources/ai_chat_ui_strings.grdp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@
<message name="IDS_CHAT_UI_LABEL_OPEN_FULL_PAGE" desc="Menu item to expand a sidebar conversation to a the full page experience">
Open full page
</message>
<message name="IDS_CHAT_UI_LABEL_CLOSE" desc="Button label to close the UI showing a chat conversation">
Close
</message>
<message name="IDS_CHAT_UI_MENU_NEW_CHAT" desc="Menu item for new chat">
New chat
</message>
Expand Down

0 comments on commit c75488f

Please sign in to comment.