diff --git a/src/routes/Settings/SectionsList/SectionsList.js b/src/routes/Settings/SectionsList/SectionsList.js
index cd2f0a303..865331933 100644
--- a/src/routes/Settings/SectionsList/SectionsList.js
+++ b/src/routes/Settings/SectionsList/SectionsList.js
@@ -5,7 +5,7 @@ const ColorInput = require('../ColorInput');
const classnames = require('classnames');
const styles = require('../styles');
-const SectionsList = React.forwardRef(({className, sections, preferences, onPreferenceChanged, onScroll }, ref) => {
+const SectionsList = React.forwardRef(({ className, sections, preferences, onPreferenceChanged, onScroll }, ref) => {
const scrollContainerRef = ref;
const toggleCheckbox = (id) => {
onPreferenceChanged(id, !preferences[id]);
@@ -20,83 +20,141 @@ const SectionsList = React.forwardRef(({className, sections, preferences, onPref
onPreferenceChanged(data.name, data.value);
};
+ // Determines whether the link should be opened in new window or in the current one.
+ const getTargetFor = url => ['//', 'http://', 'https://', 'file://', 'ftp://', 'mailto:', 'magnet:'].some(scheme => url.startsWith(scheme)) ?
+ '_blank' : '_self'
+
+ const changePasswordUrl = preferences.user && 'https://www.strem.io/reset-password/' + preferences.user.email;
+ const webCalUrl = preferences.user && 'webcal://www.strem.io/calendar/' + preferences.user._id + '.ics';
+
+ const sectionsElements = sections.map((section) =>
+
+
{section.id}
+ {(section.inputs || [])
+ .map((input) => {
+ if (input.type === 'user') {
+ return (
+
+
+ {
+ !preferences.user
+ ?
+
+ :
+
+ }
+
{!preferences.user ? 'Anonymous user' : preferences.user.email}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{'Trakt Scrobbling'}
+
+
+
+ );
+ } else if (input.type === 'select') {
+ return (
+
+ {input.header ?
{input.header}
: null}
+
+
+ );
+ } else if (input.type === 'link') {
+ return (
+
+ {input.header ?
{input.header}
: null}
+
+
+ );
+ } else if (input.type === 'button') {
+ return (
+
+ {input.header ?
{input.header}
: null}
+
+
+ );
+ } else if (input.type === 'checkbox') {
+ return (
+
+ {input.header ?
{input.header}
: null}
+
+ {input.label}
+
+
+ );
+ } else if (input.type === 'static-text') {
+ return (
+
+ {input.header ?
{input.header}
: null}
+
+ {input.icon ?
: null}
+
{input.label}
+
+
+ );
+ } else if (input.type === 'color') {
+ return (
+
+ {input.header ?
{input.header}
: null}
+
+ {/*
*/}
+
+ );
+ }
+ })}
+
+ );
+
return (
- {sections.map((section) =>
-
-
{section.id}
- {(section.inputs || [])
- .map((input) => {
- if (input.type === 'user') {
- return (
-
- {
- !preferences[input.id]
- ?
-
- :
-
- }
-
{!preferences[input.id] ? 'Anonymous user' : preferences[input.id].email}
-
- );
- } else if (input.type === 'select') {
- return (
-
- {input.header ?
{input.header}
: null}
-
-
- );
- } else if (input.type === 'link') {
- return (
-
- {input.header ?
{input.header}
: null}
-
-
- );
- } else if (input.type === 'button') {
- return (
-
- {input.header ?
{input.header}
: null}
-
-
- );
- } else if (input.type === 'checkbox') {
- return (
-
- {input.header ?
{input.header}
: null}
-
- {input.label}
-
-
- );
- } else if (input.type === 'static-text') {
- return (
-
- {input.header ?
{input.header}
: null}
-
- {input.icon ?
: null}
-
{input.label}
-
-
- );
- } else if (input.type === 'color') {
- return (
-
- {input.header ?
{input.header}
: null}
-
- {/*
*/}
-
- );
- }
- })}
-
- )}
+ {sectionsElements}
);
});
diff --git a/src/routes/Settings/Settings.js b/src/routes/Settings/Settings.js
index a892fac6b..bda1fbfbc 100644
--- a/src/routes/Settings/Settings.js
+++ b/src/routes/Settings/Settings.js
@@ -5,10 +5,16 @@ const SectionsSelector = require('./SectionsSelector');
const SectionsList = require('./SectionsList');
const { settingsSections, SECTIONS_ORDER } = require('./constants');
+const devTestWithUser = true;
+
const settingsValues = {
- "user": null,
+ "user": devTestWithUser ? {
+ "_id": "neo",
+ "email": "neo@example.com",
+ "avatar": "https://www.thenational.ae/image/policy:1.891803:1566372420/AC17-Matrix-20-04.jpg?f=16x9&w=1200&$p$f$w=5867e40",
+ } : null,
"ui_language": "eng",
- "default_subtitles_language": "",
+ "default_subtitles_language": "bul",
"default_subtitles_size": "100%",
"subtitles_background": "",
"subtitles_color": "#ffffff",
diff --git a/src/routes/Settings/constants.js b/src/routes/Settings/constants.js
index 7f89debee..796f20807 100644
--- a/src/routes/Settings/constants.js
+++ b/src/routes/Settings/constants.js
@@ -1,22 +1,13 @@
const settingsSections = {
"General": {
"inputs": [
- { "section": "General", "label": "Username", "type": "user", "id": "user" },
- { "section": "General", "label": "LOG OUT", "type": "button", "id": "log_out" },
- { "section": "General", "label": "Change password", "type": "link", "href": "", "id": "change_password" },
- { "section": "General", "label": "Import options", "type": "static-text", "id": "import_options" },
- { "section": "General", "label": "Import from Facebook", "type": "link", "href": "", "id": "import_from_facebook" },
- { "section": "General", "label": "Export user data", "type": "link", "href": "", "id": "export_user_data" },
- { "section": "General", "label": "Subscribe to calendar", "type": "link", "href": "", "id": "subscribe_to_calendar" },
- { "section": "General", "label": "Contact support", "type": "link", "id": "contact_support" },
- { "section": "General", "label": "Request account deletion", "type": "link", "id": "request_account_deletion" },
- { "section": "General", "header": "Trakt Scrobbling", "label": "AUTHENTICATE", "type": "button", "icon": "ic_trackt", "id": "authenticate" },
+ { "section": "General", "type": "user" },
{ "section": "General", "header": "UI Language", "label": "UI Language", "type": "select", "options": [{ "label": "Български език", "value": "bul" }, { "label": "English", "value": "eng" }, { "label": "Deutsch", "value": "ger" }, { "label": "Español", "value": "esp" }, { "label": "Italiano", "value": "ita" }], "id": "ui_language" },
],
},
"Player": {
"inputs": [
- { "section": "Player", "label": "ADD-ONS", "type": "button", "icon": "ic_addons", "id": "add-ons" },
+ { "section": "Player", "label": "ADD-ONS", "type": "button", "icon": "ic_addons", "id": "add-ons", "href": "#/addons" },
{ "section": "Player", "header": "Default Subtitles Language", "label": "Default Subtitles Language", "type": "select", "options": [{ "label": "Български език", "value": "bul" }, { "label": "English", "value": "eng" }, { "label": "Deutsch", "value": "ger" }, { "label": "Español", "value": "esp" }, { "label": "Italiano", "value": "ita" }], "id": "default_subtitles_language" },
{ "section": "Player", "header": "Default Subtitles Size", "label": "Default Subtitles Size", "type": "select", "options": [{ "label": "72%", "value": "72%" }, { "label": "80%", "value": "80%" }, { "label": "100%", "value": "100%" }, { "label": "120%", "value": "120%" }, { "label": "140%", "value": "140%" }, { "label": "160%", "value": "160%" }, { "label": "180%", "value": "180%" }], "id": "default_subtitles_size" },
{ "section": "Player", "header": "Subtitles Background", "label": "Subtitles background", "type": "select", "options": [{ "label": "None", "value": "" }, { "label": "Solid", "value": "solid" }, { "label": "Transparent", "value": "transparent" }], "id": "subtitles_background" },