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/Table.svelte | 138 ++++++++++++++++++++++++------------------------
 1 file changed, 69 insertions(+), 69 deletions(-)

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

diff --git a/fe/src/lib/Table.svelte b/fe/src/lib/Table.svelte
index 4b81800..3a66e0d 100644
--- a/fe/src/lib/Table.svelte
+++ b/fe/src/lib/Table.svelte
@@ -1,105 +1,105 @@
 <script lang="ts">
-import {afterUpdate} from 'svelte';
-export let data: Array<any> | undefined = undefined;
-export let nofooter: boolean = false;
-export let noheader: boolean = false;
-export let omit: string[] = ['id'];
-export let title: string | undefined = undefined;
+  export let data: Array<any> | undefined = undefined;
+  export let nofooter: boolean = false;
+  export let noheader: boolean = false;
+  export let omit: string[] = ["id"];
+  export let title: string | undefined = undefined;
 
-function getDataKeys(data: any[]): string[] {
+  function getDataKeys(data: any[]): string[] {
     if (!data || data.length === 0) return [];
-    return Object.keys(data[0]).map(k => k.split('_').join(' ')).filter(k => !omit.includes(k));
-}
+    return Object.keys(data[0])
+      .map((k) => k.split("_").join(" "))
+      .filter((k) => !omit.includes(k));
+  }
 
-function getRow(row: Record<string, any>): Array<any> {
-   return Object.entries(row).filter(r => !omit.includes(r[0]));
-}
+  function getRow(row: Record<string, any>): Array<any> {
+    return Object.entries(row).filter((r) => !omit.includes(r[0]));
+  }
 
-const formatter = new Intl.DateTimeFormat('en', {
-    year: 'numeric',
-    month: 'numeric',
-    day: 'numeric',
-    hour: 'numeric',
-    minute: '2-digit',
-    second: '2-digit',
-    timeZone: "America/New_York"
-});
+  const formatter = new Intl.DateTimeFormat("en", {
+    year: "numeric",
+    month: "numeric",
+    day: "numeric",
+    hour: "numeric",
+    minute: "2-digit",
+    second: "2-digit",
+    timeZone: "America/New_York",
+  });
 
-function formatDatum([key, value]: any[]) {
-    if (key === 'date') {
-        const parsedDate = new Date(value);
-        return formatter.format(parsedDate);
+  function formatDatum([key, value]: any[]) {
+    if (key === "date") {
+      const parsedDate = new Date(value);
+      return formatter.format(parsedDate);
     }
 
-    if (key === 'user') {
-        return value['name'];
+    if (key === "user") {
+      return value["name"];
     }
 
     return value;
-}
-
+  }
 </script>
+
 <table>
-    {#if title}
+  {#if title}
     <h2>{title}</h2>
-    {/if}
-    {#if !noheader}
+  {/if}
+  {#if !noheader && data}
     <thead>
-        <tr>
-            {#each getDataKeys(data) as header}
-                <th>{header}</th>
-            {/each}
-        </tr>
+      <tr>
+        {#each getDataKeys(data) as header}
+          <th>{header}</th>
+        {/each}
+      </tr>
     </thead>
-    {/if}
-    <tbody>
-        {#if data}
-        {#each data as row}
+  {/if}
+  <tbody>
+    {#if data}
+      {#each data as row}
         <tr>
-            {#each getRow(row) as datum}
-            
+          {#each getRow(row) as datum}
             <td>{formatDatum(datum)}</td>
-            {/each}
+          {/each}
         </tr>
-        {/each}
-        {:else}
-        <tr>
-            There is not data.
-        </tr>   
-        {/if}
-    </tbody>
-    {#if !nofooter}
+      {/each}
+    {:else}
+      <tr> There is not data. </tr>
+    {/if}
+  </tbody>
+  {#if !nofooter}
     <slot name="footer">
-       <tfoot>
+      <tfoot>
         <tr>
-            <td>Table Footer</td>
+          <td>Table Footer</td>
         </tr>
-       </tfoot>
+      </tfoot>
     </slot>
-    {/if}
+  {/if}
 </table>
+
 <style>
-table {
+  table {
     padding: 16px;
     margin: 8px;
     border: solid 1px black;
     border-collapse: collapse;
-}
+  }
 
-th {
+  th {
     text-transform: capitalize;
-}
+  }
 
-thead tr {
-    background: rgba(0,0,23, 0.34);
-}
+  thead tr {
+    background: rgba(0, 0, 23, 0.34);
+  }
 
-tbody tr:nth-child(odd) {
-   background: rgba(0,0,23,0.14); 
-}
+  tbody tr:nth-child(odd) {
+    background: rgba(0, 0, 23, 0.14);
+  }
 
-th, td {
+  th,
+  td {
     padding: 1em;
-    border: 1px solid rgba(0,0,0, 1);
-}
+    border: 1px solid rgba(0, 0, 0, 1);
+  }
 </style>
-- 
cgit v1.1

