Skip to content

Commit

Permalink
fix day filter for ca (#405)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshreisner authored Aug 13, 2024
1 parent 1ed3896 commit e9ba998
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 9 deletions.
2 changes: 1 addition & 1 deletion public/app.js

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions public/tests/area-fellowship.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta name="description" content="React JS recovery meeting finder demo" />
<link rel="icon" type="image/png" href="/logo.png" />
<title>Meetings</title>
<style type="text/css">
body {
margin: 0;
}
#tsml-ui {
min-height: 100vh;
min-height: -webkit-fill-available;
}
</style>
</head>
<body>
<div
id="tsml-ui"
data-src="https://www.areafellowship.com/meeting-guide/b0cc50acb2b4974e2ee49c062068c3678538f19ef1a427e8d6c484e85835abe6/"
data-mapbox="pk.eyJ1Ijoiam9zaHJlaXNuZXIiLCJhIjoiY2tvYXA0YnZxMGRldDJxbzdta25uNGphdiJ9.eay-UKgIT99ALmdw08xBPw"
data-timezone="America/New_York"
></div>
<script src="/app.js" async></script>
<script>
var tsml_react_config = {
feedback_emails: ['[email protected]'],
};
</script>
</body>
</html>
45 changes: 45 additions & 0 deletions public/tests/ca.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta name="description" content="React JS recovery meeting finder demo" />
<link rel="icon" type="image/png" href="/logo.png" />
<title>Meetings</title>
<style type="text/css">
body {
margin: 0;
}
#tsml-ui {
min-height: 100vh;
min-height: -webkit-fill-available;
}
@media (prefers-color-scheme: dark) {
body {
background-color: black;
color: white;
}
#tsml-ui {
--alert-background: #191919;
--alert-text: #bbb;
--background: #000;
--in-person: #66aa66;
--link: #6699cc;
--online: #6699cc;
--text: #fff;
}
}
</style>
</head>
<body>
<div
id="tsml-ui"
data-src="https://caws-api.azurewebsites.net/api/v1/meetings-tsml"
data-mapbox="pk.eyJ1Ijoiam9zaHJlaXNuZXIiLCJhIjoiY2tvYXA0YnZxMGRldDJxbzdta25uNGphdiJ9.eay-UKgIT99ALmdw08xBPw"
></div>
<script src="/app.js" async></script>
</body>
</html>
20 changes: 12 additions & 8 deletions src/helpers/load-meeting-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,9 @@ export function loadMeetingData(
}
}

let start, end, minutes_week;
let start: DateTime | undefined;
let end: DateTime | undefined;
let minutes_week: number | undefined;

// handle day and time
if (typeof meeting.day !== 'undefined' && meeting.time) {
Expand Down Expand Up @@ -261,18 +263,20 @@ export function loadMeetingData(

// day & time indexes
if (isActive) {
const weekday = settings.weekdays[
start?.weekday === 7
? 0
: (start?.weekday as keyof typeof settings.weekdays)
] as keyof typeof strings.days;

// day index
const dayIndex = indexes.weekday.findIndex(
({ key }) =>
key ===
settings.weekdays[meeting.day as keyof typeof settings.weekdays]
({ key }) => key === weekday
);
if (dayIndex === -1) {
indexes.weekday.push({
key: settings.weekdays[meeting.day],
name: strings.days[
settings.weekdays[meeting.day] as keyof typeof strings.days
],
key: weekday,
name: strings.days[weekday],
slugs: [slug],
});
} else {
Expand Down

0 comments on commit e9ba998

Please sign in to comment.