Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weekend styling updates and mobile responsiveness #39

Merged
merged 8 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/firebase-hosting-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ jobs:
- run: npm install && npm run lint && npm run test && npm run build
env:
DIRECTUS_URL: ${{ secrets.CMS_URL }}
NEXT_PUBLIC_GOOGLE_API_KEY: ${{ secrets.NEXT_PUBLIC_GOOGLE_API_KEY }}
NEXT_PUBLIC_CALENDAR_ID_1: ${{ secrets.NEXT_PUBLIC_CALENDAR_ID_1 }}
NEXT_PUBLIC_CALENDAR_ID_2: ${{ secrets.NEXT_PUBLIC_CALENDAR_ID_2 }}
NEXT_PUBLIC_CALENDAR_ID_3: ${{ secrets.NEXT_PUBLIC_CALENDAR_ID_3}}
NEXT_PUBLIC_HARASSMENT_FORM_URL: ${{ secrets.NEXT_PUBLIC_HARASSMENT_FORM_URL }}
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
target: "satakuntalainenosakunta"
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/firebase-hosting-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ jobs:
- run: npm install && npm run lint && npm run test && npm run build
env:
DIRECTUS_URL: ${{ secrets.CMS_URL }}
NEXT_PUBLIC_GOOGLE_API_KEY: ${{ secrets.NEXT_PUBLIC_GOOGLE_API_KEY }}
NEXT_PUBLIC_CALENDAR_ID_1: ${{ secrets.NEXT_PUBLIC_CALENDAR_ID_1 }}
NEXT_PUBLIC_CALENDAR_ID_2: ${{ secrets.NEXT_PUBLIC_CALENDAR_ID_2 }}
NEXT_PUBLIC_CALENDAR_ID_3: ${{ secrets.NEXT_PUBLIC_CALENDAR_ID_3}}
NEXT_PUBLIC_HARASSMENT_FORM_URL: ${{ secrets.NEXT_PUBLIC_HARASSMENT_FORM_URL }}

- uses: FirebaseExtended/action-hosting-deploy@v0
id: firebase
Expand Down
8 changes: 5 additions & 3 deletions components/Carousel.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/* eslint-disable react-hooks/exhaustive-deps */
import React, { useEffect } from "react";
import Link from "next/link";
import useTranslate from "@/hooks/useTranslate";
import { EmblaCarouselType, EmblaOptionsType } from "embla-carousel";
import useEmblaCarousel from "embla-carousel-react";
import Image from "next/image";
import Link from "next/link";
import React, { useEffect } from "react";
import { NextButton, PrevButton, usePrevNextButtons } from "./CarouselArrows";

