From ece5d104562b601675d75db07f28c7c5a4dbc40c Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Thu, 17 May 2018 17:13:17 +0200 Subject: [PATCH] fix: hide upload options by default --- add-on/_locales/en/messages.json | 4 +++ add-on/src/popup/quick-upload.js | 45 ++++++++++++++++++++------------ 2 files changed, 33 insertions(+), 16 deletions(-) diff --git a/add-on/_locales/en/messages.json b/add-on/_locales/en/messages.json index 297d87eee..610454cd6 100644 --- a/add-on/_locales/en/messages.json +++ b/add-on/_locales/en/messages.json @@ -366,6 +366,10 @@ "message": "drop it here to share", "description": "Partial info stats beneath the header on the share files page (quickUpload_drop_it_here)" }, + "quickUpload_options_show": { + "message": "upload options ยป", + "description": "Button on the share files page (quickUpload_options_show)" + }, "quickUpload_options_wrapWithDirectory": { "message": "preserve the filename when adding a single item", "description": "Checkbox label on the share files page (quickUpload_options_wrapWithDirectory)" diff --git a/add-on/src/popup/quick-upload.js b/add-on/src/popup/quick-upload.js index d23766d6f..7c9709a28 100644 --- a/add-on/src/popup/quick-upload.js +++ b/add-on/src/popup/quick-upload.js @@ -29,6 +29,7 @@ function quickUploadStore (state, emitter) { state.ipfsNodeType = 'external' state.wrapWithDirectory = true state.pinUpload = true + state.expandOptions = false function updateState ({ipfsNodeType, peerCount}) { state.ipfsNodeType = ipfsNodeType @@ -78,10 +79,35 @@ function quickUploadStore (state, emitter) { }) } -function quickUploadPage (state, emit) { - const onFileInputChange = (e) => emit('fileInputChange', e) +function quickUploadOptions (state, emit) { + const onExpandOptions = (e) => { state.expandOptions = true; emit('render') } const onWrapWithDirectoryChange = (e) => { state.wrapWithDirectory = e.target.checked } const onPinUploadChange = (e) => { state.pinUpload = e.target.checked } + if (state.expandOptions) { + return html` +
+ + +
+ ` + } + return html` + + ` +} + +function quickUploadPage (state, emit) { + const onFileInputChange = (e) => emit('fileInputChange', e) const {peerCount} = state return html` @@ -120,20 +146,7 @@ function quickUploadPage (state, emit) { - ${state.ipfsNodeType === 'external' ? html` -
- - -
- ` : null} + ${state.ipfsNodeType === 'external' ? quickUploadOptions(state, emit) : null} `