Skip to content

Commit

Permalink
logo positioning. only show schedule sometimes on mobile.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlaraBread committed Feb 18, 2024
1 parent 778e901 commit 88c27f1
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 13 deletions.
8 changes: 4 additions & 4 deletions src/app/(pages)/players/players.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@

.audio_player {
padding: 2rem 2rem;
display: flex;
flex-direction: column;
align-items: center;
height: 100%;
}

Expand All @@ -41,7 +38,10 @@
position: relative;
background: transparent;
width: 100%;
max-height: 10rem;
height: 75%;
max-height: 20rem;
min-height: 5rem;

aspect-ratio: 1.5;
}

Expand Down
5 changes: 4 additions & 1 deletion src/app/(pages)/schedule.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@

@media (max-width: 1000px) {
.container {
max-height: 10em;
max-height: 20em;
border: unset;
border-top: 0.25rem solid var(--accent-color);
border-bottom: 0.25rem solid var(--accent-color);
font-size: 1.25rem;
}
.hide_on_mobile {
display: none;
}
}

.table {
Expand Down
9 changes: 8 additions & 1 deletion src/app/(pages)/schedule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { DayOfWeek, formatDay, formatTimes, getNYCTime, getNYCWeekday, getNYCWee
import styles from "./schedule.module.scss";
import useSWR from "swr";
import { jsonFetcher } from "../utils/fetchers";
import { usePathname } from "next/navigation";

type Show = {name: string, desc: string, hosts: string, poster: string, start_time: number, end_time: number, is_running: number};
type DaySchedule = {day: DayOfWeek, shows: Array<Show>};
Expand All @@ -28,6 +29,9 @@ export default function Schedule() {
if(!data || error) {
continue;
}
if(d < 0) {
continue; // weekend
}
if(i == 0) {
data = structuredClone(data);
data.shows = data.shows.filter((show) => show.end_time > time);
Expand Down Expand Up @@ -89,8 +93,11 @@ export default function Schedule() {
}
});

const path = usePathname();
let hide_on_mobile = !["/", "/shows/"].includes(path);

return (
<div className={styles.container} tabIndex={-1}>
<div className={`${styles.container} ${hide_on_mobile?styles.hide_on_mobile:undefined}`} tabIndex={-1}>
<table className={styles.table}>
{computed}
</table>
Expand Down
12 changes: 6 additions & 6 deletions src/app/utils/delay_correction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// happy_delay_seconds should be < unhappy_delay_seconds
const happy_delay_seconds = 10.0;
const unhappy_delay_seconds = 20.0;
const correction_speed = 1.025;
const correction_speed = 1.05;
export const delay_correction_interval = 1000; // in ms

// global state is fine here since we will only ever have one stream active.
Expand All @@ -29,16 +29,16 @@ export function applyDelayCorrection(media: HTMLMediaElement | null) {
media.playbackRate = 1.0;
return;
}
if(current_delay < happy_delay_seconds) {
if(happy || current_delay < happy_delay_seconds) {
happy = true;
media.playbackRate = 1.0;
return;
}
happy = false;
if(current_delay < happy_delay_seconds) {
happy = true;
if(current_delay > unhappy_delay_seconds) {
happy = false;
}
media.playbackRate = correction_speed;
console.log(media.playbackRate);
}

export function teleportDelayCorrection(media: HTMLMediaElement | null) {
Expand All @@ -49,7 +49,7 @@ export function teleportDelayCorrection(media: HTMLMediaElement | null) {
if(timeRanges.length == 0) {
return;
}
const desired = timeRanges.end(timeRanges.length-1) - happy_delay_seconds;
const desired = timeRanges.end(timeRanges.length-1) - unhappy_delay_seconds;
if(desired == null || Number.isNaN(desired) || !Number.isFinite(desired)) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/utils/time.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function getNYCWeekday() {
}

export function getWeekdayString(day: number): DayOfWeek {
return ["monday", "tuesday", "wednesday", "thursday", "friday"][day] as DayOfWeek;
return ["monday", "tuesday", "wednesday", "thursday", "friday"][Math.abs(day % 5)] as DayOfWeek;
}

export function getNYCWeekdayString(): DayOfWeek {
Expand Down

0 comments on commit 88c27f1

Please sign in to comment.