You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-12-02 22:49:09 +02:00
Desktop: Cleaned up and improved config screen design, move all screens under same one, and added section buttons
This commit is contained in:
@@ -2,6 +2,7 @@ const Setting = require('lib/models/Setting.js');
|
||||
const SyncTargetRegistry = require('lib/SyncTargetRegistry');
|
||||
const ObjectUtils = require('lib/ObjectUtils');
|
||||
const { _ } = require('lib/locale.js');
|
||||
const { createSelector } = require('reselect');
|
||||
|
||||
const shared = {};
|
||||
|
||||
@@ -79,26 +80,51 @@ shared.settingsToComponents = function(comp, device, settings) {
|
||||
return settingComps;
|
||||
};
|
||||
|
||||
shared.settingsToComponents2 = function(comp, device, settings) {
|
||||
const keys = Setting.keys(true, device);
|
||||
const sectionComps = [];
|
||||
const metadatas = [];
|
||||
const deviceSelector = (state) => state.device;
|
||||
const settingsSelector = (state) => state.settings;
|
||||
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
const key = keys[i];
|
||||
if (!Setting.isPublic(key)) continue;
|
||||
shared.settingsSections = createSelector(
|
||||
deviceSelector,
|
||||
settingsSelector,
|
||||
(device, settings) => {
|
||||
const keys = Setting.keys(true, device);
|
||||
const metadatas = [];
|
||||
|
||||
const md = Setting.settingMetadata(key);
|
||||
if (md.show && !md.show(settings)) continue;
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
const key = keys[i];
|
||||
if (!Setting.isPublic(key)) continue;
|
||||
|
||||
metadatas.push(md);
|
||||
const md = Setting.settingMetadata(key);
|
||||
if (md.show && !md.show(settings)) continue;
|
||||
|
||||
metadatas.push(md);
|
||||
}
|
||||
|
||||
const output = Setting.groupMetadatasBySections(metadatas);
|
||||
|
||||
output.push({
|
||||
name: 'encryption',
|
||||
metadatas: [],
|
||||
isScreen: true,
|
||||
});
|
||||
|
||||
output.push({
|
||||
name: 'server',
|
||||
metadatas: [],
|
||||
isScreen: true,
|
||||
});
|
||||
|
||||
return output;
|
||||
}
|
||||
);
|
||||
|
||||
const sections = Setting.groupMetadatasBySections(metadatas);
|
||||
shared.settingsToComponents2 = function(comp, device, settings, selectedSectionName = '') {
|
||||
const sectionComps = [];
|
||||
const sections = shared.settingsSections({ device, settings });
|
||||
|
||||
for (let i = 0; i < sections.length; i++) {
|
||||
const section = sections[i];
|
||||
const sectionComp = comp.sectionToComponent(section.name, section, settings);
|
||||
const sectionComp = comp.sectionToComponent(section.name, section, settings, selectedSectionName === section.name);
|
||||
if (!sectionComp) continue;
|
||||
sectionComps.push(sectionComp);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user