Compare commits
2 Commits
9125c25259
...
0cd5365c93
Author | SHA1 | Date |
---|---|---|
Vencislav Atanasov | 0cd5365c93 | |
Vencislav Atanasov | b46549485c |
2
.env
2
.env
|
@ -1 +1 @@
|
|||
VITE_CFP_BASE_URL=http://cfp.localhost/api/conferences/
|
||||
VITE_CFP_BASE_URL=https://cfp.openfest.org/api/conferences
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
VITE_CFP_BASE_URL=https://cfp.openfest.org/api/conferences
|
|
@ -11,13 +11,20 @@ export default function Schedule({
|
|||
events,
|
||||
speakers,
|
||||
tracks,
|
||||
halls,
|
||||
isLoading,
|
||||
loadingProgress,
|
||||
} = useSchedule(conferenceId);
|
||||
|
||||
return (<>
|
||||
{isLoading && <p>Loading... <progress value={loadingProgress} /></p>}
|
||||
<div>schedule goes here</div>
|
||||
{halls && <table border="1">
|
||||
<thead>
|
||||
<tr>
|
||||
{Object.entries(halls).map(([hallId, hall]) => <th key={hallId}>{hall.name[lang]}</th>)}
|
||||
</tr>
|
||||
</thead>
|
||||
</table>}
|
||||
{tracks && Object.entries(tracks).map(([trackId, track]) => <div key={trackId} style={{
|
||||
width: '100%',
|
||||
border: '1px solid black',
|
||||
|
|
|
@ -2,6 +2,6 @@ import useSWR from 'swr';
|
|||
|
||||
const fetcher = (...args) => fetch(...args).then(res => res.json());
|
||||
|
||||
export default function useCfpRequest(path = '') {
|
||||
export default function useCfpRequest(path) {
|
||||
return useSWR(import.meta.env.VITE_CFP_BASE_URL.concat(path), fetcher);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import useCfpRequest from './useCfpRequest.js';
|
||||
|
||||
export default function useConferences() {
|
||||
return useCfpRequest();
|
||||
return useCfpRequest('.json');
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import useCfpRequest from './useCfpRequest.js';
|
||||
|
||||
export default function useEventTypes(conferenceId) {
|
||||
return useCfpRequest(`${conferenceId}/event_types.json`);
|
||||
return useCfpRequest(`/${conferenceId}/event_types.json`);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import useCfpRequest from './useCfpRequest.js';
|
||||
|
||||
export default function useEvents(conferenceId) {
|
||||
return useCfpRequest(`${conferenceId}/events.json`);
|
||||
return useCfpRequest(`/${conferenceId}/events.json`);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import useCfpRequest from './useCfpRequest.js';
|
||||
|
||||
export default function useHalls(conferenceId) {
|
||||
return useCfpRequest(`${conferenceId}/halls.json`);
|
||||
return useCfpRequest(`/${conferenceId}/halls.json`);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import useCfpRequest from './useCfpRequest.js';
|
||||
|
||||
export default function useSlots(conferenceId) {
|
||||
return useCfpRequest(`${conferenceId}/slots.json`);
|
||||
return useCfpRequest(`/${conferenceId}/slots.json`);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import useCfpRequest from './useCfpRequest.js';
|
||||
|
||||
export default function useSpeakers(conferenceId) {
|
||||
return useCfpRequest(`${conferenceId}/speakers.json`);
|
||||
return useCfpRequest(`/${conferenceId}/speakers.json`);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import useCfpRequest from './useCfpRequest.js';
|
||||
|
||||
export default function useTracks(conferenceId) {
|
||||
return useCfpRequest(`${conferenceId}/tracks.json`);
|
||||
return useCfpRequest(`/${conferenceId}/tracks.json`);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue