From dee44868f4ea0795379adef84753068025e4ecd7 Mon Sep 17 00:00:00 2001 From: NikolaBorislavovHristov Date: Mon, 30 Sep 2019 00:02:32 +0300 Subject: [PATCH 001/115] simple toast component implemented --- src/common/Toast/Toast.js | 40 ++++++++++++++++++++++++++++++++++++ src/common/Toast/index.js | 3 +++ src/common/Toast/styles.less | 4 ++++ src/common/index.js | 2 ++ 4 files changed, 49 insertions(+) create mode 100644 src/common/Toast/Toast.js create mode 100644 src/common/Toast/index.js create mode 100644 src/common/Toast/styles.less diff --git a/src/common/Toast/Toast.js b/src/common/Toast/Toast.js new file mode 100644 index 000000000..608b49a13 --- /dev/null +++ b/src/common/Toast/Toast.js @@ -0,0 +1,40 @@ +const React = require('react'); +const { Modal } = require('stremio-router'); +const styles = require('./styles'); + +const DEFAULT_TIMEOUT = 2000; + +const Toast = React.forwardRef(({ className }, ref) => { + const [state, setState] = React.useState({}); + const show = React.useCallback(({ text, timeout }) => { + setState({ + text, + timeout: timeout !== null && !isNaN(timeout) ? timeout : DEFAULT_TIMEOUT + }); + }, []); + const hide = React.useCallback(() => { + setState({}); + }, []); + React.useEffect(() => { + if (state.timeout !== null && !isNaN(state.timeout)) { + const timeoutId = setTimeout(() => { + hide(); + }, state.timeout); + return () => { + clearTimeout(timeoutId); + }; + } + }, [state]); + React.useImperativeHandle(ref, () => ({ show, hide })); + if (typeof state.text !== 'string') { + return null; + } + + return ( + +
{state.text}
+
+ ); +}); + +module.exports = Toast; diff --git a/src/common/Toast/index.js b/src/common/Toast/index.js new file mode 100644 index 000000000..37050e200 --- /dev/null +++ b/src/common/Toast/index.js @@ -0,0 +1,3 @@ +const Toast = require('./Toast'); + +module.exports = Toast; diff --git a/src/common/Toast/styles.less b/src/common/Toast/styles.less new file mode 100644 index 000000000..9a2e25f6f --- /dev/null +++ b/src/common/Toast/styles.less @@ -0,0 +1,4 @@ +.label { + background-color: aqua; + color: red; +} \ No newline at end of file diff --git a/src/common/index.js b/src/common/index.js index 580b6db4a..085f16591 100644 --- a/src/common/index.js +++ b/src/common/index.js @@ -14,6 +14,7 @@ const Popup = require('./Popup'); const ShareModal = require('./ShareModal'); const Slider = require('./Slider'); const TextInput = require('./TextInput'); +const Toast = require('./Toast'); const routesRegexp = require('./routesRegexp'); const useBinaryState = require('./useBinaryState'); const useFullscreen = require('./useFullscreen'); @@ -38,6 +39,7 @@ module.exports = { ShareModal, Slider, TextInput, + Toast, routesRegexp, useBinaryState, useFullscreen, From 5c9003d37be086b6c9c6259af51a5f58b541db36 Mon Sep 17 00:00:00 2001 From: NikolaBorislavovHristov Date: Mon, 30 Sep 2019 00:03:11 +0300 Subject: [PATCH 002/115] simple toast story implemented --- .../stories/Toast/SimpleToast/SimpleToast.js | 16 ++++++++++++++++ storybook/stories/Toast/SimpleToast/index.js | 1 + storybook/stories/Toast/SimpleToast/styles.less | 4 ++++ storybook/stories/Toast/index.js | 1 + storybook/stories/index.js | 1 + 5 files changed, 23 insertions(+) create mode 100644 storybook/stories/Toast/SimpleToast/SimpleToast.js create mode 100644 storybook/stories/Toast/SimpleToast/index.js create mode 100644 storybook/stories/Toast/SimpleToast/styles.less create mode 100644 storybook/stories/Toast/index.js diff --git a/storybook/stories/Toast/SimpleToast/SimpleToast.js b/storybook/stories/Toast/SimpleToast/SimpleToast.js new file mode 100644 index 000000000..2263dcee7 --- /dev/null +++ b/storybook/stories/Toast/SimpleToast/SimpleToast.js @@ -0,0 +1,16 @@ +const React = require('react'); +const { storiesOf } = require('@storybook/react'); +const { Toast } = require('stremio/common'); +const styles = require('./styles'); + +storiesOf('Toast', module).add('SimpleToast', () => { + const toastRef = React.useRef(null); + const showToast = React.useCallback(() => { + toastRef.current.show({ text: 'Simple toast message' }); + }, []); + return ( +
+ +
+ ); +}); diff --git a/storybook/stories/Toast/SimpleToast/index.js b/storybook/stories/Toast/SimpleToast/index.js new file mode 100644 index 000000000..ac1b818ff --- /dev/null +++ b/storybook/stories/Toast/SimpleToast/index.js @@ -0,0 +1 @@ +require('./SimpleToast'); \ No newline at end of file diff --git a/storybook/stories/Toast/SimpleToast/styles.less b/storybook/stories/Toast/SimpleToast/styles.less new file mode 100644 index 000000000..d8aec94c1 --- /dev/null +++ b/storybook/stories/Toast/SimpleToast/styles.less @@ -0,0 +1,4 @@ +.root-container { + width: 100%; + height: 100%; +} \ No newline at end of file diff --git a/storybook/stories/Toast/index.js b/storybook/stories/Toast/index.js new file mode 100644 index 000000000..ab8a632c3 --- /dev/null +++ b/storybook/stories/Toast/index.js @@ -0,0 +1 @@ +require('./SimpleToast'); diff --git a/storybook/stories/index.js b/storybook/stories/index.js index a15267d5f..dc4033f7b 100644 --- a/storybook/stories/index.js +++ b/storybook/stories/index.js @@ -1,3 +1,4 @@ require('./Addon'); require('./MetaItem'); require('./ColorPicker'); +require('./Toast'); From 74945f528e187919a4ad94c6c345fac8d72bfc2a Mon Sep 17 00:00:00 2001 From: Vladimir Borisov Date: Tue, 1 Oct 2019 17:13:48 +0300 Subject: [PATCH 003/115] LiveRef hook --- src/common/index.js | 4 +++- src/common/useLiveRef.js | 11 +++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 src/common/useLiveRef.js diff --git a/src/common/index.js b/src/common/index.js index 085f16591..f7753f909 100644 --- a/src/common/index.js +++ b/src/common/index.js @@ -21,6 +21,7 @@ const useFullscreen = require('./useFullscreen'); const useLocationHash = require('./useLocationHash'); const useRouteActive = require('./useRouteActive'); const useTabIndex = require('./useTabIndex'); +const useLiveRef = require('./useLiveRef'); module.exports = { Button, @@ -45,5 +46,6 @@ module.exports = { useFullscreen, useLocationHash, useRouteActive, - useTabIndex + useTabIndex, + useLiveRef }; diff --git a/src/common/useLiveRef.js b/src/common/useLiveRef.js new file mode 100644 index 000000000..6e3db8995 --- /dev/null +++ b/src/common/useLiveRef.js @@ -0,0 +1,11 @@ +const React = require('react'); + +const useLiveRef = (value, dependencies) => { + const ref = React.useRef(value); + React.useEffect(() => { + ref.current = value; + }, dependencies); + return ref; +}; + +module.exports = useLiveRef; \ No newline at end of file From de465d71f8c89e04bd83cfdf55860696baa5101d Mon Sep 17 00:00:00 2001 From: Vladimir Borisov Date: Tue, 1 Oct 2019 17:14:03 +0300 Subject: [PATCH 004/115] Working toasts --- src/common/Toast/Toast.js | 53 ++++++++--------- src/common/Toast/ToastItem/ToastItem.js | 59 +++++++++++++++++++ src/common/Toast/ToastItem/index.js | 3 + src/common/Toast/ToastItem/styles.less | 56 ++++++++++++++++++ src/common/Toast/styles.less | 4 -- .../stories/Toast/SimpleToast/SimpleToast.js | 20 +++++-- .../stories/Toast/SimpleToast/styles.less | 16 +++++ 7 files changed, 176 insertions(+), 35 deletions(-) create mode 100644 src/common/Toast/ToastItem/ToastItem.js create mode 100644 src/common/Toast/ToastItem/index.js create mode 100644 src/common/Toast/ToastItem/styles.less delete mode 100644 src/common/Toast/styles.less diff --git a/src/common/Toast/Toast.js b/src/common/Toast/Toast.js index 608b49a13..98c4c585f 100644 --- a/src/common/Toast/Toast.js +++ b/src/common/Toast/Toast.js @@ -1,38 +1,37 @@ const React = require('react'); +const useLiveRef = require('stremio/common/useLiveRef'); const { Modal } = require('stremio-router'); -const styles = require('./styles'); +const ToastItem = require('./ToastItem'); const DEFAULT_TIMEOUT = 2000; const Toast = React.forwardRef(({ className }, ref) => { - const [state, setState] = React.useState({}); - const show = React.useCallback(({ text, timeout }) => { - setState({ - text, - timeout: timeout !== null && !isNaN(timeout) ? timeout : DEFAULT_TIMEOUT - }); - }, []); - const hide = React.useCallback(() => { - setState({}); - }, []); - React.useEffect(() => { - if (state.timeout !== null && !isNaN(state.timeout)) { - const timeoutId = setTimeout(() => { - hide(); - }, state.timeout); - return () => { - clearTimeout(timeoutId); - }; - } - }, [state]); - React.useImperativeHandle(ref, () => ({ show, hide })); - if (typeof state.text !== 'string') { - return null; - } + const [toastItems, setToastItems] = React.useState([]); + const toastItemsRef = useLiveRef(toastItems, [toastItems]); - return ( + const hideAll = () => { + toastItemsRef.current.forEach(item => clearTimeout(item.timerId)); + setToastItems([]); + }; + + const show = ({ type, icon, title, text, closeButton, timeout, onClick }) => { + timeout = timeout !== null && !isNaN(timeout) ? timeout : DEFAULT_TIMEOUT; + const close = () => { clearTimeout(nextItem.timerId); setToastItems(toastItemsRef.current.filter(state => state !== nextItem)) }; + + const nextItem = { type, icon, title, text, closeButton, timeout, onClick, onClose: close }; + + if (timeout !== 0) { + nextItem.timerId = setTimeout(close, timeout); + } + setToastItems(toastItemsRef.current.concat([nextItem])); + return close; + }; + + React.useImperativeHandle(ref, () => ({ show, hideAll })); + + return toastItems.length === 0 ? null : ( -
{state.text}
+ {toastItems.map((item, index) => ())}
); }); diff --git a/src/common/Toast/ToastItem/ToastItem.js b/src/common/Toast/ToastItem/ToastItem.js new file mode 100644 index 000000000..7d9648cfa --- /dev/null +++ b/src/common/Toast/ToastItem/ToastItem.js @@ -0,0 +1,59 @@ +const React = require('react'); +const classnames = require('classnames'); +const PropTypes = require('prop-types'); +const Icon = require('stremio-icons/dom'); +const styles = require('./styles'); +const ToastItem = ({ type, title, text, icon, closeButton, onClick, onClose }) => { + const isClickable = typeof onClick === 'function'; + const toastClicked = React.useCallback(() => { + if (isClickable) { + onClick(); + } + }, [onClick]); + return ( +
+ { + icon + ? +
+ +
+ : + null + } +
+ { + title ? +

{title}

+ : + null + } + {text} +
+ + { + closeButton + ? +
+ +
+ : + null + } +
+ ); +}; + +ToastItem.propTypes = { + type: PropTypes.string, + title: PropTypes.string, + text: PropTypes.string, + icon: PropTypes.string, + closeButton: PropTypes.bool, + onClick: PropTypes.func, + onClose: PropTypes.func +}; + +module.exports = ToastItem; \ No newline at end of file diff --git a/src/common/Toast/ToastItem/index.js b/src/common/Toast/ToastItem/index.js new file mode 100644 index 000000000..fc2780087 --- /dev/null +++ b/src/common/Toast/ToastItem/index.js @@ -0,0 +1,3 @@ +const ToastItem = require('./ToastItem'); + +module.exports = ToastItem; \ No newline at end of file diff --git a/src/common/Toast/ToastItem/styles.less b/src/common/Toast/ToastItem/styles.less new file mode 100644 index 000000000..53415130f --- /dev/null +++ b/src/common/Toast/ToastItem/styles.less @@ -0,0 +1,56 @@ + +.toast-item { + pointer-events: all; + border: 1px solid; + border-radius: 3px; + background-color: var(--color-surfacelighter); + color: var(--color-backgrounddarker); + fill: var(--color-backgrounddarker); + padding: 1rem; + margin-bottom: 1rem; + overflow: visible; + display: flex; + flex-flow: row; + + &.success { + color: var(--color-signal5); + fill: var(--color-signal5); + } + + &.alert { + color: var(--color-signal3); + fill: var(--color-signal3); + } + + &.error { + color: var(--color-signal2); + fill: var(--color-signal2); + } + + .icon-container { + width: 3rem; + margin-right: 1rem; + display: flex; + flex-flow: row; + flex-shrink: 0; + } + .message-container { + flex-grow: 1; + &.clickable { + cursor: pointer; + } + .message-caption { + font-weight: bold; + } + } + + .close-button-container { + margin-left: 1rem; + width: 1rem; + flex-shrink: 0; + + button { + cursor: pointer; + } + } +} \ No newline at end of file diff --git a/src/common/Toast/styles.less b/src/common/Toast/styles.less deleted file mode 100644 index 9a2e25f6f..000000000 --- a/src/common/Toast/styles.less +++ /dev/null @@ -1,4 +0,0 @@ -.label { - background-color: aqua; - color: red; -} \ No newline at end of file diff --git a/storybook/stories/Toast/SimpleToast/SimpleToast.js b/storybook/stories/Toast/SimpleToast/SimpleToast.js index 2263dcee7..3af765423 100644 --- a/storybook/stories/Toast/SimpleToast/SimpleToast.js +++ b/storybook/stories/Toast/SimpleToast/SimpleToast.js @@ -5,12 +5,24 @@ const styles = require('./styles'); storiesOf('Toast', module).add('SimpleToast', () => { const toastRef = React.useRef(null); - const showToast = React.useCallback(() => { - toastRef.current.show({ text: 'Simple toast message' }); + const showToast = (message) => React.useCallback(() => { + toastRef.current.show({ title: 'Something to take your attention', timeout: 0, type: 'info', icon: 'ic_sub', closeButton: true, ...message }); }, []); + + const clickSuccess = showToast({ title: 'You clicked it', text: 'Congratulations! Click event handled successfully.', type: 'success', icon: 'ic_check', timeout: 2e3 }); + return ( -
- +
+ + + + + + + + + +
); }); diff --git a/storybook/stories/Toast/SimpleToast/styles.less b/storybook/stories/Toast/SimpleToast/styles.less index d8aec94c1..7a000be60 100644 --- a/storybook/stories/Toast/SimpleToast/styles.less +++ b/storybook/stories/Toast/SimpleToast/styles.less @@ -1,4 +1,20 @@ .root-container { width: 100%; height: 100%; + color: var(--color-surfacelighter); + // line-height: 100vh; + // text-align: center; + button { + color: var(--color-surfacelighter); + background-color: var(--color-primarydark); + padding: .5rem; + margin: .5rem; + + } +} + +.toasts-container { + width: 30rem; + pointer-events: none; + left: auto !important; } \ No newline at end of file From 88da9a1b8f12f42730dc55512706acd5f61207fb Mon Sep 17 00:00:00 2001 From: Vladimir Borisov Date: Tue, 1 Oct 2019 17:35:17 +0300 Subject: [PATCH 005/115] Improved formatting --- src/common/Toast/Toast.js | 5 ++++- src/common/Toast/ToastItem/ToastItem.js | 4 ++-- src/common/Toast/ToastItem/styles.less | 7 ++++-- .../stories/Toast/SimpleToast/SimpleToast.js | 22 +++++++++++++++---- .../stories/Toast/SimpleToast/styles.less | 3 +-- 5 files changed, 30 insertions(+), 11 deletions(-) diff --git a/src/common/Toast/Toast.js b/src/common/Toast/Toast.js index 98c4c585f..c4c53e6f7 100644 --- a/src/common/Toast/Toast.js +++ b/src/common/Toast/Toast.js @@ -16,7 +16,10 @@ const Toast = React.forwardRef(({ className }, ref) => { const show = ({ type, icon, title, text, closeButton, timeout, onClick }) => { timeout = timeout !== null && !isNaN(timeout) ? timeout : DEFAULT_TIMEOUT; - const close = () => { clearTimeout(nextItem.timerId); setToastItems(toastItemsRef.current.filter(state => state !== nextItem)) }; + const close = () => { + clearTimeout(nextItem.timerId); + setToastItems(toastItemsRef.current.filter(state => state !== nextItem)); + }; const nextItem = { type, icon, title, text, closeButton, timeout, onClick, onClose: close }; diff --git a/src/common/Toast/ToastItem/ToastItem.js b/src/common/Toast/ToastItem/ToastItem.js index 7d9648cfa..29705e1d4 100644 --- a/src/common/Toast/ToastItem/ToastItem.js +++ b/src/common/Toast/ToastItem/ToastItem.js @@ -21,7 +21,7 @@ const ToastItem = ({ type, title, text, icon, closeButton, onClick, onClose }) = : null } -
+
{ title ?

{title}

@@ -56,4 +56,4 @@ ToastItem.propTypes = { onClose: PropTypes.func }; -module.exports = ToastItem; \ No newline at end of file +module.exports = ToastItem; diff --git a/src/common/Toast/ToastItem/styles.less b/src/common/Toast/ToastItem/styles.less index 53415130f..1613847f4 100644 --- a/src/common/Toast/ToastItem/styles.less +++ b/src/common/Toast/ToastItem/styles.less @@ -14,7 +14,7 @@ &.success { color: var(--color-signal5); - fill: var(--color-signal5); + fill: var(--color-signal5); } &.alert { @@ -34,11 +34,14 @@ flex-flow: row; flex-shrink: 0; } + .message-container { flex-grow: 1; + &.clickable { cursor: pointer; } + .message-caption { font-weight: bold; } @@ -53,4 +56,4 @@ cursor: pointer; } } -} \ No newline at end of file +} diff --git a/storybook/stories/Toast/SimpleToast/SimpleToast.js b/storybook/stories/Toast/SimpleToast/SimpleToast.js index 3af765423..65eb04376 100644 --- a/storybook/stories/Toast/SimpleToast/SimpleToast.js +++ b/storybook/stories/Toast/SimpleToast/SimpleToast.js @@ -5,11 +5,25 @@ const styles = require('./styles'); storiesOf('Toast', module).add('SimpleToast', () => { const toastRef = React.useRef(null); - const showToast = (message) => React.useCallback(() => { - toastRef.current.show({ title: 'Something to take your attention', timeout: 0, type: 'info', icon: 'ic_sub', closeButton: true, ...message }); - }, []); - const clickSuccess = showToast({ title: 'You clicked it', text: 'Congratulations! Click event handled successfully.', type: 'success', icon: 'ic_check', timeout: 2e3 }); + const showToast = (message) => React.useCallback(() => { + toastRef.current.show({ + title: 'Something to take your attention', + timeout: 0, + type: 'info', + icon: 'ic_sub', + closeButton: true, + ...message + }); + }, [toastRef.current]); + + const clickSuccess = showToast({ + title: 'You clicked it', + text: 'Congratulations! Click event handled successfully.', + type: 'success', + icon: 'ic_check', + timeout: 2e3 + }); return (
diff --git a/storybook/stories/Toast/SimpleToast/styles.less b/storybook/stories/Toast/SimpleToast/styles.less index 7a000be60..09a943bea 100644 --- a/storybook/stories/Toast/SimpleToast/styles.less +++ b/storybook/stories/Toast/SimpleToast/styles.less @@ -2,8 +2,7 @@ width: 100%; height: 100%; color: var(--color-surfacelighter); - // line-height: 100vh; - // text-align: center; + button { color: var(--color-surfacelighter); background-color: var(--color-primarydark); From ec3caac6037268f7cc91a8188ede607b6b2a8b91 Mon Sep 17 00:00:00 2001 From: Vladimir Borisov Date: Thu, 31 Oct 2019 17:58:50 +0200 Subject: [PATCH 006/115] Simplified markup and styles; Bigger close button hitbox --- src/common/Toast/ToastItem/ToastItem.js | 10 ++++------ src/common/Toast/ToastItem/styles.less | 22 +++++++++++----------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/common/Toast/ToastItem/ToastItem.js b/src/common/Toast/ToastItem/ToastItem.js index 29705e1d4..18e6a1f50 100644 --- a/src/common/Toast/ToastItem/ToastItem.js +++ b/src/common/Toast/ToastItem/ToastItem.js @@ -16,7 +16,7 @@ const ToastItem = ({ type, title, text, icon, closeButton, onClick, onClose }) = icon ?
- +
: null @@ -34,11 +34,9 @@ const ToastItem = ({ type, title, text, icon, closeButton, onClick, onClose }) = { closeButton ? -
- -
+ : null } diff --git a/src/common/Toast/ToastItem/styles.less b/src/common/Toast/ToastItem/styles.less index 1613847f4..894dd25b2 100644 --- a/src/common/Toast/ToastItem/styles.less +++ b/src/common/Toast/ToastItem/styles.less @@ -1,4 +1,3 @@ - .toast-item { pointer-events: all; border: 1px solid; @@ -6,7 +5,6 @@ background-color: var(--color-surfacelighter); color: var(--color-backgrounddarker); fill: var(--color-backgrounddarker); - padding: 1rem; margin-bottom: 1rem; overflow: visible; display: flex; @@ -28,8 +26,9 @@ } .icon-container { - width: 3rem; - margin-right: 1rem; + width: 5rem; + padding: 1rem; + padding-right: 0; display: flex; flex-flow: row; flex-shrink: 0; @@ -37,6 +36,7 @@ .message-container { flex-grow: 1; + padding: 1rem; &.clickable { cursor: pointer; @@ -47,13 +47,13 @@ } } - .close-button-container { - margin-left: 1rem; - width: 1rem; - flex-shrink: 0; - - button { - cursor: pointer; + button { + height: 3rem; + padding: 1rem; + flex: 0 0 3rem; + cursor: pointer; + &:hover { + background-color: var(--color-surfacelight); } } } From 8c819e92b821f993786c412153f28a5ee817148b Mon Sep 17 00:00:00 2001 From: nklhrstv Date: Fri, 3 Jan 2020 09:58:45 +0200 Subject: [PATCH 007/115] useSubtitlesSettings hook implemented --- src/routes/Player/useSubtitlesSettings.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/routes/Player/useSubtitlesSettings.js diff --git a/src/routes/Player/useSubtitlesSettings.js b/src/routes/Player/useSubtitlesSettings.js new file mode 100644 index 000000000..1c1b3bfab --- /dev/null +++ b/src/routes/Player/useSubtitlesSettings.js @@ -0,0 +1,23 @@ +const React = require('react'); +const { useModelState } = require('stremio/common'); + +const mapSubtitlesSettings = (ctx) => ({ + size: ctx.content.settings.subtitles_size, + text_color: ctx.content.settings.subtitles_text_color, + background_color: ctx.content.settings.subtitles_background_color, + outline_color: ctx.content.settings.subtitles_outline_color, +}); + +const useSubtitlesSettings = () => { + const initSubtitlesSettings = React.useCallback(() => { + const ctx = core.getState('ctx'); + return mapSubtitlesSettings(ctx); + }, []); + return useModelState({ + model: 'ctx', + map: mapSubtitlesSettings, + init: initSubtitlesSettings + }); +}; + +module.exports = useSubtitlesSettings; From 907ccc04f406b011806bef4bdabbcb83b720021c Mon Sep 17 00:00:00 2001 From: nklhrstv Date: Fri, 3 Jan 2020 11:57:57 +0200 Subject: [PATCH 008/115] require core from services in useSubtitlesSettings --- src/routes/Player/useSubtitlesSettings.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/routes/Player/useSubtitlesSettings.js b/src/routes/Player/useSubtitlesSettings.js index 1c1b3bfab..af9217836 100644 --- a/src/routes/Player/useSubtitlesSettings.js +++ b/src/routes/Player/useSubtitlesSettings.js @@ -1,5 +1,6 @@ const React = require('react'); const { useModelState } = require('stremio/common'); +const { useServices } = require('stremio/services'); const mapSubtitlesSettings = (ctx) => ({ size: ctx.content.settings.subtitles_size, @@ -9,6 +10,7 @@ const mapSubtitlesSettings = (ctx) => ({ }); const useSubtitlesSettings = () => { + const { core } = useServices(); const initSubtitlesSettings = React.useCallback(() => { const ctx = core.getState('ctx'); return mapSubtitlesSettings(ctx); From c8a14e51f5c7cf9aced3d0047ce5a84dee5f668e Mon Sep 17 00:00:00 2001 From: nklhrstv Date: Fri, 3 Jan 2020 12:08:52 +0200 Subject: [PATCH 009/115] map subtitles origin from from ctx addons --- src/routes/Player/usePlayer.js | 37 ++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/src/routes/Player/usePlayer.js b/src/routes/Player/usePlayer.js index 6a692b192..f6237f9d1 100644 --- a/src/routes/Player/usePlayer.js +++ b/src/routes/Player/usePlayer.js @@ -1,13 +1,45 @@ const React = require('react'); const { useModelState } = require('stremio/common'); -const initPlayer = () => ({ +const initPlayerState = () => ({ selected: null, meta_resource: null, subtitles_resources: [], next_video: null }); +const mapPlayerStateWithCtx = (player, ctx) => { + const selected = player.selected; + const meta_resource = player.meta_resource; + const subtitles_resources = player.subtitles_resources.map((subtitles_resource) => { + if (subtitles_resource.content.type === 'Ready') { + const origin = ctx.content.addons.reduce((origin, addon) => { + if (addon.transportUrl === subtitles_resource.request.base) { + return typeof addon.manifest.name === 'string' && addon.manifest.name.length > 0 ? + addon.manifest.name + : + addon.manifest.id; + } + + return origin; + }, subtitles_resource.request.base); + subtitles_resource.content.content = subtitles_resource.content.content.map((subtitles) => ({ + ...subtitles, + origin + })); + } + + return subtitles_resource; + }, []); + const next_video = player.next_video; + return { + selected, + meta_resource, + subtitles_resources, + next_video + }; +}; + const usePlayer = (urlParams) => { const loadPlayerAction = React.useMemo(() => { try { @@ -34,7 +66,8 @@ const usePlayer = (urlParams) => { return useModelState({ model: 'player', action: loadPlayerAction, - init: initPlayer + init: initPlayerState, + mapWithCtx: mapPlayerStateWithCtx }); }; From 6aab3edde8a87e0936cbc2b111070168cbbbc410 Mon Sep 17 00:00:00 2001 From: nklhrstv Date: Fri, 3 Jan 2020 13:41:14 +0200 Subject: [PATCH 010/115] useRouteFocused hook fixed in Slider --- src/common/Slider/Slider.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/Slider/Slider.js b/src/common/Slider/Slider.js index 0d37bedf7..4df37cd59 100644 --- a/src/common/Slider/Slider.js +++ b/src/common/Slider/Slider.js @@ -1,7 +1,7 @@ const React = require('react'); const PropTypes = require('prop-types'); const classnames = require('classnames'); -const { useFocusedRoute } = require('stremio-router'); +const { useRouteFocused } = require('stremio-router'); const useAnimationFrame = require('stremio/common/useAnimationFrame'); const useLiveRef = require('stremio/common/useLiveRef'); const styles = require('./styles'); @@ -13,7 +13,7 @@ const Slider = ({ className, value, minimumValue, maximumValue, onSlide, onCompl const onSlideRef = useLiveRef(onSlide, [onSlide]); const onCompleteRef = useLiveRef(onComplete, [onComplete]); const sliderContainerRef = React.useRef(null); - const routeFocused = useFocusedRoute(); + const routeFocused = useRouteFocused(); const [requestThumbAnimation, cancelThumbAnimation] = useAnimationFrame(); const calculateValueForMouseX = React.useCallback((mouseX) => { if (sliderContainerRef.current === null) { From 75eb6ed8b4712b1866e99c9a00090611588258a8 Mon Sep 17 00:00:00 2001 From: nklhrstv Date: Fri, 3 Jan 2020 14:24:08 +0200 Subject: [PATCH 011/115] useDeepEqualEffect hook implemented --- src/common/index.js | 2 ++ src/common/useDeepEqualEffect.js | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 src/common/useDeepEqualEffect.js diff --git a/src/common/index.js b/src/common/index.js index ac8270b8b..c3adf4c32 100644 --- a/src/common/index.js +++ b/src/common/index.js @@ -19,6 +19,7 @@ const TextInput = require('./TextInput'); const routesRegexp = require('./routesRegexp'); const useAnimationFrame = require('./useAnimationFrame'); const useBinaryState = require('./useBinaryState'); +const useDeepEqualEffect = require('./useDeepEqualEffect'); const useDeepEqualState = require('./useDeepEqualState'); const useFullscreen = require('./useFullscreen'); const useInLibrary = require('./useInLibrary'); @@ -48,6 +49,7 @@ module.exports = { routesRegexp, useAnimationFrame, useBinaryState, + useDeepEqualEffect, useDeepEqualState, useFullscreen, useInLibrary, diff --git a/src/common/useDeepEqualEffect.js b/src/common/useDeepEqualEffect.js new file mode 100644 index 000000000..150bcf8a1 --- /dev/null +++ b/src/common/useDeepEqualEffect.js @@ -0,0 +1,17 @@ +const React = require('react'); +const isEqual = require('lodash.isequal'); + +const useDeepEqualEffect = (cb, deps) => { + const mountedRef = React.useRef(false); + const depsRef = React.useRef(null); + React.useEffect(() => { + if (!mountedRef.current || !isEqual(depsRef.current, deps)) { + cb(); + } + + mountedRef.current = true; + depsRef.current = deps; + }, [deps]); +}; + +module.exports = useDeepEqualEffect; From 74a759802b6c446d258df4a990b62acda34a105d Mon Sep 17 00:00:00 2001 From: nklhrstv Date: Fri, 3 Jan 2020 16:13:54 +0200 Subject: [PATCH 012/115] useVideoImplementation renamed to selectVideoImplementation --- src/routes/Player/Video/Video.js | 4 ++-- ...useVideoImplementation.js => selectVideoImplementation.js} | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) rename src/routes/Player/Video/{useVideoImplementation.js => selectVideoImplementation.js} (74%) diff --git a/src/routes/Player/Video/Video.js b/src/routes/Player/Video/Video.js index bd34ece5d..3f15b1c85 100644 --- a/src/routes/Player/Video/Video.js +++ b/src/routes/Player/Video/Video.js @@ -1,7 +1,7 @@ const React = require('react'); const PropTypes = require('prop-types'); const hat = require('hat'); -const useVideoImplementation = require('./useVideoImplementation'); +const selectVideoImplementation = require('./selectVideoImplementation'); const Video = React.forwardRef(({ className, ...props }, ref) => { const [onEnded, onError, onPropValue, onPropChanged, onImplementationChanged] = React.useMemo(() => [ @@ -16,7 +16,7 @@ const Video = React.forwardRef(({ className, ...props }, ref) => { const id = React.useMemo(() => `video-${hat()}`, []); const dispatch = React.useCallback((args) => { if (args && args.commandName === 'load' && args.commandArgs) { - const Video = useVideoImplementation(args.commandArgs.shell, args.commandArgs.stream); + const Video = selectVideoImplementation(args.commandArgs.shell, args.commandArgs.stream); if (typeof Video !== 'function') { videoRef.current = null; } else if (videoRef.current === null || videoRef.current.constructor !== Video) { diff --git a/src/routes/Player/Video/useVideoImplementation.js b/src/routes/Player/Video/selectVideoImplementation.js similarity index 74% rename from src/routes/Player/Video/useVideoImplementation.js rename to src/routes/Player/Video/selectVideoImplementation.js index 89b41e33d..0fd9e01af 100644 --- a/src/routes/Player/Video/useVideoImplementation.js +++ b/src/routes/Player/Video/selectVideoImplementation.js @@ -1,6 +1,6 @@ const { HTMLVideo, YouTubeVideo, MPVVideo } = require('stremio-video'); -const useVideoImplementation = (shell, stream) => { +const selectVideoImplementation = (shell, stream) => { if (shell) { return MPVVideo; } @@ -16,4 +16,4 @@ const useVideoImplementation = (shell, stream) => { return null; }; -module.exports = useVideoImplementation; +module.exports = selectVideoImplementation; From 119a0a653cfec4bbd5d406aeb0592e844285a484 Mon Sep 17 00:00:00 2001 From: nklhrstv Date: Fri, 3 Jan 2020 16:24:39 +0200 Subject: [PATCH 013/115] initial player state adapted with the core --- src/routes/Player/usePlayer.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/routes/Player/usePlayer.js b/src/routes/Player/usePlayer.js index f6237f9d1..321cd43b0 100644 --- a/src/routes/Player/usePlayer.js +++ b/src/routes/Player/usePlayer.js @@ -2,7 +2,13 @@ const React = require('react'); const { useModelState } = require('stremio/common'); const initPlayerState = () => ({ - selected: null, + selected: { + transport_url: null, + type_name: null, + id: null, + video_id: null, + stream: null, + }, meta_resource: null, subtitles_resources: [], next_video: null From 4305d2b50904422689875292c8e694595fe7fc1b Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Tue, 7 Jan 2020 17:12:44 +0200 Subject: [PATCH 014/115] move toast general style in Toast component --- src/common/Toast/Toast.js | 4 +++- src/common/Toast/styles.less | 4 ++++ storybook/stories/Toast/SimpleToast/styles.less | 3 --- 3 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 src/common/Toast/styles.less diff --git a/src/common/Toast/Toast.js b/src/common/Toast/Toast.js index c4c53e6f7..340c25daf 100644 --- a/src/common/Toast/Toast.js +++ b/src/common/Toast/Toast.js @@ -1,7 +1,9 @@ const React = require('react'); +const classnames = require('classnames'); const useLiveRef = require('stremio/common/useLiveRef'); const { Modal } = require('stremio-router'); const ToastItem = require('./ToastItem'); +const styles = require('./styles'); const DEFAULT_TIMEOUT = 2000; @@ -33,7 +35,7 @@ const Toast = React.forwardRef(({ className }, ref) => { React.useImperativeHandle(ref, () => ({ show, hideAll })); return toastItems.length === 0 ? null : ( - + {toastItems.map((item, index) => ())} ); diff --git a/src/common/Toast/styles.less b/src/common/Toast/styles.less new file mode 100644 index 000000000..7de87bf63 --- /dev/null +++ b/src/common/Toast/styles.less @@ -0,0 +1,4 @@ +.toast-container { + pointer-events: none; + left: auto !important; +} \ No newline at end of file diff --git a/storybook/stories/Toast/SimpleToast/styles.less b/storybook/stories/Toast/SimpleToast/styles.less index 09a943bea..e021c2764 100644 --- a/storybook/stories/Toast/SimpleToast/styles.less +++ b/storybook/stories/Toast/SimpleToast/styles.less @@ -8,12 +8,9 @@ background-color: var(--color-primarydark); padding: .5rem; margin: .5rem; - } } .toasts-container { width: 30rem; - pointer-events: none; - left: auto !important; } \ No newline at end of file From 3be16d5a38e9d7c3d3c969698397c9a76992ae83 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Tue, 7 Jan 2020 17:21:31 +0200 Subject: [PATCH 015/115] ToastItem component format and refactor --- src/common/Toast/ToastItem/ToastItem.js | 22 ++-- src/common/Toast/ToastItem/styles.less | 43 +++++--- storybook/stories/index.js | 1 + yarn.lock | 128 ++---------------------- 4 files changed, 47 insertions(+), 147 deletions(-) diff --git a/src/common/Toast/ToastItem/ToastItem.js b/src/common/Toast/ToastItem/ToastItem.js index 18e6a1f50..b7ab7a727 100644 --- a/src/common/Toast/ToastItem/ToastItem.js +++ b/src/common/Toast/ToastItem/ToastItem.js @@ -1,8 +1,10 @@ const React = require('react'); -const classnames = require('classnames'); const PropTypes = require('prop-types'); +const classnames = require('classnames'); const Icon = require('stremio-icons/dom'); +const Button = require('stremio/common/Button'); const styles = require('./styles'); + const ToastItem = ({ type, title, text, icon, closeButton, onClick, onClose }) => { const isClickable = typeof onClick === 'function'; const toastClicked = React.useCallback(() => { @@ -10,33 +12,31 @@ const ToastItem = ({ type, title, text, icon, closeButton, onClick, onClose }) = onClick(); } }, [onClick]); + return (
{ - icon - ? + typeof icon === 'string' && icon.length > 0 ?
- +
: null }
{ - title ? + typeof title === 'string' && title.length > 0 ?

{title}

: null } {text}
- { - closeButton - ? - + closeButton ? + : null } diff --git a/src/common/Toast/ToastItem/styles.less b/src/common/Toast/ToastItem/styles.less index 894dd25b2..9dfedb68d 100644 --- a/src/common/Toast/ToastItem/styles.less +++ b/src/common/Toast/ToastItem/styles.less @@ -1,14 +1,14 @@ .toast-item { - pointer-events: all; - border: 1px solid; - border-radius: 3px; - background-color: var(--color-surfacelighter); + display: flex; + flex-direction: row; + min-height: 6rem; + margin-bottom: 1rem; + border: thin solid; color: var(--color-backgrounddarker); fill: var(--color-backgrounddarker); - margin-bottom: 1rem; + background-color: var(--color-surfacelighter); overflow: visible; - display: flex; - flex-flow: row; + pointer-events: all; &.success { color: var(--color-signal5); @@ -26,16 +26,20 @@ } .icon-container { - width: 5rem; + flex: 1; padding: 1rem; padding-right: 0; - display: flex; - flex-flow: row; - flex-shrink: 0; + overflow: visible; + + .icon { + display: block; + width: 100%; + height: 100%; + } } .message-container { - flex-grow: 1; + flex: 5; padding: 1rem; &.clickable { @@ -47,13 +51,20 @@ } } - button { + .close-button-container { + flex: none; + width: 3rem; height: 3rem; padding: 1rem; - flex: 0 0 3rem; - cursor: pointer; + + .icon { + display: block; + width: 100%; + height: 100%; + } + &:hover { background-color: var(--color-surfacelight); } } -} +} \ No newline at end of file diff --git a/storybook/stories/index.js b/storybook/stories/index.js index 9e66e8536..7562692e3 100644 --- a/storybook/stories/index.js +++ b/storybook/stories/index.js @@ -11,3 +11,4 @@ require('./Popup'); require('./SeasonsBar'); require('./SharePrompt'); require('./Stream'); +require('./Toast'); diff --git a/yarn.lock b/yarn.lock index afe14e5f0..bbd2bb7ee 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4014,7 +4014,7 @@ debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.0: dependencies: ms "2.0.0" -debug@^3.0.0, debug@^3.1.1, debug@^3.2.5, debug@^3.2.6: +debug@^3.0.0, debug@^3.1.1, debug@^3.2.5: version "3.2.6" resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== @@ -4050,11 +4050,6 @@ deep-equal@^1.0.1, deep-equal@^1.1.1: object-keys "^1.1.1" regexp.prototype.flags "^1.2.0" -deep-extend@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" - integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== - deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" @@ -4153,11 +4148,6 @@ detect-file@^1.0.0: resolved "https://registry.yarnpkg.com/detect-file/-/detect-file-1.0.0.tgz#f0d66d03672a825cb1b73bdb3fe62310c8e552b7" integrity sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc= -detect-libc@^1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" - integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups= - detect-newline@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-2.1.0.tgz#f41f1c10be4b00e87b5f13da680759f2c5bfd3e2" @@ -5248,13 +5238,6 @@ fs-extra@^8.0.1: jsonfile "^4.0.0" universalify "^0.1.0" -fs-minipass@^1.2.5: - version "1.2.7" - resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.7.tgz#ccff8570841e7fe4265693da88936c55aed7f7c7" - integrity sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA== - dependencies: - minipass "^2.6.0" - fs-minipass@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-2.0.0.tgz#a6415edab02fae4b9e9230bc87ee2e4472003cd1" @@ -5868,7 +5851,7 @@ https-browserify@^1.0.0: resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73" integrity sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM= -iconv-lite@0.4.24, iconv-lite@^0.4.24, iconv-lite@^0.4.4, iconv-lite@~0.4.13: +iconv-lite@0.4.24, iconv-lite@^0.4.24, iconv-lite@~0.4.13: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== @@ -5892,13 +5875,6 @@ iferr@^0.1.5: resolved "https://registry.yarnpkg.com/iferr/-/iferr-0.1.5.tgz#c60eed69e6d8fdb6b3104a1fcbca1c192dc5b501" integrity sha1-xg7taebY/bazEEofy8ocGS3FtQE= -ignore-walk@^3.0.1: - version "3.0.3" - resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.3.tgz#017e2447184bfeade7c238e4aefdd1e8f95b1e37" - integrity sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw== - dependencies: - minimatch "^3.0.4" - ignore@^3.3.5: version "3.3.10" resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043" @@ -6000,7 +5976,7 @@ inherits@2.0.3: resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= -ini@^1.3.4, ini@^1.3.5, ini@~1.3.0: +ini@^1.3.4, ini@^1.3.5: version "1.3.5" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw== @@ -7596,14 +7572,6 @@ minipass-pipeline@^1.2.2: dependencies: minipass "^3.0.0" -minipass@^2.6.0, minipass@^2.8.6, minipass@^2.9.0: - version "2.9.0" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.9.0.tgz#e713762e7d3e32fed803115cf93e04bca9fcc9a6" - integrity sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg== - dependencies: - safe-buffer "^5.1.2" - yallist "^3.0.0" - minipass@^3.0.0, minipass@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.1.1.tgz#7607ce778472a185ad6d89082aa2070f79cedcd5" @@ -7611,13 +7579,6 @@ minipass@^3.0.0, minipass@^3.1.1: dependencies: yallist "^4.0.0" -minizlib@^1.2.1: - version "1.3.3" - resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.3.3.tgz#2290de96818a34c29551c8a8d301216bd65a861d" - integrity sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q== - dependencies: - minipass "^2.9.0" - mississippi@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/mississippi/-/mississippi-3.0.0.tgz#ea0a3291f97e0b5e8776b363d5f0a12d94c67022" @@ -7734,15 +7695,6 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= -needle@^2.2.1: - version "2.4.0" - resolved "https://registry.yarnpkg.com/needle/-/needle-2.4.0.tgz#6833e74975c444642590e15a750288c5f939b57c" - integrity sha512-4Hnwzr3mi5L97hMYeNl8wRW/Onhy4nUKR/lVemJ8gJedxxUyBLm9kkrDColJvoSfwi0jCNhD+xCdOtiGDQiRZg== - dependencies: - debug "^3.2.6" - iconv-lite "^0.4.4" - sax "^1.2.4" - negotiator@0.6.2: version "0.6.2" resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.2.tgz#feacf7ccf525a77ae9634436a64883ffeca346fb" @@ -7840,22 +7792,6 @@ node-notifier@^5.4.2: shellwords "^0.1.1" which "^1.3.0" -node-pre-gyp@*: - version "0.14.0" - resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.14.0.tgz#9a0596533b877289bcad4e143982ca3d904ddc83" - integrity sha512-+CvDC7ZttU/sSt9rFjix/P05iS43qHCOOGzcr3Ry99bXG7VX953+vFyEuph/tfqoYu8dttBkE86JSKBO2OzcxA== - dependencies: - detect-libc "^1.0.2" - mkdirp "^0.5.1" - needle "^2.2.1" - nopt "^4.0.1" - npm-packlist "^1.1.6" - npmlog "^4.0.2" - rc "^1.2.7" - rimraf "^2.6.1" - semver "^5.3.0" - tar "^4.4.2" - node-releases@^1.1.29, node-releases@^1.1.42: version "1.1.42" resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.42.tgz#a999f6a62f8746981f6da90627a8d2fc090bbad7" @@ -7863,7 +7799,7 @@ node-releases@^1.1.29, node-releases@^1.1.42: dependencies: semver "^6.3.0" -nopt@^4.0.1, nopt@~4.0.1: +nopt@~4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.1.tgz#d0d4685afd5415193c8c7505602d0d17cd64474d" integrity sha1-0NRoWv1UFRk8jHUFYC0NF81kR00= @@ -7913,26 +7849,6 @@ normalize-url@^3.0.0: resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-3.3.0.tgz#b2e1c4dc4f7c6d57743df733a4f5978d18650559" integrity sha512-U+JJi7duF1o+u2pynbp2zXDW2/PADgC30f0GsHZtRh+HOcXHnw137TrNlyxxRvWW5fjKd3bcLHPxofWuCjaeZg== -npm-bundled@^1.0.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.1.1.tgz#1edd570865a94cdb1bc8220775e29466c9fb234b" - integrity sha512-gqkfgGePhTpAEgUsGEgcq1rqPXA+tv/aVBlgEzfXwA1yiUJF7xtEt3CtVwOjNYQOVknDk0F20w58Fnm3EtG0fA== - dependencies: - npm-normalize-package-bin "^1.0.1" - -npm-normalize-package-bin@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/npm-normalize-package-bin/-/npm-normalize-package-bin-1.0.1.tgz#6e79a41f23fd235c0623218228da7d9c23b8f6e2" - integrity sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA== - -npm-packlist@^1.1.6: - version "1.4.7" - resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-1.4.7.tgz#9e954365a06b80b18111ea900945af4f88ed4848" - integrity sha512-vAj7dIkp5NhieaGZxBJB8fF4R0078rqsmhJcAfXZ6O7JJhjhPK96n5Ry1oZcfLXgfun0GWTZPOxaEyqv8GBykQ== - dependencies: - ignore-walk "^3.0.1" - npm-bundled "^1.0.1" - npm-run-path@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" @@ -7940,7 +7856,7 @@ npm-run-path@^2.0.0: dependencies: path-key "^2.0.0" -npmlog@^4.0.2, npmlog@^4.1.2: +npmlog@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" integrity sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg== @@ -9196,16 +9112,6 @@ raw-loader@^2.0.0: loader-utils "^1.1.0" schema-utils "^1.0.0" -rc@^1.2.7: - version "1.2.8" - resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" - integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== - dependencies: - deep-extend "^0.6.0" - ini "~1.3.0" - minimist "^1.2.0" - strip-json-comments "~2.0.1" - react-clientside-effect@^1.2.0, react-clientside-effect@^1.2.2: version "1.2.2" resolved "https://registry.yarnpkg.com/react-clientside-effect/-/react-clientside-effect-1.2.2.tgz#6212fb0e07b204e714581dd51992603d1accc837" @@ -9776,7 +9682,7 @@ rimraf@2.6.3: dependencies: glob "^7.1.3" -rimraf@^2.2.8, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.3, rimraf@^2.7.1: +rimraf@^2.2.8, rimraf@^2.5.4, rimraf@^2.6.3, rimraf@^2.7.1: version "2.7.1" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== @@ -9906,7 +9812,7 @@ selfsigned@^1.10.7: dependencies: node-forge "0.9.0" -"semver@2 || 3 || 4 || 5", semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0: +"semver@2 || 3 || 4 || 5", semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0: version "5.7.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== @@ -10554,11 +10460,6 @@ strip-json-comments@^3.0.1: resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.0.1.tgz#85713975a91fb87bf1b305cca77395e40d2a64a7" integrity sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw== -strip-json-comments@~2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" - integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= - style-loader@^0.23.1: version "0.23.1" resolved "https://registry.yarnpkg.com/style-loader/-/style-loader-0.23.1.tgz#cb9154606f3e771ab6c4ab637026a1049174d925" @@ -10647,19 +10548,6 @@ tapable@^1.0.0, tapable@^1.1.3: resolved "https://registry.yarnpkg.com/tapable/-/tapable-1.1.3.tgz#a1fccc06b58db61fd7a45da2da44f5f3a3e67ba2" integrity sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA== -tar@^4.4.2: - version "4.4.13" - resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.13.tgz#43b364bc52888d555298637b10d60790254ab525" - integrity sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA== - dependencies: - chownr "^1.1.1" - fs-minipass "^1.2.5" - minipass "^2.8.6" - minizlib "^1.2.1" - mkdirp "^0.5.0" - safe-buffer "^5.1.2" - yallist "^3.0.3" - telejson@^3.0.2: version "3.3.0" resolved "https://registry.yarnpkg.com/telejson/-/telejson-3.3.0.tgz#6d814f3c0d254d5c4770085aad063e266b56ad03" @@ -11528,7 +11416,7 @@ yallist@^2.1.2: resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" integrity sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI= -yallist@^3.0.0, yallist@^3.0.2, yallist@^3.0.3: +yallist@^3.0.2: version "3.1.1" resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== From dbcabec37c2b4ca26ab5785dba8679adc57799cd Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Wed, 8 Jan 2020 18:10:20 +0200 Subject: [PATCH 016/115] useReducer instead of useState used in Toast --- src/common/Toast/Toast.js | 40 ++++++++++++++++---------- src/common/Toast/ToastItem/styles.less | 4 +-- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/src/common/Toast/Toast.js b/src/common/Toast/Toast.js index 340c25daf..c31231743 100644 --- a/src/common/Toast/Toast.js +++ b/src/common/Toast/Toast.js @@ -1,6 +1,5 @@ const React = require('react'); const classnames = require('classnames'); -const useLiveRef = require('stremio/common/useLiveRef'); const { Modal } = require('stremio-router'); const ToastItem = require('./ToastItem'); const styles = require('./styles'); @@ -8,32 +7,43 @@ const styles = require('./styles'); const DEFAULT_TIMEOUT = 2000; const Toast = React.forwardRef(({ className }, ref) => { - const [toastItems, setToastItems] = React.useState([]); - const toastItemsRef = useLiveRef(toastItems, [toastItems]); + const [toastItems, dispatch] = React.useReducer( + (state, action) => { + switch (action.type) { + case 'add': + return state.concat([action.item]); + case 'remove': + return state.filter(item => item !== action.item); + case 'removeAll': + state.forEach(item => clearTimeout(item.timerId)); + return []; + default: + return state; + } + }, [] + ); - const hideAll = () => { - toastItemsRef.current.forEach(item => clearTimeout(item.timerId)); - setToastItems([]); - }; + const hideAll = React.useCallback(() => { + dispatch({ type: 'removeAll' }); + }, []); - const show = ({ type, icon, title, text, closeButton, timeout, onClick }) => { + const show = React.useCallback(({ type, icon, title, text, closeButton, timeout, onClick }) => { timeout = timeout !== null && !isNaN(timeout) ? timeout : DEFAULT_TIMEOUT; const close = () => { - clearTimeout(nextItem.timerId); - setToastItems(toastItemsRef.current.filter(state => state !== nextItem)); + clearTimeout(newItem.timerId); + dispatch({ type: 'remove', item: newItem }); }; - const nextItem = { type, icon, title, text, closeButton, timeout, onClick, onClose: close }; + const newItem = { type, icon, title, text, closeButton, timeout, onClick, onClose: close }; if (timeout !== 0) { - nextItem.timerId = setTimeout(close, timeout); + newItem.timerId = setTimeout(close, timeout); } - setToastItems(toastItemsRef.current.concat([nextItem])); + dispatch({ type: 'add', item: newItem }); return close; - }; + }, []); React.useImperativeHandle(ref, () => ({ show, hideAll })); - return toastItems.length === 0 ? null : ( {toastItems.map((item, index) => ())} diff --git a/src/common/Toast/ToastItem/styles.less b/src/common/Toast/ToastItem/styles.less index 9dfedb68d..27ce43c25 100644 --- a/src/common/Toast/ToastItem/styles.less +++ b/src/common/Toast/ToastItem/styles.less @@ -26,7 +26,7 @@ } .icon-container { - flex: 1; + width: 5rem; padding: 1rem; padding-right: 0; overflow: visible; @@ -39,7 +39,7 @@ } .message-container { - flex: 5; + flex: 1; padding: 1rem; &.clickable { From 21c29a6f3f8f68ae0cd1b1e8d4ef61b1157ce72a Mon Sep 17 00:00:00 2001 From: nklhrstv Date: Thu, 9 Jan 2020 09:12:54 +0200 Subject: [PATCH 017/115] stream is the only required url param in player --- src/common/routesRegexp.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/routesRegexp.js b/src/common/routesRegexp.js index d2bf19114..b5bf69db4 100644 --- a/src/common/routesRegexp.js +++ b/src/common/routesRegexp.js @@ -32,8 +32,8 @@ const routesRegexp = { urlParamsNames: [] }, player: { - regexp: /^\/player\/([^/]*)\/([^/]*)\/([^/]*)\/([^/]*)\/([^/]*)$/, - urlParamsNames: ['transportUrl', 'type', 'id', 'videoId', 'stream'] + regexp: /^\/player\/([^/]*)(?:\/([^/]*)\/([^/]*)\/([^/]*)\/([^/]*))?$/, + urlParamsNames: ['stream', 'transportUrl', 'type', 'id', 'videoId'] } }; From 1904a1e32bae13ef65e51da48ebe1b9cf50c5ec8 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Thu, 9 Jan 2020 11:56:53 +0200 Subject: [PATCH 018/115] disabled prop added to Modal --- src/router/Modal/Modal.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/router/Modal/Modal.js b/src/router/Modal/Modal.js index dc26b3f12..4b22a133c 100644 --- a/src/router/Modal/Modal.js +++ b/src/router/Modal/Modal.js @@ -5,10 +5,10 @@ const classnames = require('classnames'); const FocusLock = require('react-focus-lock').default; const { useModalsContainer } = require('../ModalsContainerContext'); -const Modal = ({ className, autoFocus, children, ...props }) => { +const Modal = ({ className, autoFocus, disabled, children, ...props }) => { const modalsContainer = useModalsContainer(); return ReactDOM.createPortal( - + {children} , modalsContainer @@ -18,6 +18,7 @@ const Modal = ({ className, autoFocus, children, ...props }) => { Modal.propTypes = { className: PropTypes.string, autoFocus: PropTypes.bool, + disabled: PropTypes.bool, children: PropTypes.node }; From 504ad74c577398dddb1974f3436a1119cf53ef39 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Thu, 9 Jan 2020 11:58:40 +0200 Subject: [PATCH 019/115] disable focus lock for Toast --- src/common/Toast/Toast.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/Toast/Toast.js b/src/common/Toast/Toast.js index c31231743..76e4d447b 100644 --- a/src/common/Toast/Toast.js +++ b/src/common/Toast/Toast.js @@ -45,7 +45,7 @@ const Toast = React.forwardRef(({ className }, ref) => { React.useImperativeHandle(ref, () => ({ show, hideAll })); return toastItems.length === 0 ? null : ( - + {toastItems.map((item, index) => ())} ); From 293868aa0ee0df129efacd460803815e1a0264f8 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Thu, 9 Jan 2020 16:31:04 +0200 Subject: [PATCH 020/115] ToastsContainerContext implemented --- .../ToastsContainerContext.js | 7 +++++++ .../ToastsContainerProvider.js | 19 +++++++++++++++++++ src/common/ToastsContainerContext/index.js | 7 +++++++ .../useToastsContainer.js | 8 ++++++++ src/common/index.js | 2 ++ 5 files changed, 43 insertions(+) create mode 100644 src/common/ToastsContainerContext/ToastsContainerContext.js create mode 100644 src/common/ToastsContainerContext/ToastsContainerProvider.js create mode 100644 src/common/ToastsContainerContext/index.js create mode 100644 src/common/ToastsContainerContext/useToastsContainer.js diff --git a/src/common/ToastsContainerContext/ToastsContainerContext.js b/src/common/ToastsContainerContext/ToastsContainerContext.js new file mode 100644 index 000000000..fdff8212f --- /dev/null +++ b/src/common/ToastsContainerContext/ToastsContainerContext.js @@ -0,0 +1,7 @@ +const React = require('react'); + +const ToastsContainerContext = React.createContext(null); + +ToastsContainerContext.displayName = 'ToastsContainerContext'; + +module.exports = ToastsContainerContext; diff --git a/src/common/ToastsContainerContext/ToastsContainerProvider.js b/src/common/ToastsContainerContext/ToastsContainerProvider.js new file mode 100644 index 000000000..82e1086a7 --- /dev/null +++ b/src/common/ToastsContainerContext/ToastsContainerProvider.js @@ -0,0 +1,19 @@ +const React = require('react'); +const PropTypes = require('prop-types'); +const ToastsContainerContext = require('./ToastsContainerContext'); + +const ToastsContainerProvider = ({ children }) => { + const [container, setContainer] = React.useState(null); + return ( + + {container instanceof HTMLElement ? children : null} +
+ + ); +}; + +ToastsContainerProvider.propTypes = { + children: PropTypes.node +}; + +module.exports = ToastsContainerProvider; diff --git a/src/common/ToastsContainerContext/index.js b/src/common/ToastsContainerContext/index.js new file mode 100644 index 000000000..55ef960ec --- /dev/null +++ b/src/common/ToastsContainerContext/index.js @@ -0,0 +1,7 @@ +const ToastsContainerProvider = require('./ToastsContainerProvider'); +const useToastsContainer = require('./useToastsContainer'); + +module.exports = { + ToastsContainerProvider, + useToastsContainer +}; diff --git a/src/common/ToastsContainerContext/useToastsContainer.js b/src/common/ToastsContainerContext/useToastsContainer.js new file mode 100644 index 000000000..0f32d0d4c --- /dev/null +++ b/src/common/ToastsContainerContext/useToastsContainer.js @@ -0,0 +1,8 @@ +const React = require('react'); +const ToastsContainerContext = require('./ToastsContainerContext'); + +const useToastsContainer = () => { + return React.useContext(ToastsContainerContext); +}; + +module.exports = useToastsContainer; diff --git a/src/common/index.js b/src/common/index.js index c66e65400..474b77c3d 100644 --- a/src/common/index.js +++ b/src/common/index.js @@ -17,6 +17,7 @@ const SharePrompt = require('./SharePrompt'); const Slider = require('./Slider'); const TextInput = require('./TextInput'); const Toast = require('./Toast'); +const ToastsContainerContext = require('./ToastsContainerContext'); const routesRegexp = require('./routesRegexp'); const useAnimationFrame = require('./useAnimationFrame'); const useBinaryState = require('./useBinaryState'); @@ -47,6 +48,7 @@ module.exports = { Slider, TextInput, Toast, + ToastsContainerContext, routesRegexp, useAnimationFrame, useBinaryState, From 850f6ce3991abfc194565f70a2c95304e6f5873e Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Thu, 9 Jan 2020 16:37:55 +0200 Subject: [PATCH 021/115] ToastsContainerProvider used in App --- src/App/App.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/App/App.js b/src/App/App.js index 0a560f919..f0d42cfd3 100644 --- a/src/App/App.js +++ b/src/App/App.js @@ -2,6 +2,7 @@ require('spatial-navigation-polyfill'); const React = require('react'); const { Router } = require('stremio-router'); const { Core, KeyboardNavigation, ServicesProvider, Shell } = require('stremio/services'); +const ToastsContainerProvider = require('../common/ToastsContainerContext/ToastsContainerProvider'); const routerViewsConfig = require('./routerViewsConfig'); const styles = require('./styles'); @@ -45,12 +46,14 @@ const App = () => { { shellInitialized && coreInitialized ? - + + + :
} From a8907ffac502d81186b0010a0ac0323ab7162348 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Thu, 9 Jan 2020 16:38:29 +0200 Subject: [PATCH 022/115] ModalsContainerContext used in Toast component --- src/common/Toast/Toast.js | 11 ++++++++--- src/common/Toast/styles.less | 8 +++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/common/Toast/Toast.js b/src/common/Toast/Toast.js index 76e4d447b..2fd701420 100644 --- a/src/common/Toast/Toast.js +++ b/src/common/Toast/Toast.js @@ -1,12 +1,15 @@ const React = require('react'); const classnames = require('classnames'); const { Modal } = require('stremio-router'); +const ModalsContainerContext = require('stremio-router/ModalsContainerContext/ModalsContainerContext'); +const { useToastsContainer } = require('../ToastsContainerContext'); const ToastItem = require('./ToastItem'); const styles = require('./styles'); const DEFAULT_TIMEOUT = 2000; const Toast = React.forwardRef(({ className }, ref) => { + const toastsContainer = useToastsContainer(); const [toastItems, dispatch] = React.useReducer( (state, action) => { switch (action.type) { @@ -45,9 +48,11 @@ const Toast = React.forwardRef(({ className }, ref) => { React.useImperativeHandle(ref, () => ({ show, hideAll })); return toastItems.length === 0 ? null : ( - - {toastItems.map((item, index) => ())} - + + + {toastItems.map((item, index) => ())} + + ); }); diff --git a/src/common/Toast/styles.less b/src/common/Toast/styles.less index 7de87bf63..eb02a8cd9 100644 --- a/src/common/Toast/styles.less +++ b/src/common/Toast/styles.less @@ -1,4 +1,10 @@ .toast-container { - pointer-events: none; + --nav-bar-size: 3.2rem; + position: absolute; + top: var(--nav-bar-size); + right: 0; + bottom: 0; left: auto !important; + z-index: 0; + pointer-events: none; } \ No newline at end of file From 7dc27c963aa804dda6e79c84b2c0ede4c67cee2f Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Thu, 9 Jan 2020 17:06:32 +0200 Subject: [PATCH 023/115] ../ usage removed --- src/App/App.js | 2 +- src/common/Toast/Toast.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/App/App.js b/src/App/App.js index f0d42cfd3..56d157dda 100644 --- a/src/App/App.js +++ b/src/App/App.js @@ -2,7 +2,7 @@ require('spatial-navigation-polyfill'); const React = require('react'); const { Router } = require('stremio-router'); const { Core, KeyboardNavigation, ServicesProvider, Shell } = require('stremio/services'); -const ToastsContainerProvider = require('../common/ToastsContainerContext/ToastsContainerProvider'); +const ToastsContainerProvider = require('stremio/common/ToastsContainerContext/ToastsContainerProvider'); const routerViewsConfig = require('./routerViewsConfig'); const styles = require('./styles'); diff --git a/src/common/Toast/Toast.js b/src/common/Toast/Toast.js index 2fd701420..d29eb1775 100644 --- a/src/common/Toast/Toast.js +++ b/src/common/Toast/Toast.js @@ -2,7 +2,7 @@ const React = require('react'); const classnames = require('classnames'); const { Modal } = require('stremio-router'); const ModalsContainerContext = require('stremio-router/ModalsContainerContext/ModalsContainerContext'); -const { useToastsContainer } = require('../ToastsContainerContext'); +const { useToastsContainer } = require('stremio/common/ToastsContainerContext'); const ToastItem = require('./ToastItem'); const styles = require('./styles'); From c59efd0165679e445b8531fb74060440a05e6cef Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Thu, 9 Jan 2020 18:08:54 +0200 Subject: [PATCH 024/115] toastClicked func renamed to toastOnClick --- src/App/App.js | 2 +- src/common/Toast/ToastItem/ToastItem.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/App/App.js b/src/App/App.js index 56d157dda..00d7d26c8 100644 --- a/src/App/App.js +++ b/src/App/App.js @@ -2,7 +2,7 @@ require('spatial-navigation-polyfill'); const React = require('react'); const { Router } = require('stremio-router'); const { Core, KeyboardNavigation, ServicesProvider, Shell } = require('stremio/services'); -const ToastsContainerProvider = require('stremio/common/ToastsContainerContext/ToastsContainerProvider'); +const { ToastsContainerProvider } = require('stremio/common/ToastsContainerContext'); const routerViewsConfig = require('./routerViewsConfig'); const styles = require('./styles'); diff --git a/src/common/Toast/ToastItem/ToastItem.js b/src/common/Toast/ToastItem/ToastItem.js index b7ab7a727..852fe3947 100644 --- a/src/common/Toast/ToastItem/ToastItem.js +++ b/src/common/Toast/ToastItem/ToastItem.js @@ -7,7 +7,7 @@ const styles = require('./styles'); const ToastItem = ({ type, title, text, icon, closeButton, onClick, onClose }) => { const isClickable = typeof onClick === 'function'; - const toastClicked = React.useCallback(() => { + const toastOnClick = React.useCallback(() => { if (isClickable) { onClick(); } @@ -23,7 +23,7 @@ const ToastItem = ({ type, title, text, icon, closeButton, onClick, onClose }) = : null } -
+
{ typeof title === 'string' && title.length > 0 ?

{title}

From 709960e939bb36ab4ea549597986fdbe2c22eab2 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Thu, 9 Jan 2020 18:25:36 +0200 Subject: [PATCH 025/115] global nav-bar-size css variable --- src/App/styles.less | 1 + src/common/NavBar/styles.less | 1 - src/common/Toast/styles.less | 1 - 3 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/App/styles.less b/src/App/styles.less index 4ab98b8ef..87529fc59 100644 --- a/src/App/styles.less +++ b/src/App/styles.less @@ -10,6 +10,7 @@ --landscape-shape-ratio: 0.5625; --poster-shape-ratio: 1.464; --scroll-bar-width: 6px; + --nav-bar-size: 3.2rem; --focus-outline-size: 2px; --color-facebook: #4267b2; --color-twitter: #1DA1F2; diff --git a/src/common/NavBar/styles.less b/src/common/NavBar/styles.less index 3c9ff80d2..30304c8ec 100644 --- a/src/common/NavBar/styles.less +++ b/src/common/NavBar/styles.less @@ -1,5 +1,4 @@ .nav-bar-container { - --nav-bar-size: 3.2rem; display: flex; flex-direction: row; align-items: center; diff --git a/src/common/Toast/styles.less b/src/common/Toast/styles.less index eb02a8cd9..c8a331491 100644 --- a/src/common/Toast/styles.less +++ b/src/common/Toast/styles.less @@ -1,5 +1,4 @@ .toast-container { - --nav-bar-size: 3.2rem; position: absolute; top: var(--nav-bar-size); right: 0; From a92f1291da08c9ed66eaa282d996d1c7cd304a98 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Thu, 9 Jan 2020 18:44:05 +0200 Subject: [PATCH 026/115] storybook SimpleToast improved --- .../stories/Toast/SimpleToast/SimpleToast.js | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/storybook/stories/Toast/SimpleToast/SimpleToast.js b/storybook/stories/Toast/SimpleToast/SimpleToast.js index 65eb04376..4facc5297 100644 --- a/storybook/stories/Toast/SimpleToast/SimpleToast.js +++ b/storybook/stories/Toast/SimpleToast/SimpleToast.js @@ -2,11 +2,12 @@ const React = require('react'); const { storiesOf } = require('@storybook/react'); const { Toast } = require('stremio/common'); const styles = require('./styles'); +const { ToastsContainerProvider } = require('stremio/common/ToastsContainerContext'); storiesOf('Toast', module).add('SimpleToast', () => { const toastRef = React.useRef(null); - const showToast = (message) => React.useCallback(() => { + const showToast = React.useCallback((message) => { toastRef.current.show({ title: 'Something to take your attention', timeout: 0, @@ -17,7 +18,7 @@ storiesOf('Toast', module).add('SimpleToast', () => { }); }, [toastRef.current]); - const clickSuccess = showToast({ + const clickSuccess = () => showToast({ title: 'You clicked it', text: 'Congratulations! Click event handled successfully.', type: 'success', @@ -27,16 +28,18 @@ storiesOf('Toast', module).add('SimpleToast', () => { return (
- - - - - - - + + + + + + + - + + +
); }); From d29114b49b6f59c4169bf986cfdbff36c8510126 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Fri, 10 Jan 2020 11:24:43 +0200 Subject: [PATCH 027/115] empty rows removed --- src/common/Toast/Toast.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/common/Toast/Toast.js b/src/common/Toast/Toast.js index d29eb1775..a4e7aa01c 100644 --- a/src/common/Toast/Toast.js +++ b/src/common/Toast/Toast.js @@ -25,11 +25,9 @@ const Toast = React.forwardRef(({ className }, ref) => { } }, [] ); - const hideAll = React.useCallback(() => { dispatch({ type: 'removeAll' }); }, []); - const show = React.useCallback(({ type, icon, title, text, closeButton, timeout, onClick }) => { timeout = timeout !== null && !isNaN(timeout) ? timeout : DEFAULT_TIMEOUT; const close = () => { @@ -45,8 +43,8 @@ const Toast = React.forwardRef(({ className }, ref) => { dispatch({ type: 'add', item: newItem }); return close; }, []); - React.useImperativeHandle(ref, () => ({ show, hideAll })); + return toastItems.length === 0 ? null : ( From 706ef68162185a7071d41a36e6908ecedd135e96 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Fri, 10 Jan 2020 13:07:38 +0200 Subject: [PATCH 028/115] Toast renamed to Toasts --- src/common/Toast/index.js | 3 --- src/common/{Toast => Toasts}/ToastItem/ToastItem.js | 0 src/common/{Toast => Toasts}/ToastItem/index.js | 0 src/common/{Toast => Toasts}/ToastItem/styles.less | 0 src/common/{Toast/Toast.js => Toasts/Toasts.js} | 6 +++--- src/common/Toasts/index.js | 3 +++ src/common/{Toast => Toasts}/styles.less | 2 +- src/common/index.js | 4 ++-- storybook/stories/index.js | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) delete mode 100644 src/common/Toast/index.js rename src/common/{Toast => Toasts}/ToastItem/ToastItem.js (100%) rename src/common/{Toast => Toasts}/ToastItem/index.js (100%) rename src/common/{Toast => Toasts}/ToastItem/styles.less (100%) rename src/common/{Toast/Toast.js => Toasts/Toasts.js} (94%) create mode 100644 src/common/Toasts/index.js rename src/common/{Toast => Toasts}/styles.less (88%) diff --git a/src/common/Toast/index.js b/src/common/Toast/index.js deleted file mode 100644 index 37050e200..000000000 --- a/src/common/Toast/index.js +++ /dev/null @@ -1,3 +0,0 @@ -const Toast = require('./Toast'); - -module.exports = Toast; diff --git a/src/common/Toast/ToastItem/ToastItem.js b/src/common/Toasts/ToastItem/ToastItem.js similarity index 100% rename from src/common/Toast/ToastItem/ToastItem.js rename to src/common/Toasts/ToastItem/ToastItem.js diff --git a/src/common/Toast/ToastItem/index.js b/src/common/Toasts/ToastItem/index.js similarity index 100% rename from src/common/Toast/ToastItem/index.js rename to src/common/Toasts/ToastItem/index.js diff --git a/src/common/Toast/ToastItem/styles.less b/src/common/Toasts/ToastItem/styles.less similarity index 100% rename from src/common/Toast/ToastItem/styles.less rename to src/common/Toasts/ToastItem/styles.less diff --git a/src/common/Toast/Toast.js b/src/common/Toasts/Toasts.js similarity index 94% rename from src/common/Toast/Toast.js rename to src/common/Toasts/Toasts.js index a4e7aa01c..38ae52fbc 100644 --- a/src/common/Toast/Toast.js +++ b/src/common/Toasts/Toasts.js @@ -8,7 +8,7 @@ const styles = require('./styles'); const DEFAULT_TIMEOUT = 2000; -const Toast = React.forwardRef(({ className }, ref) => { +const Toasts = React.forwardRef(({ className }, ref) => { const toastsContainer = useToastsContainer(); const [toastItems, dispatch] = React.useReducer( (state, action) => { @@ -47,11 +47,11 @@ const Toast = React.forwardRef(({ className }, ref) => { return toastItems.length === 0 ? null : ( - + {toastItems.map((item, index) => ())} ); }); -module.exports = Toast; +module.exports = Toasts; diff --git a/src/common/Toasts/index.js b/src/common/Toasts/index.js new file mode 100644 index 000000000..b06087a3a --- /dev/null +++ b/src/common/Toasts/index.js @@ -0,0 +1,3 @@ +const Toasts = require('./Toasts'); + +module.exports = Toasts; diff --git a/src/common/Toast/styles.less b/src/common/Toasts/styles.less similarity index 88% rename from src/common/Toast/styles.less rename to src/common/Toasts/styles.less index c8a331491..1afd990e6 100644 --- a/src/common/Toast/styles.less +++ b/src/common/Toasts/styles.less @@ -1,4 +1,4 @@ -.toast-container { +.toasts-container { position: absolute; top: var(--nav-bar-size); right: 0; diff --git a/src/common/index.js b/src/common/index.js index 474b77c3d..3770d8dca 100644 --- a/src/common/index.js +++ b/src/common/index.js @@ -16,7 +16,7 @@ const Popup = require('./Popup'); const SharePrompt = require('./SharePrompt'); const Slider = require('./Slider'); const TextInput = require('./TextInput'); -const Toast = require('./Toast'); +const Toasts = require('./Toasts'); const ToastsContainerContext = require('./ToastsContainerContext'); const routesRegexp = require('./routesRegexp'); const useAnimationFrame = require('./useAnimationFrame'); @@ -47,7 +47,7 @@ module.exports = { SharePrompt, Slider, TextInput, - Toast, + Toasts, ToastsContainerContext, routesRegexp, useAnimationFrame, diff --git a/storybook/stories/index.js b/storybook/stories/index.js index 7562692e3..e0a8bbc88 100644 --- a/storybook/stories/index.js +++ b/storybook/stories/index.js @@ -11,4 +11,4 @@ require('./Popup'); require('./SeasonsBar'); require('./SharePrompt'); require('./Stream'); -require('./Toast'); +require('./Toasts'); From 136a2fddda3cc8e492e494aa4b7cf20a49878231 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Fri, 10 Jan 2020 13:22:03 +0200 Subject: [PATCH 029/115] ToastItem renamed to Toast --- .../Toasts/{ToastItem/ToastItem.js => Toast/Toast.js} | 8 ++++---- src/common/Toasts/Toast/index.js | 3 +++ src/common/Toasts/{ToastItem => Toast}/styles.less | 2 +- src/common/Toasts/ToastItem/index.js | 3 --- src/common/Toasts/Toasts.js | 8 ++++---- 5 files changed, 12 insertions(+), 12 deletions(-) rename src/common/Toasts/{ToastItem/ToastItem.js => Toast/Toast.js} (88%) create mode 100644 src/common/Toasts/Toast/index.js rename src/common/Toasts/{ToastItem => Toast}/styles.less (98%) delete mode 100644 src/common/Toasts/ToastItem/index.js diff --git a/src/common/Toasts/ToastItem/ToastItem.js b/src/common/Toasts/Toast/Toast.js similarity index 88% rename from src/common/Toasts/ToastItem/ToastItem.js rename to src/common/Toasts/Toast/Toast.js index 852fe3947..6b82834fc 100644 --- a/src/common/Toasts/ToastItem/ToastItem.js +++ b/src/common/Toasts/Toast/Toast.js @@ -5,7 +5,7 @@ const Icon = require('stremio-icons/dom'); const Button = require('stremio/common/Button'); const styles = require('./styles'); -const ToastItem = ({ type, title, text, icon, closeButton, onClick, onClose }) => { +const Toast = ({ type, title, text, icon, closeButton, onClick, onClose }) => { const isClickable = typeof onClick === 'function'; const toastOnClick = React.useCallback(() => { if (isClickable) { @@ -14,7 +14,7 @@ const ToastItem = ({ type, title, text, icon, closeButton, onClick, onClose }) = }, [onClick]); return ( -
+
{ typeof icon === 'string' && icon.length > 0 ?
@@ -44,7 +44,7 @@ const ToastItem = ({ type, title, text, icon, closeButton, onClick, onClose }) = ); }; -ToastItem.propTypes = { +Toast.propTypes = { type: PropTypes.string, title: PropTypes.string, text: PropTypes.string, @@ -54,4 +54,4 @@ ToastItem.propTypes = { onClose: PropTypes.func }; -module.exports = ToastItem; +module.exports = Toast; diff --git a/src/common/Toasts/Toast/index.js b/src/common/Toasts/Toast/index.js new file mode 100644 index 000000000..efe31724b --- /dev/null +++ b/src/common/Toasts/Toast/index.js @@ -0,0 +1,3 @@ +const Toast = require('./Toast'); + +module.exports = Toast; \ No newline at end of file diff --git a/src/common/Toasts/ToastItem/styles.less b/src/common/Toasts/Toast/styles.less similarity index 98% rename from src/common/Toasts/ToastItem/styles.less rename to src/common/Toasts/Toast/styles.less index 27ce43c25..6bb5c6399 100644 --- a/src/common/Toasts/ToastItem/styles.less +++ b/src/common/Toasts/Toast/styles.less @@ -1,4 +1,4 @@ -.toast-item { +.toast-container { display: flex; flex-direction: row; min-height: 6rem; diff --git a/src/common/Toasts/ToastItem/index.js b/src/common/Toasts/ToastItem/index.js deleted file mode 100644 index fc2780087..000000000 --- a/src/common/Toasts/ToastItem/index.js +++ /dev/null @@ -1,3 +0,0 @@ -const ToastItem = require('./ToastItem'); - -module.exports = ToastItem; \ No newline at end of file diff --git a/src/common/Toasts/Toasts.js b/src/common/Toasts/Toasts.js index 38ae52fbc..017b9d418 100644 --- a/src/common/Toasts/Toasts.js +++ b/src/common/Toasts/Toasts.js @@ -3,14 +3,14 @@ const classnames = require('classnames'); const { Modal } = require('stremio-router'); const ModalsContainerContext = require('stremio-router/ModalsContainerContext/ModalsContainerContext'); const { useToastsContainer } = require('stremio/common/ToastsContainerContext'); -const ToastItem = require('./ToastItem'); +const Toast = require('./Toast'); const styles = require('./styles'); const DEFAULT_TIMEOUT = 2000; const Toasts = React.forwardRef(({ className }, ref) => { const toastsContainer = useToastsContainer(); - const [toastItems, dispatch] = React.useReducer( + const [toasts, dispatch] = React.useReducer( (state, action) => { switch (action.type) { case 'add': @@ -45,10 +45,10 @@ const Toasts = React.forwardRef(({ className }, ref) => { }, []); React.useImperativeHandle(ref, () => ({ show, hideAll })); - return toastItems.length === 0 ? null : ( + return toasts.length === 0 ? null : ( - {toastItems.map((item, index) => ())} + {toasts.map((toast, index) => ())} ); From 655d55b65dea049d044dbce22c5a705bcd7c526c Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Fri, 10 Jan 2020 13:40:04 +0200 Subject: [PATCH 030/115] toastOnClick func removed --- src/common/Toasts/Toast/Toast.js | 9 +-------- storybook/stories/Toast/SimpleToast/SimpleToast.js | 4 ++-- storybook/stories/index.js | 2 +- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/common/Toasts/Toast/Toast.js b/src/common/Toasts/Toast/Toast.js index 6b82834fc..b667a6d55 100644 --- a/src/common/Toasts/Toast/Toast.js +++ b/src/common/Toasts/Toast/Toast.js @@ -6,13 +6,6 @@ const Button = require('stremio/common/Button'); const styles = require('./styles'); const Toast = ({ type, title, text, icon, closeButton, onClick, onClose }) => { - const isClickable = typeof onClick === 'function'; - const toastOnClick = React.useCallback(() => { - if (isClickable) { - onClick(); - } - }, [onClick]); - return (
{ @@ -23,7 +16,7 @@ const Toast = ({ type, title, text, icon, closeButton, onClick, onClose }) => { : null } -
+
{ typeof title === 'string' && title.length > 0 ?

{title}

diff --git a/storybook/stories/Toast/SimpleToast/SimpleToast.js b/storybook/stories/Toast/SimpleToast/SimpleToast.js index 4facc5297..85c5ac44f 100644 --- a/storybook/stories/Toast/SimpleToast/SimpleToast.js +++ b/storybook/stories/Toast/SimpleToast/SimpleToast.js @@ -1,6 +1,6 @@ const React = require('react'); const { storiesOf } = require('@storybook/react'); -const { Toast } = require('stremio/common'); +const { Toasts } = require('stremio/common'); const styles = require('./styles'); const { ToastsContainerProvider } = require('stremio/common/ToastsContainerContext'); @@ -38,7 +38,7 @@ storiesOf('Toast', module).add('SimpleToast', () => { - +
); diff --git a/storybook/stories/index.js b/storybook/stories/index.js index e0a8bbc88..7562692e3 100644 --- a/storybook/stories/index.js +++ b/storybook/stories/index.js @@ -11,4 +11,4 @@ require('./Popup'); require('./SeasonsBar'); require('./SharePrompt'); require('./Stream'); -require('./Toasts'); +require('./Toast'); From 322de9e4b81a8efc5f677265850eb5792fa0ddca Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Fri, 10 Jan 2020 14:19:36 +0200 Subject: [PATCH 031/115] ToastsContainerContext moved inside Toasts --- src/App/App.js | 2 +- src/common/Toasts/Toasts.js | 2 +- .../ToastsContainerContext/ToastsContainerContext.js | 0 .../ToastsContainerContext/ToastsContainerProvider.js | 0 src/common/{ => Toasts}/ToastsContainerContext/index.js | 0 .../{ => Toasts}/ToastsContainerContext/useToastsContainer.js | 0 src/common/index.js | 2 -- 7 files changed, 2 insertions(+), 4 deletions(-) rename src/common/{ => Toasts}/ToastsContainerContext/ToastsContainerContext.js (100%) rename src/common/{ => Toasts}/ToastsContainerContext/ToastsContainerProvider.js (100%) rename src/common/{ => Toasts}/ToastsContainerContext/index.js (100%) rename src/common/{ => Toasts}/ToastsContainerContext/useToastsContainer.js (100%) diff --git a/src/App/App.js b/src/App/App.js index 00d7d26c8..2444af1b0 100644 --- a/src/App/App.js +++ b/src/App/App.js @@ -2,7 +2,7 @@ require('spatial-navigation-polyfill'); const React = require('react'); const { Router } = require('stremio-router'); const { Core, KeyboardNavigation, ServicesProvider, Shell } = require('stremio/services'); -const { ToastsContainerProvider } = require('stremio/common/ToastsContainerContext'); +const { ToastsContainerProvider } = require('stremio/common/Toasts/ToastsContainerContext'); const routerViewsConfig = require('./routerViewsConfig'); const styles = require('./styles'); diff --git a/src/common/Toasts/Toasts.js b/src/common/Toasts/Toasts.js index 017b9d418..288417549 100644 --- a/src/common/Toasts/Toasts.js +++ b/src/common/Toasts/Toasts.js @@ -2,7 +2,7 @@ const React = require('react'); const classnames = require('classnames'); const { Modal } = require('stremio-router'); const ModalsContainerContext = require('stremio-router/ModalsContainerContext/ModalsContainerContext'); -const { useToastsContainer } = require('stremio/common/ToastsContainerContext'); +const { useToastsContainer } = require('./ToastsContainerContext'); const Toast = require('./Toast'); const styles = require('./styles'); diff --git a/src/common/ToastsContainerContext/ToastsContainerContext.js b/src/common/Toasts/ToastsContainerContext/ToastsContainerContext.js similarity index 100% rename from src/common/ToastsContainerContext/ToastsContainerContext.js rename to src/common/Toasts/ToastsContainerContext/ToastsContainerContext.js diff --git a/src/common/ToastsContainerContext/ToastsContainerProvider.js b/src/common/Toasts/ToastsContainerContext/ToastsContainerProvider.js similarity index 100% rename from src/common/ToastsContainerContext/ToastsContainerProvider.js rename to src/common/Toasts/ToastsContainerContext/ToastsContainerProvider.js diff --git a/src/common/ToastsContainerContext/index.js b/src/common/Toasts/ToastsContainerContext/index.js similarity index 100% rename from src/common/ToastsContainerContext/index.js rename to src/common/Toasts/ToastsContainerContext/index.js diff --git a/src/common/ToastsContainerContext/useToastsContainer.js b/src/common/Toasts/ToastsContainerContext/useToastsContainer.js similarity index 100% rename from src/common/ToastsContainerContext/useToastsContainer.js rename to src/common/Toasts/ToastsContainerContext/useToastsContainer.js diff --git a/src/common/index.js b/src/common/index.js index 3770d8dca..955098722 100644 --- a/src/common/index.js +++ b/src/common/index.js @@ -17,7 +17,6 @@ const SharePrompt = require('./SharePrompt'); const Slider = require('./Slider'); const TextInput = require('./TextInput'); const Toasts = require('./Toasts'); -const ToastsContainerContext = require('./ToastsContainerContext'); const routesRegexp = require('./routesRegexp'); const useAnimationFrame = require('./useAnimationFrame'); const useBinaryState = require('./useBinaryState'); @@ -48,7 +47,6 @@ module.exports = { Slider, TextInput, Toasts, - ToastsContainerContext, routesRegexp, useAnimationFrame, useBinaryState, From ce399b3a0f023d6d1a0313cd94ac7ae79c282a21 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Fri, 10 Jan 2020 15:27:51 +0200 Subject: [PATCH 032/115] ToastsContainerProvider used in RouterDecorator --- src/common/Toasts/Toasts.js | 4 +--- .../ToastsContainerProvider.js | 3 ++- .../{ => ToastsContainerContext}/styles.less | 0 storybook/RouterDecorator/RouterDecorator.js | 21 +++++++++++-------- .../stories/Toast/SimpleToast/SimpleToast.js | 5 +---- 5 files changed, 16 insertions(+), 17 deletions(-) rename src/common/Toasts/{ => ToastsContainerContext}/styles.less (100%) diff --git a/src/common/Toasts/Toasts.js b/src/common/Toasts/Toasts.js index 288417549..d42a047cb 100644 --- a/src/common/Toasts/Toasts.js +++ b/src/common/Toasts/Toasts.js @@ -1,10 +1,8 @@ const React = require('react'); -const classnames = require('classnames'); const { Modal } = require('stremio-router'); const ModalsContainerContext = require('stremio-router/ModalsContainerContext/ModalsContainerContext'); const { useToastsContainer } = require('./ToastsContainerContext'); const Toast = require('./Toast'); -const styles = require('./styles'); const DEFAULT_TIMEOUT = 2000; @@ -47,7 +45,7 @@ const Toasts = React.forwardRef(({ className }, ref) => { return toasts.length === 0 ? null : ( - + {toasts.map((toast, index) => ())} diff --git a/src/common/Toasts/ToastsContainerContext/ToastsContainerProvider.js b/src/common/Toasts/ToastsContainerContext/ToastsContainerProvider.js index 82e1086a7..f54635819 100644 --- a/src/common/Toasts/ToastsContainerContext/ToastsContainerProvider.js +++ b/src/common/Toasts/ToastsContainerContext/ToastsContainerProvider.js @@ -1,13 +1,14 @@ const React = require('react'); const PropTypes = require('prop-types'); const ToastsContainerContext = require('./ToastsContainerContext'); +const styles = require('./styles'); const ToastsContainerProvider = ({ children }) => { const [container, setContainer] = React.useState(null); return ( {container instanceof HTMLElement ? children : null} -
+
); }; diff --git a/src/common/Toasts/styles.less b/src/common/Toasts/ToastsContainerContext/styles.less similarity index 100% rename from src/common/Toasts/styles.less rename to src/common/Toasts/ToastsContainerContext/styles.less diff --git a/storybook/RouterDecorator/RouterDecorator.js b/storybook/RouterDecorator/RouterDecorator.js index 6a3d3a717..d2997fd3b 100644 --- a/storybook/RouterDecorator/RouterDecorator.js +++ b/storybook/RouterDecorator/RouterDecorator.js @@ -2,20 +2,23 @@ const React = require('react'); const classnames = require('classnames'); const Route = require('stremio-router/Route'); const { RouteFocusedProvider } = require('stremio-router/RouteFocusedContext'); +const { ToastsContainerProvider } = require('stremio/common/Toasts/ToastsContainerContext'); const appStyles = require('stremio/App/styles'); const styles = require('./styles'); const RouterDecorator = ({ children }) => (
-
- - -
- {children} -
-
-
-
+ +
+ + +
+ {children} +
+
+
+
+
); diff --git a/storybook/stories/Toast/SimpleToast/SimpleToast.js b/storybook/stories/Toast/SimpleToast/SimpleToast.js index 85c5ac44f..e5e3ed388 100644 --- a/storybook/stories/Toast/SimpleToast/SimpleToast.js +++ b/storybook/stories/Toast/SimpleToast/SimpleToast.js @@ -2,7 +2,6 @@ const React = require('react'); const { storiesOf } = require('@storybook/react'); const { Toasts } = require('stremio/common'); const styles = require('./styles'); -const { ToastsContainerProvider } = require('stremio/common/ToastsContainerContext'); storiesOf('Toast', module).add('SimpleToast', () => { const toastRef = React.useRef(null); @@ -37,9 +36,7 @@ storiesOf('Toast', module).add('SimpleToast', () => { - - - +
); }); From 8345bd75be378f3be1ec307dc83821fcf82e432b Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Fri, 17 Jan 2020 15:40:07 +0200 Subject: [PATCH 033/115] Create main.yml --- .github/workflows/main.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..d7ff237c0 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,16 @@ +name: Build + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - name: Build + run: yarn build + - uses: actions/upload-artifact@v1 + with: + name: stremio-web + path: stremio-web/dist From ce2cb0af813160005205d7e88189c9b64e2db2c0 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Fri, 17 Jan 2020 15:44:48 +0200 Subject: [PATCH 034/115] Update and rename main.yml to build.yml --- .github/workflows/{main.yml => build.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{main.yml => build.yml} (83%) diff --git a/.github/workflows/main.yml b/.github/workflows/build.yml similarity index 83% rename from .github/workflows/main.yml rename to .github/workflows/build.yml index d7ff237c0..8488ddd68 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/build.yml @@ -9,7 +9,7 @@ jobs: steps: - uses: actions/checkout@v1 - name: Build - run: yarn build + run: yarn add webpack --dev && yarn build - uses: actions/upload-artifact@v1 with: name: stremio-web From 097c72bf68f26c9aad1633717ea5242b10d2a16e Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Fri, 17 Jan 2020 15:46:23 +0200 Subject: [PATCH 035/115] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8488ddd68..b2670df80 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,7 +9,7 @@ jobs: steps: - uses: actions/checkout@v1 - name: Build - run: yarn add webpack --dev && yarn build + run: yarn install && yarn build - uses: actions/upload-artifact@v1 with: name: stremio-web From cbc6115d76eef0b28b62517d9e5f783677c2225b Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Fri, 17 Jan 2020 15:48:32 +0200 Subject: [PATCH 036/115] Update build.yml --- .github/workflows/build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b2670df80..078d6457e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,7 +9,9 @@ jobs: steps: - uses: actions/checkout@v1 - name: Build - run: yarn install && yarn build + run: | + echo -e "[url \"https://github.com/\"]\n\tinsteadOf = ssh://git@github.com/" > ~/.gitconfig + yarn build - uses: actions/upload-artifact@v1 with: name: stremio-web From 18f8a19eb0165d1c0448e97e95351de6dd8f712c Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Fri, 17 Jan 2020 15:52:02 +0200 Subject: [PATCH 037/115] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 078d6457e..6a4a324ae 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ jobs: - name: Build run: | echo -e "[url \"https://github.com/\"]\n\tinsteadOf = ssh://git@github.com/" > ~/.gitconfig - yarn build + yarn add webpack --dev && yarn build - uses: actions/upload-artifact@v1 with: name: stremio-web From f184f6c5ce9c223bc9badda7106db1d4ea2ef313 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Fri, 17 Jan 2020 15:55:49 +0200 Subject: [PATCH 038/115] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6a4a324ae..df8e020f5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,4 +15,4 @@ jobs: - uses: actions/upload-artifact@v1 with: name: stremio-web - path: stremio-web/dist + path: dist From 6ee9625a1fbf86d7bb2d4a1c00d0738435172458 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Fri, 17 Jan 2020 16:02:03 +0200 Subject: [PATCH 039/115] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index df8e020f5..993c792b2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ jobs: - name: Build run: | echo -e "[url \"https://github.com/\"]\n\tinsteadOf = ssh://git@github.com/" > ~/.gitconfig - yarn add webpack --dev && yarn build + yarn install && yarn build - uses: actions/upload-artifact@v1 with: name: stremio-web From 5d86053eaafa16f150a20215f31539630077e36f Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Mon, 20 Jan 2020 12:40:56 +0200 Subject: [PATCH 040/115] Update build.yml --- .github/workflows/build.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 993c792b2..0b77d5a71 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,3 +16,23 @@ jobs: with: name: stremio-web path: dist + - name: Create Release + id: create-release + uses: actions/create-release@v1.0.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./stremio-web.zip + asset_name: stremio-web.zip + asset_content_type: application/zip From 26916ff586148370e24a0c527143b201918d1beb Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Mon, 20 Jan 2020 12:44:58 +0200 Subject: [PATCH 041/115] Update build.yml --- .github/workflows/build.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0b77d5a71..b23924195 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,13 +26,3 @@ jobs: release_name: Release ${{ github.ref }} draft: false prerelease: false - - name: Upload Release Asset - id: upload-release-asset - uses: actions/upload-release-asset@v1.0.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./stremio-web.zip - asset_name: stremio-web.zip - asset_content_type: application/zip From 0ff2665bf1b6014050385abd81eac31493fdb022 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Mon, 20 Jan 2020 12:48:54 +0200 Subject: [PATCH 042/115] Update build.yml --- .github/workflows/build.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b23924195..0b77d5a71 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,3 +26,13 @@ jobs: release_name: Release ${{ github.ref }} draft: false prerelease: false + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./stremio-web.zip + asset_name: stremio-web.zip + asset_content_type: application/zip From 637f3d25c36abcbce4841aa85e51ca23c060a08b Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Mon, 20 Jan 2020 12:53:51 +0200 Subject: [PATCH 043/115] Update build.yml --- .github/workflows/build.yml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0b77d5a71..ab695c381 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ jobs: path: dist - name: Create Release id: create-release - uses: actions/create-release@v1.0.0 + uses: actions/create-release@v1.0.1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -26,13 +26,3 @@ jobs: release_name: Release ${{ github.ref }} draft: false prerelease: false - - name: Upload Release Asset - id: upload-release-asset - uses: actions/upload-release-asset@v1.0.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./stremio-web.zip - asset_name: stremio-web.zip - asset_content_type: application/zip From 664a17bada7985150ac63b6bb5c21946ad40bc70 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Mon, 20 Jan 2020 14:45:29 +0200 Subject: [PATCH 044/115] Update build.yml --- .github/workflows/build.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ab695c381..993c792b2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,13 +16,3 @@ jobs: with: name: stremio-web path: dist - - name: Create Release - id: create-release - uses: actions/create-release@v1.0.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: Release ${{ github.ref }} - draft: false - prerelease: false From 00f611fe99a5354f9b69b413a3137bc8a32c780b Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Mon, 20 Jan 2020 15:06:15 +0200 Subject: [PATCH 045/115] Create release.yml --- .github/workflows/release.yml | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..b376f5900 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,42 @@ +name: Build + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - name: Build + run: | + echo -e "[url \"https://github.com/\"]\n\tinsteadOf = ssh://git@github.com/" > ~/.gitconfig + yarn install && yarn build + - uses: actions/upload-artifact@v1 + with: + name: stremio-web + path: dist + - uses: actions/download-artifact@v1 + with: + name: stremio-web + - run: cat stremio-web + - name: Create Release + id: create-release + uses: actions/create-release@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps + asset_path: ./stremio-web.zip + asset_name: stremi-web.zip + asset_content_type: application/zip From e7e415e95f41be7f1502204e569db2c1f2b093e5 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Mon, 20 Jan 2020 15:15:26 +0200 Subject: [PATCH 046/115] Update build.yml --- .github/workflows/build.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 993c792b2..a98c5ed04 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,11 @@ name: Build -on: [push] +on: + push: + branches: + - '*' + tags-ignore: + - '*' jobs: build: From 57515e78f9f2518b61f3da8b3561222be201800a Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Mon, 20 Jan 2020 15:16:54 +0200 Subject: [PATCH 047/115] Update release.yml --- .github/workflows/release.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b376f5900..44af76a3a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,11 @@ -name: Build +name: Release -on: [push] +on: + push: + branches-ignore: + - '*' + tags: + - '*' jobs: build: From b17f0277d707f07058331945bf1431c072d3a1ad Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Mon, 20 Jan 2020 15:20:03 +0200 Subject: [PATCH 048/115] Update release.yml --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 44af76a3a..73f9dc8f1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,7 +41,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps + upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: ./stremio-web.zip asset_name: stremi-web.zip asset_content_type: application/zip From 4a5e13566762cd9c4fbcee13938849be4c187b8b Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Mon, 20 Jan 2020 15:26:28 +0200 Subject: [PATCH 049/115] Update release.yml --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 73f9dc8f1..3b14bcfc7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,7 +27,7 @@ jobs: - run: cat stremio-web - name: Create Release id: create-release - uses: actions/create-release@v1.0.1 + uses: actions/create-release@v1.0.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: From e7bb6677c4e0d5ce3ba56be4ec45aaf81e360dfd Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Mon, 20 Jan 2020 15:56:27 +0200 Subject: [PATCH 050/115] Update release.yml --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3b14bcfc7..004cdd146 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,7 +24,7 @@ jobs: - uses: actions/download-artifact@v1 with: name: stremio-web - - run: cat stremio-web + # - run: cat stremio-web - name: Create Release id: create-release uses: actions/create-release@v1.0.0 From a9526a6d2deeb93c5cba2a93dabb2c2fec34c0fa Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Mon, 20 Jan 2020 16:12:45 +0200 Subject: [PATCH 051/115] Update release.yml --- .github/workflows/release.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 004cdd146..a5cc07f72 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,12 +24,14 @@ jobs: - uses: actions/download-artifact@v1 with: name: stremio-web - # - run: cat stremio-web + - run: ls -l - name: Create Release id: create-release uses: actions/create-release@v1.0.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ACTIONS_RUNNER_DEBUG: true + ACTIONS_STEP_DEBUG: true with: tag_name: ${{ github.ref }} release_name: Release ${{ github.ref }} @@ -43,5 +45,5 @@ jobs: with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: ./stremio-web.zip - asset_name: stremi-web.zip + asset_name: stremio-web.zip asset_content_type: application/zip From 3d17ac5b778d0961cbd91bc18cda737851e3b74a Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Mon, 20 Jan 2020 16:25:40 +0200 Subject: [PATCH 052/115] Update release.yml --- .github/workflows/release.yml | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a5cc07f72..1eed3fd3c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,26 +24,24 @@ jobs: - uses: actions/download-artifact@v1 with: name: stremio-web - - run: ls -l - - name: Create Release - id: create-release - uses: actions/create-release@v1.0.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - ACTIONS_RUNNER_DEBUG: true - ACTIONS_STEP_DEBUG: true - with: - tag_name: ${{ github.ref }} - release_name: Release ${{ github.ref }} - draft: false - prerelease: false + - run: zip -r stremio-web.zip ./stremio-web +# - name: Create Release +# id: create-release +# uses: actions/create-release@v1.0.0 +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# with: +# tag_name: ${{ github.ref }} +# release_name: Release ${{ github.ref }} +# draft: false +# prerelease: false - name: Upload Release Asset id: upload-release-asset uses: actions/upload-release-asset@v1.0.1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - upload_url: ${{ steps.create_release.outputs.upload_url }} + upload_url: https://github.com/Stremio/stremio-web/releases/${{ github.ref }} asset_path: ./stremio-web.zip asset_name: stremio-web.zip asset_content_type: application/zip From 34339849a18cc47c6a1d403eee7706e9835625c9 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Mon, 20 Jan 2020 16:34:11 +0200 Subject: [PATCH 053/115] Update release.yml --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1eed3fd3c..a92ead384 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,7 +41,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - upload_url: https://github.com/Stremio/stremio-web/releases/${{ github.ref }} + upload_url: https://uploads.github.com/repos/Stremio/stremio-web/releases/${{ github.ref }}/assets?name=stremio-web.zip asset_path: ./stremio-web.zip asset_name: stremio-web.zip asset_content_type: application/zip From 0a119efa885fbd81226a928f048b52a184bb4556 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Mon, 20 Jan 2020 16:52:18 +0200 Subject: [PATCH 054/115] Update release.yml --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a92ead384..2133429b8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,7 +41,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - upload_url: https://uploads.github.com/repos/Stremio/stremio-web/releases/${{ github.ref }}/assets?name=stremio-web.zip + upload_url: https://uploads.github.com/repos/Stremio/stremio-web/releases/${{ github.ref }}/assets{?name=stremio-web.zip} asset_path: ./stremio-web.zip asset_name: stremio-web.zip asset_content_type: application/zip From aff88f7b7e998c206af746d06bdf29acabef63b1 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Mon, 20 Jan 2020 16:57:06 +0200 Subject: [PATCH 055/115] Update release.yml --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2133429b8..3c86ad245 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,7 +41,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - upload_url: https://uploads.github.com/repos/Stremio/stremio-web/releases/${{ github.ref }}/assets{?name=stremio-web.zip} + upload_url: https://uploads.github.com/repos/Stremio/stremio-web/releases/${{ github.ref }}/assets{?name,label} asset_path: ./stremio-web.zip asset_name: stremio-web.zip asset_content_type: application/zip From fd740cded4659c88a0781baa1d1c49ed247658fd Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Mon, 20 Jan 2020 17:08:30 +0200 Subject: [PATCH 056/115] Update release.yml --- .github/workflows/release.yml | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3c86ad245..9209dd017 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,23 +25,24 @@ jobs: with: name: stremio-web - run: zip -r stremio-web.zip ./stremio-web -# - name: Create Release -# id: create-release -# uses: actions/create-release@v1.0.0 -# env: -# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -# with: -# tag_name: ${{ github.ref }} -# release_name: Release ${{ github.ref }} -# draft: false -# prerelease: false + - name: Create Release + id: create-release + uses: actions/create-release@v1.0.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }}10 + release_name: Release ${{ github.ref }}10 + draft: false + prerelease: false + - run: echo ${{ steps.create_release.outputs.upload_url }} - name: Upload Release Asset id: upload-release-asset uses: actions/upload-release-asset@v1.0.1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - upload_url: https://uploads.github.com/repos/Stremio/stremio-web/releases/${{ github.ref }}/assets{?name,label} + upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: ./stremio-web.zip asset_name: stremio-web.zip asset_content_type: application/zip From 02832aa430b1e7a594d13922a0c9e596072c20b1 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Mon, 20 Jan 2020 17:19:13 +0200 Subject: [PATCH 057/115] Update release.yml --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9209dd017..1a9dfe5c4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,7 +26,7 @@ jobs: name: stremio-web - run: zip -r stremio-web.zip ./stremio-web - name: Create Release - id: create-release + id: create_release uses: actions/create-release@v1.0.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From dc3c77ed252baeaafd45688e7e278a9597131c24 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Mon, 20 Jan 2020 17:35:20 +0200 Subject: [PATCH 058/115] Update release.yml --- .github/workflows/release.yml | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1a9dfe5c4..0fbdaab95 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,24 +25,25 @@ jobs: with: name: stremio-web - run: zip -r stremio-web.zip ./stremio-web - - name: Create Release - id: create_release - uses: actions/create-release@v1.0.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }}10 - release_name: Release ${{ github.ref }}10 - draft: false - prerelease: false - - run: echo ${{ steps.create_release.outputs.upload_url }} +# - name: Create Release +# id: create_release +# uses: actions/create-release@v1.0.0 +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# with: +# tag_name: ${{ github.ref }}10 +# release_name: Release ${{ github.ref }}10 +# draft: false +# prerelease: false +# - run: echo ${{ steps.create_release.outputs.upload_url }} - name: Upload Release Asset id: upload-release-asset uses: actions/upload-release-asset@v1.0.1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_REF: ${{ github.ref }} with: - upload_url: ${{ steps.create_release.outputs.upload_url }} + upload_url: "https://uploads.github.com/repos/Stremio/stremio-web/releases/$GITHUB_REF/assets{?name,label}" asset_path: ./stremio-web.zip asset_name: stremio-web.zip asset_content_type: application/zip From 84c97887849433fc8ae8dc2aac09383a6015bf8b Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Mon, 20 Jan 2020 17:40:55 +0200 Subject: [PATCH 059/115] Update release.yml --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0fbdaab95..f655e928d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -43,7 +43,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_REF: ${{ github.ref }} with: - upload_url: "https://uploads.github.com/repos/Stremio/stremio-web/releases/$GITHUB_REF/assets{?name,label}" + upload_url: https://uploads.github.com/repos/Stremio/stremio-web/releases/$GITHUB_REF/assets{?name,label} asset_path: ./stremio-web.zip asset_name: stremio-web.zip asset_content_type: application/zip From c894428e0675eee403ac09bed2e9afcde1997c4a Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Tue, 21 Jan 2020 11:01:28 +0200 Subject: [PATCH 060/115] Update release.yml --- .github/workflows/release.yml | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f655e928d..d836253c3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,6 +25,15 @@ jobs: with: name: stremio-web - run: zip -r stremio-web.zip ./stremio-web + - name: Upload binaries to release + uses: svenstaro/upload-release-action@v1-release + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: target/release/stremio-web + asset_name: stremio-web + tag: ${{ github.ref }} + overwrite: true + # - name: Create Release # id: create_release # uses: actions/create-release@v1.0.0 @@ -36,14 +45,14 @@ jobs: # draft: false # prerelease: false # - run: echo ${{ steps.create_release.outputs.upload_url }} - - name: Upload Release Asset - id: upload-release-asset - uses: actions/upload-release-asset@v1.0.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_REF: ${{ github.ref }} - with: - upload_url: https://uploads.github.com/repos/Stremio/stremio-web/releases/$GITHUB_REF/assets{?name,label} - asset_path: ./stremio-web.zip - asset_name: stremio-web.zip - asset_content_type: application/zip +# - name: Upload Release Asset +# id: upload-release-asset +# uses: actions/upload-release-asset@v1.0.1 +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# GITHUB_REF: ${{ github.ref }} +# with: +# upload_url: https://uploads.github.com/repos/Stremio/stremio-web/releases/$GITHUB_REF/assets{?name,label} +# asset_path: ./stremio-web.zip +# asset_name: stremio-web.zip +# asset_content_type: application/zip From 4b51bc8c74bb51e7e72bcb24dbf7d8f115d6f3be Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Tue, 21 Jan 2020 11:07:31 +0200 Subject: [PATCH 061/115] Update release.yml --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d836253c3..841825ed9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,7 +29,7 @@ jobs: uses: svenstaro/upload-release-action@v1-release with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: target/release/stremio-web + file: target/release/stremio-web/stremio-web asset_name: stremio-web tag: ${{ github.ref }} overwrite: true From e02e77be17ed8ab8f94c8d95dd05a0ba7d5e91fc Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Tue, 21 Jan 2020 11:22:06 +0200 Subject: [PATCH 062/115] Update release.yml --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 841825ed9..70bbee5bd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,8 +29,8 @@ jobs: uses: svenstaro/upload-release-action@v1-release with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: target/release/stremio-web/stremio-web - asset_name: stremio-web + file: target/release/stremio-web/stremio-web.zip + asset_name: stremio-web.zip tag: ${{ github.ref }} overwrite: true From ae70958bd5ae46decf1dcbcef39b90fa39b56449 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Tue, 21 Jan 2020 11:22:17 +0200 Subject: [PATCH 063/115] Update release.yml --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 70bbee5bd..7ea5bca76 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,7 +29,7 @@ jobs: uses: svenstaro/upload-release-action@v1-release with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: target/release/stremio-web/stremio-web.zip + file: target/release/stremio-web.zip asset_name: stremio-web.zip tag: ${{ github.ref }} overwrite: true From c40a04ae19b62f5f9cfc03a1f4b5b39f91d461dc Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Tue, 21 Jan 2020 11:27:36 +0200 Subject: [PATCH 064/115] Update release.yml --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7ea5bca76..70bbee5bd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,7 +29,7 @@ jobs: uses: svenstaro/upload-release-action@v1-release with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: target/release/stremio-web.zip + file: target/release/stremio-web/stremio-web.zip asset_name: stremio-web.zip tag: ${{ github.ref }} overwrite: true From 7aee666a0b01ff5fd9aacc6c9a1bb5ee2a15479a Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Tue, 21 Jan 2020 11:31:13 +0200 Subject: [PATCH 065/115] Update release.yml --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 70bbee5bd..f0e02eec1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,7 +29,7 @@ jobs: uses: svenstaro/upload-release-action@v1-release with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: target/release/stremio-web/stremio-web.zip + file: stremio-web.zip asset_name: stremio-web.zip tag: ${{ github.ref }} overwrite: true From 4bf15dd5e01a0d5dac18f2ad1f7b518828064978 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Tue, 21 Jan 2020 11:37:46 +0200 Subject: [PATCH 066/115] Update release.yml --- .github/workflows/release.yml | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f0e02eec1..d42a1a1b0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,29 +30,6 @@ jobs: with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: stremio-web.zip - asset_name: stremio-web.zip + asset_name: stremio-web tag: ${{ github.ref }} overwrite: true - -# - name: Create Release -# id: create_release -# uses: actions/create-release@v1.0.0 -# env: -# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -# with: -# tag_name: ${{ github.ref }}10 -# release_name: Release ${{ github.ref }}10 -# draft: false -# prerelease: false -# - run: echo ${{ steps.create_release.outputs.upload_url }} -# - name: Upload Release Asset -# id: upload-release-asset -# uses: actions/upload-release-asset@v1.0.1 -# env: -# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -# GITHUB_REF: ${{ github.ref }} -# with: -# upload_url: https://uploads.github.com/repos/Stremio/stremio-web/releases/$GITHUB_REF/assets{?name,label} -# asset_path: ./stremio-web.zip -# asset_name: stremio-web.zip -# asset_content_type: application/zip From 935432dcd01d97c85c2b19221225441ebd5e9337 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Tue, 21 Jan 2020 15:58:33 +0200 Subject: [PATCH 067/115] Update release.yml --- .github/workflows/release.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d42a1a1b0..c0389eca8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,10 +17,6 @@ jobs: run: | echo -e "[url \"https://github.com/\"]\n\tinsteadOf = ssh://git@github.com/" > ~/.gitconfig yarn install && yarn build - - uses: actions/upload-artifact@v1 - with: - name: stremio-web - path: dist - uses: actions/download-artifact@v1 with: name: stremio-web From ae6c5a55024fcb5128ea656ae9bbf7f6c3117684 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Tue, 21 Jan 2020 16:05:09 +0200 Subject: [PATCH 068/115] Update release.yml --- .github/workflows/release.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c0389eca8..d42a1a1b0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,6 +17,10 @@ jobs: run: | echo -e "[url \"https://github.com/\"]\n\tinsteadOf = ssh://git@github.com/" > ~/.gitconfig yarn install && yarn build + - uses: actions/upload-artifact@v1 + with: + name: stremio-web + path: dist - uses: actions/download-artifact@v1 with: name: stremio-web From adadfb9e1024aff60f9e8fc650d089ba028f6a69 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Tue, 21 Jan 2020 17:20:37 +0200 Subject: [PATCH 069/115] Update release.yml --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d42a1a1b0..573d69d95 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,7 +16,7 @@ jobs: - name: Build run: | echo -e "[url \"https://github.com/\"]\n\tinsteadOf = ssh://git@github.com/" > ~/.gitconfig - yarn install && yarn build + yarn install && yarn build && yarn test - uses: actions/upload-artifact@v1 with: name: stremio-web From 8f53b226f6740d069c3bc8a05375105f281b03d0 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Tue, 21 Jan 2020 17:20:53 +0200 Subject: [PATCH 070/115] Update release.yml --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 573d69d95..d42a1a1b0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,7 +16,7 @@ jobs: - name: Build run: | echo -e "[url \"https://github.com/\"]\n\tinsteadOf = ssh://git@github.com/" > ~/.gitconfig - yarn install && yarn build && yarn test + yarn install && yarn build - uses: actions/upload-artifact@v1 with: name: stremio-web From fcec63cd22dfc760a76865e17caec264d38d0646 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Tue, 21 Jan 2020 17:21:22 +0200 Subject: [PATCH 071/115] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a98c5ed04..117f9eb91 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,7 @@ jobs: - name: Build run: | echo -e "[url \"https://github.com/\"]\n\tinsteadOf = ssh://git@github.com/" > ~/.gitconfig - yarn install && yarn build + yarn install && yarn build && yarn test - uses: actions/upload-artifact@v1 with: name: stremio-web From 539df0f834f208237055853100d2db87689d89b7 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Wed, 22 Jan 2020 11:54:09 +0200 Subject: [PATCH 072/115] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 117f9eb91..a98c5ed04 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,7 @@ jobs: - name: Build run: | echo -e "[url \"https://github.com/\"]\n\tinsteadOf = ssh://git@github.com/" > ~/.gitconfig - yarn install && yarn build && yarn test + yarn install && yarn build - uses: actions/upload-artifact@v1 with: name: stremio-web From 9beefbb982ae0f889980daa3743164f14e2d058c Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Wed, 22 Jan 2020 12:04:47 +0200 Subject: [PATCH 073/115] Create test.yml --- .github/workflows/test.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..24508e55d --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,20 @@ +name: Test + +on: + push: + branches: + - '*' + tags-ignore: + - '*' + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - name: Test + run: | + echo -e "[url \"https://github.com/\"]\n\tinsteadOf = ssh://git@github.com/" > ~/.gitconfig + yarn install && yarn test + From 036f6d3092fe92814c99e8ff250eaadc393dc7a7 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Wed, 22 Jan 2020 12:10:28 +0200 Subject: [PATCH 074/115] Update release.yml --- .github/workflows/release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d42a1a1b0..2d456b4b9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,9 +21,9 @@ jobs: with: name: stremio-web path: dist - - uses: actions/download-artifact@v1 - with: - name: stremio-web +# - uses: actions/download-artifact@v1 +# with: +# name: stremio-web - run: zip -r stremio-web.zip ./stremio-web - name: Upload binaries to release uses: svenstaro/upload-release-action@v1-release From dd5d4e3407c188698ba87dbe3aec17dbe48e9a41 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Wed, 22 Jan 2020 12:26:48 +0200 Subject: [PATCH 075/115] Update release.yml --- .github/workflows/release.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2d456b4b9..ebc79d457 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,14 +17,14 @@ jobs: run: | echo -e "[url \"https://github.com/\"]\n\tinsteadOf = ssh://git@github.com/" > ~/.gitconfig yarn install && yarn build - - uses: actions/upload-artifact@v1 - with: - name: stremio-web - path: dist +# - uses: actions/upload-artifact@v1 +# with: +# name: stremio-web +# path: dist # - uses: actions/download-artifact@v1 # with: # name: stremio-web - - run: zip -r stremio-web.zip ./stremio-web + - run: zip -r stremio-web.zip ./dist - name: Upload binaries to release uses: svenstaro/upload-release-action@v1-release with: From a2b5e1df57cc5a583945a3ddede745e097d35ca6 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Wed, 22 Jan 2020 12:32:14 +0200 Subject: [PATCH 076/115] Update release.yml --- .github/workflows/release.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ebc79d457..acf50fb7b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,13 +17,6 @@ jobs: run: | echo -e "[url \"https://github.com/\"]\n\tinsteadOf = ssh://git@github.com/" > ~/.gitconfig yarn install && yarn build -# - uses: actions/upload-artifact@v1 -# with: -# name: stremio-web -# path: dist -# - uses: actions/download-artifact@v1 -# with: -# name: stremio-web - run: zip -r stremio-web.zip ./dist - name: Upload binaries to release uses: svenstaro/upload-release-action@v1-release From a4e263000b17593f52843d2113458d569071227e Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Wed, 22 Jan 2020 14:20:25 +0200 Subject: [PATCH 077/115] Update release.yml --- .github/workflows/release.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index acf50fb7b..0d04f2945 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,3 +26,9 @@ jobs: asset_name: stremio-web tag: ${{ github.ref }} overwrite: true + - run: | + curl -H "Content-Type: application/zip" \ + -H "Authorization: Bearer ${{ secrets.netlify_access_token }}" \ + --data-binary "@stremio-web.zip" \ + https://api.netlify.com/api/v1/sites/mysite.netlify.com/deploys + From 277ac5450f71ad38a7899dfebfa0e38fa843d685 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Wed, 22 Jan 2020 14:32:01 +0200 Subject: [PATCH 078/115] Update release.yml --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0d04f2945..9ba7c4070 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,5 +30,5 @@ jobs: curl -H "Content-Type: application/zip" \ -H "Authorization: Bearer ${{ secrets.netlify_access_token }}" \ --data-binary "@stremio-web.zip" \ - https://api.netlify.com/api/v1/sites/mysite.netlify.com/deploys + https://api.netlify.com/api/v1/sites/stremio-web.netlify.com/deploys From 952bd827c824471a74fff7a4c0f0963ff04ec510 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Wed, 22 Jan 2020 14:38:47 +0200 Subject: [PATCH 079/115] Update release.yml --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9ba7c4070..293ea97e4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,7 +23,7 @@ jobs: with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: stremio-web.zip - asset_name: stremio-web + asset_name: stremio-web.zip tag: ${{ github.ref }} overwrite: true - run: | From ae27944076471dfb6627474874a34b27f87f01b4 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Wed, 22 Jan 2020 14:55:18 +0200 Subject: [PATCH 080/115] Update release.yml --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 293ea97e4..1f20e83dc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,5 +30,5 @@ jobs: curl -H "Content-Type: application/zip" \ -H "Authorization: Bearer ${{ secrets.netlify_access_token }}" \ --data-binary "@stremio-web.zip" \ - https://api.netlify.com/api/v1/sites/stremio-web.netlify.com/deploys + https://api.netlify.com/api/v1/sites/practical-kepler-5c9c19.netlify.com/deploys From fdfdf056c8d5b966c8717f79f864a195a49c23e3 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Wed, 22 Jan 2020 16:27:31 +0200 Subject: [PATCH 081/115] dist renamed to build --- .github/workflows/build.yml | 2 +- .github/workflows/release.yml | 2 +- .gitignore | 2 +- package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a98c5ed04..bbd3d62ca 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,4 +20,4 @@ jobs: - uses: actions/upload-artifact@v1 with: name: stremio-web - path: dist + path: build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1f20e83dc..23e32b9ad 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,7 +17,7 @@ jobs: run: | echo -e "[url \"https://github.com/\"]\n\tinsteadOf = ssh://git@github.com/" > ~/.gitconfig yarn install && yarn build - - run: zip -r stremio-web.zip ./dist + - run: zip -r stremio-web.zip ./build - name: Upload binaries to release uses: svenstaro/upload-release-action@v1-release with: diff --git a/.gitignore b/.gitignore index 6a44f9718..cfc12513d 100755 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ /node_modules -/dist +/build /package-lock.json /npm-debug.log .DS_Store diff --git a/package.json b/package.json index 53d6f78c6..b4ddb06cf 100755 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "license": "GPLv3", "scripts": { "start": "webpack-dev-server --mode development", - "build": "webpack --mode production", + "build": "webpack --mode production --output-path build", "storybook": "start-storybook --ci --config-dir ./storybook --static-dir ./ --port 6060", "test": "jest", "lint": "eslint src" From 12f71ecec07e7cda5b36c61a538d0f20ece2c846 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Wed, 22 Jan 2020 16:44:32 +0200 Subject: [PATCH 082/115] Update build.yml --- .github/workflows/build.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bbd3d62ca..dcbf7c81b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,9 +14,7 @@ jobs: steps: - uses: actions/checkout@v1 - name: Build - run: | - echo -e "[url \"https://github.com/\"]\n\tinsteadOf = ssh://git@github.com/" > ~/.gitconfig - yarn install && yarn build + run: yarn install && yarn build - uses: actions/upload-artifact@v1 with: name: stremio-web From 5e7475a76cd0ec7931f0b01935274b84f581e090 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Wed, 22 Jan 2020 16:45:00 +0200 Subject: [PATCH 083/115] Update test.yml --- .github/workflows/test.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 24508e55d..abac07105 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,7 +14,5 @@ jobs: steps: - uses: actions/checkout@v1 - name: Test - run: | - echo -e "[url \"https://github.com/\"]\n\tinsteadOf = ssh://git@github.com/" > ~/.gitconfig - yarn install && yarn test + run: yarn install && yarn test From 7a82df47921cf31835def0c01570a57cad3eaa05 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Wed, 22 Jan 2020 16:48:26 +0200 Subject: [PATCH 084/115] Update build.yml --- .github/workflows/build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dcbf7c81b..bbd3d62ca 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,9 @@ jobs: steps: - uses: actions/checkout@v1 - name: Build - run: yarn install && yarn build + run: | + echo -e "[url \"https://github.com/\"]\n\tinsteadOf = ssh://git@github.com/" > ~/.gitconfig + yarn install && yarn build - uses: actions/upload-artifact@v1 with: name: stremio-web From 8cf5650dbea8454131a57537a228e080a654210f Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Wed, 22 Jan 2020 16:49:03 +0200 Subject: [PATCH 085/115] Update test.yml --- .github/workflows/test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index abac07105..24508e55d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,5 +14,7 @@ jobs: steps: - uses: actions/checkout@v1 - name: Test - run: yarn install && yarn test + run: | + echo -e "[url \"https://github.com/\"]\n\tinsteadOf = ssh://git@github.com/" > ~/.gitconfig + yarn install && yarn test From f47ccfdc83c14eac2853cd17348cc7123e3b2855 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Thu, 23 Jan 2020 16:09:43 +0200 Subject: [PATCH 086/115] output path moved to webpack config --- package.json | 2 +- webpack.config.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index b4ddb06cf..53d6f78c6 100755 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "license": "GPLv3", "scripts": { "start": "webpack-dev-server --mode development", - "build": "webpack --mode production --output-path build", + "build": "webpack --mode production", "storybook": "start-storybook --ci --config-dir ./storybook --static-dir ./ --port 6060", "test": "jest", "lint": "eslint src" diff --git a/webpack.config.js b/webpack.config.js index 466f5cc30..a9c28c840 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -8,6 +8,9 @@ const TerserPlugin = require('terser-webpack-plugin'); module.exports = { entry: './src/index.js', + output: { + path: path.join(__dirname, 'build') + }, module: { rules: [ { From ba51eaa879af5b9665b4a7eb4040981027a4e942 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Fri, 24 Jan 2020 11:35:14 +0200 Subject: [PATCH 087/115] sentry added --- package.json | 1 + src/index.js | 3 +++ yarn.lock | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+) diff --git a/package.json b/package.json index 53d6f78c6..a6e4132e2 100755 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "lint": "eslint src" }, "dependencies": { + "@sentry/browser": "^5.11.1", "a-color-picker": "1.2.1", "classnames": "2.2.6", "events": "1.1.1", diff --git a/src/index.js b/src/index.js index a4c6e3704..cd359aba8 100755 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,8 @@ const React = require('react'); const ReactDOM = require('react-dom'); +const Sentry = require('@sentry/browser'); const App = require('./App'); +Sentry.init({dsn: "https://e47a6d214ae4478b81136c29612003a7@sentry.io/1911455"}); + ReactDOM.render(, document.getElementById('app')); diff --git a/yarn.lock b/yarn.lock index 6ed5ab0f5..fda1848f7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1240,6 +1240,58 @@ react-lifecycles-compat "^3.0.4" warning "^3.0.0" +"@sentry/browser@^5.11.1": + version "5.11.1" + resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-5.11.1.tgz#337ffcb52711b23064c847a07629e966f54a5ebb" + integrity sha512-oqOX/otmuP92DEGRyZeBuQokXdeT9HQRxH73oqIURXXNLMP3PWJALSb4HtT4AftEt/2ROGobZLuA4TaID6My/Q== + dependencies: + "@sentry/core" "5.11.1" + "@sentry/types" "5.11.0" + "@sentry/utils" "5.11.1" + tslib "^1.9.3" + +"@sentry/core@5.11.1": + version "5.11.1" + resolved "https://registry.yarnpkg.com/@sentry/core/-/core-5.11.1.tgz#9e2da485e196ae32971545c1c49ee6fe719930e2" + integrity sha512-BpvPosVNT20Xso4gAV54Lu3KqDmD20vO63HYwbNdST5LUi8oYV4JhvOkoBraPEM2cbBwQvwVcFdeEYKk4tin9A== + dependencies: + "@sentry/hub" "5.11.1" + "@sentry/minimal" "5.11.1" + "@sentry/types" "5.11.0" + "@sentry/utils" "5.11.1" + tslib "^1.9.3" + +"@sentry/hub@5.11.1": + version "5.11.1" + resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-5.11.1.tgz#ddcb865563fae53852d405885c46b4c6de68a91b" + integrity sha512-ucKprYCbGGLLjVz4hWUqHN9KH0WKUkGf5ZYfD8LUhksuobRkYVyig0ZGbshECZxW5jcDTzip4Q9Qimq/PkkXBg== + dependencies: + "@sentry/types" "5.11.0" + "@sentry/utils" "5.11.1" + tslib "^1.9.3" + +"@sentry/minimal@5.11.1": + version "5.11.1" + resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-5.11.1.tgz#0e705d01a567282d8fbbda2aed848b4974cc3cec" + integrity sha512-HK8zs7Pgdq7DsbZQTThrhQPrJsVWzz7MaluAbQA0rTIAJ3TvHKQpsVRu17xDpjZXypqWcKCRsthDrC4LxDM1Bg== + dependencies: + "@sentry/hub" "5.11.1" + "@sentry/types" "5.11.0" + tslib "^1.9.3" + +"@sentry/types@5.11.0": + version "5.11.0" + resolved "https://registry.yarnpkg.com/@sentry/types/-/types-5.11.0.tgz#40f0f3174362928e033ddd9725d55e7c5cb7c5b6" + integrity sha512-1Uhycpmeo1ZK2GLvrtwZhTwIodJHcyIS6bn+t4IMkN9MFoo6ktbAfhvexBDW/IDtdLlCGJbfm8nIZerxy0QUpg== + +"@sentry/utils@5.11.1": + version "5.11.1" + resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-5.11.1.tgz#aa19fcc234cf632257b2281261651d2fac967607" + integrity sha512-O0Zl4R2JJh8cTkQ8ZL2cDqGCmQdpA5VeXpuBbEl1v78LQPkBDISi35wH4mKmLwMsLBtTVpx2UeUHBj0KO5aLlA== + dependencies: + "@sentry/types" "5.11.0" + tslib "^1.9.3" + "@sheerun/mutationobserver-shim@^0.3.2": version "0.3.2" resolved "https://registry.yarnpkg.com/@sheerun/mutationobserver-shim/-/mutationobserver-shim-0.3.2.tgz#8013f2af54a2b7d735f71560ff360d3a8176a87b" From ab75849e6c7b96ed40afc69bc10dcbf7ea6065e7 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Fri, 24 Jan 2020 15:12:49 +0200 Subject: [PATCH 088/115] sentry dsn exported from package.json --- package.json | 5 ++++- src/index.js | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index a6e4132e2..17f7cebb5 100755 --- a/package.json +++ b/package.json @@ -6,6 +6,9 @@ "website": "www.stremio.com", "private": true, "license": "GPLv3", + "Sentry": { + "dsn": "https://e47a6d214ae4478b81136c29612003a7@sentry.io/1911455" + }, "scripts": { "start": "webpack-dev-server --mode development", "build": "webpack --mode production", @@ -14,7 +17,7 @@ "lint": "eslint src" }, "dependencies": { - "@sentry/browser": "^5.11.1", + "@sentry/browser": "5.11.1", "a-color-picker": "1.2.1", "classnames": "2.2.6", "events": "1.1.1", diff --git a/src/index.js b/src/index.js index cd359aba8..90d24e87f 100755 --- a/src/index.js +++ b/src/index.js @@ -1,8 +1,9 @@ const React = require('react'); const ReactDOM = require('react-dom'); const Sentry = require('@sentry/browser'); +const Package = require('../package'); const App = require('./App'); -Sentry.init({dsn: "https://e47a6d214ae4478b81136c29612003a7@sentry.io/1911455"}); +Sentry.init({ dsn: Package.Sentry.dsn }); ReactDOM.render(, document.getElementById('app')); From b14ccaae5197dbcb93c8c3f0e5e029881cffa0aa Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Tue, 28 Jan 2020 11:31:40 +0200 Subject: [PATCH 089/115] addon not installed warning implemented --- src/routes/Discover/Discover.js | 26 +++++++++++++++++++++- src/routes/Discover/styles.less | 38 +++++++++++++++++++++++++++++++-- 2 files changed, 61 insertions(+), 3 deletions(-) diff --git a/src/routes/Discover/Discover.js b/src/routes/Discover/Discover.js index e2c1f7426..4ad6181a2 100644 --- a/src/routes/Discover/Discover.js +++ b/src/routes/Discover/Discover.js @@ -2,7 +2,8 @@ const React = require('react'); const PropTypes = require('prop-types'); const classnames = require('classnames'); const Icon = require('stremio-icons/dom'); -const { Button, MainNavBar, MetaItem, MetaPreview, Multiselect, ModalDialog, PaginationInput, useBinaryState } = require('stremio/common'); +const { AddonDetailsModal, Button, MainNavBar, MetaItem, MetaPreview, Multiselect, ModalDialog, PaginationInput, useBinaryState } = require('stremio/common'); +const { useServices } = require('stremio/services'); const useDiscover = require('./useDiscover'); const useSelectableInputs = require('./useSelectableInputs'); const styles = require('./styles'); @@ -19,9 +20,12 @@ const getMetaItemAtIndex = (catalog_resource, index) => { }; const Discover = ({ urlParams, queryParams }) => { + const { core } = useServices(); + const state = core.getState(); const discover = useDiscover(urlParams, queryParams); const [selectInputs, paginationInput] = useSelectableInputs(discover); const [inputsModalOpen, openInputsModal, closeInputsModal] = useBinaryState(false); + const [onInstallButtonClicked, openAddonModal, closeAddonModal] = useBinaryState(false); const [selectedMetaItem, setSelectedMetaItem] = React.useState(() => { return getMetaItemAtIndex(discover.catalog_resource, 0); }); @@ -69,6 +73,17 @@ const Discover = ({ urlParams, queryParams }) => { null }
+ { + discover.catalog_resource != null && !state.ctx.content.addons.some((addon) => addon.transportUrl === discover.catalog_resource.request.base) ? +
+
This addon is not installed. Install now?
+ +
+ : + null + }
{ discover.selectable.types.length === 0 && discover.catalog_resource === null ? @@ -132,6 +147,15 @@ const Discover = ({ urlParams, queryParams }) => { : null } + { + onInstallButtonClicked ? + + : + null + }
); }; diff --git a/src/routes/Discover/styles.less b/src/routes/Discover/styles.less index b2ddb748d..75532344c 100644 --- a/src/routes/Discover/styles.less +++ b/src/routes/Discover/styles.less @@ -27,9 +27,10 @@ align-self: stretch; display: grid; grid-template-columns: 1fr 28rem; - grid-template-rows: auto 1fr; + grid-template-rows: auto auto 1fr; grid-template-areas: "selectable-inputs-area meta-preview-area" + "warning meta-preview-area" "catalog-content-area meta-preview-area"; .selectable-inputs-container { @@ -102,6 +103,38 @@ } } + .warning-container { + grid-area: warning; + display: flex; + flex-direction: column; + align-items: center; + padding: 0 1.5rem 1.5rem 1.5rem; + + .warning-info { + margin-bottom: 1rem; + font-size: 1.2rem; + color: var(--color-surfacelighter); + } + + .install-button { + display: flex; + flex-direction: row; + align-items: center; + justify-content: center; + width: 10rem; + padding: 1rem; + background-color: var(--color-signal5); + + &:hover { + filter: brightness(1.2); + } + + .label { + color: var(--color-surfacelighter); + } + } + } + .catalog-content-container { grid-area: catalog-content-area; @@ -203,9 +236,10 @@ .discover-container { .discover-content { grid-template-columns: 1fr; - grid-template-rows: auto 1fr; + grid-template-rows: auto auto 1fr; grid-template-areas: "selectable-inputs-area" + "warning" "catalog-content-area"; .catalog-content-container { From a8d537c305182d56b79799801fa946b9c43eeb35 Mon Sep 17 00:00:00 2001 From: svetlagasheva Date: Tue, 28 Jan 2020 11:34:43 +0200 Subject: [PATCH 090/115] onInstallButtonClicked renamed to addonModalOpen --- src/routes/Discover/Discover.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routes/Discover/Discover.js b/src/routes/Discover/Discover.js index 4ad6181a2..76bfbfe5d 100644 --- a/src/routes/Discover/Discover.js +++ b/src/routes/Discover/Discover.js @@ -25,7 +25,7 @@ const Discover = ({ urlParams, queryParams }) => { const discover = useDiscover(urlParams, queryParams); const [selectInputs, paginationInput] = useSelectableInputs(discover); const [inputsModalOpen, openInputsModal, closeInputsModal] = useBinaryState(false); - const [onInstallButtonClicked, openAddonModal, closeAddonModal] = useBinaryState(false); + const [addonModalOpen, openAddonModal, closeAddonModal] = useBinaryState(false); const [selectedMetaItem, setSelectedMetaItem] = React.useState(() => { return getMetaItemAtIndex(discover.catalog_resource, 0); }); @@ -148,7 +148,7 @@ const Discover = ({ urlParams, queryParams }) => { null } { - onInstallButtonClicked ? + addonModalOpen ? Date: Tue, 28 Jan 2020 12:37:29 +0200 Subject: [PATCH 091/115] warning-container remaned to missing-addon-warning-container --- src/routes/Discover/Discover.js | 2 +- src/routes/Discover/styles.less | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/routes/Discover/Discover.js b/src/routes/Discover/Discover.js index 76bfbfe5d..d314c2d68 100644 --- a/src/routes/Discover/Discover.js +++ b/src/routes/Discover/Discover.js @@ -75,7 +75,7 @@ const Discover = ({ urlParams, queryParams }) => {
{ discover.catalog_resource != null && !state.ctx.content.addons.some((addon) => addon.transportUrl === discover.catalog_resource.request.base) ? -
+
This addon is not installed. Install now?
- : - null - } -
+ + ); }; Toast.propTypes = { - type: PropTypes.string, + type: PropTypes.oneOf(['success', 'alert', 'error']), title: PropTypes.string, - text: PropTypes.string, + message: PropTypes.string, icon: PropTypes.string, - closeButton: PropTypes.bool, - onClick: PropTypes.func, + dataset: PropTypes.objectOf(PropTypes.string), + onSelect: PropTypes.func, onClose: PropTypes.func }; diff --git a/src/common/Toasts/Toast/index.js b/src/common/Toasts/Toast/index.js index efe31724b..37050e200 100644 --- a/src/common/Toasts/Toast/index.js +++ b/src/common/Toasts/Toast/index.js @@ -1,3 +1,3 @@ const Toast = require('./Toast'); -module.exports = Toast; \ No newline at end of file +module.exports = Toast; diff --git a/src/common/Toasts/Toast/styles.less b/src/common/Toasts/Toast/styles.less index 6bb5c6399..41ff0ca39 100644 --- a/src/common/Toasts/Toast/styles.less +++ b/src/common/Toasts/Toast/styles.less @@ -2,13 +2,14 @@ display: flex; flex-direction: row; min-height: 6rem; + max-width: 25rem; margin-bottom: 1rem; border: thin solid; - color: var(--color-backgrounddarker); - fill: var(--color-backgrounddarker); background-color: var(--color-surfacelighter); overflow: visible; - pointer-events: all; + box-shadow: 0 0.3rem 0.5rem var(--color-backgrounddarker40), + 0 0.6rem 1rem var(--color-backgrounddarker20); + pointer-events: auto; &.success { color: var(--color-signal5); @@ -26,10 +27,10 @@ } .icon-container { - width: 5rem; - padding: 1rem; - padding-right: 0; - overflow: visible; + flex: none; + align-self: stretch; + width: 4.5rem; + padding: 1.2rem 0 1.2rem 1.2rem; .icon { display: block; @@ -38,33 +39,35 @@ } } - .message-container { + .info-container { flex: 1; + align-self: stretch; padding: 1rem; - &.clickable { - cursor: pointer; + .title-container { + font-size: 1.2rem; } - .message-caption { - font-weight: bold; + .message-container { + font-size: 1.1rem; } } .close-button-container { flex: none; + align-self: flex-start; width: 3rem; height: 3rem; padding: 1rem; + &:hover { + background-color: var(--color-surfacelight); + } + .icon { display: block; width: 100%; height: 100%; } - - &:hover { - background-color: var(--color-surfacelight); - } } } \ No newline at end of file From 3bbcceb949687c745b7462b13a1369a85270fc82 Mon Sep 17 00:00:00 2001 From: nklhrstv Date: Sat, 1 Feb 2020 00:39:44 +0200 Subject: [PATCH 103/115] toast item shadow fixed --- src/App/styles.less | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/App/styles.less b/src/App/styles.less index 0c89fe3e2..8844fde5e 100644 --- a/src/App/styles.less +++ b/src/App/styles.less @@ -75,10 +75,11 @@ html { .toasts-container { position: absolute; top: calc(1.2 * var(--nav-bar-size)); - right: var(--nav-bar-size); + right: 0; bottom: calc(1.2 * var(--nav-bar-size)); left: auto; - z-index: 0; + z-index: 1; + padding: 0 calc(1.2 * var(--nav-bar-size)); overflow-y: auto; scrollbar-width: none; pointer-events: none; From 0b7aa5068ab624babc7b5dbce8d67743c855baeb Mon Sep 17 00:00:00 2001 From: nklhrstv Date: Sat, 1 Feb 2020 10:03:04 +0200 Subject: [PATCH 104/115] dataset prop type changed --- src/common/ColorInput/ColorInput.js | 2 +- src/common/MetaItem/MetaItem.js | 2 +- src/common/ModalDialog/ModalDialog.js | 2 +- src/common/Multiselect/Multiselect.js | 2 +- src/common/PaginationInput/PaginationInput.js | 2 +- src/common/Popup/Popup.js | 2 +- src/routes/Addons/Addon/Addon.js | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/common/ColorInput/ColorInput.js b/src/common/ColorInput/ColorInput.js index 7e846a4a8..d64d8938e 100644 --- a/src/common/ColorInput/ColorInput.js +++ b/src/common/ColorInput/ColorInput.js @@ -77,7 +77,7 @@ const ColorInput = ({ className, value, dataset, onChange, ...props }) => { ColorInput.propTypes = { className: PropTypes.string, value: PropTypes.string, - dataset: PropTypes.objectOf(PropTypes.string), + dataset: PropTypes.object, onChange: PropTypes.func, onClick: PropTypes.func }; diff --git a/src/common/MetaItem/MetaItem.js b/src/common/MetaItem/MetaItem.js index 4d4f6cb1f..ffd75a754 100644 --- a/src/common/MetaItem/MetaItem.js +++ b/src/common/MetaItem/MetaItem.js @@ -121,7 +121,7 @@ MetaItem.propTypes = { playIcon: PropTypes.bool, progress: PropTypes.number, options: PropTypes.array, - dataset: PropTypes.objectOf(PropTypes.string), + dataset: PropTypes.object, optionOnSelect: PropTypes.func, onClick: PropTypes.func }; diff --git a/src/common/ModalDialog/ModalDialog.js b/src/common/ModalDialog/ModalDialog.js index abb594c09..441907f10 100644 --- a/src/common/ModalDialog/ModalDialog.js +++ b/src/common/ModalDialog/ModalDialog.js @@ -112,7 +112,7 @@ ModalDialog.propTypes = { PropTypes.arrayOf(PropTypes.node), PropTypes.node ]), - dataset: PropTypes.objectOf(PropTypes.string), + dataset: PropTypes.object, onCloseRequest: PropTypes.func }; diff --git a/src/common/Multiselect/Multiselect.js b/src/common/Multiselect/Multiselect.js index ff7b11eda..0ac42c2d1 100644 --- a/src/common/Multiselect/Multiselect.js +++ b/src/common/Multiselect/Multiselect.js @@ -143,7 +143,7 @@ Multiselect.propTypes = { })), selected: PropTypes.arrayOf(PropTypes.string), disabled: PropTypes.bool, - dataset: PropTypes.objectOf(PropTypes.string), + dataset: PropTypes.object, renderLabelContent: PropTypes.func, renderLabelText: PropTypes.func, onOpen: PropTypes.func, diff --git a/src/common/PaginationInput/PaginationInput.js b/src/common/PaginationInput/PaginationInput.js index 7358c55c7..dd5029117 100644 --- a/src/common/PaginationInput/PaginationInput.js +++ b/src/common/PaginationInput/PaginationInput.js @@ -35,7 +35,7 @@ const PaginationInput = ({ className, label, dataset, onSelect, ...props }) => { PaginationInput.propTypes = { className: PropTypes.string, label: PropTypes.string, - dataset: PropTypes.objectOf(PropTypes.string), + dataset: PropTypes.object, onSelect: PropTypes.func }; diff --git a/src/common/Popup/Popup.js b/src/common/Popup/Popup.js index 59b89f26e..1df4192b4 100644 --- a/src/common/Popup/Popup.js +++ b/src/common/Popup/Popup.js @@ -103,7 +103,7 @@ Popup.propTypes = { direction: PropTypes.oneOf(['top-left', 'bottom-left', 'top-right', 'bottom-right']), renderLabel: PropTypes.func.isRequired, renderMenu: PropTypes.func.isRequired, - dataset: PropTypes.objectOf(PropTypes.string), + dataset: PropTypes.object, onCloseRequest: PropTypes.func }; diff --git a/src/routes/Addons/Addon/Addon.js b/src/routes/Addons/Addon/Addon.js index d646ed2b9..3c97cd1bb 100644 --- a/src/routes/Addons/Addon/Addon.js +++ b/src/routes/Addons/Addon/Addon.js @@ -105,7 +105,7 @@ Addon.propTypes = { installed: PropTypes.bool, onToggle: PropTypes.func, onShare: PropTypes.func, - dataset: PropTypes.objectOf(PropTypes.string) + dataset: PropTypes.object }; module.exports = Addon; From 56ebd9dafcf8b8417abd5948cd8f035ce8c565c2 Mon Sep 17 00:00:00 2001 From: nklhrstv Date: Sat, 1 Feb 2020 10:46:00 +0200 Subject: [PATCH 105/115] Toast refactored to not use modals context --- src/App/App.js | 6 +- src/common/Toast/ToastContext.js | 10 +++ .../Toast.js => Toast/ToastItem/ToastItem.js} | 17 +++-- src/common/Toast/ToastItem/index.js | 3 + .../Toast => Toast/ToastItem}/styles.less | 4 +- src/common/Toast/ToastProvider.js | 72 +++++++++++++++++++ src/common/Toast/index.js | 7 ++ src/common/Toast/useToast.js | 8 +++ src/common/Toasts/Toast/index.js | 3 - src/common/Toasts/Toasts.js | 57 --------------- .../ToastsContainerContext.js | 7 -- .../ToastsContainerProvider.js | 20 ------ .../Toasts/ToastsContainerContext/index.js | 7 -- .../useToastsContainer.js | 8 --- src/common/Toasts/index.js | 3 - src/common/index.js | 5 +- 16 files changed, 119 insertions(+), 118 deletions(-) create mode 100644 src/common/Toast/ToastContext.js rename src/common/{Toasts/Toast/Toast.js => Toast/ToastItem/ToastItem.js} (78%) create mode 100644 src/common/Toast/ToastItem/index.js rename src/common/{Toasts/Toast => Toast/ToastItem}/styles.less (97%) create mode 100644 src/common/Toast/ToastProvider.js create mode 100644 src/common/Toast/index.js create mode 100644 src/common/Toast/useToast.js delete mode 100644 src/common/Toasts/Toast/index.js delete mode 100644 src/common/Toasts/Toasts.js delete mode 100644 src/common/Toasts/ToastsContainerContext/ToastsContainerContext.js delete mode 100644 src/common/Toasts/ToastsContainerContext/ToastsContainerProvider.js delete mode 100644 src/common/Toasts/ToastsContainerContext/index.js delete mode 100644 src/common/Toasts/ToastsContainerContext/useToastsContainer.js delete mode 100644 src/common/Toasts/index.js diff --git a/src/App/App.js b/src/App/App.js index 82b12d898..c7d23c300 100644 --- a/src/App/App.js +++ b/src/App/App.js @@ -2,7 +2,7 @@ require('spatial-navigation-polyfill'); const React = require('react'); const { Router } = require('stremio-router'); const { Core, KeyboardNavigation, ServicesProvider, Shell } = require('stremio/services'); -const { Toasts } = require('stremio/common'); +const { ToastProvider } = require('stremio/common'); const routerViewsConfig = require('./routerViewsConfig'); const styles = require('./styles'); @@ -51,14 +51,14 @@ const App = () => { { shellInitialized && coreInitialized ? - + - + :
} diff --git a/src/common/Toast/ToastContext.js b/src/common/Toast/ToastContext.js new file mode 100644 index 000000000..7418affbd --- /dev/null +++ b/src/common/Toast/ToastContext.js @@ -0,0 +1,10 @@ +const React = require('react'); + +const ToastContext = React.createContext({ + show: () => { }, + clear: () => { } +}); + +ToastContext.displayName = 'ToastContext'; + +module.exports = ToastContext; diff --git a/src/common/Toasts/Toast/Toast.js b/src/common/Toast/ToastItem/ToastItem.js similarity index 78% rename from src/common/Toasts/Toast/Toast.js rename to src/common/Toast/ToastItem/ToastItem.js index 8b4470c02..04ddbebe6 100644 --- a/src/common/Toasts/Toast/Toast.js +++ b/src/common/Toast/ToastItem/ToastItem.js @@ -5,7 +5,7 @@ const Icon = require('stremio-icons/dom'); const Button = require('stremio/common/Button'); const styles = require('./styles'); -const Toast = ({ type, title, message, icon, dataset, onSelect, onClose }) => { +const ToastItem = ({ type, title, message, icon, dataset, onSelect, onClose }) => { const toastOnClick = React.useCallback((event) => { if (!event.nativeEvent.selectPrevented && typeof onSelect === 'function') { onSelect({ @@ -28,7 +28,7 @@ const Toast = ({ type, title, message, icon, dataset, onSelect, onClose }) => { } }, [dataset, onClose]); return ( -
From 5600659a567344ec855019f58d75f8aff39c0ff2 Mon Sep 17 00:00:00 2001 From: nklhrstv Date: Tue, 4 Feb 2020 14:47:48 +0200 Subject: [PATCH 112/115] facebook statement removed --- src/routes/Intro/Intro.js | 1 - src/routes/Intro/styles.less | 8 +------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/routes/Intro/Intro.js b/src/routes/Intro/Intro.js index 4e4be4482..223294e12 100644 --- a/src/routes/Intro/Intro.js +++ b/src/routes/Intro/Intro.js @@ -257,7 +257,6 @@ const Intro = ({ queryParams }) => {
Continue with Facebook
-
We won't post anything on your behalf
Date: Tue, 4 Feb 2020 15:31:27 +0200 Subject: [PATCH 113/115] NavMenu adapted to changes in core --- src/common/NavBar/NavMenu/NavMenu.js | 23 +++++++++++------- src/common/NavBar/NavMenu/useProfile.js | 23 ++++++++++++++++++ src/common/index.js | 4 +--- src/common/useUser.js | 31 ------------------------- 4 files changed, 39 insertions(+), 42 deletions(-) create mode 100644 src/common/NavBar/NavMenu/useProfile.js delete mode 100644 src/common/useUser.js diff --git a/src/common/NavBar/NavMenu/NavMenu.js b/src/common/NavBar/NavMenu/NavMenu.js index 2509185a2..40a846d9d 100644 --- a/src/common/NavBar/NavMenu/NavMenu.js +++ b/src/common/NavBar/NavMenu/NavMenu.js @@ -2,17 +2,19 @@ const React = require('react'); const PropTypes = require('prop-types'); const classnames = require('classnames'); const Icon = require('stremio-icons/dom'); +const { useServices } = require('stremio/services'); const Button = require('stremio/common/Button'); const Popup = require('stremio/common/Popup'); const useBinaryState = require('stremio/common/useBinaryState'); const useFullscreen = require('stremio/common/useFullscreen'); -const useUser = require('stremio/common/useUser'); +const useProfile = require('./useProfile'); const styles = require('./styles'); const NavMenu = ({ className }) => { + const { core } = useServices(); + const profile = useProfile(); const [menuOpen, , closeMenu, toggleMenu] = useBinaryState(false); const [fullscreen, requestFullscreen, exitFullscreen] = useFullscreen(); - const [user, logout] = useUser(); const popupLabelOnClick = React.useCallback((event) => { if (!event.nativeEvent.togglePopupPrevented) { toggleMenu(); @@ -22,7 +24,12 @@ const NavMenu = ({ className }) => { event.nativeEvent.togglePopupPrevented = true; }, []); const logoutButtonOnClick = React.useCallback(() => { - logout(); + core.dispatch({ + action: 'Ctx', + args: { + action: 'Logout' + } + }); }, []); return ( {
-
{user === null ? 'Anonymous user' : user.email}
+
{profile.auth === null ? 'Anonymous user' : profile.auth.user.email}
-
diff --git a/src/common/NavBar/NavMenu/useProfile.js b/src/common/NavBar/NavMenu/useProfile.js new file mode 100644 index 000000000..943f1de17 --- /dev/null +++ b/src/common/NavBar/NavMenu/useProfile.js @@ -0,0 +1,23 @@ +const React = require('react'); +const { useServices } = require('stremio/services'); +const useModelState = require('stremio/common/useModelState'); + +const mapProfileState = (ctx) => { + return ctx.profile; +}; + +const useProfile = () => { + const { core } = useServices(); + const initProfileState = React.useCallback(() => { + const ctx = core.getState('ctx'); + return mapProfileState(ctx); + }, []); + const profile = useModelState({ + model: 'ctx', + init: initProfileState, + map: mapProfileState + }); + return profile; +}; + +module.exports = useProfile; diff --git a/src/common/index.js b/src/common/index.js index d42007c89..ef266e228 100644 --- a/src/common/index.js +++ b/src/common/index.js @@ -27,7 +27,6 @@ const useFullscreen = require('./useFullscreen'); const useInLibrary = require('./useInLibrary'); const useLiveRef = require('./useLiveRef'); const useModelState = require('./useModelState'); -const useUser = require('./useUser'); module.exports = { AddonDetailsModal, @@ -59,6 +58,5 @@ module.exports = { useFullscreen, useInLibrary, useLiveRef, - useModelState, - useUser + useModelState }; diff --git a/src/common/useUser.js b/src/common/useUser.js deleted file mode 100644 index 36ff01acd..000000000 --- a/src/common/useUser.js +++ /dev/null @@ -1,31 +0,0 @@ -const React = require('react'); -const { useServices } = require('stremio/services'); -const useModelState = require('stremio/common/useModelState'); - -const mapUserState = (ctx) => { - return ctx.content.auth ? ctx.content.auth.user : null; -}; - -const useUser = () => { - const { core } = useServices(); - const logout = React.useCallback(() => { - core.dispatch({ - action: 'UserOp', - args: { - userOp: 'Logout' - } - }); - }, []); - const initUserState = React.useCallback(() => { - const ctx = core.getState('ctx'); - return mapUserState(ctx); - }, []); - const user = useModelState({ - model: 'ctx', - map: mapUserState, - init: initUserState - }); - return [user, logout]; -}; - -module.exports = useUser; From c82a4563dfcc0db8dca41c32cc371d8ae8208a92 Mon Sep 17 00:00:00 2001 From: nklhrstv Date: Tue, 4 Feb 2020 16:07:46 +0200 Subject: [PATCH 114/115] implement component that show toast for every error in core --- src/App/App.js | 4 +++- src/App/CoreEventsToaster.js | 29 +++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 src/App/CoreEventsToaster.js diff --git a/src/App/App.js b/src/App/App.js index c7d23c300..22a1bb92a 100644 --- a/src/App/App.js +++ b/src/App/App.js @@ -3,6 +3,7 @@ const React = require('react'); const { Router } = require('stremio-router'); const { Core, KeyboardNavigation, ServicesProvider, Shell } = require('stremio/services'); const { ToastProvider } = require('stremio/common'); +const CoreEventsToaster = require('./CoreEventsToaster'); const routerViewsConfig = require('./routerViewsConfig'); const styles = require('./styles'); @@ -23,13 +24,13 @@ const App = () => { }; const onCoreStateChanged = () => { if (services.core.active) { + window.core = services.core; services.core.dispatch({ action: 'Load', args: { model: 'Ctx' } }); - window.core = services.core; } setCoreInitialized(services.core.active || services.core.error instanceof Error); }; @@ -52,6 +53,7 @@ const App = () => { { shellInitialized && coreInitialized ? + { + const { core } = useServices(); + const toast = useToast(); + React.useEffect(() => { + const onEvent = ({ event, args }) => { + // UserAuthenticated are handled only in the /intro route + if (event === 'Error' && args.source.event !== 'UserAuthenticated') { + toast.show({ + type: 'error', + title: args.source.event, + message: args.error.message, + icon: 'ic_warning', + timeout: 10000 + }); + } + }; + core.on('Event', onEvent); + return () => { + core.off('Event', onEvent); + }; + }, []); + return null; +}; + +module.exports = CoreEventsToaster; From 5ee47cf7d289e45218160a21eae3c592d62fa2c3 Mon Sep 17 00:00:00 2001 From: nklhrstv Date: Tue, 4 Feb 2020 17:53:26 +0200 Subject: [PATCH 115/115] addons hooks adapted to changes in core --- src/routes/Addons/useAddons.js | 46 +++++++++++++----------- src/routes/Addons/useSelectableInputs.js | 30 ++++++++-------- 2 files changed, 41 insertions(+), 35 deletions(-) diff --git a/src/routes/Addons/useAddons.js b/src/routes/Addons/useAddons.js index cd0fae6f9..d92afbed9 100644 --- a/src/routes/Addons/useAddons.js +++ b/src/routes/Addons/useAddons.js @@ -21,16 +21,16 @@ const mapAddonsStateWithCtx = (addons, ctx) => { ...addons.catalog_resource, content: { ...addons.catalog_resource.content, - content: addons.catalog_resource.content.content.map((descriptor) => ({ - transportUrl: descriptor.transportUrl, - installed: ctx.content.addons.some((addon) => addon.transportUrl === descriptor.transportUrl), + content: addons.catalog_resource.content.content.map((addon) => ({ + transportUrl: addon.transportUrl, + installed: ctx.profile.addons.some(({ transportUrl }) => transportUrl === addon.transportUrl), manifest: { - id: descriptor.manifest.id, - name: descriptor.manifest.name, - version: descriptor.manifest.version, - logo: descriptor.manifest.logo, - description: descriptor.manifest.description, - types: descriptor.manifest.types + id: addon.manifest.id, + name: addon.manifest.name, + version: addon.manifest.version, + logo: addon.manifest.logo, + description: addon.manifest.description, + types: addon.manifest.types } })) } @@ -45,8 +45,10 @@ const onNewAddonsState = (addons) => { return { action: 'Load', args: { - load: 'CatalogFiltered', - args: addons.selectable.catalogs[0].load_request + model: 'CatalogFiltered', + args: { + request: addons.selectable.catalogs[0].request + } } }; } @@ -59,14 +61,16 @@ const useAddons = (urlParams) => { return { action: 'Load', args: { - load: 'CatalogFiltered', + model: 'CatalogFiltered', args: { - base: urlParams.transportUrl, - path: { - resource: 'addon_catalog', - type_name: urlParams.type, - id: urlParams.catalogId, - extra: [] + request: { + base: urlParams.transportUrl, + path: { + resource: 'addon_catalog', + type_name: urlParams.type, + id: urlParams.catalogId, + extra: [] + } } } } @@ -77,8 +81,10 @@ const useAddons = (urlParams) => { return { action: 'Load', args: { - load: 'CatalogFiltered', - args: addons.selectable.catalogs[0].load_request + model: 'CatalogFiltered', + args: { + request: addons.selectable.catalogs[0].request + } } }; } else { diff --git a/src/routes/Addons/useSelectableInputs.js b/src/routes/Addons/useSelectableInputs.js index 4db24b058..913556b69 100644 --- a/src/routes/Addons/useSelectableInputs.js +++ b/src/routes/Addons/useSelectableInputs.js @@ -1,9 +1,9 @@ const React = require('react'); -const navigateWithLoadRequest = (load_request) => { - const transportUrl = encodeURIComponent(load_request.base); - const catalogId = encodeURIComponent(load_request.path.id); - const type = encodeURIComponent(load_request.path.type_name); +const navigateWithRequest = (request) => { + const transportUrl = encodeURIComponent(request.base); + const catalogId = encodeURIComponent(request.path.id); + const type = encodeURIComponent(request.path.type_name); window.location.replace(`#/addons/${transportUrl}/${catalogId}/${type}`); }; @@ -18,35 +18,35 @@ const mapSelectableInputs = (addons) => { const catalogSelect = { title: 'Select catalog', options: addons.selectable.catalogs - .map(({ name, load_request }) => ({ - value: JSON.stringify(load_request), + .map(({ name, request }) => ({ + value: JSON.stringify(request), label: name })), selected: addons.selectable.catalogs - .filter(({ load_request: { path: { id } } }) => { + .filter(({ request: { path: { id } } }) => { return addons.catalog_resource !== null && addons.catalog_resource.request.path.id === id; }) - .map(({ load_request }) => JSON.stringify(load_request)), + .map(({ request }) => JSON.stringify(request)), onSelect: (event) => { - navigateWithLoadRequest(JSON.parse(event.value)); + navigateWithRequest(JSON.parse(event.value)); } }; const typeSelect = { title: 'Select type', options: addons.selectable.types - .map(({ name, load_request }) => ({ - value: JSON.stringify(load_request), + .map(({ name, request }) => ({ + value: JSON.stringify(request), label: name })), selected: addons.selectable.types - .filter(({ load_request }) => { + .filter(({ request }) => { return addons.catalog_resource !== null && - equalWithouExtra(addons.catalog_resource.request, load_request); + equalWithouExtra(addons.catalog_resource.request, request); }) - .map(({ load_request }) => JSON.stringify(load_request)), + .map(({ request }) => JSON.stringify(request)), onSelect: (event) => { - navigateWithLoadRequest(JSON.parse(event.value)); + navigateWithRequest(JSON.parse(event.value)); } }; return [catalogSelect, typeSelect];