-
Notifications
You must be signed in to change notification settings - Fork 34
Isolate /search to /navigation-search and simplify our webcomponents #2441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
bd6543b
Rename endpoint /search to /navigation-search
Mpdreamz d8dde79
Refactor web-components to use NavigationSearch, remove Search modal
Mpdreamz c1c67ba
staging
Mpdreamz 722bae8
staging
Mpdreamz 0f244ce
staging
Mpdreamz 2ef4011
fix npm run build
Mpdreamz 4cce89a
ensure components are placed
Mpdreamz cb86635
format css js
Mpdreamz 4f888ca
disable ctrl+; opening ask ai modal
Mpdreamz 451df07
Merge branch 'main' into fix/search-endpoint
Mpdreamz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
19 changes: 19 additions & 0 deletions
19
src/Elastic.Documentation.Site/Assets/web-components/AskAi/AskAiModal.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import { Chat } from './Chat' | ||
| import { useAskAiCooldown, useAskAiCooldownActions } from './useAskAiCooldown' | ||
| import { useCooldown } from './useCooldown' | ||
| import * as React from 'react' | ||
|
|
||
| export const AskAiModal = React.memo(() => { | ||
| // Manage cooldown countdowns at the modal level so they continue running | ||
| const askAiCooldown = useAskAiCooldown() | ||
| const { notifyCooldownFinished: notifyAskAiCooldownFinished } = | ||
| useAskAiCooldownActions() | ||
|
|
||
| useCooldown({ | ||
| domain: 'askAi', | ||
| cooldown: askAiCooldown, | ||
| onCooldownFinished: () => notifyAskAiCooldownFinished(), | ||
| }) | ||
|
|
||
| return <Chat /> | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ponents/SearchOrAskAi/AskAi/ChatInput.tsx → ...Assets/web-components/AskAi/ChatInput.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
.../SearchOrAskAi/AskAi/ChatMessage.test.tsx → ...web-components/AskAi/ChatMessage.test.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
26 changes: 26 additions & 0 deletions
26
src/Elastic.Documentation.Site/Assets/web-components/AskAi/askAi.modal.store.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import { create } from 'zustand/react' | ||
|
|
||
| interface ModalState { | ||
| isOpen: boolean | ||
| actions: { | ||
| openModal: () => void | ||
| closeModal: () => void | ||
| toggleModal: () => void | ||
| } | ||
| } | ||
|
|
||
| const askAiModalStore = create<ModalState>((set) => ({ | ||
| isOpen: false, | ||
| actions: { | ||
| openModal: () => set({ isOpen: true }), | ||
| closeModal: () => set({ isOpen: false }), | ||
| toggleModal: () => set((state) => ({ isOpen: !state.isOpen })), | ||
| }, | ||
| })) | ||
|
|
||
| export const useAskAiModalIsOpen = () => | ||
| askAiModalStore((state) => state.isOpen) | ||
| export const useAskAiModalActions = () => | ||
| askAiModalStore((state) => state.actions) | ||
|
|
||
| export { askAiModalStore } |
File renamed without changes.
6 changes: 3 additions & 3 deletions
6
...ponents/SearchOrAskAi/AskAi/chat.store.ts → ...Assets/web-components/AskAi/chat.store.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...s/SearchOrAskAi/AskAi/useAskAiCooldown.ts → .../web-components/AskAi/useAskAiCooldown.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/Elastic.Documentation.Site/Assets/web-components/AskAi/useAskAiRateLimitHandler.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import { ApiError } from '../shared/errorHandling' | ||
| import { useRateLimitHandler } from '../shared/useRateLimitHandler' | ||
|
|
||
| export function useAskAiRateLimitHandler(error: ApiError | Error | null) { | ||
| useRateLimitHandler('askAi', error) | ||
| } |
5 changes: 2 additions & 3 deletions
5
...b-components/SearchOrAskAi/useCooldown.ts → ...ssets/web-components/AskAi/useCooldown.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...SearchOrAskAi/AskAi/useMessageFeedback.ts → ...eb-components/AskAi/useMessageFeedback.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.