Begin integrating components with lit

This commit is contained in:
Mehdi Benadel
2024-05-09 22:32:42 +02:00
parent 9ff4abfce4
commit 2638e137b3
6 changed files with 176 additions and 53 deletions

View File

@ -5,6 +5,7 @@
import type { RegisterClientOptions } from '@peertube/peertube-types/client'
import { renderConfigurationHome } from './templates/home'
import { renderConfigurationChannel } from './templates/channel'
import { render } from 'lit'
/**
* Registers stuff related to the user's configuration pages.
@ -19,7 +20,7 @@ async function registerConfiguration (clientOptions: RegisterClientOptions): Pro
registerClientRoute({
route: 'livechat/configuration',
onMount: async ({ rootEl }) => {
rootEl.innerHTML = await renderConfigurationHome(clientOptions)
render(await renderConfigurationHome(clientOptions), rootEl)
}
})
@ -28,7 +29,7 @@ async function registerConfiguration (clientOptions: RegisterClientOptions): Pro
onMount: async ({ rootEl }) => {
const urlParams = new URLSearchParams(window.location.search)
const channelId = urlParams.get('channelId') ?? ''
await renderConfigurationChannel(clientOptions, channelId, rootEl)
render(await renderConfigurationChannel(clientOptions, channelId, rootEl), rootEl)
}
})