Add configurable Discord link

This commit is contained in:
Andrio Celos 2022-12-20 11:30:10 +11:00
parent 59e9de56ce
commit 051d568269
3 changed files with 11 additions and 2 deletions

View File

@ -57,7 +57,7 @@
</form>
<footer>
<p>This website is not affiliated with Nintendo. All product names, logos, and brands are property of their respective owners.</p>
<p><a href="https://github.com/AndrioCelos/TableturfBattleApp">GitHub</a></p>
<p><a href="https://github.com/AndrioCelos/TableturfBattleApp">GitHub</a><span id="discordSection"> | <a id="discordLink">Discord</a></span></p>
</footer>
</div>
<div id="lobbyPage" hidden>

View File

@ -1,7 +1,9 @@
interface Config {
apiBaseUrl: string,
qrCodeGameUrl: string | null | undefined,
qrCodeCorrectionLevel: QRCode.CorrectLevel | keyof typeof QRCode.CorrectLevel | undefined
qrCodeCorrectionLevel: QRCode.CorrectLevel | keyof typeof QRCode.CorrectLevel | undefined,
discordUrl?: string,
discordTitle?: string
}
declare var config: Config;

View File

@ -373,6 +373,13 @@ function clearChildren(el: Element) {
el.removeChild(el2);
}
if (config.discordUrl) {
(document.getElementById('discordLink') as HTMLLinkElement).href = config.discordUrl;
if (config.discordTitle)
(document.getElementById('discordLink') as HTMLLinkElement).innerText = `Discord ${config.discordTitle}`;
} else
document.getElementById('discordSection')!.hidden = true;
Promise.all([ cardDatabase.loadAsync().then(initCardDatabase), stageDatabase.loadAsync().then(initStageDatabase) ])
.then(() => {
initialised = true;