diff options
author | Zach Berwaldt <zberwaldt@tutamail.com> | 2024-03-02 16:52:55 -0500 |
---|---|---|
committer | Zach Berwaldt <zberwaldt@tutamail.com> | 2024-03-02 16:52:55 -0500 |
commit | cf2113e77edabf8e3a632c7b76c769752039ba88 (patch) | |
tree | 874872f22aa63df532769de62119816748b167f8 /fe/src/lib/Card.svelte | |
parent | 326f186d67017f87e631a1fbcdf3f184cbc42d7d (diff) |
feat: Add API logging
Add logging to the API to keep track of specific requests and headers. Also added CORS middleware to handle OPTIONS requests.
---
The commit adds logging functionality to the API and includes a middleware function to handle CORS OPTIONS requests. This will allow us to track specific requests and headers received by the API.
[API/main.go](/api/main.go):
- Added import for the 'log' package
- Added logging statements to print the request headers and "_I am here_" message
- Removed unnecessary newlines and comments
[fe/src/app.css](/fe/src/app.css):
- Added a new style for button hover effects
[fe/src/lib/Card.svelte](/fe/src/lib/Card.svelte):
- Added a new `height` prop to the Card component
[fe/src/lib/Column.svelte](/fe/src/lib/Column.svelte):
- Added a new CSS class for column layout
- Set the width and gap using CSS variables
[fe/src/lib/DataView.svelte](/fe/src/lib/DataView.svelte):
- Updated the 'fetchData' function to also fetch 'totals' and 'userStats' data
- Added canvas references and chart variables for bar and line charts
- Added a new 'getLastSevenDays' function to calculate the labels for the charts
- Updated the 'onMount' function to initialize the bar and line charts using the canvas references and data
- Updated the 'onDestroy' function to destroy the bar and line charts
- Added a new 'addFormOpen' store and imported it
- Added a new 'onClick' handler for the Add button to open the AddForm modal
- Updated the layout and added Card components to display the bar and line charts and the JSON data
- Added a new 'fetchTotals' function to fetch data for the 'totals' section
- Added a new 'fetchStatsForUser' function to fetch data for the 'userStats' section
[fe/src/lib/Layout.svelte](/fe/src/lib/Layout.svelte):
- Added a new 'preferenceFormOpen' variable and initialized it to 'false'
- Added a new 'showPreferencesDialog' function to set 'preferenceFormOpen' to 'true'
- Added a new 'closePreferenceDialog' function to set 'preferenceFormOpen' to 'false'
- Added a new 'showAddDialog' function to open the AddForm modal
Diffstat (limited to 'fe/src/lib/Card.svelte')
-rw-r--r-- | fe/src/lib/Card.svelte | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/fe/src/lib/Card.svelte b/fe/src/lib/Card.svelte index 0835940..d7cd900 100644 --- a/fe/src/lib/Card.svelte +++ b/fe/src/lib/Card.svelte | |||
@@ -1,22 +1,24 @@ | |||
1 | <script lang="ts"> | 1 | <script lang="ts"> |
2 | export let title = ""; | 2 | export let title = ""; |
3 | export let height: number | undefined = undefined; | ||
3 | </script> | 4 | </script> |
4 | 5 | ||
5 | <div class="card"> | 6 | <div class="card"> |
6 | {#if title} | 7 | {#if title} |
7 | <h2>{title}</h2> | 8 | <h2>{title}</h2> |
8 | {/if} | 9 | {/if} |
9 | <slot /> | 10 | <slot /> |
10 | </div> | 11 | </div> |
11 | 12 | ||
12 | <style> | 13 | <style> |
13 | .card { | 14 | .card { |
14 | background: #fff; | 15 | background: #fff; |
15 | width: 16rem; | 16 | display: flex; |
16 | display: flex; | 17 | flex-direction: column; |
17 | flex-direction: column; | 18 | align-items: flex-start; |
18 | align-items: left; | 19 | border: solid 2px #00000066; |
19 | border: solid 2px #00000066; | 20 | border-radius: 0.25em; |
20 | border-radius: 0.25em; | 21 | height: var(--height, fit-content); |
21 | } | 22 | overflow-y: var(--overflow, initial); |
23 | } | ||
22 | </style> | 24 | </style> |