diff options
Diffstat (limited to 'src/renderer/gameserver/serverView/info.ts')
-rw-r--r-- | src/renderer/gameserver/serverView/info.ts | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/renderer/gameserver/serverView/info.ts b/src/renderer/gameserver/serverView/info.ts new file mode 100644 index 0000000..b37562a --- /dev/null +++ b/src/renderer/gameserver/serverView/info.ts @@ -0,0 +1,48 @@ +import { NewsType, News } from "../news"; +import { shell } from "electron"; +import { GameServerPage } from "./serverPage"; + +export class ServerInfoPage extends GameServerPage { + + public getPage(): HTMLElement { + const content = document.createElement('div'); + content.classList.add("infoServerPage"); + + const title = document.createElement('div'); + title.classList.add("title"); + title.innerText = this.server.name; + content.appendChild(title); + + const socialContainer = document.createElement('div'); + socialContainer.classList.add("socialContainer"); + setTimeout(() => { + this.server.socialLinks.forEach((link) => { + socialContainer.appendChild(link.getHTML()); + }); + }, 5); + content.appendChild(socialContainer); + + const shrtDsrption = document.createElement('div'); + shrtDsrption.classList.add("shortDescription"); + shrtDsrption.innerText = this.server.shortDescription; + content.appendChild(shrtDsrption); + if (this.server.newsLatestPage && this.server.newsLatestPage != null) { + const latestNews = document.createElement('div'); + latestNews.classList.add("news"); + content.appendChild(latestNews); + News.get(this.server.newsLatestPage.url, this.server.newsLatestPage.type).then((result: string) => { + latestNews.innerHTML = result; + const aTags = latestNews.getElementsByTagName("a"); + for (var i = 0; i < aTags.length; i++) { + const href = aTags[i].href.toString(); + aTags[i].addEventListener('click', () => { + shell.openExternal(href); + }); + aTags[i].href = "#"; + } + }); + } + + return content; + } +}
\ No newline at end of file |