diff --git a/.cache/325c8f456729b912b0d2134054eb7448-dfeeb2271cc2857eb0a45a5003c8bbee b/.cache/325c8f456729b912b0d2134054eb7448-dfeeb2271cc2857eb0a45a5003c8bbee deleted file mode 100644 index f7e9f79b1..000000000 --- a/.cache/325c8f456729b912b0d2134054eb7448-dfeeb2271cc2857eb0a45a5003c8bbee +++ /dev/null @@ -1 +0,0 @@ -{"value":{"success":true,"data":{"latest":{"version":"4.0.0","info":{"plain":"- upgrade webpack & babel to latest\n- new addParameters and third argument to .add to pass data to addons\n- added the ability to theme storybook\n- improved ui for mobile devices\n- improved performance of addon-knobs"}}},"time":1541422002878},"type":"Object"} \ No newline at end of file diff --git a/.storybook/webpack.config.js b/.storybook/webpack.config.js index f65644619..83ddb8e51 100644 --- a/.storybook/webpack.config.js +++ b/.storybook/webpack.config.js @@ -27,7 +27,7 @@ module.exports = { loader: 'css-loader', options: { modules: true, - localIdentName: '[path][name]_[local]_[hash:base64:5]', + localIdentName: '[local]_[hash:base64:5]', importLoaders: 2 } }, diff --git a/src/routes/Settings/Settings.js b/src/routes/Settings/Settings.js index 6724afa15..9f50fd060 100644 --- a/src/routes/Settings/Settings.js +++ b/src/routes/Settings/Settings.js @@ -1,54 +1,64 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import Icon from 'stremio-icons/dom'; +import classnames from 'classnames'; import styles from './styles'; +const SETTINGS_MENUS = { + PLAYER_MENU: 1, + LANGUAGE_MENU: 2, + ACCOUNT_MENU: 3, + NOTIFICATIONS_MENU: 4, + DATA_MENU: 5 +}; + class Settings extends Component { constructor(props) { super(props); this.state = { - selectedMenu: 'player_preferences', - selectedMenuId: 0 - } + selectedMenu: SETTINGS_MENUS.PLAYER_MENU + }; } - changeSettings = (selectedMenu, id) => { - this.setState({ selectedMenu, selectedMenuId: id }); + changeSelectedMenu = (selectedMenu) => { + this.setState({ selectedMenu }); } - renderPlayerPreferences = () => { - const preferences = ["Hardware-accelerated decoding", "Auto-play next episode", "Data saver"]; + shouldComponentUpdate(nextState) { + return nextState.selectedMenu != this.state.selectedMenu; + } + + renderPlayerSettings = () => { + const preferences = ['Hardware-accelerated decoding', 'Auto-play next episode', 'Data saver']; return (
- {preferences.map((item, key) => { - return ( - - ); - })} + {preferences.map((item, key) => + + )}
); } - renderLanguage = () => { + renderLanguageSettings = () => { return (
-
+
INTERFACE LANGUAGE -
English +
English
-
+
DEFAULT SUBTITLES LANGUAGE -
Portugese - BR +
Portugese - BR
@@ -57,30 +67,22 @@ class Settings extends Component { } renderSelectedMenu = () => { - const { selectedMenuId } = this.state; - - if (selectedMenuId == 0) { - this.selectedMenu = 'player-preferences'; - return ( -
{this.renderPlayerPreferences()}
- ); - } else if (selectedMenuId == 1) { - this.selectedMenu = 'language'; - return ( -
{this.renderLanguage()}
- ); + switch (this.state.selectedMenu) { + case SETTINGS_MENUS.PLAYER_MENU: + return this.renderPlayerSettings(); + case SETTINGS_MENUS.LANGUAGE_MENU: + return this.renderLanguageSettings(); + default: + return null; } } render() { - const { selectedMenu } = this.state; - const options = ["Player Preferences", "Language", "Account Settings", "Notifications", "Data Caching"]; - return (
-
- {options.map((key, index) => -
this.changeSettings(selectedMenu, index)}>{options[index]}
+
+ {Object.keys(SETTINGS_MENUS).map((menu) => +
this.changeSelectedMenu(SETTINGS_MENUS[menu])}>{menu}
)}
{this.renderSelectedMenu()} diff --git a/src/routes/Settings/styles.less b/src/routes/Settings/styles.less index af52137ca..297e51b55 100644 --- a/src/routes/Settings/styles.less +++ b/src/routes/Settings/styles.less @@ -4,14 +4,14 @@ display: flex; color: @colorwhite60; font-family: LatoLight; - .options { + .side-menu { width: 240px; padding: 20px; display: flex; font-size: 14px; flex-direction: column; background: @colordarkest; - .option { + .menu-option { padding: 14px; font-weight: 600; &:hover { @@ -19,28 +19,21 @@ color: @colorwhite; background: @colorglass; } - } - .selected-menu { - padding: 14px; - font-weight: 600; - cursor: pointer; - color: @colorwhite; - background: @colorglass; - } - .selected { - cursor: pointer; - color: @colorwhite; - background: @colorglass; + &.menu-option-selected { + cursor: pointer; + color: @colorwhite; + background: @colorglass; + } } } .player-preferences-menu { - height: 150px; - margin: 60px 50px; + height: 145px; + margin: 40px 50px; border-bottom: 1px solid @colormedium; - .preference-container { + .preferences-section { display: flex; cursor: pointer; - margin: 30px 0px; + margin-bottom: 30px; align-items: center; .preference { width: 280px; @@ -74,18 +67,15 @@ } .language-menu { margin: 40px 50px; - .interface-language { - margin-bottom: 30px; - } - .interface-language, .default-subtitles-language { + .language-section { border-bottom: 1px solid @colormedium; .headline { font-weight: 600; color: @colorwhite40; } - .name { + .selected-language { height: 40px; - width: 250px; + width: 280px; padding: 20px; display: flex; margin: 30px 0px; @@ -105,6 +95,10 @@ border: 1px solid @colormedium; } } + &:not(:last-child) { + margin-bottom: 30px; + + } } } } \ No newline at end of file diff --git a/stories/index.stories.js b/stories/index.stories.js index dbefe9995..5d5b55413 100644 --- a/stories/index.stories.js +++ b/stories/index.stories.js @@ -5,26 +5,7 @@ import { storiesOf } from '@storybook/react'; import { action } from '@storybook/addon-actions'; import { linkTo } from '@storybook/addon-links'; -import { Button, Welcome } from '@storybook/react/demo'; -import { Addon } from 'stremio-common'; -import { LibraryItemList } from 'stremio-common'; -import { MetaItem } from 'stremio-common'; -import { ShareAddon } from 'stremio-common'; -import { Stream } from 'stremio-common'; -import { UserPanel } from 'stremio-common'; -import { Video } from 'stremio-common'; - -storiesOf('Welcome', module).add('to Storybook', () => ); - -storiesOf('Button', module) - .add('with text', () => ) - .add('with some emoji', () => ( - - )); +import { Addon, LibraryItemList, MetaItem, ShareAddon, Stream, UserPanel, Video } from 'stremio-common'; storiesOf('Addon', module) .add('addon', () => ( diff --git a/webpack.config.js b/webpack.config.js index 3ba4852b2..fe2083ff1 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -33,7 +33,7 @@ module.exports = { loader: 'css-loader', options: { modules: true, - localIdentName: '[hash:base64:5]', + localIdentName: '[local]_[hash:base64:5]', importLoaders: 2 } },