mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-11-16 11:51:36 +00:00
The change in this commits are pretty involved but cannot be split
into small commits. The main changes in this commits are:
* Remove declare module * now that we don't need it
* Normalize import paths so typescript is happy
Previously, we were using wrong import paths and so typescript couldn't
really provide full types information for imports. The wrong paths isn't
a bug because it was done to make sure it work when it was imported via a
script tag; we fix this by using require inside the script tag in main.html.
Also, did audit to make sure we correctly use __dirname not that it's
value will be diffrent, it won't be js/ but will be respective to the file
path of the module.
50 lines
1.0 KiB
TypeScript
50 lines
1.0 KiB
TypeScript
'use strict';
|
|
|
|
import BaseSection = require('./base-section');
|
|
import NewServerForm = require('./new-server-form');
|
|
|
|
class ServersSection extends BaseSection {
|
|
// TODO: TypeScript - Here props should be object type
|
|
props: any;
|
|
$newServerContainer: Element;
|
|
constructor(props: any) {
|
|
super();
|
|
this.props = props;
|
|
}
|
|
|
|
template(): string {
|
|
return `
|
|
<div class="add-server-modal">
|
|
<div class="modal-container">
|
|
<div class="settings-pane" id="server-settings-pane">
|
|
<div class="page-title">Add a Zulip organization</div>
|
|
<div id="new-server-container"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
`;
|
|
}
|
|
|
|
init(): void {
|
|
this.initServers();
|
|
}
|
|
|
|
initServers(): void {
|
|
this.props.$root.innerHTML = '';
|
|
|
|
this.props.$root.innerHTML = this.template();
|
|
this.$newServerContainer = document.querySelector('#new-server-container');
|
|
|
|
this.initNewServerForm();
|
|
}
|
|
|
|
initNewServerForm(): void {
|
|
new NewServerForm({
|
|
$root: this.$newServerContainer,
|
|
onChange: this.reloadApp
|
|
}).init();
|
|
}
|
|
}
|
|
|
|
export = ServersSection;
|