mirror of
https://github.com/Roslund/sthlm-mesh.git
synced 2026-10-30 23:41:58 +01:00
Remove channel filter UI and related functionality from messages
This commit is contained in:
1 parent
f9e3a35f61
commit
5820d02e92
2 files changed
-29
No files matched your search
@@ -35,22 +35,6 @@ menu: {main: {weight: 50}}
|
||||
<span class="badge rounded-pill bg-dark">?</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-toolbar mb-2" role="toolbar" aria-label="Channel toolbar">
|
||||
<div class="btn-group btn-group-sm me-2" role="group" aria-label="Channel filter">
|
||||
<input type="radio" class="btn-check" name="btnchannel" id="channelAll" autocomplete="off" checked>
|
||||
<label class="btn btn-outline-primary" for="channelAll">Alla</label>
|
||||
</div>
|
||||
<div class="btn-group btn-group-sm me-2" role="group" aria-label="Basic radio toggle button group">
|
||||
<input type="radio" class="btn-check" name="btnchannel" id="channelMediumFast" data-channel="MediumFast" autocomplete="off">
|
||||
<label class="btn btn-outline-primary" for="channelMediumFast">MediumFast</label>
|
||||
|
||||
<input type="radio" class="btn-check" name="btnchannel" id="channelLongFast" data-channel="LongFast" autocomplete="off">
|
||||
<label class="btn btn-outline-primary" for="channelLongFast">LongFast</label>
|
||||
</div>
|
||||
<div data-bs-toggle="tooltip" data-bs-placement="right" title="Filtrera på kanal eller visa alla.">
|
||||
<span class="badge rounded-pill bg-dark">?</span>
|
||||
</div>
|
||||
</div>
|
||||
<div id="loading"><p>Loading...</p></div>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
document.addEventListener("DOMContentLoaded", async function () {
|
||||
const messagesContainer = document.getElementById("messages");
|
||||
const radioButtons = document.querySelectorAll("input[name='btnradio']");
|
||||
const channelRadioButtons = document.querySelectorAll("input[name='btnchannel']");
|
||||
const loadingDiv = document.getElementById("loading");
|
||||
const messagesList = document.createElement("div");
|
||||
messagesList.style="max-height:70vh;overflow: auto;"
|
||||
@@ -26,23 +25,11 @@ document.addEventListener("DOMContentLoaded", async function () {
|
||||
radio.addEventListener("change", fetchMessages);
|
||||
});
|
||||
|
||||
channelRadioButtons.forEach(radio => {
|
||||
radio.addEventListener("change", fetchMessages);
|
||||
});
|
||||
|
||||
|
||||
async function fetchMessages() {
|
||||
try {
|
||||
let url = "https://map.sthlm-mesh.se/api/v1/text-messages?order=desc&count=300";
|
||||
const selectedRadio = document.querySelector("input[name='btnradio']:checked");
|
||||
const selectedChannel = document.querySelector("input[name='btnchannel']:checked");
|
||||
|
||||
if (selectedChannel) {
|
||||
const channelId = selectedChannel.getAttribute('data-channel');
|
||||
if (channelId) {
|
||||
url += `&channel_id=${encodeURIComponent(channelId)}`;
|
||||
}
|
||||
}
|
||||
|
||||
const response = await fetch(url);
|
||||
const data = await response.json();
|
||||
|
||||
Reference in new issue
Block a user