Skip to content

Commit

Permalink
feat: adding a nice table to metrics page
Browse files Browse the repository at this point in the history
  • Loading branch information
tm26a21p committed Jun 28, 2024
1 parent 7751912 commit 226adc7
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 25 deletions.
42 changes: 30 additions & 12 deletions public/input.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,38 @@
body {
@apply font-sans;
}
}

#theme-btn {
@apply btn btn-primary btn-block mb-2;
}
#theme-btn {
@apply btn btn-primary btn-block mb-2;
}

.card:hover {
@apply shadow-lg border-primary ring-8;
}
.card:hover {
@apply shadow-lg border-primary ring-8;
}

.link:hover {
@apply shadow-lg border-primary ring-8;
}
.link:hover {
@apply shadow-lg border-primary ring-8;
}

p {
@apply subpixel-antialiased;
}

p {
@apply subpixel-antialiased;
table tr td:first-child {
@apply p-4;
@apply font-extrabold;
@apply min-w-60;
@apply text-left;
@apply border-r-green-100;
@apply mr-4;
}

table tr td:nth-child(2) {
@apply p-4;
@apply min-w-60;
@apply text-left;
@apply border-l-2;
@apply ml-4;

}
}
2 changes: 1 addition & 1 deletion src/htmx_routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use axum::{
};
use askama_axum::Template;
use axum_extra::{headers::*, TypedHeader};
use octocrab::params::repos::Type;
// use octocrab::params::repos::Type;
use serde::Deserialize;

use crate::{htmx_templates::*, project::Project, state::Common};
Expand Down
27 changes: 20 additions & 7 deletions templates/components/table_stats.html
Original file line number Diff line number Diff line change
@@ -1,24 +1,37 @@
<div class="overflow-x-auto flex justify-center items-center">
<table class="table table-zebra">
<div class="flex justify-between min-h">
<table class="table">
<thead>
<tr>
<tr class="">
{# <th></th> #}
<th class="text-xl border-left">Metric</th>
<th class="text-xl border-left">Value</th>
{# <th class="text-left text-lg">Metric</th>
<th class="text-right text-lg">Value</th> #}
</tr>
</thead>
<tbody>
<tr class="hover">
<td class="">IP Address</td>
<td>IP Address</td>
<td hx-get="/api/ip" hx-swap="innerHTML" hx-trigger="load">Unknown
address</td>
</tr>
<tr class="hover" hx-get="/api/location" hx-swap="outerHTML" hx-trigger="load">
</tr>
</tbody>
</table>
<table class="table">
<thead>

</thead>
<tbody>
<tr class="hover" hx-get="/api/device_info" hx-swap="outerHTML" hx-trigger="load">
</tr>
</tbody>
</table>
<table class="table">
<thead>

</thead>
<tbody>
<tr class="hover" hx-get="/api/visit_info" hx-swap="outerHTML" hx-trigger="load">
</tr>
</tbody>
</table>
</div>
4 changes: 0 additions & 4 deletions templates/htmx/device_info.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
<td>Window Resolution</td>
<td id="srt">
</tr>
<tr class="hover">
<td>Language</td>
<td>{{language}}</td>
</tr>
<script type="text/javascript">
document.getElementById('srt').innerHTML = window.innerWidth + 'x' + window.innerHeight;
// listen to the changes in the size of the window and change the value of the userAgent input field
Expand Down
10 changes: 9 additions & 1 deletion templates/htmx/visit_info.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@
</tr>
<tr class="hover">
<td>Visit Duration</td>
<td>{{total_time}}</td>
<td>
<span class="countdown">
<span style="--value:12;"></span>
</span>
</td>
</tr>
<tr class="hover">
<td>Origin</td>
<td>{{origin}}</td>
</tr>
<tr class="hover">
<td>Language</td>
<td>language</td>
</tr>

0 comments on commit 226adc7

Please sign in to comment.