From 4dd5c7e22f697b3a57c80048037bfaff34574297 Mon Sep 17 00:00:00 2001 From: danilo-cupido Date: Thu, 9 Dec 2021 16:41:52 +0000 Subject: [PATCH 1/2] apply style to index page and change welcome message Co-authored-by: Michael <72146072+MJOW1999@users.noreply.github.com> --- components/Auth.js | 55 +++++++++++++++++++++++----------------------- pages/index.js | 7 ++++-- 2 files changed, 32 insertions(+), 30 deletions(-) diff --git a/components/Auth.js b/components/Auth.js index c2fdbef..d6a38b7 100644 --- a/components/Auth.js +++ b/components/Auth.js @@ -1,5 +1,6 @@ import { useState } from 'react'; import { supabase } from '../utils/supabaseClient'; +import Main from './Main'; export default function Auth() { const [loading, setLoading] = useState(false); @@ -19,34 +20,32 @@ export default function Auth() { }; return ( -
-
-

Supabase + Next.js

-

- Sign in via magic link with your email below -

-
- setEmail(e.target.value)} - /> -
-
- -
+
+

Welcome to Solent Mind

+

+ Sign in via magic link with your email below +

+
+ setEmail(e.target.value)} + />
-
+
+ +
+ ); } diff --git a/pages/index.js b/pages/index.js index 9cc2aab..5718edd 100644 --- a/pages/index.js +++ b/pages/index.js @@ -1,10 +1,13 @@ import Auth from '../components/Auth'; import Account from '../components/Account'; +import Main from '../components/Main'; +import Header from '../components/Header'; export default function Home({ supabase, session }) { return ( <> -
+
@@ -13,7 +16,7 @@ export default function Home({ supabase, session }) { ) : ( )} -
+ ); } From 57675106fbd8fb4d6cf0a1e957d6833aebffef13 Mon Sep 17 00:00:00 2001 From: danilo-cupido Date: Thu, 9 Dec 2021 17:38:53 +0000 Subject: [PATCH 2/2] create Tabs component, clean up console.logs and some unused code Co-authored-by: Michael <72146072+MJOW1999@users.noreply.github.com> --- components/Greeting.js | 1 - components/Main.js | 2 -- components/Tabs.js | 26 +++++++++++++++++ pages/aboutUs.js | 65 +++++++++++++---------------------------- pages/announcements.js | 7 +++-- pages/courses/[name].js | 2 -- pages/myCourses.js | 1 - pages/myProfile.js | 34 ++++----------------- pages/resources.js | 5 +++- 9 files changed, 61 insertions(+), 82 deletions(-) create mode 100644 components/Tabs.js diff --git a/components/Greeting.js b/components/Greeting.js index a9abbc3..8b7ee4b 100644 --- a/components/Greeting.js +++ b/components/Greeting.js @@ -1,6 +1,5 @@ import React from 'react'; import { CgProfile } from 'react-icons/cg'; -import { supabase } from '../utils/supabaseClient'; const Greeting = ({ user }) => { return ( diff --git a/components/Main.js b/components/Main.js index f572878..cfdbf30 100644 --- a/components/Main.js +++ b/components/Main.js @@ -1,6 +1,4 @@ import React from 'react'; -import Link from 'next/link'; -import { BsFillArrowRightCircleFill } from 'react-icons/bs'; const Main = ({ children }) => { return ( diff --git a/components/Tabs.js b/components/Tabs.js new file mode 100644 index 0000000..6b5be63 --- /dev/null +++ b/components/Tabs.js @@ -0,0 +1,26 @@ +import Link from 'next/link'; +import { BsFillArrowRightCircleFill } from 'react-icons/bs'; + +const Tabs = ({ contents }) => { + return ( +
    + {contents.map((content) => ( +
  • +
    +
    {content.topic}
    + + + + + +
    +
  • + ))} +
+ ); +}; + +export default Tabs; diff --git a/pages/aboutUs.js b/pages/aboutUs.js index f4642d0..33868f4 100644 --- a/pages/aboutUs.js +++ b/pages/aboutUs.js @@ -1,13 +1,29 @@ -import Link from 'next/link'; import Header from '../components/Header'; -import { BsFillArrowRightCircleFill } from 'react-icons/bs'; import Main from '../components/Main'; +import Tabs from '../components/Tabs'; const AboutUs = () => { + const contents = [ + { + topic: 'What we do', + url: 'https://www.solentmind.org.uk/about-us/what-we-do/', + }, + { + topic: 'Who we are', + url: 'https://www.solentmind.org.uk/about-us/who-we-are/', + }, + { + topic: 'Reports & accounts', + url: 'https://www.solentmind.org.uk/about-us/reports-and-accounts/', + }, + { + topic: 'Policies', + url: 'https://www.solentmind.org.uk/about-us/policies/', + }, + ]; return ( <>
-

ABOUT US

@@ -17,48 +33,7 @@ const AboutUs = () => { plan to achieve it.
- + ); diff --git a/pages/announcements.js b/pages/announcements.js index 2bc86e5..7d83ba2 100644 --- a/pages/announcements.js +++ b/pages/announcements.js @@ -1,12 +1,15 @@ import React from 'react'; import Header from '../components/Header'; +import Main from '../components/Main'; const Announcements = () => { return ( <>
-

Announcements 🔊

+
+

Announcements 🔊

+
); -} +}; export default Announcements; diff --git a/pages/courses/[name].js b/pages/courses/[name].js index 93879dd..7d532c0 100644 --- a/pages/courses/[name].js +++ b/pages/courses/[name].js @@ -1,12 +1,10 @@ import React from 'react'; import { supabase } from '../../utils/supabaseClient'; -import { useRouter } from 'next/router'; import Header from '../../components/Header'; export async function getStaticProps({ params }) { const { data, error } = await supabase.from('classes').select('name'); - console.log(data); return { props: { data, diff --git a/pages/myCourses.js b/pages/myCourses.js index ae1138e..75282b2 100644 --- a/pages/myCourses.js +++ b/pages/myCourses.js @@ -18,7 +18,6 @@ export default function MyCourses() { .select('user_id, course_id, classes("name", "short_description")') .eq('user_id', user.id); setEnrolData(data); - console.log('Enrol data is: ', data); } React.useEffect(() => { diff --git a/pages/myProfile.js b/pages/myProfile.js index ef28f1e..f0d5469 100644 --- a/pages/myProfile.js +++ b/pages/myProfile.js @@ -1,14 +1,16 @@ import React from 'react'; -import Link from 'next/link'; import Header from '../components/Header'; import Greeting from '../components/Greeting'; import Account from '../components/Account'; -import { BsFillArrowRightCircleFill } from 'react-icons/bs'; import Main from '../components/Main'; +import Tabs from '../components/Tabs'; const MyProfile = ({ supabase }) => { - const [userData, setUserData] = React.useState(null); + const contents = [ + { topic: 'My booked courses', url: '/myCourses' }, + { topic: 'Upcoming courses', url: '/courses' }, + ]; async function fetchData() { const user = await supabase.auth.user(); @@ -23,36 +25,12 @@ const MyProfile = ({ supabase }) => { return ( <>
-

My Profile

- -
-
    -
  • -
    -
    My booked courses
    - - - - - -
    -
  • -
  • -
    -
    Upcoming courses
    - - - - - -
    -
  • -
+
); diff --git a/pages/resources.js b/pages/resources.js index be191ba..d825e5d 100644 --- a/pages/resources.js +++ b/pages/resources.js @@ -1,11 +1,14 @@ import React from 'react'; import Header from '../components/Header'; +import Main from '../components/Main'; export default function Announcements() { return ( <>
-

Resources

+
+

Resources

+
); }