| | |
| | | notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') }) |
| | | setName(name) |
| | | } |
| | | catch { |
| | | catch (e: any) { |
| | | notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') }) |
| | | setName(tag.name) |
| | | const recoverList = tagList.map((tag) => { |
| | |
| | | } |
| | | } |
| | | const [showRemoveModal, setShowRemoveModal] = useState(false) |
| | | const [pending, setPending] = useState<boolean>(false) |
| | | const [pending, setPending] = useState<Boolean>(false) |
| | | const removeTag = async (tagID: string) => { |
| | | if (pending) |
| | | return |
| | |
| | | ]) |
| | | setPending(false) |
| | | } |
| | | catch { |
| | | catch (e: any) { |
| | | notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') }) |
| | | setPending(false) |
| | | } |
| | |
| | | |
| | | return ( |
| | | <> |
| | | <div className={cn('flex shrink-0 items-center gap-0.5 rounded-lg border border-components-panel-border py-1 pl-2 pr-1 text-sm leading-5 text-text-secondary')}> |
| | | <div className={cn('shrink-0 flex items-center gap-0.5 pr-1 pl-2 py-1 rounded-lg border border-gray-200 text-sm leading-5 text-gray-700')}> |
| | | {!isEditing && ( |
| | | <> |
| | | <div className='text-sm leading-5 text-text-secondary'> |
| | | <div className='text-sm leading-5 text-gray-700'> |
| | | {tag.name} |
| | | </div> |
| | | <div className='leading-4.5 shrink-0 px-1 text-sm font-medium text-text-tertiary'>{tag.binding_count}</div> |
| | | <div className='group/edit shrink-0 cursor-pointer rounded-md p-1 hover:bg-state-base-hover' onClick={() => setIsEditing(true)}> |
| | | <RiEditLine className='h-3 w-3 text-text-tertiary group-hover/edit:text-text-secondary' /> |
| | | <div className='shrink-0 px-1 text-sm leading-4.5 text-gray-500 font-medium'>{tag.binding_count}</div> |
| | | <div className='group/edit shrink-0 p-1 rounded-md cursor-pointer hover:bg-black/5' onClick={() => setIsEditing(true)}> |
| | | <RiEditLine className='w-3 h-3 text-gray-500 group-hover/edit:text-gray-800' /> |
| | | </div> |
| | | <div className='group/remove shrink-0 cursor-pointer rounded-md p-1 hover:bg-state-base-hover' onClick={() => { |
| | | <div className='group/remove shrink-0 p-1 rounded-md cursor-pointer hover:bg-black/5' onClick={() => { |
| | | if (tag.binding_count) |
| | | setShowRemoveModal(true) |
| | | else |
| | | handleRemove() |
| | | }}> |
| | | <RiDeleteBinLine className='h-3 w-3 text-text-tertiary group-hover/remove:text-text-secondary' /> |
| | | <RiDeleteBinLine className='w-3 h-3 text-gray-500 group-hover/remove:text-gray-800' /> |
| | | </div> |
| | | </> |
| | | )} |
| | | {isEditing && ( |
| | | <input |
| | | className='shrink-0 appearance-none caret-primary-600 outline-none placeholder:text-text-quaternary' |
| | | className='shrink-0 outline-none appearance-none placeholder:text-gray-300 caret-primary-600' |
| | | autoFocus |
| | | value={name} |
| | | onChange={e => setName(e.target.value)} |