Compare commits

...

2 Commits

Author SHA1 Message Date
Vencislav Atanasov 0cd5365c93 Fix CFP URL so CORS is allowed 2024-09-19 12:57:24 +03:00
Vencislav Atanasov b46549485c Add hall labels to schedule 2024-09-19 02:02:32 +03:00
11 changed files with 18 additions and 10 deletions

2
.env
View File

@ -1 +1 @@
VITE_CFP_BASE_URL=http://cfp.localhost/api/conferences/
VITE_CFP_BASE_URL=https://cfp.openfest.org/api/conferences

1
.env.example Normal file
View File

@ -0,0 +1 @@
VITE_CFP_BASE_URL=https://cfp.openfest.org/api/conferences

View File

@ -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',

View File

@ -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);
}

View File

@ -1,5 +1,5 @@
import useCfpRequest from './useCfpRequest.js';
export default function useConferences() {
return useCfpRequest();
return useCfpRequest('.json');
}

View File

@ -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`);
}

View File

@ -1,5 +1,5 @@
import useCfpRequest from './useCfpRequest.js';
export default function useEvents(conferenceId) {
return useCfpRequest(`${conferenceId}/events.json`);
return useCfpRequest(`/${conferenceId}/events.json`);
}

View File

@ -1,5 +1,5 @@
import useCfpRequest from './useCfpRequest.js';
export default function useHalls(conferenceId) {
return useCfpRequest(`${conferenceId}/halls.json`);
return useCfpRequest(`/${conferenceId}/halls.json`);
}

View File

@ -1,5 +1,5 @@
import useCfpRequest from './useCfpRequest.js';
export default function useSlots(conferenceId) {
return useCfpRequest(`${conferenceId}/slots.json`);
return useCfpRequest(`/${conferenceId}/slots.json`);
}

View File

@ -1,5 +1,5 @@
import useCfpRequest from './useCfpRequest.js';
export default function useSpeakers(conferenceId) {
return useCfpRequest(`${conferenceId}/speakers.json`);
return useCfpRequest(`/${conferenceId}/speakers.json`);
}

View File

@ -1,5 +1,5 @@
import useCfpRequest from './useCfpRequest.js';
export default function useTracks(conferenceId) {
return useCfpRequest(`${conferenceId}/tracks.json`);
return useCfpRequest(`/${conferenceId}/tracks.json`);
}