-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from bittorrent/v2.3.5
V2.3.5
- Loading branch information
Showing
23 changed files
with
758 additions
and
10 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
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
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.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,3 +61,4 @@ | |
} | ||
} | ||
} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
import React, { useEffect } from 'react'; | ||
import { createPopper } from '@popperjs/core'; | ||
import Emitter from 'utils/eventBus'; | ||
import { t } from 'utils/text.js'; | ||
|
||
// let folderInput = null; | ||
|
||
|
||
|
||
|
||
|
||
const ImportFilesEncryptDropdown = ({ color, path }) => { | ||
const [dropdownPopoverShow, setDropdownPopoverShow] = React.useState(false); | ||
const btnDropdownRef = React.createRef(); | ||
const popoverDropdownRef = React.createRef(); | ||
const openDropdownPopover = () => { | ||
createPopper(btnDropdownRef.current, popoverDropdownRef.current, { | ||
placement: 'bottom-start', | ||
}); | ||
Emitter.emit('closeDropdownPopover'); | ||
setDropdownPopoverShow(true); | ||
}; | ||
const closeDropdownPopover = () => { | ||
setDropdownPopoverShow(false); | ||
}; | ||
|
||
|
||
const onDecryptFile = e => { | ||
e.preventDefault(); | ||
Emitter.emit('openDecryptFileModal',{ path: path }); | ||
}; | ||
|
||
const onAddEncryptFile = e => { | ||
e.preventDefault(); | ||
Emitter.emit('openEncryptFileModal',{ path: path }); | ||
}; | ||
|
||
|
||
useEffect(() => { | ||
const t = function () { | ||
closeDropdownPopover(); | ||
}; | ||
|
||
Emitter.on('closeDropdownPopover',closeDropdownPopover); | ||
document.addEventListener('click', t); | ||
return () => { | ||
document.removeEventListener('click', t); | ||
Emitter.removeListener('closeDropdownPopover'); | ||
}; | ||
}, []); | ||
|
||
return ( | ||
<> | ||
<button | ||
className="common-btn theme-common-btn mr-4" | ||
type="button" | ||
ref={btnDropdownRef} | ||
onClick={e => { | ||
e.preventDefault(); | ||
e.stopPropagation(); | ||
e.nativeEvent.stopImmediatePropagation(); | ||
dropdownPopoverShow ? closeDropdownPopover() : openDropdownPopover(); | ||
}}> | ||
{t('encrypt_decrypt')} | ||
</button> | ||
|
||
<div | ||
ref={popoverDropdownRef} | ||
className={ | ||
(dropdownPopoverShow ? 'block ' : 'hidden ') + | ||
'_box-shadow text-base z-50 float-left py-2 list-none text-left rounded shadow-lg min-w-48 mt-important theme-bg' | ||
}> | ||
<a | ||
href="#addFile" | ||
className={'text-sm py-2 px-4 font-normal block w-full whitespace-nowrap bg-transparent'} | ||
onClick={onAddEncryptFile}> | ||
<img | ||
alt="" | ||
src={require(`../../assets/img/encrypt-icon_${color}.svg`).default} | ||
className="far mr-2 align-top " | ||
/> | ||
{t('encrypt_file')} | ||
</a> | ||
<a | ||
href="#addFolder" | ||
className={' text-sm py-2 px-4 font-normal block w-full whitespace-nowrap bg-transparent'} | ||
onClick={onDecryptFile}> | ||
<img | ||
alt="" | ||
src={require(`../../assets/img/decrypt-icon_${color}.svg`).default} | ||
className="far mr-2 align-top" | ||
/> | ||
{t('decrypt_file')} | ||
</a> | ||
</div> | ||
</> | ||
); | ||
}; | ||
|
||
export default ImportFilesEncryptDropdown; |
Oops, something went wrong.