From e37c73e33a4aaf7fb8d25b5af03627f20bcda19f Mon Sep 17 00:00:00 2001
From: Doog <157747121+doogongithub@users.noreply.github.com>
Date: Sat, 24 Feb 2024 20:08:35 -0500
Subject: add gitignore

---
 fe/src/lib/Layout.svelte | 57 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100644 fe/src/lib/Layout.svelte

(limited to 'fe/src/lib/Layout.svelte')

diff --git a/fe/src/lib/Layout.svelte b/fe/src/lib/Layout.svelte
new file mode 100644
index 0000000..f349632
--- /dev/null
+++ b/fe/src/lib/Layout.svelte
@@ -0,0 +1,57 @@
+<script>
+import { authenticated, token } from '../stores/auth';
+
+const logout = () => token.unauthenticate();
+
+function showSettingsDialog() {
+    console.log('show settings');
+}
+
+</script>
+
+<div class="layout">
+    {#if $authenticated}
+    <nav>
+        <div>
+            <h1>Water</h1>
+        </div>
+        <div>
+            <button on:click={showSettingsDialog}>Settings</button>
+            <button on:click={logout}>Logout</button>
+        </div>
+    </nav>
+    {/if}
+    <div id="content">
+        <slot />
+    </div>
+</div>
+
+<style>
+.layout {
+    height: 100vh;
+}
+nav {
+   display: flex;
+   flex-direction: row;
+   align-items: center;
+   justify-content: space-between;
+   height: 64px;
+   padding: 0 2em;
+}
+
+nav div {
+    width: fit-content;
+}
+
+nav div h1 {
+    font-size: 1.75em;
+}
+
+#content {
+    display: flex;
+    flex-direction: column;
+    justify-content: center;
+    align-items: center;
+    padding: 3em 0;
+}
+</style>
-- 
cgit v1.1


From afeffe31bd7d0f8333627a972e1d32e64a325b5b Mon Sep 17 00:00:00 2001
From: Zach Berwaldt <zberwaldt@tutamail.com>
Date: Fri, 1 Mar 2024 18:17:42 -0500
Subject: reformat fe

---
 fe/src/lib/Layout.svelte | 77 ++++++++++++++++++++++++++----------------------
 1 file changed, 41 insertions(+), 36 deletions(-)

(limited to 'fe/src/lib/Layout.svelte')

diff --git a/fe/src/lib/Layout.svelte b/fe/src/lib/Layout.svelte
index f349632..94ce84d 100644
--- a/fe/src/lib/Layout.svelte
+++ b/fe/src/lib/Layout.svelte
@@ -1,57 +1,62 @@
 <script>
-import { authenticated, token } from '../stores/auth';
-
-const logout = () => token.unauthenticate();
-
-function showSettingsDialog() {
-    console.log('show settings');
-}
-
+  import { authenticated, token } from "../stores/auth";
+  import PreferencesForm from "./PreferencesForm.svelte";
+  const logout = () => token.unauthenticate();
+  let open = false;
+
+  function showSettingsDialog() {
+    open = true;
+  }
+
+  function closeDialog() {
+    open = false;
+  }
 </script>
 
 <div class="layout">
-    {#if $authenticated}
+  {#if $authenticated}
     <nav>
-        <div>
-            <h1>Water</h1>
-        </div>
-        <div>
-            <button on:click={showSettingsDialog}>Settings</button>
-            <button on:click={logout}>Logout</button>
-        </div>
+      <div>
+        <h1>Water</h1>
+      </div>
+      <div>
+        <button on:click={showSettingsDialog}>Settings</button>
+        <button on:click={logout}>Logout</button>
+      </div>
     </nav>
-    {/if}
-    <div id="content">
-        <slot />
-    </div>
+    <PreferencesForm {open} on:close={closeDialog} />
+  {/if}
+  <div id="content">
+    <slot />
+  </div>
 </div>
 
 <style>
-.layout {
+  .layout {
     height: 100vh;
-}
-nav {
-   display: flex;
-   flex-direction: row;
-   align-items: center;
-   justify-content: space-between;
-   height: 64px;
-   padding: 0 2em;
-}
+  }
+  nav {
+    display: flex;
+    flex-direction: row;
+    align-items: center;
+    justify-content: space-between;
+    height: 64px;
+    padding: 0 2em;
+  }
 
-nav div {
+  nav div {
     width: fit-content;
-}
+  }
 
-nav div h1 {
+  nav div h1 {
     font-size: 1.75em;
-}
+  }
 
-#content {
+  #content {
     display: flex;
     flex-direction: column;
     justify-content: center;
     align-items: center;
     padding: 3em 0;
-}
+  }
 </style>
-- 
cgit v1.1


