-
Notifications
You must be signed in to change notification settings - Fork 571
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use /file and /folder endpoints instead of /q?open:true
- Loading branch information
1 parent
82d4ce3
commit 2795b03
Showing
31 changed files
with
250 additions
and
203 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
client/src/Project/CurrentTabContent/ChatTab/Message/LoadingStep.tsx
This file contains 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,43 @@ | ||
import { memo, useCallback, useContext } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import FileChip from '../../../../components/Chips/FileChip'; | ||
import { ChatLoadingStep, TabTypesEnum } from '../../../../types/general'; | ||
import { TabsContext } from '../../../../context/tabsContext'; | ||
|
||
type Props = ChatLoadingStep & { | ||
side: 'left' | 'right'; | ||
repo?: string; | ||
}; | ||
|
||
const LoadingStep = ({ type, path, displayText, side, repo }: Props) => { | ||
const { t } = useTranslation(); | ||
const { openNewTab } = useContext(TabsContext.Handlers); | ||
|
||
const handleClickFile = useCallback(() => { | ||
if (type === 'proc' && repo && path) { | ||
openNewTab( | ||
{ | ||
type: TabTypesEnum.FILE, | ||
repoRef: repo, | ||
path, | ||
}, | ||
side === 'left' ? 'right' : 'left', | ||
); | ||
} | ||
}, [path, repo, side]); | ||
|
||
return ( | ||
<div className="flex gap-2 body-s text-label-base items-center"> | ||
<span>{type === 'proc' ? t('Reading ') : displayText}</span> | ||
{type === 'proc' ? ( | ||
<FileChip | ||
onClick={handleClickFile} | ||
fileName={path.split('/').pop() || ''} | ||
filePath={path || ''} | ||
/> | ||
) : null} | ||
</div> | ||
); | ||
}; | ||
|
||
export default memo(LoadingStep); |
This file contains 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 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 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 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 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
Oops, something went wrong.