Skip to content

Commit b40e27e

Browse files
authored
Merge pull request #104 from UTDNebula/calendar-for-apple-outlook
Instructions to subscribe for Apple/Outlook
2 parents d7921bf + 3d06394 commit b40e27e

File tree

5 files changed

+64
-19
lines changed

5 files changed

+64
-19
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
'use client';
2+
3+
import React from 'react';
4+
5+
interface Props {
6+
href: string;
7+
}
8+
9+
export default function CopyInput(props: Props) {
10+
return (
11+
<input
12+
type="text"
13+
className="w-full bg-cornflower-50 border-2 border-royal px-2 py-1 rounded"
14+
value={props.href}
15+
readOnly
16+
onFocus={(e) => {
17+
e.target.select();
18+
}}
19+
/>
20+
);
21+
}

src/app/resources/calendar/error.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,21 @@
22

33
import React from 'react';
44

5+
import Header from '@/components/Header';
6+
57
export default function Error() {
68
const buttonLinkClasses =
79
'hover:scale-105 active:scale-95 transition duration-300 ease-in-out px-4 py-2 rounded-lg cursor-pointer hover:bg-royal hover:text-white border-royal border-2';
810

911
return (
10-
<div className="px-8 lg:px-16 xl:px-32 flex flex-col items-center gap-4">
11-
<h2 className="text-5xl font-bold text-center">Error loading calendar</h2>
12-
<button className={buttonLinkClasses} onClick={() => location.reload()}>
13-
Reload
14-
</button>
15-
</div>
12+
<>
13+
<Header text="Calendar" />
14+
<h2 className="px-8 lg:px-16 xl:px-32 text-2xl text-center mb-12">Error loading calendar</h2>
15+
<div className="px-8 lg:px-16 xl:px-32 mb-12 flex justify-center gap-2 flex-wrap">
16+
<button className={buttonLinkClasses} onClick={() => location.reload()}>
17+
Reload
18+
</button>
19+
</div>
20+
</>
1621
);
1722
}

src/app/resources/calendar/loading.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,10 @@ export default function Loading() {
3939
return (
4040
<>
4141
<Header text="Calendar" />
42-
<h2 className="px-8 lg:px-16 xl:px-32 text-2xl text-center mb-12">
42+
<h2 className="px-8 lg:px-16 xl:px-32 text-2xl text-center mb-2">
4343
Stop by any of our events to learn more about becoming a new member!
4444
</h2>
45+
<p className="px-8 lg:px-16 xl:px-32 text-center mb-8">Times in CT.</p>
4546
<div className="px-8 lg:px-16 xl:px-32 mb-12 flex justify-center gap-2 flex-wrap">
4647
<a
4748
className={buttonLinkClasses}
@@ -51,12 +52,7 @@ export default function Loading() {
5152
>
5253
Subscribe in Google Calendar
5354
</a>
54-
<a
55-
className={buttonLinkClasses}
56-
href="https://calendar.google.com/calendar/ical/c_81b7102868d4acac8b7db3a18de6440d45740e4754be4f8a28a5c3915b0d1e71%40group.calendar.google.com/public/basic.ics"
57-
>
58-
Subscribe with iCal
59-
</a>
55+
<button className={buttonLinkClasses}>Subscribe in Apple/Outlook</button>
6056
<a
6157
className={buttonLinkClasses}
6258
target="_blank"

src/app/resources/calendar/page.tsx

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import Footer from '@/components/Footer';
99
import Header from '@/components/Header';
1010
import fetchCalendar from '@/lib/fetchCalendar';
1111

12+
import CopyInput from './CopyInput';
1213
import Error from './error';
1314

1415
// Do not cache
@@ -233,12 +234,9 @@ export default async function Calendar() {
233234
>
234235
Subscribe in Google Calendar
235236
</a>
236-
<a
237-
className={buttonLinkClasses}
238-
href="https://calendar.google.com/calendar/ical/c_81b7102868d4acac8b7db3a18de6440d45740e4754be4f8a28a5c3915b0d1e71%40group.calendar.google.com/public/basic.ics"
239-
>
240-
Subscribe with iCal
241-
</a>
237+
<button className={buttonLinkClasses} popoverTarget="ics-cal-popover">
238+
Subscribe in Apple/Outlook
239+
</button>
242240
<a
243241
className={buttonLinkClasses}
244242
target="_blank"
@@ -250,6 +248,26 @@ export default async function Calendar() {
250248
</div>
251249
<div className="px-8 lg:px-16 xl:px-32 flex flex-col items-center">{result}</div>
252250
<Footer />
251+
<div
252+
popover="auto"
253+
id="ics-cal-popover"
254+
className="absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 bg-white rounded-xl p-4 w-[80vw] max-w-[90vw]"
255+
>
256+
<h3 className="text-xl font-bold mb-2 text-center">Instructions</h3>
257+
<p className="mb-1">
258+
<b>Apple Calendar on Mac</b>: File &gt; New Calendar Subscription... &gt; Paste in the
259+
URL.
260+
</p>
261+
<p className="mb-1">
262+
<b>Apple Calendar on iOS</b>: Calendars &gt; Add Calendar &gt; Add Subscription Calendar
263+
&gt; Paste in the URL.
264+
</p>
265+
<p className="mb-4">
266+
<b>Outlook Calendar on Desktop</b>: Add calendar &gt; Subscribe from web &gt; Paste in the
267+
URL.
268+
</p>
269+
<CopyInput href="webcal://calendar.google.com/calendar/ical/c_81b7102868d4acac8b7db3a18de6440d45740e4754be4f8a28a5c3915b0d1e71%40group.calendar.google.com/public/basic.ics" />
270+
</div>
253271
</>
254272
);
255273
}

src/styles/globals.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,9 @@
8383
.text-shadow {
8484
text-shadow: 0 0 4px rgb(0 0 0 / 0.4);
8585
}
86+
87+
:popover-open::backdrop {
88+
background-color: rgba(0, 0, 0, 0.2);
89+
backdrop-filter: blur(5px);
90+
}
8691
}

0 commit comments

Comments
 (0)