-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
678aa17
commit eca3021
Showing
23 changed files
with
1,477 additions
and
111 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,88 @@ | ||
'use server'; | ||
|
||
import Calls from './calls'; | ||
|
||
const BaseUrl = process.env.BASEURL ?? 'https://evento-qo6d.onrender.com/api/v1'; | ||
|
||
const $http = Calls(BaseUrl); | ||
|
||
export const allevent = async () => { | ||
try { | ||
const res = await $http.get('/events'); | ||
if (res.status === 200) { | ||
return { | ||
status: 'success', | ||
events: res.data.data, | ||
}; | ||
} | ||
} catch (e: any) { | ||
console.log(e); | ||
if (e?.response?.status === 403) { | ||
return { | ||
error: 'Forbidden', | ||
}; | ||
} else if (e?.response?.status === 404) { | ||
return { | ||
error: 'Not Found. The requested endpoint was not found.', | ||
}; | ||
} else { | ||
return { | ||
error: 'An error occurred. Please try again later.', | ||
}; | ||
} | ||
} | ||
}; | ||
|
||
export const allcategories = async () => { | ||
try { | ||
const res = await $http.get('/categories'); | ||
if (res.status === 200) { | ||
return { | ||
status: 'success', | ||
categories: res.data.data, | ||
}; | ||
} | ||
} catch (e: any) { | ||
console.log(e); | ||
if (e?.response?.status === 403) { | ||
return { | ||
error: 'Forbidden', | ||
}; | ||
} else if (e?.response?.status === 404) { | ||
return { | ||
error: 'Not Found. The requested endpoint was not found.', | ||
}; | ||
} else { | ||
return { | ||
error: 'An error occurred. Please try again later.', | ||
}; | ||
} | ||
} | ||
}; | ||
|
||
export const geteventsbycategories = async (categoryID: string) => { | ||
try { | ||
const res = await $http.get(`/categories/${categoryID}/events`); | ||
if (res.status === 200) { | ||
return { | ||
status: 'success', | ||
events: res.data.data, | ||
}; | ||
} | ||
} catch (e: any) { | ||
console.log(e); | ||
if (e?.response?.status === 403) { | ||
return { | ||
error: 'Forbidden', | ||
}; | ||
} else if (e?.response?.status === 404) { | ||
return { | ||
error: 'Not Found. The requested endpoint was not found.', | ||
}; | ||
} else { | ||
return { | ||
error: 'An error occurred. Please try again later.', | ||
}; | ||
} | ||
} | ||
}; |
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,48 @@ | ||
'use server'; | ||
|
||
import Calls from './calls'; | ||
import { cookies } from 'next/headers'; | ||
|
||
const BaseUrl = process.env.BASEURL ?? 'https://evento-qo6d.onrender.com/api/v1'; | ||
|
||
const $http = Calls(BaseUrl, true); | ||
|
||
export const getNotifications = async () => { | ||
const userId = cookies()?.get('userId')?.value; | ||
|
||
if (!userId) { | ||
return { | ||
error: 'Unauthorized. Missing access token.', | ||
status: 401, | ||
}; | ||
} | ||
try { | ||
const res = await $http.get(`/notifications/${userId}`); | ||
if (res.status === 200) { | ||
return { | ||
status: 'success', | ||
notifications: res.data.data, | ||
}; | ||
} | ||
} catch (e: any) { | ||
console.log(e); | ||
if (e?.response?.status === 401) { | ||
return { | ||
error: 'Unauthorized. Please check your access token.', | ||
status: 401, | ||
}; | ||
} else if (e?.response?.status === 403) { | ||
return { | ||
error: 'Forbidden', | ||
}; | ||
} else if (e?.response?.status === 404) { | ||
return { | ||
error: 'Not Found. The requested endpoint was not found.', | ||
}; | ||
} else { | ||
return { | ||
error: 'An error occurred. Please try again later.', | ||
}; | ||
} | ||
} | ||
}; |
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,16 @@ | ||
import React from 'react'; | ||
import Hero from '@/modules/explore/Hero'; | ||
import Categories from '@/modules/explore/Categories'; | ||
import EventsGrid from '@/modules/explore/EventsGrid'; | ||
|
||
const Explore = () => { | ||
return ( | ||
<> | ||
<Hero /> | ||
<Categories /> | ||
<EventsGrid /> | ||
</> | ||
); | ||
}; | ||
|
||
export default Explore; |
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,104 @@ | ||
'use client'; | ||
|
||
import Link from 'next/link'; | ||
import Image from 'next/image'; | ||
import React, { useState } from 'react'; | ||
import { EventProps } from '@/types'; | ||
import { useUserCtx } from '@/context/UserCtx'; | ||
import { Location, Timer1 } from 'iconsax-react'; | ||
import { convertUTCtoLocalTime } from '@/utils'; | ||
import { useExploreCtx } from '@/context/ExploreCtx'; | ||
|
||
const ExploreCard = ({ | ||
imageURL, | ||
eventID, | ||
startDate, | ||
organizerID, | ||
tickets, | ||
participants, | ||
location, | ||
title, | ||
}: EventProps) => { | ||
const [weekday, monthDay] = convertUTCtoLocalTime(startDate!); | ||
const [, , , time] = convertUTCtoLocalTime(startDate!); | ||
const { eventsSearchTerm } = useExploreCtx(); | ||
const { user } = useUserCtx(); | ||
|
||
return ( | ||
<> | ||
<Link | ||
href={organizerID === user.userID ? `/event-management/?eventid=${eventID}` : `/event/?eventid=${eventID}`} | ||
className="block border border-Grey-G80/50 dark:border-dark-two card-shadow rounded-lg hover:scale-[1.01]" | ||
> | ||
<div className="relative w-full h-[180px] rounded-t-lg overflow-hidden"> | ||
<Image src={imageURL!} fill alt="Event Image" className="object-cover" /> | ||
</div> | ||
<div className="p-4"> | ||
<div className="flex justify-between items-center mb-1 font-nunito"> | ||
<span className="font-bold text-sm text-primary-100 dark:text-dark-two "> | ||
{weekday}, {monthDay} | ||
</span> | ||
{tickets?.map((ticket) => ( | ||
<div key={ticket.ticketID}> | ||
<span className="text-primary-100 bg-secondary-100 dark:bg-dark-two dark:text-dark-one rounded block px-3 py-1 capitalize"> | ||
{ticket.ticketType === 'Free' ? 'Free' : `$${ticket.ticketPrice}`} | ||
</span> | ||
</div> | ||
))} | ||
</div> | ||
<h2 className="text-Grey-G800 dark:text-dark-two text-lg whitespace-nowrap overflow-hidden text-ellipsis sm:text-xl font-bold pt-1 pb-2 font-montserrat"> | ||
{/* {title!} */} | ||
<strong> | ||
<span | ||
dangerouslySetInnerHTML={{ | ||
__html: title!.replace( | ||
new RegExp(`(${eventsSearchTerm})`, 'gi'), | ||
(match, group) => | ||
`<span style="color: black; background-color: ${ | ||
group.toLowerCase() === eventsSearchTerm.toLowerCase() ? 'yellow' : 'inherit' | ||
}">${match}</span>`, | ||
), | ||
}} | ||
/> | ||
</strong> | ||
</h2> | ||
<p className="text-Grey-G500 dark:text-dark-two text-sm flex items-center gap-0.5 mb-1 font-nunito"> | ||
<Location size={16} /> | ||
<span className="font-medium">{location!}</span> | ||
</p> | ||
<p className="text-Grey-G500 dark:text-dark-two flex items-center gap-0.5 mb-2 font-nunito"> | ||
<Timer1 size={16} /> | ||
<span className="font-medium">{time}</span> | ||
</p> | ||
<div className="flex items-center font-montserrat"> | ||
{participants?.length !== 0 && ( | ||
<div className="flex items-center"> | ||
{participants?.map((item, index) => { | ||
if (index >= 3) return; | ||
return ( | ||
<div key={index} className="h-8 w-8 first:ml-0 -ml-1.5 rounded-full overflow-hidden"> | ||
<Image | ||
src={item?.profileImage ?? '/assets/avatar.png'} | ||
height={32} | ||
width={32} | ||
alt="Attendant" | ||
className="object-top object-cover" | ||
/> | ||
</div> | ||
); | ||
})} | ||
{participants && participants?.length > 3 && ( | ||
<span className="pl-3 text-sm font-medium font-nunito"> | ||
+{participants?.length - 3} People registered | ||
</span> | ||
)} | ||
</div> | ||
)} | ||
</div> | ||
</div> | ||
</Link> | ||
</> | ||
); | ||
}; | ||
|
||
export default ExploreCard; |
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,12 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
import Image from 'next/image'; | ||
import { NotificationsProps, Notification } from '@/types'; | ||
import { Activity } from 'iconsax-react'; | ||
import { useStateCtx } from '@/context/StateCtx'; | ||
|
||
const NotificationDropDown = () => { | ||
const { OpenNotification, setOpenNotification } = useStateCtx(); | ||
return <div>Notification</div>; | ||
}; | ||
|
||
export default NotificationDropDown; |
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
Oops, something went wrong.