mirror of
				https://github.com/langgenius/dify.git
				synced 2025-10-31 19:03:09 +00:00 
			
		
		
		
	 7709d9df20
			
		
	
	
		7709d9df20
		
			
		
	
	
	
	
		
			
			Co-authored-by: NFish <douxc512@gmail.com> Co-authored-by: zxhlyh <jasonapring2015@outlook.com> Co-authored-by: twwu <twwu@dify.ai> Co-authored-by: jZonG <jzongcode@gmail.com>
		
			
				
	
	
		
			36 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| 'use client'
 | |
| import { useState } from 'react'
 | |
| import { useTranslation } from 'react-i18next'
 | |
| import { RiKey2Line } from '@remixicon/react'
 | |
| import Button from '@/app/components/base/button'
 | |
| import SecretKeyModal from '@/app/components/develop/secret-key/secret-key-modal'
 | |
| 
 | |
| type ISecretKeyButtonProps = {
 | |
|   className?: string
 | |
|   appId?: string
 | |
|   textCls?: string
 | |
| }
 | |
| 
 | |
| const SecretKeyButton = ({ className, appId, textCls }: ISecretKeyButtonProps) => {
 | |
|   const [isVisible, setVisible] = useState(false)
 | |
|   const { t } = useTranslation()
 | |
|   return (
 | |
|     <>
 | |
|       <Button
 | |
|         className={`px-3 ${className}`}
 | |
|         onClick={() => setVisible(true)}
 | |
|         size='small'
 | |
|         variant='ghost'
 | |
|       >
 | |
|         <div className={'flex h-3.5 w-3.5 items-center justify-center'}>
 | |
|           <RiKey2Line className='h-3.5 w-3.5 text-text-tertiary' />
 | |
|         </div>
 | |
|         <div className={`system-xs-medium px-[3px] text-text-tertiary ${textCls}`}>{t('appApi.apiKey')}</div>
 | |
|       </Button>
 | |
|       <SecretKeyModal isShow={isVisible} onClose={() => setVisible(false)} appId={appId} />
 | |
|     </>
 | |
|   )
 | |
| }
 | |
| 
 | |
| export default SecretKeyButton
 |