diff options
Diffstat (limited to 'includes/components/sysbanner.inc')
-rw-r--r-- | includes/components/sysbanner.inc | 88 |
1 files changed, 37 insertions, 51 deletions
diff --git a/includes/components/sysbanner.inc b/includes/components/sysbanner.inc index a650cd0..26a049e 100644 --- a/includes/components/sysbanner.inc +++ b/includes/components/sysbanner.inc @@ -13,49 +13,12 @@ $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pa ?> -<div id="system-info" style="display:grid;grid-template-columns: 128px 1fr;background-color:rgba(255, 255, 255, .05);margin-left: -20px; margin-right: -20px;margin-top:-20px;padding: 20px 20px 10px;"> - <div style="display: flex; align-items: center; justify-content: center;"> - <img src="<?= getAsset($systemID) ?>" alt="" style="width:128px;max-height:128px;border-radius:10px;"> - </div> +<div id="system-info" style="background-color:rgba(255, 255, 255, .05);margin-left: -20px; margin-right: -20px;margin-top:-20px;padding: 0 20px 10px; <?php if ($systemID === $app["other"]["id"]): ?>padding-top: 15px;<?php endif; ?>"> <div style="padding:10px 10px 10px 20px;text-align:center;"> - <div style="display: grid; grid-template-columns: 1fr;height:100%;grid-template-rows: max-content max-content 1fr;"> + <div> + <img src="<?= getAsset($systemID) ?>" alt="" style="margin-right: auto; margin-left: auto; display: block; width:128px;max-height:128px;border-radius:10px;"> <h3 style="height:max-content;"><?= $systemCommonName ?></h3> - <div style="height:max-content;display:grid;grid-template-columns: repeat(4, 1fr);" id="member-card"> - <span> - <?php $fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/fronters.json"), true); ?> - <b><?= $lang["system"]["fronter"] ?> </b> - <?php if (isset($fronters["members"][0])): ?> - <?php $member = $fronters["members"][0]; ?> - <a class="member-link" href="/<?= $member["name"] ?>"><img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member["display_name"] ?? ($member["name"] === "fusion" ? "<peh-muted>" . $lang["system"]["more"] . "</peh-muted>" : $member["name"])) ?></a> - <?php if (count($fronters["members"]) > 1): ?> - <br>and - <?php if (isset($fronters["members"][1])): ?><?php $member2 = $fronters["members"][1]; ?><a class="member-link" href="/<?= $member2["name"] ?>"><img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member2["display_name"] ?? ($member2["name"] === "fusion" ? "<peh-muted>" . $lang["system"]["more"] . "</peh-muted>" : $member2["name"])) ?></a><?php endif; ?><?php if (isset($fronters["members"][2])): ?><?php $member2 = $fronters["members"][2]; ?>, <a class="member-link" href="/<?= $member2["name"] ?>"><img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member2["display_name"] ?? ($member2["name"] === "fusion" ? "<peh-muted>" . $lang["system"]["more"] . "</peh-muted>" : $member2["name"])) ?></a><?php endif; ?><?php if (isset($fronters["members"][3])): ?><?php $member2 = $fronters["members"][3]; ?>, <a class="member-link" href="/<?= $member2["name"] ?>"><img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member2["display_name"] ?? ($member2["name"] === "fusion" ? "<peh-muted>" . $lang["system"]["more"] . "</peh-muted>" : $member2["name"])) ?></a><?php endif; ?><?php endif; ?> - <?php else: ?>-<?php endif; ?> - </span> - <span> - <b><?= $lang["system"]["last"] ?> </b> - <?php - - $previous = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/switches.json"), true)[1]["members"]; - - if (isset($previous[0])): - $previousID = $previous[0]; - $member = null; - - foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/members.json"), true) as $members) { - if ($members["id"] === $previousID) { - $member = $members; - break; - } - } - - ?> - <a class="member-link" href="/<?= $member["name"] ?>"><img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member["display_name"] ?? ($member["name"] === "fusion" ? "<peh-muted>" . $lang["system"]["more"] . "</peh-muted>" : $member["name"])) ?></a> - <?php if (count($previous) > 1): ?> - <br>and <?php if (isset($previous[1])): ?><?php $member2 = getMemberWithoutSystem($previous[1]); ?><a class="member-link" href="/<?= $member2["name"] ?>"><img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member2["display_name"] ?? ($member2["name"] === "fusion" ? "<peh-muted>" . $lang["system"]["more"] . "</peh-muted>" : $member2["name"])) ?></a><?php endif; ?><?php if (isset($previous[2])): ?><?php $member2 = getMemberWithoutSystem($previous[2]); ?>, <a class="member-link" href="/<?= $member2["name"] ?>"><img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member2["display_name"] ?? ($member2["name"] === "fusion" ? "<peh-muted>" . $lang["system"]["more"] . "</peh-muted>" : $member2["name"])) ?></a><?php endif; ?><?php if (isset($previous[3])): ?><?php $member2 = getMemberWithoutSystem($previous[3]); ?>, <a class="member-link" href="/<?= $member2["name"] ?>"><img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member2["display_name"] ?? ($member2["name"] === "fusion" ? "<peh-muted>" . $lang["system"]["more"] . "</peh-muted>" : $member2["name"])) ?></a><?php endif; ?> - <?php endif; ?> - <?php else: ?>-<?php endif; ?> - </span> + <div style="height:max-content;" id="member-card"> <span> <?php @@ -68,27 +31,50 @@ $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pa } ?> - <b><?= $lang["system"]["members"] ?> </b><?= count(scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/members.json"), true), $systemID)) ?><?php + <?= count(scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/members.json"), true), $systemID)) ?> members<?php if (count($travellers) > 0) { - echo("<br>+ " . count($travellers) . " " . (count($travellers) > 1 ? $lang["system"]["traveller"] : $lang["system"]["travellers"])); + echo(" (+ " . count($travellers) . " " . (count($travellers) > 1 ? $lang["system"]["traveller"] : $lang["system"]["travellers"]) . ")"); } ?> </span> <span> - <b><?= $lang["system"]["switch"] ?> </b><span data-bs-toggle="tooltip" title="<?= date("D j M Y, G:i:s (e)", strtotime(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/fronters.json"), true)["timestamp"])) ?>"><?= timeAgo(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/fronters.json"), true)["timestamp"]) ?></span> + </span> </div> </div> </div> </div> -<div id="system-actions" style="padding:5px 30px;display:grid;grid-template-columns: 0.5fr 1fr 0.5fr;background-color:rgba(255, 255, 255, .025);margin-left: -20px; margin-right: -20px;"> - <div></div> - <a title="<?= $pages["s:history"]["name"][$lang["_name"]] ?>" data-bs-toggle="tooltip" style="display:inline-block;padding:5px 10px;text-align: center" class="system-action tooltip-nohelp" href="/<?= $system ?>/-/history"> - <img src="/assets/icons/history.svg" style="vertical-align: middle;height: 24px;width: 24px;filter: invert(1)" alt=""> - <span style="vertical-align: middle;" class="list-separator-desktop"><?= $pages["s:history"]["name"][$lang["_name"]] ?></span> - </a> - <div></div> +<div id="system-actions" style="padding:5px 30px;background-color:rgba(255, 255, 255, .025);margin-left: -20px; margin-right: -20px;"> + <div id="timeline"></div> + <script> + async function refreshTimeline() { + document.getElementById("timeline").innerHTML = await (await fetch("/api/timeline?<?= $systemID ?>")).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 style="display:grid;grid-template-columns: repeat(2, 1fr);"> + <div style="display: flex; align-items: center; justify-content: center; text-align: center;"> + Last switch <span data-bs-toggle="tooltip" title="<?= date("D j M Y, G:i:s (e)", strtotime(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/fronters.json"), true)["timestamp"])) ?>"><?= timeAgo(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/fronters.json"), true)["timestamp"]) ?></span> + </div> + <a title="<?= $pages["s:history"]["name"][$lang["_name"]] ?>" data-bs-toggle="tooltip" style="display:inline-block;padding:5px 10px;text-align: center" class="system-action tooltip-nohelp" href="/<?= $system ?>/-/history"> + <img src="/assets/icons/history.svg" style="vertical-align: middle;height: 24px;width: 24px;filter: invert(1)" alt=""> + <span style="vertical-align: middle;" class="list-separator-desktop"><?= $pages["s:history"]["name"][$lang["_name"]] ?></span> + </a> + <div></div> + </div> </div>
\ No newline at end of file |