hide tabs when same timezone

This commit is contained in:
liyunze 2024-07-07 18:34:39 +10:00
parent a736e8386a
commit d46ab9b545
2 changed files with 35 additions and 28 deletions

View file

@ -79,7 +79,7 @@
task: "chat about MBTI", task: "chat about MBTI",
}, },
{ {
streamer: "Elly78456", streamer: "Ellyskey",
task: "sell YOUthversity merch", task: "sell YOUthversity merch",
}, },
{ {
@ -126,10 +126,6 @@
streamer: "lyricalclove", streamer: "lyricalclove",
task: "teach English", task: "teach English",
}, },
{
streamer: "mikewhatwhere",
task: "be a dietician",
},
{ {
streamer: "msmushh", streamer: "msmushh",
task: "vibe on stream", task: "vibe on stream",

View file

@ -25,15 +25,6 @@
// Current time in my timezone // Current time in my timezone
let now = moment.tz(myLocation); let now = moment.tz(myLocation);
// Find the upcoming Friday
let upcomingFriday = now.clone().day(5).hour(8).minute(0).second(0);
if (now.day() >= 5 && now.format("HH:mm") >= "08:00") {
// If today is Friday and it's already past 8am, set to next Friday
upcomingFriday.add(1, "week");
}
// Adjust based on the provided day and time
let dayDiff = (5 - dayOfWeek + 7) % 7; // Calculate days until Friday
let inputTime = moment(time24, "HH:mm"); let inputTime = moment(time24, "HH:mm");
let upcomingTime = now let upcomingTime = now
.clone() .clone()
@ -66,6 +57,8 @@
end: string; end: string;
}; };
let sameTimezone = false;
let myStreamSchedule = []; let myStreamSchedule = [];
let localisedStreamSchedule = []; let localisedStreamSchedule = [];
@ -105,30 +98,42 @@
onMount(() => { onMount(() => {
// Example usage // Example usage
displayStreamSchedule(); displayStreamSchedule();
if (
formattedLocalisedSchedule[0].day === formattedSchedule[0].day &&
formattedLocalisedSchedule[0].start ===
formattedSchedule[0].start &&
formattedLocalisedSchedule[0].end === formattedSchedule[0].end
) {
sameTimezone = true;
}
}); });
</script> </script>
<!-- TABS --> <!-- TABS -->
<div {#if !sameTimezone}
class="w-full flex <div
class="w-full flex
bg-[#141414] bg-[#141414]
rounded-xl rounded-xl
px-1 py-1 z-20" px-1 py-1 z-20"
> >
<button <button
on:click={() => (adjusted = true)} on:click={() => (adjusted = true)}
class="rounded-lg w-1/2 py-2 class="rounded-lg w-1/2 py-2
transition-colors duration-150 transition-colors duration-150
{adjusted ? 'text-white bg-[#303030]' : 'text-gray-400'}" {adjusted ? 'text-white bg-[#303030]' : 'text-gray-400'}"
>Your Timezone</button >Your Timezone</button
> >
<button <button
on:click={() => (adjusted = false)} on:click={() => (adjusted = false)}
class="rounded-lg flex-grow py-2 class="rounded-lg flex-grow py-2
transition-colors duration-150 transition-colors duration-150
{adjusted ? 'text-gray-400' : 'text-white bg-[#303030]'}">AEDT</button {adjusted ? 'text-gray-400' : 'text-white bg-[#303030]'}"
> >AEST/<wbr />AEDT</button
</div> >
</div>
{/if}
<div class="mt-2"> <div class="mt-2">
<table> <table>
<tr> <tr>
@ -155,3 +160,9 @@
{/if} {/if}
</table> </table>
</div> </div>
<style>
tr {
text-align: center;
}
</style>