diff options
Diffstat (limited to 'includes/fragments')
-rw-r--r-- | includes/fragments/dashboard.inc | 267 | ||||
-rw-r--r-- | includes/fragments/member.inc | 2 | ||||
-rw-r--r-- | includes/fragments/metadata.inc | 2 |
3 files changed, 269 insertions, 2 deletions
diff --git a/includes/fragments/dashboard.inc b/includes/fragments/dashboard.inc new file mode 100644 index 0000000..2a6d905 --- /dev/null +++ b/includes/fragments/dashboard.inc @@ -0,0 +1,267 @@ +<?php + +if (isset($_GET["ec"])) { + header("HTTP/1.1 " . $_GET["ec"] . " Error"); +} + +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; $title = "Dashboard"; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; global $readOnly; global $isNormallyLoggedIn; global $_PROFILE; global $lang; global $pages; global $isLowerLoggedIn; global $app; global $isLoggedIn; + +global $use2023UI; + +?> + + <br> + <div class="container"> + <?php if (isset($_GET['em'])): ?> + <div class="alert alert-danger alert-dismissible"> + <button onclick='window.history.pushState({"html":null,"pageTitle":document.title},"", "/");' type="button" class="btn-close" data-bs-dismiss="alert"></button> + <b><?= $lang["home"]["error"] ?> </b><?= strip_tags(base64_decode($_GET['em'])) ?> + </div> + <?php endif; ?> + + <div class="alert alert-warning alert-dismissible" id="gpuWarning" style="display: none;"> + <button onclick='window.history.pushState({"html":null,"pageTitle":document.title},"", "/");' type="button" class="btn-close" data-bs-dismiss="alert"></button> + <b>GPU acceleration is turned off or not supported.</b> A lot of visual effects on this website rely on GPU acceleration, which is currently disabled on your browser, meaning the website's overall look will be affected. Please enable GPU acceleration in your browser settings. + </div> + + <style> + .day-gradient { + background-image: linear-gradient(180deg, rgba(7,15,36,1) 0%, rgba(36,56,83,1) 14%, rgba(165,126,57,1) 28%, rgba(37,109,201,1) 42%, rgba(47,165,208,1) 57%, rgba(252,120,15,1) 71%, rgba(38,66,97,1) 85%, rgba(7,15,36,1) 100%); + background-size: 100% 1000%; + } + + .invert { + filter: invert(1) hue-rotate(180deg); + } + + @media (max-width: 800px) { + #schedules { + grid-template-columns: 1fr !important; + } + + .schedules-separator { + display: block !important; + } + } + </style> + + <h2> + <span id="greeting">Hi</span> <span><?php + + $fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($_PROFILE["login"] === "raindrops" ? "gdapd" : ($_PROFILE["login"] === "cloudburst" ? "ynmuc" : ($_PROFILE["login"] === "Moonwind" ? "hrbom" : "other"))) . "/fronters.json"), true); + $name = ($_PROFILE["login"] === "raindrops" ? "Raindrops System" : ($_PROFILE["login"] === "cloudburst" ? "Cloudburst System" : ($_PROFILE["login"] === "Moonwind" ? "Moonglow" : $app["other"]["name"]))); + + if (isset($fronters["members"][0])) { + $name = implode(" and ", array_map(function ($i) { + return $i["display_name"] ?? $i["name"]; + }, $fronters["members"])); + } + + echo $name; + + ?>!</span> + </h2> + <script> + let greeting = "Hi"; + + switch (new Date().getHours()) { + case 22: + case 23: + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + greeting = "Good night"; + break; + + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + greeting = "Good morning"; + break; + + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + greeting = "Good afternoon"; + break; + + case 18: + case 19: + case 20: + case 21: + greeting = "Good evening"; + break; + } + + document.getElementById("greeting").innerText = greeting; + </script> + + <div id="schedules" style="margin-top: 20px; display: grid; grid-template-columns: repeat(4, 1fr); grid-gap: 20px;"> + <div> + <div id="live-time-other-outer" class="day-gradient" style="text-align: center; background-color: rgba(255, 255, 255, .1); padding: 20px 0; border-radius: 10px;"> + <b><?= $app["other"]["name"] ?></b><br> + <h3 id="live-time-other">--:--</h3> + </div> + + <hr style="display: none;" class="schedules-separator"> + </div> + + <div> + <div id="live-time-cloudburst-outer" class="day-gradient" style="text-align: center; background-color: rgba(255, 255, 255, .1); padding: 20px 0; border-radius: 10px;"> + <b>Cloudburst System</b><br> + <h3 id="live-time-cloudburst">--:--</h3> + </div> + + <hr style="display: none;" class="schedules-separator"> + </div> + + <div> + <div id="live-time-raindrops-outer" class="day-gradient" style="text-align: center; background-color: rgba(255, 255, 255, .1); padding: 20px 0; border-radius: 10px;"> + <b>Raindrops System</b><br> + <h3 id="live-time-raindrops">--:--</h3> + </div> + </div> + + <div> + <div id="live-time-moonwind-outer" class="day-gradient" style="text-align: center; background-color: rgba(255, 255, 255, .1); padding: 20px 0; border-radius: 10px;"> + <b>Moonglow</b><br> + <h3 id="live-time-moonwind">--:--</h3> + </div> + </div> + </div> + + <script> + function getDayPercentage(time) { + let hours = parseInt(time.split(":")[0]); + let minutes = parseInt(time.split(":")[1].split(" ")[0]); + + if (time.split(":")[1].split(" ")[1] === "PM") hours += 12; + if (hours === 12 && time.split(":")[1].split(" ")[1] === "AM") hours = 0; + if (hours === 24 && time.split(":")[1].split(" ")[1] === "PM") hours = 12; + + let timestamp = new Date("1970-01-01 " + hours + ":" + minutes + " UTC").getTime() / 1000; + + return (timestamp / 86400) * 100; + } + + function updateTime() { + let time1 = (new Intl.DateTimeFormat('en-US', { + timeZone: 'Europe/Paris', + hour: 'numeric', + minute: '2-digit', + hour12: false + })).format(new Date()); + + document.getElementById("live-time-raindrops").innerText = time1; + document.getElementById("live-time-raindrops-outer").style.backgroundPositionY = getDayPercentage(time1) + "%"; + + let time4 = (new Intl.DateTimeFormat('en-US', { + timeZone: 'Europe/Kyiv', + hour: 'numeric', + minute: '2-digit', + hour12: false + })).format(new Date()); + + document.getElementById("live-time-moonwind").innerText = time4; + document.getElementById("live-time-moonwind-outer").style.backgroundPositionY = getDayPercentage(time4) + "%"; + + let time2 = (new Intl.DateTimeFormat('en-US', { + timeZone: 'Europe/London', + hour: 'numeric', + minute: '2-digit', + hour12: false + })).format(new Date()); + + document.getElementById("live-time-cloudburst").innerText = time2; + document.getElementById("live-time-cloudburst-outer").style.backgroundPositionY = getDayPercentage(time2) + "%"; + + let time3 = (new Intl.DateTimeFormat('en-US', { + timeZone: 'America/Chicago', + hour: 'numeric', + minute: '2-digit', + hour12: false + })).format(new Date()); + + document.getElementById("live-time-other").innerText = time3; + document.getElementById("live-time-other-outer").style.backgroundPositionY = getDayPercentage(time3) + "%"; + } + + updateTime(); + + setInterval(() => { + updateTime(); + }, 10000); + </script> + + <div id="timeline-container" style="background: #3332328a;padding: 5px 10px;border-radius: 10px; margin-top: 20px;"> + <div id="timeline"></div> + <script> + async function refreshTimeline() { + document.getElementById("timeline").innerHTML = await (await fetch("/api/timeline?gdapd&ynmuc<?= ($isLowerLoggedIn || $isLoggedIn) ? "&" . $app["other"]["id"] : "" ?>&hrbom")).text(); + + Array.from(document.getElementsByClassName("dynamic-time")).forEach((el) => { + let time = el.getAttribute("data-time"); + el.innerText = new Date(parseInt(time) * 1000).toTimeString().split(":").splice(0, 2).join(":"); + }); + + Array.from(document.getElementsByClassName("dynamic-time-mobile")).forEach((el) => { + let time = el.getAttribute("data-time"); + el.innerText = new Date(parseInt(time) * 1000).toTimeString().split(":")[0] + ":"; + }); + } + + setInterval(refreshTimeline, 10000); + refreshTimeline(); + </script> + </div> + + <div style="display: grid; grid-template-columns: 1fr 2fr; grid-gap: 20px;" id="home-parts"> + <div style="background-color: var(--palette-2) !important; margin-top: 20px; border-radius: 10px;"> + <div class="list-group"> + <a href="/cloudburst" class="list-group-item list-group-item-action" style="display: flex; align-items: center;"> + <img src="/assets/avatars/ade46823206b4b0cad3ccaae934a5f3b.webp" style="margin-right: 5px; width: 24px;"><div style="vertical-align: middle; display: flex; align-items: center; color: var(--bs-body-color);">Cloudburst System</div> + </a> + <a href="/raindrops" class="list-group-item list-group-item-action" style="display: flex; align-items: center;"> + <img src="/assets/avatars/7d9f543ef74240f69d0786c3f2983124.webp" style="margin-right: 5px; width: 24px;"><div style="vertical-align: middle; display: flex; align-items: center; color: var(--bs-body-color);">Raindrops System</div> + </a> + <a href="/<?= $app["other"]["slug"] ?>" class="list-group-item list-group-item-action" style="display: flex; align-items: center;"> + <img src="/assets/avatars/64fb19057fae41cfac0f844e9e186848.webp" style="margin-right: 5px; width: 24px;"><div style="vertical-align: middle; display: flex; align-items: center; color: var(--bs-body-color);"><?= $app["other"]["name"] ?></div> + </a> + <a href="/moonglow" class="list-group-item list-group-item-action" style="display: flex; align-items: center;"> + <img src="/assets/avatars/d1cd97eb9c924e4294cd4397a5074ff9.webp" style="margin-right: 5px; width: 24px;"><div style="vertical-align: middle; display: flex; align-items: center; color: var(--bs-body-color);">Moonwind</div> + </a> + <a href="/-/wakeup" class="list-group-item list-group-item-action" style="display: grid; grid-template-columns: max-content 1fr;"> + <img src="/assets/icons/new/wakeup.svg?color=474747" style="margin-right: 5px; height: 24px; width: 24px;"><div style="display: flex; align-items: center; color: var(--bs-body-color);">Wake-up alert</div> + </a> + <a href="/-/byfront" class="list-group-item list-group-item-action" style="display: grid; grid-template-columns: max-content 1fr;"> + <img src="/assets/icons/new/front.svg?color=474747" style="margin-right: 5px; height: 24px; width: 24px;"><div style="display: flex; align-items: center; color: var(--bs-body-color);">By last fronted date</div> + </a> + <a href="https://countdown.equestria.horse" target="_blank" class="list-group-item list-group-item-action" style="display: grid; grid-template-columns: max-content 1fr;"> + <img src="/assets/icons/new/schedule.svg?color=474747" style="margin-right: 5px; height: 24px; width: 24px;"><div style="display: flex; align-items: center; color: var(--bs-body-color);">Meet-up countdown</div> + </a> + <a href="https://plex.equestria.horse" target="_blank" class="list-group-item list-group-item-action" style="display: grid; grid-template-columns: max-content 1fr;"> + <img src="https://plex.equestria.horse/web/favicon.ico" style="margin-right: 5px; height: 24px; width: 24px;"><div style="display: flex; align-items: center; color: var(--bs-body-color);">Plex</div> + </a> + <a href="https://live.equestria.dev" target="_blank" class="list-group-item list-group-item-action" style="display: grid; grid-template-columns: max-content 1fr;"> + <img src="https://avatars.githubusercontent.com/u/8463692?s=128" style="margin-right: 5px; height: 24px; width: 24px;"><div style="display: flex; align-items: center; color: var(--bs-body-color);">Streaming server</div> + </a> + <a href="https://mist.equestria.horse" target="_blank" class="list-group-item list-group-item-action" style="display: grid; grid-template-columns: max-content 1fr;"> + <img src="https://mist.equestria.horse/icons/normal_128x128.png" style="margin-right: 5px; height: 24px; width: 24px;"><div style="display: flex; align-items: center; color: var(--bs-body-color);">Mist</div> + </a> + </div> + </div> + <div style="background-color: var(--palette-2) !important; text-align: center; margin-top: 20px; border-radius: 10px; display: flex; align-items: center; justify-content: center;"> + <div style="color: var(--palette-9);">There is nothing here yet, check back later!</div> + </div> + </div> + </div> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?>
\ No newline at end of file diff --git a/includes/fragments/member.inc b/includes/fragments/member.inc index 10cd241..8b153fa 100644 --- a/includes/fragments/member.inc +++ b/includes/fragments/member.inc @@ -135,7 +135,7 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/ponies/" . $memberID . ".pn </div> <div class="container"> - <?php global $isLoggedIn; global $isLowerLoggedIn; if ($isLoggedIn || ($isLowerLoggedIn && $systemID === $app["other"]["id"])): ?> + <?php global $isLoggedIn; global $isLowerLoggedIn; if ($isLoggedIn || ($isLowerLoggedIn && ($systemID === $app["other"]["id"] || $systemID === "hrbom"))): ?> <hr> <details> diff --git a/includes/fragments/metadata.inc b/includes/fragments/metadata.inc index da3c326..6449dc0 100644 --- a/includes/fragments/metadata.inc +++ b/includes/fragments/metadata.inc @@ -266,7 +266,7 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member <h3>Age and birth</h3> <p> - <b>Birth date (use January 1<sup>st</sup> for none, fixed age takes priority over birth year if applicable)</b><br> + <b>Birthdate (use January 1<sup>st</sup> for none, fixed age takes priority over birth year if applicable)</b><br> <input name="birth" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="date" value="<?= $metadata["birth"]["year"] ?? "" ?>-<?= $metadata["birth"]["date"] ?? "" ?>"> </p> <p> |