- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Downloads tests and improvements (#1116)
* Convert components to typescript and create a snapshot test * More tests for downloads container
- v0.6.42
- v0.6.41
- v0.6.40
- v0.6.39
- v0.6.38
- v0.6.37
- v0.6.36
- v0.6.35
- v0.6.34
- v0.6.33
- v0.6.32
- v0.6.31
- v0.6.30
- v0.6.29
- v0.6.28
- v0.6.27
- v0.6.26
- v0.6.25
- v0.6.24
- v0.6.23
- v0.6.22
- v0.6.21
- v0.6.20
- v0.6.19
- v0.6.18
- nightly
- latest
- fd06a3
- f5ec0d
- f2f59d
- eac584
- e94388
- e8fcb6
- e8d6cc
- c9cb81
- bc8b7b
- b6e5b2
- b2a752
- ${GITHUB_SHA}
- 52769a
- 9545bf
- 8988ba
- 549e4d
- 0437ae
- 268b26
- 95cfe0
- 58dfc7
- 27f5b2a
- 23bcaf
- 15c5eb
- 9f77fc
- 3f9007
- 2f1ec0
- 2ec701
- 2dd909
- 2c7b60
- 2a872a
Showing
16 changed files
with
643 additions
and
248 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
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
67 changes: 0 additions & 67 deletions
67
packages/app/app/components/Downloads/DownloadsHeader/index.js
This file was deleted.
Oops, something went wrong.
57 changes: 57 additions & 0 deletions
57
packages/app/app/components/Downloads/DownloadsHeader/index.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,57 @@ | ||
import React, { useCallback } from 'react'; | ||
import _ from 'lodash'; | ||
import { | ||
Button, | ||
Icon, | ||
Segment | ||
} from 'semantic-ui-react'; | ||
import { remote } from 'electron'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
import { setStringOption } from '../../../actions/settings'; | ||
import styles from './styles.scss'; | ||
|
||
type DownloadsHeaderProps = { | ||
directory: string; | ||
setStringOption: typeof setStringOption; | ||
}; | ||
|
||
const DownloadsHeader: React.FC<DownloadsHeaderProps> = ({ | ||
directory, | ||
setStringOption | ||
}) => { | ||
const { t } = useTranslation('settings'); | ||
const setDirectory = useCallback(async () => { | ||
const dialogResult = await remote.dialog.showOpenDialog({ | ||
properties: ['openDirectory'] | ||
}); | ||
if (!dialogResult.canceled && !_.isEmpty(dialogResult.filePaths)) { | ||
setStringOption( | ||
'downloads.dir', | ||
_.head(dialogResult.filePaths) | ||
); | ||
} | ||
}, [setStringOption]); | ||
|
||
return ( | ||
<Segment className={styles.downloads_header}> | ||
<span className={styles.label}> | ||
{t('saving-in')} | ||
<span className={styles.directory}> | ||
{_.isEmpty(directory) ? remote.app.getPath('downloads') : directory} | ||
</span> | ||
</span> | ||
<Button | ||
icon | ||
inverted | ||
labelPosition='left' | ||
onClick={setDirectory} | ||
> | ||
<Icon name='folder open' /> | ||
{t('downloads-dir-button')} | ||
</Button> | ||
</Segment> | ||
); | ||
}; | ||
|
||
export default DownloadsHeader; |
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.