Improve UI usability

This commit is contained in:
Mark Veidemanis 2022-07-21 13:51:22 +01:00
parent 6b820f96a3
commit cd82740662
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
5 changed files with 65 additions and 19 deletions

View File

@ -96,6 +96,7 @@ class ThresholdInfoModal(LoginRequiredMixin, APIView):
else:
inter_chans = []
context = {
"net": net,
"nick": nick,
"channel": channel,
"chans": channels,

View File

@ -21,6 +21,8 @@ new Chart(ctx, {
],
},
options: {
responsive: true,
maintainAspectRatio: false,
parsing: {
xAxisKey: 'date',
yAxisKey: 'value',

View File

@ -60,7 +60,7 @@
</div>
<div id="tab-content">
<div class="is-active" data-content="1">
<h4 class="subtitle is-4">Channels {{ nick }} is on</h4>
<h4 class="subtitle is-4">Channels for {{ nick }} on {{ net }}</h4>
{% for channel in chans %}
<a class="panel-block">
<span class="panel-icon">
@ -71,7 +71,7 @@
{% endfor %}
</div>
<div data-content="2">
<h4 class="subtitle is-4">Users on {{ channel }}</h4>
<h4 class="subtitle is-4">Users on {{ channel }} for {{ net }}</h4>
{% for user in users %}
<a class="panel-block">
<span class="panel-icon">
@ -82,7 +82,7 @@
{% endfor %}
</div>
<div data-content="3">
<h4 class="subtitle is-4">Users sharing channels with {{ nick }}</h4>
<h4 class="subtitle is-4">Users sharing channels with {{ nick }} on {{ net }}</h4>
{% for user in inter_users %}
<a class="panel-block">
<span class="panel-icon">
@ -93,7 +93,7 @@
{% endfor %}
</div>
<div data-content="4">
<h4 class="subtitle is-4">Channels sharing users with {{ channel }}</h4>
<h4 class="subtitle is-4">Channels sharing users with {{ channel }} on {{ net }}</h4>
{% for channel in inter_chans %}
<a class="panel-block">
<span class="panel-icon">

View File

@ -3,6 +3,7 @@
{% block content %}
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script>
// tabbed browsing for the modal
function initTabs() {
TABS.forEach((tab) => {
tab.addEventListener('click', (e) => {

View File

@ -5,20 +5,18 @@
<div style="display: none" id="jsonData" data-json="{{ data }}">
</div>
<div class="box">
<div style="height: 30rem">
<canvas id="volume"></canvas>
</div>
<script src="{% static 'chart.js' %}"></script>
</div>
<div class="box">
<span class="tag is-success">Online</span>
<span class="tag is-danger">Offline</span>
<span class="tag is-warning">Unknown</span>
IRC: <i class="fa-solid fa-hashtag" aria-hidden="true"></i>
Discord: <i class="fa-brands fa-discord" aria-hidden="true"></i>
<div class="table-container">
<table class="table is-striped is-hoverable is-fullwidth">
<thead>
<tr>
<th>src</th>
<th>type</th>
<th>ts</th>
<th>msg</th>
<th>host</th>
@ -28,15 +26,51 @@
<th>net</th>
</tr>
</thead>
<tbody>
{% for item in results %}
<tr>
<td>
{% if item.src == 'irc' %}
<span class="icon" data-tooltip="IRC">
<i class="fa-solid fa-hashtag" aria-hidden="true"></i>
</span>
{% elif item.src == 'dis' %}
<span class="icon" data-tooltip="Discord">
<i class="fa-brands fa-discord" aria-hidden="true"></i>
</span>
{% endif %}
</td>
<td>
{% if item.type == 'msg' %}
<span class="icon" data-tooltip="Message">
<i class="fa-solid fa-message"></i>
</span>
{% elif item.type == 'join' %}
<span class="icon" data-tooltip="Join">
<i class="fa-solid fa-person-to-portal"></i>
</span>
{% elif item.type == 'part' %}
<span class="icon" data-tooltip="Part">
<i class="fa-solid fa-person-from-portal"></i>
</span>
{% elif item.type == 'quit' %}
<span class="icon" data-tooltip="Quit">
<i class="fa-solid fa-circle-xmark"></i>
</span>
{% elif item.type == 'kick' %}
<span class="icon" data-tooltip="Kick">
<i class="fa-solid fa-user-slash"></i>
</span>
{% elif item.type == 'nick' %}
<span class="icon" data-tooltip="Nick">
<i class="fa-solid fa-signature"></i>
</span>
{% elif item.type == 'mode' %}
<span class="icon" data-tooltip="Mode">
<i class="fa-solid fa-gear"></i>
</span>
{% else %}
{{ item.type }}
{% endif %}
</td>
<td>
@ -47,11 +81,20 @@
<td>{{ item.host }}</td>
<td>
{% if item.online is True %}
<span class="tag is-success">{{ item.nick }}</span>
<span class="icon has-text-success has-tooltip-success" data-tooltip="Online">
<i class="fa-solid fa-circle"></i>
</span>
{{ item.nick }}
{% elif item.online is False %}
<span class="tag is-danger">{{ item.nick }}</span>
<span class="icon has-text-danger has-tooltip-danger" data-tooltip="Offline">
<i class="fa-solid fa-circle"></i>
</span>
{{ item.nick }}
{% else %}
<span class="tag is-warning">{{ item.nick }}</span>
<span class="icon has-text-warning has-tooltip-warning" data-tooltip="Unknown">
<i class="fa-solid fa-circle"></i>
</span>
{{ item.nick }}
{% endif %}
</td>
<td>
@ -62,8 +105,7 @@
hx-vals='{"net": "{{ item.net }}", "nick": "{{ item.nick }}", "channel": "{{ item.channel }}"}'
hx-target="#modals-here"
hx-trigger="click"
class="btn btn-primary"
_="on htmx:afterOnLoad wait 10ms then add .show to #modal then add .show to #modal-backdrop">
class="btn btn-primary">
Information
</button>
<div id="modals-here"></div>