From 4738923be6c2c79eb75b5917119ccd3e7ea34166 Mon Sep 17 00:00:00 2001 From: Tim Date: Sun, 17 Dec 2023 17:24:17 +0100 Subject: [PATCH 1/4] fix(App): core error handling was broken --- src/App/App.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/App/App.js b/src/App/App.js index de443d9d4..d6e92fbbb 100644 --- a/src/App/App.js +++ b/src/App/App.js @@ -146,8 +146,10 @@ const App = () => { .catch((e) => console.error(e)); } return () => { - window.removeEventListener('focus', onWindowFocus); - services.core.transport.off('CoreEvent', onCoreEvent); + if (services.core.active) { + window.removeEventListener('focus', onWindowFocus); + services.core.transport.off('CoreEvent', onCoreEvent); + } }; }, [initialized]); return ( From d9feff83bf4bc6f02d4cba121f4a811571cbc5a9 Mon Sep 17 00:00:00 2001 From: Tim Date: Sun, 17 Dec 2023 17:34:25 +0100 Subject: [PATCH 2/4] style(App): update error dialog to latest design --- src/App/ErrorDialog/styles.less | 25 ++++++++++++++++--------- src/App/styles.less | 1 - 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/App/ErrorDialog/styles.less b/src/App/ErrorDialog/styles.less index 01f6634b2..c3f7813d4 100644 --- a/src/App/ErrorDialog/styles.less +++ b/src/App/ErrorDialog/styles.less @@ -7,12 +7,12 @@ flex-direction: column; align-items: center; justify-content: center; + gap: 1rem; .error-image { flex: none; width: 12rem; height: 12rem; - margin-bottom: 1rem; object-fit: contain; object-position: center; opacity: 0.9; @@ -24,7 +24,7 @@ font-size: 2rem; max-height: 3.6em; text-align: center; - color: @color-surface-light5-90; + color: var(--primary-foreground-color); } .buttons-container { @@ -36,6 +36,8 @@ flex-wrap: wrap; align-items: center; justify-content: center; + gap: 1.5rem; + margin-top: 1rem; .button-container { flex-grow: 0; @@ -45,18 +47,23 @@ flex-direction: row; align-items: center; justify-content: center; - margin: 2rem 1rem 0; - padding: 0 1rem; + padding: 0 2.5rem; min-width: 8rem; - height: 3rem; - background-color: @color-accent3; + height: 3.5rem; + border-radius: 3.5rem; + background-color: var(--overlay-color); &:hover { - background-color: @color-accent3-light1; + outline: var(--focus-outline-size) solid var(--primary-foreground-color); + background-color: transparent; + } + + &:active { + outline: none; } &:global(.disabled) { - background-color: @color-surface-dark5; + opacity: 0.3; } .label { @@ -67,7 +74,7 @@ font-size: 1.1rem; font-weight: 500; text-align: center; - color: @color-surface-light5-90; + color: var(--primary-foreground-color); } } } diff --git a/src/App/styles.less b/src/App/styles.less index 64177ad65..95566c9a8 100644 --- a/src/App/styles.less +++ b/src/App/styles.less @@ -144,7 +144,6 @@ html { .loader-container, .error-container { width: 100%; height: 100%; - background-color: @color-background-dark2; } } } From 6ba0ff95128b80275f9caa4f92ae52f1f86322e2 Mon Sep 17 00:00:00 2001 From: Tim Date: Mon, 18 Dec 2023 11:30:19 +0100 Subject: [PATCH 3/4] chore: update stremio-translations --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 99ff58363..f728b0b04 100644 --- a/package-lock.json +++ b/package-lock.json @@ -36,7 +36,7 @@ "react-i18next": "^12.1.1", "react-is": "18.2.0", "spatial-navigation-polyfill": "git+ssh://git@github.com/Stremio/spatial-navigation.git#64871b1422466f5f45d24ebc8bbd315b2ebab6a6", - "stremio-translations": "git+ssh://git@github.com/Stremio/stremio-translations.git#8e30d9961402a7389f1a6209d9dab5592f32c9d7", + "stremio-translations": "git+ssh://git@github.com/Stremio/stremio-translations.git#847c7675a0ad4f70787aebb88e2fd6e2ed9b9ccb", "url": "0.11.0", "use-long-press": "^3.1.5" }, @@ -13600,9 +13600,9 @@ } }, "node_modules/stremio-translations": { - "version": "1.44.3", - "resolved": "git+ssh://git@github.com/Stremio/stremio-translations.git#8e30d9961402a7389f1a6209d9dab5592f32c9d7", - "integrity": "sha512-E8UqbRzVQzDFQvKLTztrtA2V8xL8JeYfi+hI9IWx9kwIMQ34no2hxuualXH7A4U0s8xlM6BQW4bcQlVKwflhEg==", + "version": "1.44.4", + "resolved": "git+ssh://git@github.com/Stremio/stremio-translations.git#847c7675a0ad4f70787aebb88e2fd6e2ed9b9ccb", + "integrity": "sha512-X+RBUiq9fEmjHft6R7BZLkLJY1Km/QK3LicrUddSYOV6qPEpyjhXsVDeaqppUEZGA4sFsd7daB3vgphmwM0MmQ==", "license": "MIT" }, "node_modules/string_decoder": { @@ -26007,9 +26007,9 @@ "dev": true }, "stremio-translations": { - "version": "git+ssh://git@github.com/Stremio/stremio-translations.git#8e30d9961402a7389f1a6209d9dab5592f32c9d7", - "integrity": "sha512-E8UqbRzVQzDFQvKLTztrtA2V8xL8JeYfi+hI9IWx9kwIMQ34no2hxuualXH7A4U0s8xlM6BQW4bcQlVKwflhEg==", - "from": "stremio-translations@git+ssh://git@github.com/Stremio/stremio-translations.git#8e30d9961402a7389f1a6209d9dab5592f32c9d7" + "version": "git+ssh://git@github.com/Stremio/stremio-translations.git#847c7675a0ad4f70787aebb88e2fd6e2ed9b9ccb", + "integrity": "sha512-X+RBUiq9fEmjHft6R7BZLkLJY1Km/QK3LicrUddSYOV6qPEpyjhXsVDeaqppUEZGA4sFsd7daB3vgphmwM0MmQ==", + "from": "stremio-translations@git+ssh://git@github.com/Stremio/stremio-translations.git#847c7675a0ad4f70787aebb88e2fd6e2ed9b9ccb" }, "string_decoder": { "version": "1.1.1", diff --git a/package.json b/package.json index 3cd957b52..d46bbbffe 100755 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "react-i18next": "^12.1.1", "react-is": "18.2.0", "spatial-navigation-polyfill": "git+ssh://git@github.com/Stremio/spatial-navigation.git#64871b1422466f5f45d24ebc8bbd315b2ebab6a6", - "stremio-translations": "git+ssh://git@github.com/Stremio/stremio-translations.git#8e30d9961402a7389f1a6209d9dab5592f32c9d7", + "stremio-translations": "git+ssh://git@github.com/Stremio/stremio-translations.git#847c7675a0ad4f70787aebb88e2fd6e2ed9b9ccb", "url": "0.11.0", "use-long-press": "^3.1.5" }, From 59abfb7c5f19e6119456258b3b8de92e632b4d27 Mon Sep 17 00:00:00 2001 From: Tim Date: Mon, 18 Dec 2023 11:36:32 +0100 Subject: [PATCH 4/4] refactor(ErrorDialog): use translation strings --- src/App/ErrorDialog/ErrorDialog.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/App/ErrorDialog/ErrorDialog.js b/src/App/ErrorDialog/ErrorDialog.js index eb0335d9f..8429bb340 100644 --- a/src/App/ErrorDialog/ErrorDialog.js +++ b/src/App/ErrorDialog/ErrorDialog.js @@ -1,12 +1,15 @@ // Copyright (C) 2017-2023 Smart code 203358507 const React = require('react'); +const { useTranslation } = require('react-i18next'); const PropTypes = require('prop-types'); const classnames = require('classnames'); const { Button, Image } = require('stremio/common'); const styles = require('./styles'); const ErrorDialog = ({ className }) => { + const { t } = useTranslation(); + const [dataCleared, setDataCleared] = React.useState(false); const reload = React.useCallback(() => { window.location.reload(); @@ -22,13 +25,19 @@ const ErrorDialog = ({ className }) => { src={require('/images/empty.png')} alt={' '} /> -
Something went wrong!
+
+ { t('GENERIC_ERROR_MESSAGE') } +
- -