type PropType = {
Expand Down Expand Up @@ -36,6 +37,7 @@ const setOpacity = (emblaApi: EmblaCarouselType) => {

const Carousel: React.FC<PropType> = ({ slides, options }) => {
const [emblaRef, emblaApi] = useEmblaCarousel(options);
const t = useTranslate();

const {
prevBtnDisabled,
Expand Down Expand Up @@ -77,7 +79,7 @@ const Carousel: React.FC<PropType> = ({ slides, options }) => {
<div className="embla__buttons">
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid -- Placeholder href */}
<Link href="" className="embla__link">
Katso Lisää
{t("general:seeMore")}
</Link>
</div>
</div>
Expand Down
5 changes: 3 additions & 2 deletions components/HarassmentForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const HarassmentForm = () => {
const [buttonText, setButtonText] = useState("Submit");
const [buttonDisabled, setButtonDisabled] = useState(false);
// For development only, disable or delete for prod
const corsProxy: string = "https://cors-anywhere.herokuapp.com/";
// const corsProxy: string = "https://cors-anywhere.herokuapp.com/";

const handleSnackbarClose = () => {
setSnackbarOpen(false);
Expand Down Expand Up @@ -89,7 +89,8 @@ const HarassmentForm = () => {
formData.append("entry.200517309", values.name); // Example ID for 'name'
formData.append("entry.1828602041", values.email); // Example ID for 'email'

fetch(`${corsProxy + process.env.NEXT_PUBLIC_HARASSMENT_FORM_URL}`, {
// Add corsProxy + to this for development
fetch(`${process.env.NEXT_PUBLIC_HARASSMENT_FORM_URL}`, {
method: "POST",
body: formData,
})
Expand Down
1 change: 1 addition & 0 deletions components/MonthCalendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const MonthCalendar = () => {
en: enLocale,
};
const currentLocale = localeMap[language] || enLocale;

return (
<>
<FullCalendar
Expand Down
4 changes: 2 additions & 2 deletions components/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Image from "next/image";
import Link from "next/link";
import { useEffect } from "react";
import { NavigationLink } from "@/lib/cmsClient";
import sato_logo_nav from "../public/sato_logo_nav.png";
import sato_logo_nav from "../public/sato_logo_nav.webp";
import Sidebar from "./Sidebar";

export type NavbarProps = {
Expand Down Expand Up @@ -39,7 +39,7 @@ const Navbar = ({ links }: NavbarProps) => {
<Image
src={sato_logo_nav}
alt="A nav link to the home page"
width={120}
width={95}
/>
</Link>
<Sidebar links={links} />
Expand Down
47 changes: 33 additions & 14 deletions components/WeekCalendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,27 @@ const WeekCalendar = () => {
const [minTime, setMinTime] = useState("12:00:00");
const [maxTime, setMaxTime] = useState("24:00:00");

const eventSources = [
{
googleCalendarId: process.env.NEXT_PUBLIC_CALENDAR_ID_1,
googleCalendarApiKey: process.env.NEXT_PUBLIC_GOOGLE_API_KEY,
className: "gcal-1",
},
{
googleCalendarId: process.env.NEXT_PUBLIC_CALENDAR_ID_2,
googleCalendarApiKey: process.env.NEXT_PUBLIC_GOOGLE_API_KEY,
className: "gcal-2",
},
{
googleCalendarId: process.env.NEXT_PUBLIC_CALENDAR_ID_3,
googleCalendarApiKey: process.env.NEXT_PUBLIC_GOOGLE_API_KEY,
className: "gcal-3",
},
];

// there was way too much empty space, mostly before any events,
// this should cut that out and leave a 2hr bufer on either side
// eslint-disable-next-line react-hooks/exhaustive-deps
const adjustTimeRange = useCallback(
debounce((events: EventApi[]) => {
if (events.length > 0) {
Expand All @@ -45,26 +64,26 @@ const WeekCalendar = () => {
<>
<FullCalendar
plugins={[dayGridPlugin, googleCalendarPlugin]}
eventSources={[
{
googleCalendarId: process.env.NEXT_PUBLIC_CALENDAR_ID_1,
googleCalendarApiKey: process.env.NEXT_PUBLIC_GOOGLE_API_KEY,
},
{
googleCalendarId: process.env.NEXT_PUBLIC_CALENDAR_ID_2,
googleCalendarApiKey: process.env.NEXT_PUBLIC_GOOGLE_API_KEY,
},
{
googleCalendarId: process.env.NEXT_PUBLIC_CALENDAR_ID_3,
googleCalendarApiKey: process.env.NEXT_PUBLIC_GOOGLE_API_KEY,
},
]}
eventSources={eventSources}
initialView="timeGridWeek"
locale={currentLocale}
slotMinTime={minTime}
slotMaxTime={maxTime}
eventsSet={adjustTimeRange}
contentHeight="auto"
allDaySlot={false}
eventClick={(info) => {
// Prevent the default behavior of navigating to Google Calendar
info.jsEvent.preventDefault(); // Prevent the default click behavior
}}
views={{
timeGridWeek: {
dayHeaderFormat: {
weekday: "short",
day: "2-digit",
},
},
}}
/>
<div />
</>
Expand Down
Loading
Loading