Additional typing fixes
This commit is contained in:
@@ -18,16 +18,16 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Scene, push_scene, pop_scene, scene_stack } from "./scene_manager.js";
|
||||
import { CreateEditCollectionScene } from "./CreateEditCollectionScene.js";
|
||||
import { CreateShareCollectionScene } from "./ShareCollectionScene.js";
|
||||
import { UploadCollectionScene } from "./UploadCollectionScene.js";
|
||||
import { DeleteCollectionScene } from "./DeleteCollectionScene.js";
|
||||
import { LoadingScene } from "./LoadingScene.js";
|
||||
import { CreateShareCollectionScene } from "./ShareCollectionScene.js";
|
||||
import { UploadCollectionScene } from "./UploadCollectionScene.js";
|
||||
import { get_collections } from "./api.js";
|
||||
import { Collection, CollectionType } from "./models.js";
|
||||
import { bytesToHumanReadable } from "./utils.js";
|
||||
import { SERVER } from "./constants.js";
|
||||
import { Collection, CollectionType } from "./models.js";
|
||||
import { Scene, pop_scene, push_scene, scene_stack } from "./scene_manager.js";
|
||||
import { bytesToHumanReadable } from "./utils.js";
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
@@ -38,7 +38,8 @@ import { SERVER } from "./constants.js";
|
||||
* @param {function(string):void} onerror Called when an error occurs, before the
|
||||
* scene is popped.
|
||||
*/
|
||||
export function CollectionsScene(user, password, collection, onerror) {
|
||||
export class CollectionsScene {
|
||||
constructor(user, password, collection, onerror) {
|
||||
/** @type {HTMLElement} */ let html_scene = document.getElementById("collectionsscene");
|
||||
/** @type {HTMLElement} */ let template = html_scene.querySelector("[data-name=collectiontemplate]");
|
||||
/** @type {HTMLElement} */ let new_btn = html_scene.querySelector("[data-name=new]");
|
||||
@@ -100,16 +101,17 @@ export function CollectionsScene(user, password, collection, onerror) {
|
||||
}
|
||||
|
||||
function show_collections(collections) {
|
||||
let heightOfNavBar = document.querySelector("#logoutview").offsetHeight + "px";
|
||||
/** @type {HTMLElement} */ let navBar = document.querySelector("#logoutview");
|
||||
let heightOfNavBar = navBar.offsetHeight + "px";
|
||||
html_scene.style.marginTop = heightOfNavBar;
|
||||
html_scene.style.height = "calc(100vh - " + heightOfNavBar + ")";
|
||||
collections.forEach(function (collection) {
|
||||
/** @type {HTMLElement} */ let node = template.cloneNode(true);
|
||||
/** @type {HTMLElement} */ let node = /** @type {HTMLElement} */(template.cloneNode(true));
|
||||
node.classList.remove("hidden");
|
||||
/** @type {HTMLElement} */ let title_form = node.querySelector("[data-name=title]");
|
||||
/** @type {HTMLElement} */ let description_form = node.querySelector("[data-name=description]");
|
||||
/** @type {HTMLElement} */ let contentcount_form = node.querySelector("[data-name=contentcount]");
|
||||
/** @type {HTMLElement} */ let url_form = node.querySelector("[data-name=url]");
|
||||
/** @type {HTMLInputElement} */ let url_form = node.querySelector("[data-name=url]");
|
||||
/** @type {HTMLElement} */ let color_form = node.querySelector("[data-name=color]");
|
||||
/** @type {HTMLElement} */ let delete_btn = node.querySelector("[data-name=delete]");
|
||||
/** @type {HTMLElement} */ let edit_btn = node.querySelector("[data-name=edit]");
|
||||
@@ -213,3 +215,4 @@ export function CollectionsScene(user, password, collection, onerror) {
|
||||
collections = null;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ import {
|
||||
server_features,
|
||||
} from "./api.js";
|
||||
import { Collection } from "./models.js";
|
||||
import { pop_scene, scene_stack } from "./scene_manager.js";
|
||||
import { Scene, pop_scene, scene_stack } from "./scene_manager.js";
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
@@ -34,17 +34,25 @@ import { pop_scene, scene_stack } from "./scene_manager.js";
|
||||
* @param {string} password
|
||||
* @param {Collection} collection The collection on which to edit sharing setting. Must exist.
|
||||
*/
|
||||
export function CreateShareCollectionScene(user, password, collection) {
|
||||
/**
|
||||
* @constructor
|
||||
* @implements {Scene}
|
||||
* @param {string} user
|
||||
* @param {string} password
|
||||
* @param {Collection} collection The collection on which to edit sharing setting. Must exist.
|
||||
*/
|
||||
export class CreateShareCollectionScene {
|
||||
constructor(user, password, collection) {
|
||||
/** @type {?number} */ let scene_index = null;
|
||||
|
||||
let html_scene = document.getElementById("sharecollectionscene");
|
||||
|
||||
/** @type {HTMLElement} */ let cancel_btn = html_scene.querySelector("[data-name=cancel]");
|
||||
/** @type {HTMLElement} */ let share_by_token_btn_ro = html_scene.querySelector(
|
||||
"[data-name=sharebytoken_ro]",
|
||||
"[data-name=sharebytoken_ro]"
|
||||
);
|
||||
/** @type {HTMLElement} */ let share_by_token_btn_rw = html_scene.querySelector(
|
||||
"[data-name=sharebytoken_rw]",
|
||||
"[data-name=sharebytoken_rw]"
|
||||
);
|
||||
|
||||
/** @type {HTMLElement} */ let title = html_scene.querySelector("[data-name=title]");
|
||||
@@ -93,6 +101,7 @@ export function CreateShareCollectionScene(user, password, collection) {
|
||||
scene_index = null;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function update_share_list(user, password, collection) {
|
||||
let share_rows = document.querySelectorAll(
|
||||
|
||||
@@ -21,19 +21,21 @@
|
||||
/**
|
||||
* @interface
|
||||
*/
|
||||
export function Scene() {}
|
||||
export class Scene {
|
||||
constructor() { }
|
||||
/**
|
||||
* Scene is on top of stack and visible.
|
||||
*/
|
||||
Scene.prototype.show = function() {};
|
||||
show() { }
|
||||
/**
|
||||
* Scene is no longer visible.
|
||||
*/
|
||||
Scene.prototype.hide = function() {};
|
||||
hide() { }
|
||||
/**
|
||||
* Scene is removed from scene stack.
|
||||
*/
|
||||
Scene.prototype.release = function() {};
|
||||
release() { }
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user