From 3af751548d765cd80fd6f2340569fa46b44688e0 Mon Sep 17 00:00:00 2001
From: Alexander Schoch <schochal@student.ethz.ch>
Date: Sat, 16 Sep 2023 23:12:00 +0200
Subject: [PATCH] only show future events, fix styles for guides

---
 components/toc.jsx   | 4 +++-
 graphql/resolvers.js | 5 +++--
 styles/globals.css   | 6 ++++--
 utilities/dates.js   | 4 ++--
 4 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/components/toc.jsx b/components/toc.jsx
index 6e85d4d..efa1c75 100644
--- a/components/toc.jsx
+++ b/components/toc.jsx
@@ -11,6 +11,8 @@ import {
 
 import { Icon, ICONS } from "vseth-canine-ui";
 
+import { getAccentColor } from "../utilities/colors";
+
 const useStyles = createStyles((theme) => ({
   link: {
     ...theme.fn.focusStyles(),
@@ -119,7 +121,7 @@ export default function TOC() {
       }}
     >
       <Group mb="md">
-        <Icon icon={ICONS.LIST} />
+        <Icon icon={ICONS.LIST} color={getAccentColor(theme)} />
         <Text>Table of contents</Text>
       </Group>
       {entries}
diff --git a/graphql/resolvers.js b/graphql/resolvers.js
index ed3f0b8..4910c08 100644
--- a/graphql/resolvers.js
+++ b/graphql/resolvers.js
@@ -21,8 +21,9 @@ export const resolvers = {
               lastName: hasAccess(session, true),
               email: hasAccess(session, true)
             }
-          },
-        }
+          }
+        },
+        orderBy: [{date: 'asc'}, {startTime: 'asc'}]
       });
       const futureEvents = events.filter((event) => isInFuture(event));
       return futureEvents;
diff --git a/styles/globals.css b/styles/globals.css
index 913d8e3..deddc89 100644
--- a/styles/globals.css
+++ b/styles/globals.css
@@ -4,6 +4,7 @@ p {
 
 h1 {
   font-size: 4rem !important;
+  overflow-x: auto;
 }
 
 h2 {
@@ -142,12 +143,13 @@ p {
 }
 
 .bash-guide pre {
-  background-color: #eeeeee;
   padding: 0.5rem;
+  background-color: rgba(125,125,125,0.1);
+  overflow-x: auto;
 }
 
 .bash-guide p>code {
-  color: #888888;
+  color: #f28a20;
 }
 
 .vseth-footer-dark {
diff --git a/utilities/dates.js b/utilities/dates.js
index 36d8bc7..f75ad27 100644
--- a/utilities/dates.js
+++ b/utilities/dates.js
@@ -19,6 +19,6 @@ export function formatTimeFromDB(startTime, endTime) {
 }
 
 export function isInFuture(event) {
-  // TODO: implement logic
-  return true;
+  const now = new Date();
+  return event.date > now.toISOString();
 }
-- 
GitLab