Skip to content

Commit

Permalink
+ toasts fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Arakasi21 committed May 28, 2024
1 parent de36295 commit 9e24d26
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/app/clubs/[clubID]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function Page({ params }: { params: { clubID: number } }) {
<div className="z-1 absolute inset-x-0 bottom-0 h-2/3 bg-gradient-to-t from-[#020817]/90" />
</div>

<div className="relative z-30 mx-auto max-w-[800px] pt-14">
<div className="relative z-30 mx-auto max-w-[1000px] pt-14">
<BackgroundClubImage club={club} />
<div className="z-50 rounded-lg bg-[#0c1125]">
<div className="flex items-center justify-between gap-4 p-6">
Expand Down
41 changes: 20 additions & 21 deletions src/app/clubs/[clubID]/settings/_components/Events.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
'use client'
import { Input } from '@/components/ui/input'
import { Button } from '@/components/ui/button'
import { AlertTriangle, Search } from 'lucide-react'
import DropdownMenuEvent from '@/components/clubs/events/DropdownMenuEvent'
import { AlertTriangle } from 'lucide-react'
import React, { useCallback, useEffect, useState } from 'react'
import { Event } from '@/types/event'
import { useAxiosInterceptor } from '@/helpers/fetch_api'
Expand Down Expand Up @@ -98,27 +96,28 @@ export default function EventsContent() {
<p className="text-xs text-gray-500 dark:text-gray-400">
{new Date(event.created_at).toLocaleString()}
</p>

{event.status === 'DRAFT' ? (
<div className="my-2 flex items-center space-x-2 text-xs">
<AlertTriangle className="h-5 w-5 text-yellow-500" />
<div className="rounded-md bg-yellow-500 px-2 py-2 text-xs text-white">
{eventStatus.label}
<div className="flex flex-row justify-between">
{event.status === 'DRAFT' ? (
<div className="my-2 flex items-center space-x-2 text-xs">
<AlertTriangle className="h-5 w-5 text-yellow-500" />
<div className="rounded-md bg-yellow-500 px-2 py-2 text-xs text-white">
{eventStatus.label}
</div>
</div>
</div>
) : (
<div className="my-2 flex items-center space-x-2 text-xs">
<div className={`rounded-md px-2 py-2 text-xs text-white ${eventStatus.color}`}>
{eventStatus.label}
) : (
<div className="my-2 flex items-center space-x-2 text-xs">
<div className={`rounded-md px-2 py-2 text-xs text-white ${eventStatus.color}`}>
{eventStatus.label}
</div>
</div>
</div>
)}
<div className="flex items-center justify-between">
{isEventOwner(event) && (
<Link href={`/events/${event.id}`}>
<Button className=" w-22 h-8 p-4">View Event</Button>
</Link>
)}
<div className="flex items-center justify-between">
{isEventOwner(event) && (
<Link href={`/events/${event.id}`}>
<Button className=" w-18 h-8 p-4">View Event</Button>
</Link>
)}
</div>
</div>
</div>
)
Expand Down
6 changes: 5 additions & 1 deletion src/components/clubs/events/DialogViewClubInvites.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Button } from '@/components/ui/button'
import React from 'react'
import usePendingClubInvites from '@/hooks/usePendingClubInvites'
import { useAxiosInterceptor } from '@/helpers/fetch_api'
import { toast } from 'sonner'

type DialogViewClubInvites = {
clubId: number | undefined
Expand All @@ -35,12 +36,14 @@ function DialogViewClubInvites({ clubId }: DialogViewClubInvites) {
console.log(response.data)
if (response.status.toString().startsWith('2')) {
setPendingRequests(pendingClubInvites - 1)
toast.success('Invite accepted')
if (eventInvites) {
setEventInvites(eventInvites.filter((invite) => invite.id !== inviteId))
}
}
} catch (error) {
console.error(error)
console.error('Network error:', error)
toast.error('Failed to accept invite, maybe user is already organizer.')
}
}

Expand All @@ -53,6 +56,7 @@ function DialogViewClubInvites({ clubId }: DialogViewClubInvites) {
console.log(response.data)
if (response.status.toString().startsWith('2')) {
setPendingRequests(pendingClubInvites - 1)
toast.success('Invite rejected')
if (eventInvites) {
setEventInvites(eventInvites.filter((invite) => invite.id !== inviteId))
}
Expand Down

0 comments on commit 9e24d26

Please sign in to comment.