-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* build(deps): bump @types/node from 20.4.0 to 20.4.1 (#32) Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.4.0 to 20.4.1. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix fetch bug to sanity (#36) * refactor: components are now not async * refactor: useEffect for fetching the data * add: date util function and fix event page bug * build(deps): bump semver from 5.7.1 to 5.7.2 (#35) Bumps [semver](https://github.com/npm/node-semver) from 5.7.1 to 5.7.2. - [Release notes](https://github.com/npm/node-semver/releases) - [Changelog](https://github.com/npm/node-semver/blob/v5.7.2/CHANGELOG.md) - [Commits](npm/node-semver@v5.7.1...v5.7.2) --- updated-dependencies: - dependency-name: semver dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Create CODEOWNERS (#39) * Update CODEOWNERS * fix: small fix for fetching data (#41) * Loading page (#42) * add: loading page with spinner to show that we are fetching data * refactor: using loading page on waiting for api calls --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
- Loading branch information
Showing
11 changed files
with
135 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# CODEOWNERS file | ||
|
||
# IT Leder Start GJøvik and repsonsible for | ||
* @KjetilIN | ||
|
||
# Deployment responsible | ||
/.github/* @KjetilIN | ||
|
||
# @sanity-team is responsible for the /app/(sanity)/ folder | ||
/app/(sanity)/* @IT-Start-Gjovik/sanity-team | ||
|
||
# Web Developers are repsonsible for the app itself that is found inside the /app/(site)/ folder | ||
/app/(site)/* @IT-Start-Gjovik/web-utviklere |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
import LoadingPage from "@/components/loadingPage/loadingPage"; | ||
|
||
export default function PageLoading() { | ||
return <LoadingPage /> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export default function NoEvents() { | ||
return ( | ||
<div className="flex justify-center"> | ||
<h2 className="text-white text-xl">Ingen kommende Arrangementer! </h2> | ||
</div>); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,20 @@ | ||
"use client"; | ||
|
||
import { EventCardType } from "@/types/EventCardType"; | ||
import EventCard from "./eventCard"; | ||
import { useState } from "react"; | ||
import { useRouter } from "next/navigation"; | ||
import Spinner from "../UI/Spinner"; | ||
import getDateTimeFormat from "@/utils/date"; | ||
|
||
|
||
// Props for the event card | ||
interface EventCardListProps { | ||
events: EventCardType[]; | ||
events: EventCardType[]; | ||
} | ||
|
||
// Component for the list of events | ||
export default function EventCardList({events }: EventCardListProps) { | ||
|
||
// State for if the list is loading or not after being clicked on | ||
const [loading, setLoading] = useState(false); | ||
|
||
// Router for sending to another page | ||
const router = useRouter(); | ||
|
||
// Function for handling click on an event link | ||
const handleClick = (e:any, url: string) => { | ||
setLoading(true); | ||
router.push(url); | ||
} | ||
|
||
|
||
return ( | ||
<> | ||
{loading ? ( | ||
<div className="flex justify-center my-20"> | ||
<Spinner /> | ||
</div> | ||
) : ( | ||
<div className="flex flex-wrap justify-center items-center px-5 mt-20 gap-5 md:flex-row"> | ||
{events && events.length > 0 ? ( | ||
events.map((event) => { | ||
let currentDate: Date = new Date(event.datetime); | ||
let dateFormat: string = currentDate.getDay() + ". " + currentDate.toLocaleString("no-NO", { month: "long" }) + " " +currentDate.getFullYear().toString(); | ||
let timeFormat: string = currentDate.getHours().toString() + ":" + currentDate.getMinutes().toString(); | ||
|
||
return ( | ||
<a | ||
key={event._id} | ||
onClick={(e: any) => | ||
handleClick(e, `/events/${event.slug}`) | ||
} | ||
className="cursor-pointer" | ||
> | ||
<EventCard | ||
title={event.title} | ||
description={event.description} | ||
imageUrl={event.image} | ||
date={dateFormat} | ||
time={timeFormat} | ||
/> | ||
</a> | ||
); | ||
}) | ||
) : ( | ||
<div className="flex justify-center"> | ||
<h2 className="text-white text-xl">Ingen kommende Arrangementer! </h2> | ||
</div> | ||
|
||
)} | ||
</div> | ||
)} | ||
</> | ||
); | ||
export default function EventCardList({ events }: EventCardListProps) { | ||
return ( | ||
<> | ||
{events.map((event) => { | ||
let { dateFormat, timeFormat } = getDateTimeFormat(event.datetime); | ||
return <EventCard description={event.description} imageUrl={event.image} title={event.title} key={event._id} date={dateFormat} slug={event.slug} time={timeFormat} />; | ||
})} | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import Spinner from "../UI/Spinner"; | ||
|
||
export default function LoadingPage() { | ||
return ( | ||
<div className="flex flex-col gap-3 justify-center items-center h-screen "> | ||
<Spinner /> | ||
<p className="font-sans md:text-xl">Vi henter siden for deg...</p> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.