updated stream schedule

This commit is contained in:
liyunze 2024-11-23 16:52:29 +11:00
parent 3ee787c3c0
commit bf66861cb4

View file

@ -4,15 +4,20 @@
const myLocation = "Australia/Melbourne"; const myLocation = "Australia/Melbourne";
const myStreamSchedule = [ type StreamScheduleDay = {
{ start: moment.Moment;
start: getUpcomingTimeDevTZ(2, "9:30"), end: moment.Moment;
end: getUpcomingTimeDevTZ(2, "16:00"), };
},
{ const myStreamSchedule: null | StreamScheduleDay[] = [
start: getUpcomingTimeDevTZ(4, "9:30"), // {
end: getUpcomingTimeDevTZ(4, "16:00"), // start: getUpcomingTimeDevTZ(2, "9:30"),
}, // end: getUpcomingTimeDevTZ(2, "16:00"),
// },
// {
// start: getUpcomingTimeDevTZ(4, "9:30"),
// end: getUpcomingTimeDevTZ(4, "16:00"),
// },
]; ];
/** /**
@ -75,6 +80,9 @@
let formattedLocalisedSchedule: Schedule[] = $state([]); let formattedLocalisedSchedule: Schedule[] = $state([]);
function displayStreamSchedule() { function displayStreamSchedule() {
if (myStreamSchedule == null) {
return;
}
localisedStreamSchedule = myStreamSchedule.map((stream) => ({ localisedStreamSchedule = myStreamSchedule.map((stream) => ({
start: convertToUserLocalTimezone(stream.start), start: convertToUserLocalTimezone(stream.start),
end: convertToUserLocalTimezone(stream.end), end: convertToUserLocalTimezone(stream.end),
@ -133,35 +141,45 @@
</div> </div>
{/if} {/if}
<div class="mt-1"> <div class="mt-1">
<table> {#if myStreamSchedule.length}
<thead> <table>
<tr> <thead>
<th>Day</th> <tr>
<th>Time</th> <th>Day</th>
</tr> <th>Time</th>
</thead> </tr>
<tbody> </thead>
{#if adjusted} <tbody>
{#each formattedLocalisedSchedule as localTime} {#if adjusted}
<tr> {#each formattedLocalisedSchedule as localTime}
<td class="px-1 md:px-5">{localTime.day}</td> <tr>
<td class="px-1 md:px-5" <td class="px-1 md:px-5">{localTime.day}</td>
>{localTime.start} - {localTime.end}</td <td class="px-1 md:px-5"
> >{localTime.start} - {localTime.end}</td
</tr> >
{/each} </tr>
{:else} {/each}
{#each formattedSchedule as devTime} {:else}
<tr> {#each formattedSchedule as devTime}
<td class="px-1 md:px-5">{devTime.day}</td> <tr>
<td class="px-1 md:px-5" <td class="px-1 md:px-5">{devTime.day}</td>
>{devTime.start} - {devTime.end}</td <td class="px-1 md:px-5"
> >{devTime.start} - {devTime.end}</td
</tr> >
{/each} </tr>
{/if} {/each}
</tbody> {/if}
</table> </tbody>
</table>
{:else}
<div>
To be announced on <a
href="/discord"
target="_blank"
class="underline hover:text-blue-500">Discord</a
>
</div>
{/if}
</div> </div>
<style> <style>