From c38712811daa06546bc7838f49fdec923d623868 Mon Sep 17 00:00:00 2001 From: Anastasiia Solop <35258279+anastasiya1155@users.noreply.github.com> Date: Wed, 31 Jan 2024 16:12:58 -0500 Subject: [PATCH] Minor fixes (#1222) * focus first item on search changed * fix model param name * set focus on the panel where user types, fix scroll to line when clicking from chat * fix missing highlights in left sidebar for currently focused tab * fix long names in command bar items * don't add repos to project automatically, but add a button to 'indexing finished' toast --- client/src/App.tsx | 4 +- client/src/CommandBar/Body/Item.tsx | 2 +- client/src/CommandBar/Body/index.tsx | 6 ++ .../CommandBar/steps/ManageRepos/index.tsx | 8 +-- .../CommandBar/steps/PrivateRepos/index.tsx | 8 +-- .../src/CommandBar/steps/items/RepoItem.tsx | 2 +- .../ChatTab/ChatPersistentState.tsx | 4 +- .../CurrentTabContent/ChatTab/Input/index.tsx | 3 + .../CurrentTabContent/FileTab/index.tsx | 1 + .../Conversations/CoversationEntry.tsx | 17 ++++-- .../NavPanel/Conversations/index.tsx | 15 ++++- .../LeftSidebar/NavPanel/Doc/DocEntry.tsx | 18 ++++-- .../LeftSidebar/NavPanel/Doc/index.tsx | 3 + .../NavPanel/Studios/StudioEntry.tsx | 13 ++++ .../NavPanel/Studios/StudioFile.tsx | 5 ++ .../NavPanel/Studios/StudioHistory.tsx | 3 + .../NavPanel/Studios/StudioSubItem.tsx | 12 +++- .../LeftSidebar/NavPanel/Studios/index.tsx | 61 ++++++++++++++++--- .../Project/LeftSidebar/NavPanel/index.tsx | 22 ++++++- .../Code/CodeFullSelectable/CodeContainer.tsx | 2 +- client/src/consts/tutorialSteps.ts | 8 ++- .../providers/RepositoriesContextProvider.tsx | 24 +++++--- client/src/locales/en.json | 5 +- client/src/locales/es.json | 5 +- client/src/locales/it.json | 5 +- client/src/locales/ja.json | 5 +- client/src/locales/zh-CN.json | 5 +- 27 files changed, 206 insertions(+), 60 deletions(-) diff --git a/client/src/App.tsx b/client/src/App.tsx index 810f25b84c..fe5132f9a4 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -24,12 +24,12 @@ const toastOptions = { unStyled: true, classNames: { toast: - 'w-[20.75rem] p-4 pl-5 flex items-start gap-3 rounded-md border border-bg-border bg-bg-base shadow-high', + 'w-[20.75rem] p-4 pl-5 grid grid-cols-[1rem_1fr] items-start gap-3 rounded-md border border-bg-border bg-bg-base shadow-high', error: 'text-red', info: 'text-label-title', title: 'body-s-b', description: '!text-label-muted body-s mt-1.5', - actionButton: 'bg-zinc-400', + actionButton: 'col-span-full', cancelButton: 'bg-orange-400', closeButton: '!bg-bg-base !text-label-muted !border-none !left-[unset] !right-2 !top-6 !w-6 !h-6', diff --git a/client/src/CommandBar/Body/Item.tsx b/client/src/CommandBar/Body/Item.tsx index 0b67847005..ae69efec25 100644 --- a/client/src/CommandBar/Body/Item.tsx +++ b/client/src/CommandBar/Body/Item.tsx @@ -141,7 +141,7 @@ const CommandBarItem = ({ /> )} -

{label}

+

{label}

{!!shortcutKeys && (
{shortcutKeys.map((k) => ( diff --git a/client/src/CommandBar/Body/index.tsx b/client/src/CommandBar/Body/index.tsx index f2c3b32c45..5641bb2404 100644 --- a/client/src/CommandBar/Body/index.tsx +++ b/client/src/CommandBar/Body/index.tsx @@ -20,6 +20,12 @@ const CommandBarBody = ({ const { focusedIndex, setFocusedIndex, handleArrowKey, navContainerRef } = useArrowNavigation(); + useEffect(() => { + if (sections?.[0]?.items?.[0]) { + setFocusedIndex(`${sections[0].key}-${sections[0].items[0].key}`); + } + }, [sections]); + useEffect(() => { if (onFocusedIndexChange) { onFocusedIndexChange(focusedIndex); diff --git a/client/src/CommandBar/steps/ManageRepos/index.tsx b/client/src/CommandBar/steps/ManageRepos/index.tsx index ced45802c3..0dd2156843 100644 --- a/client/src/CommandBar/steps/ManageRepos/index.tsx +++ b/client/src/CommandBar/steps/ManageRepos/index.tsx @@ -105,10 +105,6 @@ const ManageRepos = ({ shouldShowTutorial }: Props) => { setTutorialStep(3); }, onDone: () => { - setOnBoardingState((prev) => ({ - ...prev, - isCommandBarTutorialFinished: true, - })); setTutorialStep(4); }, onAddToProject: () => { @@ -116,7 +112,7 @@ const ManageRepos = ({ shouldShowTutorial }: Props) => { ...prev, isCommandBarTutorialFinished: true, })); - setTutorialStep(4); + setTutorialStep(5); }, }, key: r.ref, @@ -234,7 +230,7 @@ const ManageRepos = ({ shouldShowTutorial }: Props) => { placeholder={t('')} disableKeyNav={isDropdownVisible} /> - {shouldShowTutorial && tutorialStep < 4 ? ( + {shouldShowTutorial && tutorialStep < 5 ? ( { setTutorialStep(3); }, onDone: () => { - setOnBoardingState((prev) => ({ - ...prev, - isCommandBarTutorialFinished: true, - })); setTutorialStep(4); }, onAddToProject: () => { @@ -74,7 +70,7 @@ const PrivateReposStep = ({ shouldShowTutorial }: Props) => { ...prev, isCommandBarTutorialFinished: true, })); - setTutorialStep(4); + setTutorialStep(5); }, }, key: r.ref, @@ -131,7 +127,7 @@ const PrivateReposStep = ({ shouldShowTutorial }: Props) => { placeholder={t('Search private repos...')} disableKeyNav={isDropdownVisible} /> - {shouldShowTutorial && tutorialStep < 4 ? ( + {shouldShowTutorial && tutorialStep < 5 ? ( ) : undefined } diff --git a/client/src/Project/CurrentTabContent/ChatTab/ChatPersistentState.tsx b/client/src/Project/CurrentTabContent/ChatTab/ChatPersistentState.tsx index f5b3c07f3b..85dbc642ff 100644 --- a/client/src/Project/CurrentTabContent/ChatTab/ChatPersistentState.tsx +++ b/client/src/Project/CurrentTabContent/ChatTab/ChatPersistentState.tsx @@ -246,9 +246,9 @@ const ChatPersistentState = ({ options ? `/explain` : `` }`; const queryParams: Record = { - model: + answer_model: preferredAnswerSpeed === 'normal' - ? 'gpt-4' + ? 'gpt-4-turbo-24k' : 'gpt-3.5-turbo-finetuned', }; if (conversationId) { diff --git a/client/src/Project/CurrentTabContent/ChatTab/Input/index.tsx b/client/src/Project/CurrentTabContent/ChatTab/Input/index.tsx index 8aeb1028e1..30b38f3efb 100644 --- a/client/src/Project/CurrentTabContent/ChatTab/Input/index.tsx +++ b/client/src/Project/CurrentTabContent/ChatTab/Input/index.tsx @@ -27,6 +27,7 @@ import { MentionOptionType } from '../../../../types/results'; import { splitPath } from '../../../../utils'; import { openTabsCache } from '../../../../services/cache'; import { CommandBarContext } from '../../../../context/commandBarContext'; +import { UIContext } from '../../../../context/uiContext'; import InputCore from './InputCore'; import { mapEditorContentToInputValue } from './utils'; @@ -76,6 +77,7 @@ const ConversationInput = ({ const { t } = useTranslation(); const { envConfig } = useContext(EnvContext); const { isVisible } = useContext(CommandBarContext.General); + const { setIsLeftSidebarFocused } = useContext(UIContext.Focus); const [initialValue, setInitialValue] = useState< Record | null | undefined >({ @@ -135,6 +137,7 @@ const ConversationInput = ({ const onChangeInput = useCallback((inputState: InputEditorContent[]) => { setInputValue(mapEditorContentToInputValue(inputState)); + setIsLeftSidebarFocused(false); }, []); const onSubmitButtonClicked = useCallback(() => { diff --git a/client/src/Project/CurrentTabContent/FileTab/index.tsx b/client/src/Project/CurrentTabContent/FileTab/index.tsx index e996aee750..ae1c9b9705 100644 --- a/client/src/Project/CurrentTabContent/FileTab/index.tsx +++ b/client/src/Project/CurrentTabContent/FileTab/index.tsx @@ -643,6 +643,7 @@ const FileTab = ({
{file?.lang === 'jupyter notebook' ? ( diff --git a/client/src/Project/LeftSidebar/NavPanel/Conversations/CoversationEntry.tsx b/client/src/Project/LeftSidebar/NavPanel/Conversations/CoversationEntry.tsx index b0351fb109..dd5b278e61 100644 --- a/client/src/Project/LeftSidebar/NavPanel/Conversations/CoversationEntry.tsx +++ b/client/src/Project/LeftSidebar/NavPanel/Conversations/CoversationEntry.tsx @@ -6,26 +6,31 @@ import { useArrowNavigationItemProps } from '../../../../hooks/useArrowNavigatio type Props = ConversationShortType & { index: string; + isCurrentPath?: boolean; }; -const ConversationEntry = ({ title, id, index }: Props) => { +const ConversationEntry = ({ title, id, index, isCurrentPath }: Props) => { const { openNewTab } = useContext(TabsContext.Handlers); const onClick = useCallback(() => { openNewTab({ type: TabTypesEnum.CHAT, conversationId: id, title }); }, [openNewTab, id, title]); - const { isFocused, props } = useArrowNavigationItemProps( - index, - onClick, - ); + const { isFocused, isLeftSidebarFocused, props } = + useArrowNavigationItemProps(index, onClick); return ( diff --git a/client/src/Project/LeftSidebar/NavPanel/Conversations/index.tsx b/client/src/Project/LeftSidebar/NavPanel/Conversations/index.tsx index e4f0e3a0a8..caf399a8a2 100644 --- a/client/src/Project/LeftSidebar/NavPanel/Conversations/index.tsx +++ b/client/src/Project/LeftSidebar/NavPanel/Conversations/index.tsx @@ -16,11 +16,17 @@ type Props = { setExpanded: Dispatch>; isExpanded: boolean; index: string; + currentPath?: string; }; const reactRoot = document.getElementById('root')!; -const ConversationsNav = ({ isExpanded, setExpanded, index }: Props) => { +const ConversationsNav = ({ + isExpanded, + setExpanded, + index, + currentPath, +}: Props) => { const { t } = useTranslation(); const { project } = useContext(ProjectContext.Current); const { noPropagate, itemProps } = useNavPanel( @@ -70,7 +76,12 @@ const ConversationsNav = ({ isExpanded, setExpanded, index }: Props) => { {isExpanded && (
{project?.conversations.map((c) => ( - + ))}
)} diff --git a/client/src/Project/LeftSidebar/NavPanel/Doc/DocEntry.tsx b/client/src/Project/LeftSidebar/NavPanel/Doc/DocEntry.tsx index 5b1455d838..806d93bdb1 100644 --- a/client/src/Project/LeftSidebar/NavPanel/Doc/DocEntry.tsx +++ b/client/src/Project/LeftSidebar/NavPanel/Doc/DocEntry.tsx @@ -8,6 +8,7 @@ import { useArrowNavigationItemProps } from '../../../../hooks/useArrowNavigatio type Props = DocPageType & { index: string; favicon?: string; + isCurrentPath?: boolean; }; const DocEntry = ({ @@ -16,6 +17,7 @@ const DocEntry = ({ doc_title, relative_url, favicon, + isCurrentPath, }: Props) => { const { openNewTab } = useContext(TabsContext.Handlers); @@ -29,17 +31,21 @@ const DocEntry = ({ }); }, [openNewTab, doc_id, doc_title, favicon, relative_url]); - const { isFocused, props } = useArrowNavigationItemProps( - index, - onClick, - ); + const { isFocused, isLeftSidebarFocused, props } = + useArrowNavigationItemProps(index, onClick); return (
diff --git a/client/src/Project/LeftSidebar/NavPanel/Doc/index.tsx b/client/src/Project/LeftSidebar/NavPanel/Doc/index.tsx index 62b6baeb7d..1a32966cb8 100644 --- a/client/src/Project/LeftSidebar/NavPanel/Doc/index.tsx +++ b/client/src/Project/LeftSidebar/NavPanel/Doc/index.tsx @@ -34,6 +34,7 @@ type Props = { favicon?: string; title?: string; url: string; + currentPath?: string; }; const reactRoot = document.getElementById('root')!; @@ -47,6 +48,7 @@ const DocNav = ({ docId, title, url, + currentPath, }: Props) => { const { t } = useTranslation(); const [pages, setPages] = useState([]); @@ -134,6 +136,7 @@ const DocNav = ({ {...p} index={`${index}-${p.relative_url}`} favicon={favicon} + isCurrentPath={currentPath === p.relative_url} /> ))}
diff --git a/client/src/Project/LeftSidebar/NavPanel/Studios/StudioEntry.tsx b/client/src/Project/LeftSidebar/NavPanel/Studios/StudioEntry.tsx index c5934cb041..5823207921 100644 --- a/client/src/Project/LeftSidebar/NavPanel/Studios/StudioEntry.tsx +++ b/client/src/Project/LeftSidebar/NavPanel/Studios/StudioEntry.tsx @@ -33,6 +33,9 @@ type Props = CodeStudioType & { indexingStatus: IndexingStatusType; projectId: string; previewingSnapshot: HistoryConversationTurn | null; + currentPath?: { path: string; repoRef: string }; + currentDoc?: { docId: string; relativeUrl: string }; + isViewingPrompts?: boolean; }; const StudioEntry = ({ @@ -47,6 +50,9 @@ const StudioEntry = ({ indexingStatus, projectId, previewingSnapshot, + currentPath, + currentDoc, + isViewingPrompts, }: Props) => { const { t } = useTranslation(); @@ -98,11 +104,13 @@ const StudioEntry = ({ projectId={projectId} shouldRefresh={token_counts} index={`${index}-history`} + previewingSnapshot={previewingSnapshot?.id} /> @@ -124,6 +132,7 @@ const StudioEntry = ({ studioName={name} tokens={token_counts.per_file[i]} indexingData={indexingStatus[f.repo]} + currentPath={currentPath} {...f} /> ))} @@ -143,6 +152,10 @@ const StudioEntry = ({ docTitle={d.doc_title || ''} docFavicon={d.doc_icon || ''} sections={d.ranges} + isCurrentPath={ + currentDoc?.docId === d.doc_id && + currentDoc?.relativeUrl === d.relative_url + } > {d.doc_icon ? ( { const { t } = useTranslation(); @@ -55,6 +57,9 @@ const StudioFile = ({ repoRef={repo} branch={branch} ranges={ranges} + isCurrentPath={ + currentPath?.path === path && currentPath?.repoRef === repo + } > {isIndexing && indexingData ? ( { const { t } = useTranslation(); const { locale } = useContext(LocaleContext); @@ -87,6 +89,7 @@ const StudioHistory = ({ index={`${index}-${s.id}`} studioName={studioName} snapshot={i === 0 ? null : s} + isCurrentPath={previewingSnapshot === s.id} > diff --git a/client/src/Project/LeftSidebar/NavPanel/Studios/StudioSubItem.tsx b/client/src/Project/LeftSidebar/NavPanel/Studios/StudioSubItem.tsx index 649fdf19c2..f7e6a1a441 100644 --- a/client/src/Project/LeftSidebar/NavPanel/Studios/StudioSubItem.tsx +++ b/client/src/Project/LeftSidebar/NavPanel/Studios/StudioSubItem.tsx @@ -20,6 +20,7 @@ type Props = { sections?: string[]; morePadding?: boolean; snapshot?: HistoryConversationTurn | null; + isCurrentPath?: boolean; }; const StudioSubItem = ({ @@ -38,6 +39,7 @@ const StudioSubItem = ({ sections, morePadding, snapshot, + isCurrentPath, }: PropsWithChildren) => { const { openNewTab } = useContext(TabsContext.Handlers); @@ -89,7 +91,7 @@ const StudioSubItem = ({ snapshot, ]); - const { isFocused, focusedIndex, props } = + const { isFocused, isLeftSidebarFocused, props } = useArrowNavigationItemProps(index, onClick); return ( @@ -98,7 +100,13 @@ const StudioSubItem = ({ className={`w-full h-7 flex items-center gap-3 ${ morePadding ? 'pl-[4.25rem]' : 'pl-10.5' } pr-4 ${ - isFocused ? 'bg-bg-sub-hover text-label-title' : 'text-label-base' + isCurrentPath + ? isLeftSidebarFocused + ? 'bg-bg-shade-hover text-label-title' + : 'bg-bg-shade text-label-title' + : isFocused + ? 'bg-bg-sub-hover text-label-title' + : 'text-label-base' }`} {...props} > diff --git a/client/src/Project/LeftSidebar/NavPanel/Studios/index.tsx b/client/src/Project/LeftSidebar/NavPanel/Studios/index.tsx index 54e73c92b0..e62afb5006 100644 --- a/client/src/Project/LeftSidebar/NavPanel/Studios/index.tsx +++ b/client/src/Project/LeftSidebar/NavPanel/Studios/index.tsx @@ -16,8 +16,13 @@ import { import Button from '../../../../components/Button'; import { ProjectContext } from '../../../../context/projectContext'; import { useNavPanel } from '../../../../hooks/useNavPanel'; -import { IndexingStatusType, TabTypesEnum } from '../../../../types/general'; -import { TabsContext } from '../../../../context/tabsContext'; +import { + DocTabType, + FileTabType, + IndexingStatusType, + StudioTabType, + TabTypesEnum, +} from '../../../../types/general'; import StudioEntry from './StudioEntry'; import StudiosDropdown from './StudiosDropdown'; @@ -26,6 +31,7 @@ type Props = { isExpanded: boolean; index: string; indexingStatus: IndexingStatusType; + currentlyFocusedTab?: StudioTabType | FileTabType | DocTabType; }; const reactRoot = document.getElementById('root')!; @@ -35,13 +41,11 @@ const StudiosNav = ({ setExpanded, index, indexingStatus, + currentlyFocusedTab, }: Props) => { const { t } = useTranslation(); const [expandedIndex, setExpandedIndex] = useState(''); const { project } = useContext(ProjectContext.Current); - const { tab: tabLeft } = useContext(TabsContext.CurrentLeft); - const { tab: tabRight } = useContext(TabsContext.CurrentRight); - const { focusedPanel } = useContext(TabsContext.FocusedPanel); const { noPropagate, itemProps } = useNavPanel( index, setExpanded, @@ -49,14 +53,36 @@ const StudiosNav = ({ ); const previewingSnapshot = useMemo(() => { - const focusedTab = focusedPanel === 'left' ? tabLeft : tabRight; - return focusedTab?.type === TabTypesEnum.STUDIO && focusedTab?.snapshot + return currentlyFocusedTab?.type === TabTypesEnum.STUDIO && + currentlyFocusedTab?.snapshot ? { - studioId: focusedTab.studioId, - snapshot: focusedTab.snapshot, + studioId: currentlyFocusedTab.studioId, + snapshot: currentlyFocusedTab.snapshot, } : null; - }, [focusedPanel, tabLeft, tabRight]); + }, [currentlyFocusedTab]); + + const currentPath = useMemo(() => { + return currentlyFocusedTab?.type === TabTypesEnum.FILE && + currentlyFocusedTab.studioId + ? { + studioId: currentlyFocusedTab.studioId, + path: currentlyFocusedTab.path, + repoRef: currentlyFocusedTab.repoRef, + } + : undefined; + }, [currentlyFocusedTab]); + + const currentDoc = useMemo(() => { + return currentlyFocusedTab?.type === TabTypesEnum.DOC && + currentlyFocusedTab.studioId + ? { + studioId: currentlyFocusedTab.studioId, + docId: currentlyFocusedTab.docId, + relativeUrl: currentlyFocusedTab.relativeUrl, + } + : undefined; + }, [currentlyFocusedTab]); return (
@@ -112,6 +138,21 @@ const StudiosNav = ({ ? previewingSnapshot.snapshot : null } + currentPath={ + currentPath?.studioId.toString() === c.id.toString() + ? currentPath + : undefined + } + currentDoc={ + currentDoc?.studioId.toString() === c.id.toString() + ? currentDoc + : undefined + } + isViewingPrompts={ + currentlyFocusedTab?.type === TabTypesEnum.STUDIO && + currentlyFocusedTab.studioId.toString() === c.id.toString() && + !currentlyFocusedTab.snapshot + } /> ))}
diff --git a/client/src/Project/LeftSidebar/NavPanel/index.tsx b/client/src/Project/LeftSidebar/NavPanel/index.tsx index cacde496e5..8e612335fd 100644 --- a/client/src/Project/LeftSidebar/NavPanel/index.tsx +++ b/client/src/Project/LeftSidebar/NavPanel/index.tsx @@ -18,7 +18,7 @@ const NavPanel = ({}: Props) => { const { tab: leftTab } = useContext(TabsContext.CurrentLeft); const { tab: rightTab } = useContext(TabsContext.CurrentRight); const { indexingStatus } = useContext(RepositoriesContext); - const { setFocusedIndex } = useContext(ArrowNavigationContext); + const { setFocusedIndex, focusedIndex } = useContext(ArrowNavigationContext); const currentlyFocusedTab = useMemo(() => { return focusedPanel === 'left' ? leftTab : rightTab; @@ -76,6 +76,15 @@ const NavPanel = ({}: Props) => { isExpanded={expanded === 'studios'} index={`studios`} indexingStatus={indexingStatus} + currentlyFocusedTab={ + currentlyFocusedTab?.type === TabTypesEnum.STUDIO || + (currentlyFocusedTab?.type === TabTypesEnum.FILE && + currentlyFocusedTab?.studioId) || + (currentlyFocusedTab?.type === TabTypesEnum.DOC && + currentlyFocusedTab?.studioId) + ? currentlyFocusedTab + : undefined + } /> )} {!!project?.conversations.length && ( @@ -83,6 +92,11 @@ const NavPanel = ({}: Props) => { setExpanded={setExpanded} isExpanded={expanded === 'conversations'} index={`conversations`} + currentPath={ + currentlyFocusedTab?.type === TabTypesEnum.CHAT + ? currentlyFocusedTab?.conversationId + : undefined + } /> )} {project?.repos.map((r) => ( @@ -117,6 +131,12 @@ const NavPanel = ({}: Props) => { title={d.name} favicon={d.favicon} url={d.url} + currentPath={ + currentlyFocusedTab?.type === TabTypesEnum.DOC && + currentlyFocusedTab?.docId === d.id + ? currentlyFocusedTab?.relativeUrl + : undefined + } /> ))}
diff --git a/client/src/components/Code/CodeFullSelectable/CodeContainer.tsx b/client/src/components/Code/CodeFullSelectable/CodeContainer.tsx index 66967b5071..b5ea1a804b 100644 --- a/client/src/components/Code/CodeFullSelectable/CodeContainer.tsx +++ b/client/src/components/Code/CodeFullSelectable/CodeContainer.tsx @@ -93,7 +93,7 @@ const CodeContainerSelectable = ({ setTimeout( () => { const line = findElementInCurrentTab( - `[data-active="true"] [data-line-number="${scrollToItem}"]`, + `[data-path="${relativePath}"] [data-line-number="${scrollToItem}"]`, ); line?.scrollIntoView({ behavior: 'smooth', diff --git a/client/src/consts/tutorialSteps.ts b/client/src/consts/tutorialSteps.ts index 7565748e95..ad59ae06f4 100644 --- a/client/src/consts/tutorialSteps.ts +++ b/client/src/consts/tutorialSteps.ts @@ -21,7 +21,13 @@ export const tutorialSteps = [ { title: 'Indexing in progress', description: - '{{repoName}} is currently indexing as soon as it is finished it will be added to your project.', + '{{repoName}} is currently indexing as soon as it is finished you will be able to add it to your project.', hint: [], }, + { + title: 'Add to project', + description: + '{{repoName}} has finished indexing and you can use it in your projects now.', + hint: ['Start by selecting again and pressing Enter (↵) on your keyboard.'], + }, ]; diff --git a/client/src/context/providers/RepositoriesContextProvider.tsx b/client/src/context/providers/RepositoriesContextProvider.tsx index 57ced27519..42d3cba1aa 100644 --- a/client/src/context/providers/RepositoriesContextProvider.tsx +++ b/client/src/context/providers/RepositoriesContextProvider.tsx @@ -41,11 +41,13 @@ const RepositoriesContextProvider = ({ const data = JSON.parse(ev.data); if (data.ev?.status_change === SyncStatus.Done) { if (!data.rsync) { - if (project?.id) { - addRepoToProject(project.id, data.ref).finally(() => { - refreshCurrentProjectRepos(); - }); - } + const onClick = () => { + if (project?.id) { + return addRepoToProject(project.id, data.ref).finally(() => { + refreshCurrentProjectRepos(); + }); + } + }; toast(t('Repository indexed'), { id: `${data.ref}-indexed`, description: ( @@ -56,13 +58,19 @@ const RepositoriesContextProvider = ({ .join('/'), }} > - repoName has - finished indexing and was added to the context of the current - project. You can also use it in your other projects now. + + {'{{repoName}}'} + {' '} + has finished indexing and can be added to your projects. Click + the button to below to add it to the current project. ), icon: , unstyled: true, + action: { + label: 'Add to project', + onClick, + }, }); } if (project?.repos.find((r) => r.repo.ref === data.ref)) { diff --git a/client/src/locales/en.json b/client/src/locales/en.json index 548a85b43d..76c1dff60d 100644 --- a/client/src/locales/en.json +++ b/client/src/locales/en.json @@ -527,5 +527,8 @@ "{{repoName}} has finished indexing and you can use it in your projects now.": "{{repoName}} has finished indexing and you can use it in your projects now.", "{{repoName}} is currently indexing as soon as it is finished it will be added to your project.": "{{repoName}} is currently indexing as soon as it is finished it will be added to your project.", "Hide search steps": "Hide search steps", - "Add documentation": "Add documentation" + "Add documentation": "Add documentation", + "<0>{{repoName}} has finished indexing and can be added to your projects. Click the button to below to add it to the current project.": "<0>{{repoName}} has finished indexing and can be added to your projects. Click the button to below to add it to the current project.", + "Start by selecting again and pressing Enter (↵) on your keyboard.": "Start by selecting again and pressing Enter (↵) on your keyboard.", + "{{repoName}} is currently indexing as soon as it is finished you will be able to add it to your project.": "{{repoName}} is currently indexing as soon as it is finished you will be able to add it to your project." } \ No newline at end of file diff --git a/client/src/locales/es.json b/client/src/locales/es.json index 2771c98171..a9bfed2068 100644 --- a/client/src/locales/es.json +++ b/client/src/locales/es.json @@ -526,5 +526,8 @@ "Close currently focused tab": "Cerrar pestaña actualmente enfocada", "Add documentation": "Agregar documentación", "Usage resets at": "Restablecimiento de uso en", - "Restore session": "Restaurar sesion" + "Restore session": "Restaurar sesion", + "<0>{{repoName}} has finished indexing and can be added to your projects. Click the button to below to add it to the current project.": "<0>{{repoName}} ha terminado de indexación y se puede agregar a sus proyectos. Haga clic en el botón a continuación para agregarlo al proyecto actual.", + "Start by selecting again and pressing Enter (↵) on your keyboard.": "Comience seleccionando nuevamente y presionando Enter (↵) en su teclado.", + "{{repoName}} is currently indexing as soon as it is finished you will be able to add it to your project.": "{{repoName}} actualmente está indexando tan pronto como esté terminado, podrá agregarlo a su proyecto." } \ No newline at end of file diff --git a/client/src/locales/it.json b/client/src/locales/it.json index 0be100756a..8b4824916e 100644 --- a/client/src/locales/it.json +++ b/client/src/locales/it.json @@ -508,5 +508,8 @@ "Existing studio conversations": "Conversazioni in studio esistenti", "Select section": "Seleziona la sezione", "Clear section": "Pulisci sezione", - "Let’s get you started with bloop!": "Ti cominciamo con Bloop!" + "Let’s get you started with bloop!": "Ti cominciamo con Bloop!", + "<0>{{repoName}} has finished indexing and can be added to your projects. Click the button to below to add it to the current project.": "<0>{{repoName}} ha terminato l'indicizzazione e può essere aggiunto ai tuoi progetti. Fai clic sul pulsante sotto per aggiungerlo al progetto corrente.", + "Start by selecting again and pressing Enter (↵) on your keyboard.": "Inizia selezionando di nuovo e premendo Invio (↵) sulla tastiera.", + "{{repoName}} is currently indexing as soon as it is finished you will be able to add it to your project.": "{{repoName}} sta attualmente indicizzando non appena sarà finito, sarai in grado di aggiungerlo al tuo progetto." } \ No newline at end of file diff --git a/client/src/locales/ja.json b/client/src/locales/ja.json index aaf8cd9325..ea65c5d8d8 100644 --- a/client/src/locales/ja.json +++ b/client/src/locales/ja.json @@ -513,5 +513,8 @@ "Usage resets at": "使用法がリセットされます", "Upgrade to Personal plan": "個人計画にアップグレードします", "Restore session": "セッションを復元します", - "In this project": "このプロジェクトで" + "In this project": "このプロジェクトで", + "<0>{{repoName}} has finished indexing and can be added to your projects. Click the button to below to add it to the current project.": "<0>{{repoName}}はインデックス作成が終了し、プロジェクトに追加できます。 以下のボタンをクリックして、現在のプロジェクトに追加します。", + "Start by selecting again and pressing Enter (↵) on your keyboard.": "もう一度選択して、キーボードのEnter(‡)を押すことから始めます。", + "{{repoName}} is currently indexing as soon as it is finished you will be able to add it to your project.": "{{repoName}}は現在、終了したらすぐにインデックスを作成しています。プロジェクトに追加できるようになります。" } \ No newline at end of file diff --git a/client/src/locales/zh-CN.json b/client/src/locales/zh-CN.json index 454827ac8f..8750ceec45 100644 --- a/client/src/locales/zh-CN.json +++ b/client/src/locales/zh-CN.json @@ -523,5 +523,8 @@ "Usage resets at": "用法重置", "Upgrade to Personal plan": "升级到个人计划", "In this project": "在这个项目中", - "Existing studio conversations": "现有的工作室对话" + "Existing studio conversations": "现有的工作室对话", + "<0>{{repoName}} has finished indexing and can be added to your projects. Click the button to below to add it to the current project.": "<0>{{repoName}}已完成索引,可以添加到您的项目中。 单击下面的按钮将其添加到当前项目中。", + "Start by selecting again and pressing Enter (↵) on your keyboard.": "首先选择再次选择键盘上的Enter(↵)。", + "{{repoName}} is currently indexing as soon as it is finished you will be able to add it to your project.": "{{repoName}}当前,一旦完成后,您就可以将其添加到项目中。" } \ No newline at end of file