From fe8cef1b709f09f508f17d0d6d06f204dd44a8bb Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 29 May 2018 18:51:27 +0200 Subject: pushing files to s3.. filelist color --- app/client/api/crud.upload.js | 4 +++- app/client/api/index.js | 1 + app/client/api/util.js | 11 +++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 app/client/api/util.js (limited to 'app/client/api') diff --git a/app/client/api/crud.upload.js b/app/client/api/crud.upload.js index 97b6769..2e0269a 100644 --- a/app/client/api/crud.upload.js +++ b/app/client/api/crud.upload.js @@ -20,11 +20,13 @@ export function crud_upload(type, fd, data, dispatch) { dispatch && dispatch({ type: as_type(type, 'upload_loading')}) + let complete = false + function uploadProgress (e) { if (e.lengthComputable) { dispatch && dispatch({ type: as_type(type, 'upload_progress'), - percent: Math.round(e.loaded * 100 / e.total), + percent: Math.round(e.loaded * 100 / e.total) || 0, [type]: id, }) } diff --git a/app/client/api/index.js b/app/client/api/index.js index 82cd364..a0cae50 100644 --- a/app/client/api/index.js +++ b/app/client/api/index.js @@ -1,4 +1,5 @@ import { crud_actions } from './crud.actions' +import * as util from './util' /* for our crud events, create corresponding actions diff --git a/app/client/api/util.js b/app/client/api/util.js new file mode 100644 index 0000000..99d63b4 --- /dev/null +++ b/app/client/api/util.js @@ -0,0 +1,11 @@ +export const is_iphone = !!((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) +export const is_ipad = !!(navigator.userAgent.match(/iPad/i)) +export const is_android = !!(navigator.userAgent.match(/Android/i)) +export const is_mobile = is_iphone || is_ipad || is_android +export const is_desktop = ! is_mobile; + +const htmlClassList = document.body.parentNode.classList +htmlClassList.add(is_desktop ? 'desktop' : 'mobile') +htmlClassList.remove('loading') + +// window.debug = false -- cgit v1.2.3-70-g09d2