diff --git a/html/account-linking.html b/html/account-linking.html new file mode 100644 index 0000000..0fcaf66 --- /dev/null +++ b/html/account-linking.html @@ -0,0 +1,49 @@ +{{ if .discordEnabled }} + +{{ end }} +{{ if .telegramEnabled }} + +{{ end }} +{{ if .matrixEnabled }} + +{{ end }} diff --git a/html/form.html b/html/form.html index 1ef1820..ef2b888 100644 --- a/html/form.html +++ b/html/form.html @@ -26,53 +26,7 @@

{{ .strings.confirmationRequiredMessage }}

- {{ if .telegramEnabled }} - - {{ end }} - {{ if .discordEnabled }} - - {{ end }} - {{ if .matrixEnabled }} - - {{ end }} + {{ template "account-linking.html" . }}
diff --git a/html/user.html b/html/user.html index 3de47a7..5135c2e 100644 --- a/html/user.html +++ b/html/user.html @@ -41,49 +41,7 @@
- - - + {{ template "account-linking.html" . }}
diff --git a/lang/form/en-us.json b/lang/form/en-us.json index 715d0d3..1e132b3 100644 --- a/lang/form/en-us.json +++ b/lang/form/en-us.json @@ -20,7 +20,8 @@ "sendPIN": "Send the PIN below to the bot, then come back here to link your account.", "sendPINDiscord": "Type {command} in {server_channel} on Discord, then send the PIN below.", "matrixEnterUser": "Enter your User ID, press submit, and a PIN will be sent to you. Enter it here to continue.", - "welcomeUser": "Welcome, {user}!" + "welcomeUser": "Welcome, {user}!", + "joinTheServer": "Join the server:" }, "notifications": { "errorUserExists": "User already exists.", diff --git a/ts/modules/account-linking.ts b/ts/modules/account-linking.ts index 76e34c5..5902732 100644 --- a/ts/modules/account-linking.ts +++ b/ts/modules/account-linking.ts @@ -75,13 +75,15 @@ export class Discord { const link = document.getElementById("discord-invite") as HTMLAnchorElement; link.href = inv.invite; link.target = "_blank"; + let innerHTML = `${window.lang.strings("joinTheServer")}`; if (inv.icon != "") { - link.innerHTML = `${window.discordServerName}`; + innerHTML += `${window.discordServerName}`; } else { - link.innerHTML = ` + innerHTML += ` ${window.discordServerName} `; } + link.innerHTML = innerHTML; }); private _checkVerified = () => { diff --git a/ts/user.ts b/ts/user.ts index 465dfd9..340f7e5 100644 --- a/ts/user.ts +++ b/ts/user.ts @@ -35,9 +35,15 @@ window.modals = {} as Modals; (() => { window.modals.login = new Modal(document.getElementById("modal-login"), true); window.modals.email = new Modal(document.getElementById("modal-email"), false); - window.modals.discord = new Modal(document.getElementById("modal-discord"), false); - window.modals.telegram = new Modal(document.getElementById("modal-telegram"), false); - window.modals.matrix = new Modal(document.getElementById("modal-matrix"), false); + if (window.discordEnabled) { + window.modals.discord = new Modal(document.getElementById("modal-discord"), false); + } + if (window.telegramEnabled) { + window.modals.telegram = new Modal(document.getElementById("modal-telegram"), false); + } + if (window.matrixEnabled) { + window.modals.matrix = new Modal(document.getElementById("modal-matrix"), false); + } })(); window.notifications = new notificationBox(document.getElementById('notification-box') as HTMLDivElement, 5);