New page loading and error cases:

* adding new custom elements: spinner and error
* using them on async tasks
This commit is contained in:
John Livingston
2024-06-11 16:25:05 +02:00
parent 75ac7a1052
commit 597afc8ba6
9 changed files with 55 additions and 6 deletions

View File

@ -230,6 +230,8 @@ export class ChannelConfigurationElement extends LivechatElement {
}
return this._asyncTaskRender.render({
pending: () => html`<livechat-spinner></livechat-spinner>`,
error: () => html`<livechat-error></livechat-error>`,
complete: () => html`
<div class="margin-content peertube-plugin-livechat-configuration
peertube-plugin-livechat-configuration-channel">

View File

@ -71,7 +71,8 @@ export class ChannelEmojisElement extends LivechatElement {
}
}
return this._asyncTaskRender.render({
pending: () => {},
pending: () => html`<livechat-spinner></livechat-spinner>`,
error: () => html`<livechat-error></livechat-error>`,
complete: () => html`
<div
class="margin-content peertube-plugin-livechat-configuration peertube-plugin-livechat-configuration-channel"
@ -150,10 +151,7 @@ export class ChannelEmojisElement extends LivechatElement {
</div>
</form>
</div>
`,
error: (err: any) => {
this.registerClientOptions?.peertubeHelpers.notifier.error(err.toString())
}
`
})
}

View File

@ -47,6 +47,8 @@ export class ChannelHomeElement extends LivechatElement {
protected override render = (): unknown => {
return this._asyncTaskRender.render({
pending: () => html`<livechat-spinner></livechat-spinner>`,
error: () => html`<livechat-error></livechat-error>`,
complete: () => html`
<div class="margin-content peertube-plugin-livechat-configuration peertube-plugin-livechat-configuration-home">
<h1>
@ -62,7 +64,7 @@ export class ChannelHomeElement extends LivechatElement {
<a href="${channel.livechatConfigurationUri}">
${channel.avatar
? html`<img class="avatar channel" src="${channel.avatar.path}">`
: html`<div class="avatar channel initial gray"></div>`
: html`<div class="avatar channel initial gray"></div>`
}
</a>
<div class="peertube-plugin-livechat-configuration-home-info">