mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
fix memory leak in settings view by using nested template builder
This commit is contained in:
parent
04a1d89907
commit
bfaeffcb51
@ -27,7 +27,7 @@ export class SettingsView extends TemplateView {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const row = (label, content, extraClass = "") => {
|
const row = (t, label, content, extraClass = "") => {
|
||||||
return t.div({className: `row ${extraClass}`}, [
|
return t.div({className: `row ${extraClass}`}, [
|
||||||
t.div({className: "label"}, label),
|
t.div({className: "label"}, label),
|
||||||
t.div({className: "content"}, content),
|
t.div({className: "content"}, content),
|
||||||
@ -38,9 +38,9 @@ export class SettingsView extends TemplateView {
|
|||||||
|
|
||||||
settingNodes.push(
|
settingNodes.push(
|
||||||
t.h3("Session"),
|
t.h3("Session"),
|
||||||
row(vm.i18n`User ID`, vm.userId),
|
row(t, vm.i18n`User ID`, vm.userId),
|
||||||
row(vm.i18n`Session ID`, vm.deviceId, "code"),
|
row(t, vm.i18n`Session ID`, vm.deviceId, "code"),
|
||||||
row(vm.i18n`Session key`, vm.fingerprintKey, "code")
|
row(t, vm.i18n`Session key`, vm.fingerprintKey, "code")
|
||||||
);
|
);
|
||||||
settingNodes.push(
|
settingNodes.push(
|
||||||
t.h3("Session Backup"),
|
t.h3("Session Backup"),
|
||||||
@ -59,7 +59,7 @@ export class SettingsView extends TemplateView {
|
|||||||
const buttonLabel = vm => vm.pushNotifications.enabled ?
|
const buttonLabel = vm => vm.pushNotifications.enabled ?
|
||||||
vm.i18n`Disable`:
|
vm.i18n`Disable`:
|
||||||
vm.i18n`Enable`;
|
vm.i18n`Enable`;
|
||||||
return row(label, t.button({
|
return row(t, label, t.button({
|
||||||
onClick: () => vm.togglePushNotifications(),
|
onClick: () => vm.togglePushNotifications(),
|
||||||
disabled: vm => vm.pushNotifications.updating
|
disabled: vm => vm.pushNotifications.updating
|
||||||
}, buttonLabel));
|
}, buttonLabel));
|
||||||
@ -92,13 +92,13 @@ export class SettingsView extends TemplateView {
|
|||||||
|
|
||||||
settingNodes.push(
|
settingNodes.push(
|
||||||
t.h3("Preferences"),
|
t.h3("Preferences"),
|
||||||
row(vm.i18n`Scale down images when sending`, this._imageCompressionRange(t, vm)),
|
row(t, vm.i18n`Scale down images when sending`, this._imageCompressionRange(t, vm)),
|
||||||
);
|
);
|
||||||
settingNodes.push(
|
settingNodes.push(
|
||||||
t.h3("Application"),
|
t.h3("Application"),
|
||||||
row(vm.i18n`Version`, version),
|
row(t, vm.i18n`Version`, version),
|
||||||
row(vm.i18n`Storage usage`, vm => `${vm.storageUsage} / ${vm.storageQuota}`),
|
row(t, vm.i18n`Storage usage`, vm => `${vm.storageUsage} / ${vm.storageQuota}`),
|
||||||
row(vm.i18n`Debug logs`, t.button({onClick: () => vm.exportLogs()}, "Export")),
|
row(t, vm.i18n`Debug logs`, t.button({onClick: () => vm.exportLogs()}, "Export")),
|
||||||
t.p(["Debug logs contain application usage data including your username, the IDs or aliases of the rooms or groups you have visited, the usernames of other users and the names of files you send. They do not contain messages. For more information, review our ",
|
t.p(["Debug logs contain application usage data including your username, the IDs or aliases of the rooms or groups you have visited, the usernames of other users and the names of files you send. They do not contain messages. For more information, review our ",
|
||||||
t.a({href: "https://element.io/privacy", target: "_blank", rel: "noopener"}, "privacy policy"), "."]),
|
t.a({href: "https://element.io/privacy", target: "_blank", rel: "noopener"}, "privacy policy"), "."]),
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user