Skip to content

Commit

Permalink
Merge pull request #848 from enguerran/fix.joseph
Browse files Browse the repository at this point in the history
fix: some annoying stuff
  • Loading branch information
enguerran authored Mar 29, 2018
2 parents ca2c76d + a4d7f35 commit cdc33b1
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 15 deletions.
File renamed without changes
55 changes: 41 additions & 14 deletions src/drive/ducks/files/Toolbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { uploadedFile, downloadFiles, trashFiles } from '../../actions'
import {
ShareButton,
SharedWithMeButton,
SharedByMeButton,
ShareModal,
SharingDetailsModal
} from 'sharing'
Expand Down Expand Up @@ -59,6 +60,7 @@ class Toolbar extends Component {
uploadFiles,
downloadAll,
leaveFolder,
trashFolder,
breakpoints: { isMobile }
} = this.props
const notRootfolder = displayedFolder && displayedFolder.id !== ROOT_DIR_ID
Expand Down Expand Up @@ -98,7 +100,10 @@ class Toolbar extends Component {
<UploadButton
onUpload={files => uploadFiles(files, displayedFolder)}
label={t('toolbar.menu_upload')}
className={styles['fil-action-upload']}
className={classNames(
styles['fil-action-upload'],
styles['u-hide--desk']
)}
/>
</Item>
)}
Expand Down Expand Up @@ -131,17 +136,27 @@ class Toolbar extends Component {
{t('toolbar.menu_select')}
</a>
</Item>
{shared.withMe && <hr />}
{shared.withMe && (
<Item>
<a
className={classNames(styles['fil-action-delete'])}
onClick={() => leaveFolder(displayedFolder)}
>
{t('toolbar.leave')}
</a>
</Item>
)}
{notRootfolder && <hr />}
{notRootfolder &&
(shared.withMe ? (
<Item>
<a
className={classNames(styles['fil-action-delete'])}
onClick={() => leaveFolder(displayedFolder)}
>
{t('toolbar.leave')}
</a>
</Item>
) : (
<Item>
<a
className={classNames(styles['fil-action-delete'])}
onClick={() => trashFolder(displayedFolder)}
>
{t('toolbar.trash')}
</a>
</Item>
))}
</Menu>
)

Expand Down Expand Up @@ -172,7 +187,7 @@ class Toolbar extends Component {
/>
)}
{notRootfolder &&
!shared.withMe && (
!(shared.withMe || shared.byMe || shared.byLink) && (
<ShareButton
disabled={disabled}
onClick={() => this.setState(toggleShowShareModal)}
Expand All @@ -187,6 +202,14 @@ class Toolbar extends Component {
className={styles['u-hide--mob']}
/>
)}
{shared.byMe ||
(shared.byLink && (
<SharedByMeButton
label={t('Files.share.sharedByMe')}
onClick={() => this.setState(toggleShowShareModal)}
className={styles['u-hide--mob']}
/>
))}

{isMobile ? <BarRight>{MoreMenu}</BarRight> : MoreMenu}

Expand Down Expand Up @@ -260,7 +283,11 @@ const mapDispatchToProps = (dispatch, ownProps) => ({
leaveFolder: folder =>
dispatch(leave(folder))
.then(() => dispatch(trashFiles([folder])))
.then(() => ownProps.router.push(`/folder/${folder.parent.id}`))
.then(() => ownProps.router.push(`/folder/${folder.parent.id}`)),
trashFolder: folder =>
dispatch(trashFiles([folder])).then(() => {
ownProps.router.push(`/folder/${folder.parent.id}`)
})
})

export default translate()(
Expand Down
1 change: 1 addition & 0 deletions src/drive/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"menu_download_folder": "Download folder",
"empty_trash": "Empty trash",
"share": "Share",
"trash": "Remove",
"leave": "Leave shared folder & delete it"
},
"service": {
Expand Down
3 changes: 2 additions & 1 deletion src/drive/styles/toolbar.styl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
&.fil-action-select
background embedurl('../assets/icons/icon-checkbox-16.svg') 1rem center no-repeat
&.fil-action-delete
background embedurl('../assets/icons/icon-trash-dark.svg') 1rem center no-repeat
color pomegranate
background embedurl('../assets/icons/icon-trash-red.svg') 1rem center no-repeat
&.fil-action-share
background embedurl('../assets/icons/icon-share-dark.svg') 1rem center no-repeat

Expand Down
1 change: 1 addition & 0 deletions src/sharing/components/ShareByLink.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class ShareByLink extends React.Component {
}

toggleShareLink(checked) {
this.setState(state => ({ ...state, copied: false }))
if (checked) {
this.createShareLink()
} else {
Expand Down

0 comments on commit cdc33b1

Please sign in to comment.