-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(web-client): Fix frontend to work with the new backend
- Loading branch information
1 parent
3e49dca
commit fda4e69
Showing
16 changed files
with
152 additions
and
64 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
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
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
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
68 changes: 68 additions & 0 deletions
68
...b-client/src/pages/organizations/[organizationId]/events/[eventId]/participants/index.jsx
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,68 @@ | ||
import React, { useEffect, useState } from 'react'; | ||
import { useRouter } from 'next/router'; | ||
|
||
import DashboardLayout from '@/layouts/DashboardLayout'; | ||
import EventCard from '@/components/cards/EventCard'; | ||
|
||
import { Skeleton } from '@/components/ui/skeleton'; | ||
import { PlusCircledIcon } from '@radix-ui/react-icons'; | ||
import { Button } from '@/components/ui/button'; | ||
import axiosInstance from '@/lib/axios'; | ||
|
||
const Dashboard = () => { | ||
const router = useRouter(); | ||
const { organizationId, eventId } = router.query; | ||
|
||
const [loading, setLoading] = useState(true); | ||
const [participants, setParticipants] = useState([]); | ||
|
||
const fetchParticipants = async () => { | ||
try { | ||
const { data, status } = await axiosInstance.get( | ||
`/core/${organizationId}/events/${eventId}/participants`, | ||
); | ||
|
||
if (status === 200) setParticipants(data.participants || []); | ||
|
||
setLoading(false); | ||
} catch (error) { | ||
console.error(error); | ||
setLoading(true); | ||
} | ||
}; | ||
|
||
useEffect(() => { | ||
if (!organizationId || !eventId) return; | ||
fetchParticipants(); | ||
}, [router, organizationId, eventId]); | ||
|
||
return ( | ||
<DashboardLayout> | ||
<div className="flex flex-row justify-end"> | ||
<Button | ||
onClick={() => { | ||
router.push(`/organizations/${organizationId}/new`); | ||
}} | ||
> | ||
<PlusCircledIcon className="mr-2 h-4 w-4" /> | ||
New | ||
</Button> | ||
</div> | ||
<div className="h-full w-full bg-black-russian flex flex-row justify-start items-start overflow-y-auto gap-8 flex-wrap p-6"> | ||
{loading && ( | ||
<> | ||
<Skeleton className="w-[100px] h-[20px] rounded-full" /> | ||
<Skeleton className="w-[100px] h-[20px] rounded-full" /> | ||
<Skeleton className="w-[100px] h-[20px] rounded-full" /> | ||
<Skeleton className="w-[100px] h-[20px] rounded-full" /> | ||
</> | ||
)} | ||
{participants.map((p) => ( | ||
<div key={p?.id}>{JSON.stringify(p)}</div> | ||
))} | ||
</div> | ||
</DashboardLayout> | ||
); | ||
}; | ||
|
||
export default Dashboard; |
File renamed without changes.
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
24 changes: 24 additions & 0 deletions
24
apps/web-client/src/pages/organizations/[organizationId]/index.jsx
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,24 @@ | ||
import DashboardLayout from '@/layouts/DashboardLayout'; | ||
import { useRouter } from 'next/router'; | ||
import { useEffect } from 'react'; | ||
|
||
const Home = () => { | ||
const router = useRouter(); | ||
|
||
const { organizationId } = router.query; | ||
|
||
useEffect(() => { | ||
if (!organizationId) return; | ||
router.replace(`/organizations/${organizationId}/events`); | ||
}, [router, organizationId]); | ||
|
||
return ( | ||
<main> | ||
<DashboardLayout> | ||
<p className="text-3xl">Please wait ...</p> | ||
</DashboardLayout> | ||
</main> | ||
); | ||
}; | ||
|
||
export default Home; |
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.