mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-10-29 02:53:40 +00:00
50 lines
1.1 KiB
JavaScript
50 lines
1.1 KiB
JavaScript
'use strict';
|
|
|
|
const BaseComponent = require(__dirname + '/js/components/base.js');
|
|
|
|
const Nav = require(__dirname + '/js/pages/preference/nav.js');
|
|
const ServersSection = require(__dirname + '/js/pages/preference/servers-section.js');
|
|
const GeneralSection = require(__dirname + '/js/pages/preference/general-section.js');
|
|
|
|
class PreferenceView extends BaseComponent {
|
|
constructor() {
|
|
super();
|
|
|
|
this.$sidebarContainer = document.getElementById('sidebar');
|
|
this.$settingsContainer = document.getElementById('settings-container');
|
|
}
|
|
|
|
init() {
|
|
this.nav = new Nav({
|
|
$root: this.$sidebarContainer,
|
|
onItemSelected: this.handleNavigation.bind(this)
|
|
});
|
|
this.handleNavigation('General');
|
|
}
|
|
|
|
handleNavigation(navItem) {
|
|
this.nav.select(navItem);
|
|
switch (navItem) {
|
|
case 'Servers': {
|
|
this.section = new ServersSection({
|
|
$root: this.$settingsContainer
|
|
});
|
|
break;
|
|
}
|
|
case 'General': {
|
|
this.section = new GeneralSection({
|
|
$root: this.$settingsContainer
|
|
});
|
|
break;
|
|
}
|
|
default: break;
|
|
}
|
|
this.section.init();
|
|
}
|
|
}
|
|
|
|
window.onload = () => {
|
|
const preferenceView = new PreferenceView();
|
|
preferenceView.init();
|
|
};
|