diff --git a/web/src/main/javascript/index.ts b/web/src/main/javascript/index.ts index 9e01c701..7c40437c 100644 --- a/web/src/main/javascript/index.ts +++ b/web/src/main/javascript/index.ts @@ -11,12 +11,34 @@ function loadEmbedCalendar(embedKey: string, apiUrl: string) { embedRunner.init(embedKey, apiUrl); } -const body = document.getElementById("page-top"); -if (body!.dataset.embedKey != null) { - loadEmbedCalendar(body!.dataset.embedKey, body!.dataset.apiUrl); -} else if (body!.dataset.apiKey != null) { - loadDashboardGuildPage(body!.dataset.apiKey, - body!.dataset.apiUrl, body!.dataset.userId) +const body = document.getElementById("page-top")!; +if (body.dataset.embedKey != null) { + //This will eventually be a switch or something when we get more embed pages. + loadEmbedCalendar(body.dataset.embedKey, body.dataset.apiUrl); +} else if (body.dataset.dashboard != null) { + //Get the various data attributes we need... + const dash = body.dataset.dashboard; + const apiKey = body.dataset.apiKey; + const apiUrl = body.dataset.apiUrl; + const userId = body.dataset.userId; + + switch (dash.toUpperCase()) { + case "GUILD": + loadDashboardGuildPage(apiKey, apiUrl, userId); + break; + case "CALENDAR": + //TODO: load dashboard calendar page + break; + case "EVENTS": + //TODO: load dashboard events page + break; + case "ANNOUNCEMENTS": + //TODO: load dashboard announcements page + break; + default: + //No default action, if its incorrect we don't do anything. + break; + } } (function ($) { diff --git a/web/src/main/resources/templates/dashboard/dashboard.html b/web/src/main/resources/templates/dashboard/dashboard.html index a9b2fbd8..6b72c38e 100644 --- a/web/src/main/resources/templates/dashboard/dashboard.html +++ b/web/src/main/resources/templates/dashboard/dashboard.html @@ -103,7 +103,7 @@ - -