aboutsummaryrefslogtreecommitdiff
path: root/client-web/source/resource/file.ts
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2023-09-07 20:24:21 +0200
committermetamuffin <metamuffin@disroot.org>2023-09-07 20:24:21 +0200
commitf5fa4f7d58344c2dc722d1f37c1d7a008f6ee9b3 (patch)
treec7ac2a7497670745c73f927abf264d63a5a4805d /client-web/source/resource/file.ts
parent2d0761b8932f11b01e241e2db3a8f08250efe878 (diff)
downloadkeks-meet-f5fa4f7d58344c2dc722d1f37c1d7a008f6ee9b3.tar
keks-meet-f5fa4f7d58344c2dc722d1f37c1d7a008f6ee9b3.tar.bz2
keks-meet-f5fa4f7d58344c2dc722d1f37c1d7a008f6ee9b3.tar.zst
new element creation helper
Diffstat (limited to 'client-web/source/resource/file.ts')
-rw-r--r--client-web/source/resource/file.ts22
1 files changed, 11 insertions, 11 deletions
diff --git a/client-web/source/resource/file.ts b/client-web/source/resource/file.ts
index 4deb1b6..701383b 100644
--- a/client-web/source/resource/file.ts
+++ b/client-web/source/resource/file.ts
@@ -5,7 +5,7 @@
*/
/// <reference lib="dom" />
-import { display_filesize, ebutton, ediv, espan, sleep } from "../helper.ts";
+import { display_filesize, e, sleep } from "../helper.ts";
import { log } from "../logger.ts";
import { StreamDownload } from "../download_stream.ts";
import { RemoteUser } from "../user/remote.ts";
@@ -16,17 +16,17 @@ const MAX_CHUNK_SIZE = 1 << 15;
export const resource_file: ResourceHandlerDecl = {
kind: "file",
new_remote(info, user, enable) {
- const download_button = ebutton("Download", {
+ const download_button = e("button", {
onclick: self => {
enable()
self.textContent = "Downloading…"
self.disabled = true
}
- })
+ }, "Download")
return {
info,
- el: ediv({},
- espan(`File: ${JSON.stringify(info.label)} (${display_filesize(info.size!)})`),
+ el: e("div", {},
+ e("span", {}, `File: ${JSON.stringify(info.label)} (${display_filesize(info.size!)})`),
download_button,
),
on_statechange(_s) { },
@@ -114,15 +114,15 @@ export function create_file_res(): Promise<LocalResource> {
}
function file_res_inner(file: File): LocalResource {
- const transfers_el = ediv({})
+ const transfers_el = e("div", {})
const transfers_abort = new Set<() => void>()
return {
info: { kind: "file", id: Math.random().toString(), label: file.name, size: file.size },
destroy() {
transfers_abort.forEach(abort => abort())
},
- el: ediv({ class: "file" },
- espan(`Sharing file: ${JSON.stringify(file.name)}`),
+ el: e("div", { class: "file" },
+ e("span", {}, `Sharing file: ${JSON.stringify(file.name)}`),
transfers_el
),
on_request(user, create_channel) {
@@ -189,10 +189,10 @@ function file_res_inner(file: File): LocalResource {
}
function transfer_status_el(remote: RemoteUser) {
- const status = espan("…")
- const bar = ediv({ class: "progress-bar" });
+ const status = e("span", {}, "…")
+ const bar = e("div", { class: "progress-bar" });
return {
- el: ediv({ class: "transfer-status" }, status, bar),
+ el: e("div", { class: "transfer-status" }, status, bar),
set status(s: string) {
status.textContent = `${remote.display_name}: ${s}`
},