-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add question message copy and resend
- Loading branch information
Showing
8 changed files
with
123 additions
and
0 deletions.
There are no files selected for viewing
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,46 @@ | ||
import type { FC } from 'react' | ||
import { | ||
memo, | ||
} from 'react' | ||
import type { ChatItem } from './../types' | ||
import cn from '@/utils/classnames' | ||
import CopyBtn from '@/app/components/base/copy-btn' | ||
import ResendBtn from '@/app/components/base/resend-btn' | ||
|
||
type OperationProps = { | ||
item: ChatItem | ||
} | ||
const Operation: FC<OperationProps> = ({ | ||
item, | ||
}) => { | ||
const { | ||
isOpeningStatement, | ||
content, | ||
message_files, | ||
} = item | ||
|
||
return ( | ||
<> | ||
<div | ||
className={cn('absolute flex justify-end gap-1 -top-3.5 right-0')} | ||
> | ||
{!isOpeningStatement && ( | ||
<div className='hidden group-hover:flex items-center w-max h-[28px] p-0.5 rounded-lg bg-white border-[0.5px] border-gray-100 shadow-md shrink-0'> | ||
<CopyBtn | ||
value={content} | ||
className='hidden group-hover:block' | ||
/> | ||
<ResendBtn | ||
value={content} | ||
files={message_files} | ||
className='hidden group-hover:block' | ||
/> | ||
</div> | ||
)} | ||
|
||
</div> | ||
</> | ||
) | ||
} | ||
|
||
export default memo(Operation) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
'use client' | ||
import { t } from 'i18next' | ||
import s from './style.module.css' | ||
import { useChatContext } from '@/app/components/base/chat/chat/context' | ||
import Tooltip from '@/app/components/base/tooltip' | ||
import type { VisionFile } from '@/types/app' | ||
|
||
type ResendBtnProps = { | ||
value: string | ||
files?: VisionFile[] | ||
className?: string | ||
isPlain?: boolean | ||
} | ||
|
||
const ResendBtn = ({ | ||
value, | ||
files, | ||
className, | ||
isPlain, | ||
}: ResendBtnProps) => { | ||
const { onSend } = useChatContext() | ||
return ( | ||
<div className={`${className}`}> | ||
<Tooltip popupContent={t('appApi.resend')}> | ||
<div | ||
className={'box-border p-0.5 flex items-center justify-center rounded-md bg-white cursor-pointer'} | ||
style={!isPlain | ||
? { | ||
boxShadow: '0px 4px 8px -2px rgba(16, 24, 40, 0.1), 0px 2px 4px -2px rgba(16, 24, 40, 0.06)', | ||
} | ||
: {}} | ||
onClick={() => { | ||
if (onSend) | ||
onSend(value, files) | ||
}} | ||
> | ||
<div className={`w-6 h-6 rounded-md hover:bg-gray-50 ${s.resendIcon}`}></div> | ||
</div> | ||
</Tooltip> | ||
</div> | ||
) | ||
} | ||
|
||
export default ResendBtn |
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,11 @@ | ||
.resendIcon { | ||
background-image: url(~@/app/components/develop/secret-key/assets/resend.svg); | ||
background-position: center; | ||
background-repeat: no-repeat; | ||
} | ||
|
||
.resendIcon:hover { | ||
background-image: url(~@/app/components/develop/secret-key/assets/resend-hover.svg); | ||
background-position: center; | ||
background-repeat: no-repeat; | ||
} |
9 changes: 9 additions & 0 deletions
9
web/app/components/develop/secret-key/assets/resend-hover.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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