From cf2113e77edabf8e3a632c7b76c769752039ba88 Mon Sep 17 00:00:00 2001
From: Zach Berwaldt <zberwaldt@tutamail.com>
Date: Sat, 2 Mar 2024 16:52:55 -0500
Subject: 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
---
 fe/src/lib/Layout.svelte | 116 +++++++++++++++++++++++++----------------------
 1 file changed, 62 insertions(+), 54 deletions(-)

(limited to 'fe/src/lib/Layout.svelte')

diff --git a/fe/src/lib/Layout.svelte b/fe/src/lib/Layout.svelte
index 94ce84d..f208f34 100644
--- a/fe/src/lib/Layout.svelte
+++ b/fe/src/lib/Layout.svelte
@@ -1,62 +1,70 @@
 <script>
-  import { authenticated, token } from "../stores/auth";
-  import PreferencesForm from "./PreferencesForm.svelte";
-  const logout = () => token.unauthenticate();
-  let open = false;
-
-  function showSettingsDialog() {
-    open = true;
-  }
-
-  function closeDialog() {
-    open = false;
-  }
+    import { authenticated, token } from "../stores/auth";
+    import PreferencesForm from "./PreferencesForm.svelte";
+    import { addFormOpen } from "../stores/forms";
+
+    const logout = () => token.unauthenticate();
+    let preferenceFormOpen = false;
+
+    function showPreferencesDialog() {
+        preferenceFormOpen = true;
+    }
+
+    function closePreferenceDialog() {
+        preferenceFormOpen = false;
+    }
+
+    function showAddDialog() {
+        addFormOpen.set(true);
+    }
 </script>
 
 <div class="layout">
-  {#if $authenticated}
-    <nav>
-      <div>
-        <h1>Water</h1>
-      </div>
-      <div>
-        <button on:click={showSettingsDialog}>Settings</button>
-        <button on:click={logout}>Logout</button>
-      </div>
-    </nav>
-    <PreferencesForm {open} on:close={closeDialog} />
-  {/if}
-  <div id="content">
-    <slot />
-  </div>
+    {#if $authenticated}
+        <nav>
+            <div>
+                <h1>Water</h1>
+            </div>
+            <div>
+                <button on:click={showAddDialog}>Log Water</button>
+                <button on:click={showPreferencesDialog}>Preference</button>
+                <button on:click={logout}>Logout</button>
+            </div>
+        </nav>
+        <PreferencesForm open={preferenceFormOpen} on:close={closePreferenceDialog} />
+    {/if}
+    <div id="content">
+        <slot />
+    </div>
 </div>
 
 <style>
-  .layout {
-    height: 100vh;
-  }
-  nav {
-    display: flex;
-    flex-direction: row;
-    align-items: center;
-    justify-content: space-between;
-    height: 64px;
-    padding: 0 2em;
-  }
-
-  nav div {
-    width: fit-content;
-  }
-
-  nav div h1 {
-    font-size: 1.75em;
-  }
-
-  #content {
-    display: flex;
-    flex-direction: column;
-    justify-content: center;
-    align-items: center;
-    padding: 3em 0;
-  }
+    .layout {
+        height: 100vh;
+    }
+
+    nav {
+        display: flex;
+        flex-direction: row;
+        align-items: center;
+        justify-content: space-between;
+        height: 64px;
+        padding: 0 2em;
+    }
+
+    nav div {
+        width: fit-content;
+    }
+
+    nav div h1 {
+        font-size: 1.75em;
+    }
+
+    #content {
+        display: flex;
+        flex-direction: row;
+        justify-content: center;
+        gap: 2em;
+        margin-top: 4em;
+    }
 </style>
-- 
cgit v1.1


From 9cae9c1d2a0b4f7fa72f3075541b9ffafe1a7275 Mon Sep 17 00:00:00 2001
From: Zach Berwaldt <zberwaldt@tutamail.com>
Date: Fri, 15 Mar 2024 18:49:43 -0400
Subject: Add routes for preference, clean up and add types

---
 fe/src/lib/Layout.svelte | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

(limited to 'fe/src/lib/Layout.svelte')

diff --git a/fe/src/lib/Layout.svelte b/fe/src/lib/Layout.svelte
index f208f34..2728dd3 100644
--- a/fe/src/lib/Layout.svelte
+++ b/fe/src/lib/Layout.svelte
@@ -1,9 +1,13 @@
 <script>
-    import { authenticated, token } from "../stores/auth";
+    import { authenticated, token, user, preferences } from "../stores/auth";
     import PreferencesForm from "./PreferencesForm.svelte";
     import { addFormOpen } from "../stores/forms";
 
-    const logout = () => token.unauthenticate();
+    const logout = () => { 
+        preferences.reset();
+        user.reset();
+        token.unauthenticate();
+    }
     let preferenceFormOpen = false;
 
     function showPreferencesDialog() {
-- 
cgit v1.1

