Skip to content

Commit e9e814b

Browse files
committed
run prettier
1 parent f0aeca4 commit e9e814b

File tree

3 files changed

+26
-17
lines changed

3 files changed

+26
-17
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"clsx": "^1.1.1",
2525
"country-flag-icons": "^1.5.4",
2626
"date-fns": "^2.30.0",
27+
"ics": "^3.5.0",
2728
"lodash.flatmap": "^4.5.0",
2829
"lodash.flatten": "^4.4.0",
2930
"react": "^18.2.0",

src/lib/utils.ts

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
formatMultiResult,
88
} from '@wca/helpers';
99
import { format, parseISO } from 'date-fns';
10-
import * as ics from 'ics'
10+
import * as ics from 'ics';
1111

1212
export const byName = (a: { name: string }, b: { name: string }) => a.name.localeCompare(b.name);
1313
export const byDate = <T>(a: T & { startTime: string }, b: T & { startTime: string }) =>
@@ -157,20 +157,28 @@ const AssignmentCodeDescription = {
157157
'staff-dataentry': 'Data Entry for:',
158158
'staff-announcer': 'Announcing for:',
159159
'staff-delegate': 'Delegating for:',
160-
'competitor': 'Competing in:'
160+
competitor: 'Competing in:',
161161
};
162162

163-
export const generateIcs = (assignments, fileName) => {
163+
export const generateIcs = (assignments, fileName) => {
164164
if (!assignments) {
165165
return;
166166
}
167167

168168
console.log(assignments);
169169

170-
let events: { title: string; description: string; location: string; start: ics.DateArray; end: ics.DateArray }[] = [];
171-
172-
assignments.forEach(item => {
173-
const titleFormatted = `${AssignmentCodeDescription[item.assignmentCode]} for ${item.activity.name}`;
170+
let events: {
171+
title: string;
172+
description: string;
173+
location: string;
174+
start: ics.DateArray;
175+
end: ics.DateArray;
176+
}[] = [];
177+
178+
assignments.forEach((item) => {
179+
const titleFormatted = `${AssignmentCodeDescription[item.assignmentCode]} for ${
180+
item.activity.name
181+
}`;
174182
const startDate = new Date(item.activity.startTime);
175183
const endDate = new Date(item.activity.endTime);
176184

@@ -188,7 +196,8 @@ export const generateIcs = (assignments, fileName) => {
188196
endDate.getDate(),
189197
endDate.getHours(),
190198
endDate.getMinutes(),
191-
];endDate
199+
];
200+
endDate;
192201

193202
const icalEvent = {
194203
title: titleFormatted,
@@ -222,4 +231,4 @@ export const generateIcs = (assignments, fileName) => {
222231
a.click();
223232

224233
document.body.removeChild(a);
225-
}
234+
};

src/pages/Competition/Person/index.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -446,14 +446,13 @@ export default function PersonPage() {
446446
<div>No Assignments</div>
447447
)}
448448
<div className="flex items-center justify-center">
449-
<button
450-
onClick={() => generateIcs(assignmentsWithParsedDate, `${wcif?.name}: ${person.name}`)}
451-
className="my-2 bg-white text-blue-500 border border-blue-500 p-2 rounded-md"
452-
style={{ width: '300px' }}
453-
>
454-
Download Calendar Export
455-
</button>
456-
</div>
449+
<button
450+
onClick={() => generateIcs(assignmentsWithParsedDate, `${wcif?.name}: ${person.name}`)}
451+
className="my-2 bg-white text-blue-500 border border-blue-500 p-2 rounded-md"
452+
style={{ width: '300px' }}>
453+
Download Calendar Export
454+
</button>
455+
</div>
457456
</div>
458457
);
459458
}

0 commit comments

Comments
 (0)