Compare commits
3 commits
60d2743ade
...
e8d6c53974
Author | SHA1 | Date | |
---|---|---|---|
e8d6c53974 | |||
dbe49b45aa | |||
0e749e5afb |
7 changed files with 94 additions and 72 deletions
|
@ -2,13 +2,13 @@ package web
|
||||||
|
|
||||||
templ dashboard() {
|
templ dashboard() {
|
||||||
<title>Dashboard</title>
|
<title>Dashboard</title>
|
||||||
<div class="container">
|
<div class="container" data-main-body="true">
|
||||||
<div class="row" style="margin-top: -20px">
|
<div class="row" style="margin-top: -20px">
|
||||||
<div class="c-crust col card mx-auto cr-all d-flex-col">
|
<div class="c-crust col card mx-auto cr-all d-flex-col">
|
||||||
<div class="c-s0 d-flex w-100 cr-top">
|
<div class="c-surface0 d-flex w-100 cr-top">
|
||||||
<i class="my-auto c-text py-3 ps-3 ms-1" data-feather="arrow-left"></i>
|
<i class="my-auto tc-text py-3 ps-3 ms-1" data-feather="arrow-left"></i>
|
||||||
<span class="mx-auto my-auto c-text">Income/Expenses</span>
|
<span class="mx-auto my-auto tc-text">Income/Expenses</span>
|
||||||
<i class="my-auto c-text py-3 pe-3 me-1" data-feather="arrow-right"></i>
|
<i class="my-auto tc-text py-3 pe-3 me-1" data-feather="arrow-right"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex" style="height: 88%">
|
<div class="d-flex" style="height: 88%">
|
||||||
<div class="w-50">
|
<div class="w-50">
|
||||||
|
@ -19,7 +19,7 @@ templ dashboard() {
|
||||||
id="IncomeVsExpenditureChart"
|
id="IncomeVsExpenditureChart"
|
||||||
></canvas>
|
></canvas>
|
||||||
</div>
|
</div>
|
||||||
<div class="w-50 c-s1" style="overflow-y: scroll">
|
<div class="w-50 c-surface1" style="overflow-y: scroll">
|
||||||
<div class="m-4 my-5"
|
<div class="m-4 my-5"
|
||||||
hx-trigger="load delay:0.25s"
|
hx-trigger="load delay:0.25s"
|
||||||
hx-get="web/account_summaries"
|
hx-get="web/account_summaries"
|
||||||
|
@ -30,9 +30,9 @@ templ dashboard() {
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="c-crust col card mx-auto cr-all">
|
<div class="c-crust col card mx-auto cr-all">
|
||||||
<div class="c-s0 d-flex w-100 cr-top">
|
<div class="c-surface0 d-flex w-100 cr-top">
|
||||||
<i class="my-auto c-text py-3 ps-3 ms-1" data-feather="arrow-left"></i>
|
<i class="my-auto tc-text py-3 ps-3 ms-1" data-feather="arrow-left"></i>
|
||||||
<i class="my-auto c-text py-3 pe-3 me-1 ms-auto" data-feather="arrow-right"></i>
|
<i class="my-auto tc-text py-3 pe-3 me-1 ms-auto" data-feather="arrow-right"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -137,6 +137,7 @@ $w_h_sizes: (
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
background-color: var(--#{$prefix}-surface2);
|
background-color: var(--#{$prefix}-surface2);
|
||||||
transition: all 0.1s linear;
|
transition: all 0.1s linear;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
.borderless-btn:hover {
|
.borderless-btn:hover {
|
||||||
background-color: var(--#{$prefix}-overlay1);
|
background-color: var(--#{$prefix}-overlay1);
|
||||||
|
@ -205,19 +206,22 @@ table.table-striped {
|
||||||
border-color: var(--#{$prefix}-overlay2);
|
border-color: var(--#{$prefix}-overlay2);
|
||||||
border-width: thin;
|
border-width: thin;
|
||||||
transition: max-height 0.2s linear;
|
transition: max-height 0.2s linear;
|
||||||
}
|
|
||||||
|
|
||||||
.popup-menu select {
|
select {
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: $border-radius;
|
border-radius: $border-radius;
|
||||||
background-color: var(--#{$prefix}-mantle);
|
background-color: var(--#{$prefix}-mantle);
|
||||||
color: var(--#{$prefix}-text);
|
color: var(--#{$prefix}-text);
|
||||||
}
|
}
|
||||||
.popup-menu input {
|
input {
|
||||||
width: 5em;
|
width: 5em;
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
|
border-radius: $border-radius;
|
||||||
|
border-style: solid;
|
||||||
|
border-color: var(--#{$prefix}-text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,13 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.c-text {
|
@each $color, $_ in map-get(catppuccin.$palette, 'latte') {
|
||||||
|
.c-#{$color} {
|
||||||
|
background-color: var(--#{$prefix}-#{$color}) !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tc-text {
|
||||||
color: var(--#{$prefix}-text);
|
color: var(--#{$prefix}-text);
|
||||||
}
|
}
|
||||||
.c-s0 {
|
.c-s0 {
|
||||||
|
@ -38,21 +44,3 @@
|
||||||
.c-s1 {
|
.c-s1 {
|
||||||
background-color: var(--#{$prefix}-surface1);
|
background-color: var(--#{$prefix}-surface1);
|
||||||
}
|
}
|
||||||
.c-crust {
|
|
||||||
background-color: var(--#{$prefix}-crust);
|
|
||||||
}
|
|
||||||
.c-mantle {
|
|
||||||
background-color: var(--#{$prefix}-mantle);
|
|
||||||
}
|
|
||||||
.c-mauve {
|
|
||||||
background-color: var(--#{$prefix}-mauve);
|
|
||||||
}
|
|
||||||
.c-teal {
|
|
||||||
background-color: var(--#{$prefix}-teal) !important;
|
|
||||||
}
|
|
||||||
.c-green {
|
|
||||||
background-color: var(--#{$prefix}-green) !important;
|
|
||||||
}
|
|
||||||
.c-maroon {
|
|
||||||
background-color: var(--#{$prefix}-maroon) !important;
|
|
||||||
}
|
|
||||||
|
|
|
@ -144,6 +144,11 @@ function sparkline_summary_chart(jsonData, element) {
|
||||||
|
|
||||||
function fill_charts() {
|
function fill_charts() {
|
||||||
document.querySelectorAll(".chartjs-chart").forEach(function (el) {
|
document.querySelectorAll(".chartjs-chart").forEach(function (el) {
|
||||||
|
fill_chart(el);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function fill_chart(el) {
|
||||||
var url = el.dataset.chartEndpoint;
|
var url = el.dataset.chartEndpoint;
|
||||||
var type = el.dataset.chartType;
|
var type = el.dataset.chartType;
|
||||||
|
|
||||||
|
@ -163,8 +168,6 @@ function fill_charts() {
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.error("Unable to set up chart: ", error)
|
console.error("Unable to set up chart: ", error)
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export {fill_charts}
|
export {fill_charts, fill_chart}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {fill_charts} from "./chart_functions.js";
|
import {fill_charts, fill_chart} from "./chart_functions.js";
|
||||||
import {register_dropdowns} from "./dropdowns.js";
|
import {register_dropdowns} from "./dropdowns.js";
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ function register_nav_links() {
|
||||||
|
|
||||||
function register_handlers() {
|
function register_handlers() {
|
||||||
register_nav_links();
|
register_nav_links();
|
||||||
fill_charts();
|
//fill_charts();
|
||||||
register_dropdowns();
|
register_dropdowns();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,4 +57,4 @@ const trigger_table_animation = debounce(load_in_table, 100);
|
||||||
|
|
||||||
const trigger_reset_handlers = debounce(register_handlers, 200);
|
const trigger_reset_handlers = debounce(register_handlers, 200);
|
||||||
|
|
||||||
export {trigger_reset_handlers, trigger_table_animation};
|
export {trigger_reset_handlers, trigger_table_animation, fill_chart};
|
||||||
|
|
|
@ -61,15 +61,34 @@
|
||||||
</div>
|
</div>
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/4.4.1/chart.umd.min.js" integrity="sha512-CQBWl4fJHWbryGE+Pc7UAxWMUMNMWzWxF4SQo9CgkJIN1kx6djDQZjh3Y8SZ1d+6I+1zze6Z7kHXO7q3UyZAWw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/4.4.1/chart.umd.min.js" integrity="sha512-CQBWl4fJHWbryGE+Pc7UAxWMUMNMWzWxF4SQo9CgkJIN1kx6djDQZjh3Y8SZ1d+6I+1zze6Z7kHXO7q3UyZAWw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import {trigger_reset_handlers, trigger_table_animation} from "/static/index.js";
|
import {trigger_reset_handlers, trigger_table_animation, fill_chart} from "/static/index.js";
|
||||||
feather.replace();
|
|
||||||
htmx.onLoad(function (element) {
|
htmx.onLoad(function (element) {
|
||||||
if (element.localName === "tr") {
|
feather.replace();
|
||||||
trigger_table_animation();
|
if (element.dataset.mainBody) {
|
||||||
} else {
|
|
||||||
trigger_reset_handlers();
|
trigger_reset_handlers();
|
||||||
}
|
}
|
||||||
|
if (element.localName === "tr") {
|
||||||
|
trigger_table_animation();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (element.querySelectorAll("canvas").length > 0) {
|
||||||
|
element.querySelectorAll("canvas").forEach(function (el) {
|
||||||
|
fill_chart(el);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
document.body.addEventListener('htmx:beforeSwap', function (event) {
|
||||||
|
// Get the target element where content will be replaced
|
||||||
|
var target = event.detail.target;
|
||||||
|
|
||||||
|
// Check if the target has Chart.js charts
|
||||||
|
var charts = target.querySelectorAll('.chartjs-chart');
|
||||||
|
charts.forEach(function (chart) {
|
||||||
|
// Destroy each Chart.js chart before swapping content
|
||||||
|
Chart.getChart(chart).destroy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
trigger_reset_handlers();
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -2,7 +2,7 @@ package web
|
||||||
|
|
||||||
templ transactions_page(userID int, accounts *[]string) {
|
templ transactions_page(userID int, accounts *[]string) {
|
||||||
<title>Transactions</title>
|
<title>Transactions</title>
|
||||||
<div class="d-flex-col mx-4 h-100">
|
<div class="d-flex-col mx-4 h-100" data-main-body="true">
|
||||||
<div class="c-crust row cr-all p-5" style="height: fit-content">
|
<div class="c-crust row cr-all p-5" style="height: fit-content">
|
||||||
<button
|
<button
|
||||||
class="borderless-btn dropdown-button"
|
class="borderless-btn dropdown-button"
|
||||||
|
@ -59,6 +59,14 @@ templ transactions_page(userID int, accounts *[]string) {
|
||||||
<button class="ms-5 borderless-btn">
|
<button class="ms-5 borderless-btn">
|
||||||
<span class="my-auto mx-3">No Filters</span>
|
<span class="my-auto mx-3">No Filters</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
<button
|
||||||
|
class="borderless-btn ms-auto me-3 c-green ch-teal"
|
||||||
|
style="color: var(--pf-bg);"
|
||||||
|
>
|
||||||
|
<i class="" data-feather="plus"></i>
|
||||||
|
Add New
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row mt-5">
|
<div class="row mt-5">
|
||||||
|
|
Loading…
Reference in a new issue