Channels list UI

This commit is contained in:
John Livingston
2023-09-20 14:59:01 +02:00
parent 6c966f608b
commit 19264fb915
4 changed files with 130 additions and 5 deletions

View File

@ -52,7 +52,7 @@ async function renderConfigurationChannel (
}
return Mustache.render(`
<div class="margin-content">
<div class="margin-content peertube-plugin-livechat-configuration">
<h1>{{title}} {{channelConfiguration.channel.displayName}}</h1>
<p>{{description}}</p>
<form livechat-configuration-channel-options>

View File

@ -17,6 +17,7 @@ async function renderConfigurationHome (registerClientOptions: RegisterClientOpt
throw new Error('Can\'t get the current username.')
}
// FIXME: if more than 100 channels, loop (or add a pagination)
const channels = await (await fetch(
'/api/v1/accounts/' + encodeURIComponent(username) + '/video-channels?start=0&count=100&sort=name',
{
@ -40,16 +41,27 @@ async function renderConfigurationHome (registerClientOptions: RegisterClientOpt
}
return Mustache.render(`
<div class="margin-content">
<div class="margin-content peertube-plugin-livechat-configuration peertube-plugin-livechat-configuration-home">
<h1>{{title}}</h1>
<p>{{description}}</p>
<h2>{{please_select}}</h2>
<ul>
<ul class="peertube-plugin-livechat-configuration-home-channels">
{{#channels}}
<li>
<a href="{{livechatConfigurationUri}}">
{{displayName}}
{{#avatar}}
<img class="avatar channel" src="{{path}}">
{{/avatar}}
{{^avatar}}
<div class="avatar channel initial gray"></div>
{{/avatar}}
</a>
<div class="peertube-plugin-livechat-configuration-home-info">
<a href="{{livechatConfigurationUri}}">
<div>{{displayName}}</div>
<div>{{name}}</div>
</a>
</div>
</li>
{{/channels}}
</ul>