diff --git a/components/analytics/graph.tsx b/components/analytics/graph.tsx index e8ddd767..f2b16635 100644 --- a/components/analytics/graph.tsx +++ b/components/analytics/graph.tsx @@ -1,3 +1,5 @@ +/* eslint-disable react/no-unused-prop-types, react/prop-types */ + import { Area, AreaChart, diff --git a/components/banner/index.tsx b/components/banner/index.tsx index e7dd6cda..86455840 100644 --- a/components/banner/index.tsx +++ b/components/banner/index.tsx @@ -1,6 +1,6 @@ +import cn from 'classnames'; import { useState } from 'react'; import useTranslation from 'next-translate/useTranslation'; -import cn from 'classnames'; import styles from './banner.module.scss'; diff --git a/components/button/index.tsx b/components/button/index.tsx index c3ed334d..36a2d950 100644 --- a/components/button/index.tsx +++ b/components/button/index.tsx @@ -4,8 +4,8 @@ import { ButtonProps as MDCButtonProps, } from '@rmwc/button'; import Link from 'next/link'; -import { useMemo } from 'react'; import cn from 'classnames'; +import { useMemo } from 'react'; import Arrow from './arrow'; import styles from './button.module.scss'; diff --git a/components/calendar/meetings/item.tsx b/components/calendar/meetings/item.tsx index bee4d5b9..aa99f63e 100644 --- a/components/calendar/meetings/item.tsx +++ b/components/calendar/meetings/item.tsx @@ -82,10 +82,7 @@ export default function MeetingItem({ const edit = (e: MouseEvent) => { e.stopPropagation(); if (lastPosition) - mouseMovement += Math.sqrt( - Math.pow(lastPosition.x - e.clientX, 2) + - Math.pow(lastPosition.y - e.clientY, 2) - ); + mouseMovement += Math.sqrt(((lastPosition.x - e.clientX) ** 2 + (lastPosition.y - e.clientY) ** 2)); lastPosition = { x: e.clientX, y: e.clientY }; if (mouseMovement > 10) { removeListeners(); diff --git a/components/calendar/state.ts b/components/calendar/state.ts index 36497125..2af58062 100644 --- a/components/calendar/state.ts +++ b/components/calendar/state.ts @@ -1,6 +1,6 @@ import { FormEvent, createContext, useContext } from 'react'; -import { Callback, CallbackParam } from 'lib/model/callback'; +import { Callback } from 'lib/model/callback'; import { Meeting } from 'lib/model/meeting'; import { MeetingsQuery } from 'lib/model/query/meetings'; @@ -27,15 +27,15 @@ export interface CalendarState { export const CalendarStateContext = createContext({ start: new MeetingsQuery().from, editing: new Meeting(), - setEditing: (param: CallbackParam) => {}, - onEditStop: (evt?: FormEvent) => {}, + setEditing: () => {}, + onEditStop: () => {}, rnd: false, - setRnd: (param: CallbackParam) => {}, + setRnd: () => {}, dialog: false, - setDialog: (param: CallbackParam) => {}, - setDialogPage: (param: CallbackParam) => {}, + setDialog: () => {}, + setDialogPage: () => {}, dragging: false, - setDragging: (param: CallbackParam) => {}, + setDragging: () => {}, }); export const useCalendarState = (): CalendarState => diff --git a/components/carousel/cards.tsx b/components/carousel/cards.tsx index 99588b80..7c318496 100644 --- a/components/carousel/cards.tsx +++ b/components/carousel/cards.tsx @@ -1,5 +1,5 @@ -import React from 'react'; import Link from 'next/link'; +import React from 'react'; import { Ripple } from '@rmwc/ripple'; import cn from 'classnames'; diff --git a/components/carousel/index.tsx b/components/carousel/index.tsx index 273ba25e..9e351ba2 100644 --- a/components/carousel/index.tsx +++ b/components/carousel/index.tsx @@ -3,8 +3,8 @@ import { nanoid } from 'nanoid'; import { useEffect } from 'react'; import { User, UserJSON } from 'lib/model/user'; -import { UsersQuery } from 'lib/model/query/users'; import { ListUsersRes } from 'lib/api/routes/users/list'; +import { UsersQuery } from 'lib/model/query/users'; import { useOrg } from 'lib/context/org'; import { LoadingCard, UserCard } from './cards'; diff --git a/components/home/index.tsx b/components/home/index.tsx index 150d7af1..97b2338a 100644 --- a/components/home/index.tsx +++ b/components/home/index.tsx @@ -5,9 +5,9 @@ import useTranslation from 'next-translate/useTranslation'; import Avatar from 'components/avatar'; import Button from 'components/button'; -import { getEmailLink } from 'lib/utils'; import Link from 'lib/intl/link'; import { Org } from 'lib/model/org'; +import { getEmailLink } from 'lib/utils'; import styles from './home.module.scss'; diff --git a/components/login/index.tsx b/components/login/index.tsx index 8698cfac..8de1dab7 100644 --- a/components/login/index.tsx +++ b/components/login/index.tsx @@ -10,8 +10,8 @@ import Button from 'components/button'; import { APIErrorJSON } from 'lib/model/error'; import getLocation from 'lib/utils/location'; -import { period } from 'lib/utils'; import { loginWithGoogle } from 'lib/firebase/login'; +import { period } from 'lib/utils'; import useTrack from 'lib/hooks/track'; import styles from './login.module.scss'; diff --git a/components/navigation/pop-over.tsx b/components/navigation/pop-over.tsx index 8500896a..77b3bad2 100644 --- a/components/navigation/pop-over.tsx +++ b/components/navigation/pop-over.tsx @@ -10,11 +10,11 @@ import AddIcon from 'components/icons/add'; import Avatar from 'components/avatar'; import ContactSupportIcon from 'components/icons/contact-support'; -import Intercom from 'lib/intercom'; import { AccountInterface } from 'lib/model/account'; +import Intercom from 'lib/intercom'; +import Link from 'lib/intl/link'; import { Org } from 'lib/model/org'; import { User } from 'lib/model/user'; -import Link from 'lib/intl/link'; import { useTheme } from 'lib/context/theme'; import { useUser } from 'lib/context/user'; @@ -168,7 +168,7 @@ export default function PopOverMenu({ window.analytics?.reset(); Intercom('shutdown'); Intercom('boot'); - }, []); + }, [updateUser]); return ( diff --git a/components/notification/index.tsx b/components/notification/index.tsx index 55bb0444..51c40882 100644 --- a/components/notification/index.tsx +++ b/components/notification/index.tsx @@ -2,13 +2,11 @@ import styles from './notification.module.scss'; export interface NotificationProps { header: string; - intercom?: boolean; children?: React.ReactNode; } export default function Notification({ header, - intercom, children, }: NotificationProps): JSX.Element { return ( diff --git a/components/settings/context.ts b/components/settings/context.ts index 46e4bc3f..c92ff5d1 100644 --- a/components/settings/context.ts +++ b/components/settings/context.ts @@ -1,6 +1,6 @@ import { createContext, useContext } from 'react'; -import { Callback, CallbackParam } from 'lib/model/callback'; +import { Callback } from 'lib/model/callback'; import { Org } from 'lib/model/org'; export interface SettingsContextValue { @@ -10,7 +10,7 @@ export interface SettingsContextValue { export const SettingsContext = createContext({ org: new Org(), - setOrg: (org: CallbackParam) => {}, + setOrg: () => {}, }); export const useSettings = () => diff --git a/components/settings/home.tsx b/components/settings/home.tsx index 11b4a0a4..3e6b927d 100644 --- a/components/settings/home.tsx +++ b/components/settings/home.tsx @@ -6,8 +6,8 @@ import PhotoInput from 'components/photo-input'; import { Org } from 'lib/model/org'; -import { useSettings } from './context'; import styles from './settings.module.scss'; +import { useSettings } from './context'; export default function Home(): JSX.Element { const { t, lang: locale } = useTranslation(); diff --git a/components/time-select/select-surface.tsx b/components/time-select/select-surface.tsx index 83a1e75f..61baf63a 100644 --- a/components/time-select/select-surface.tsx +++ b/components/time-select/select-surface.tsx @@ -93,18 +93,18 @@ function SelectSurface({ uid ? `/api/users/${uid}/availability?month=${month}&year=${year}` : null ); const full = useMemo(() => { - const full = new Availability(); + const fill = new Availability(); const days = Array(7).fill(null); days.forEach((_, day) => { - full.push(new Timeslot({ from: getDate(day, 0), to: getDate(day, 24) })); + fill.push(new Timeslot({ from: getDate(day, 0), to: getDate(day, 24) })); }); - return getMonthsTimeslots(full, month, year); + return getMonthsTimeslots(fill, month, year); }, [month, year]); const availability = useMemo(() => { // TODO: Shouldn't I make this empty by default? Not filled? const base = data ? Availability.fromJSON(data) : full; return new Availability(...base.filter((t) => t.from > now)); - }, [data, month, year, now, full]); + }, [data, now, full]); const availabilityOnSelected = useMemo(() => availability.onDate(selected), [ selected, availability, diff --git a/lib/api/get/rand-background.ts b/lib/api/get/rand-background.ts deleted file mode 100644 index 05cbb65d..00000000 --- a/lib/api/get/rand-background.ts +++ /dev/null @@ -1,14 +0,0 @@ -// TODO: Perhaps use the Unsplash API instead if we find a custom collection of -// interesting photos. Or, even better, use my own photography. -export default async function getRandBackground(): Promise { - const backgrounds = [ - 'beach.jpg', - 'beach-overlook.jpg', - 'forest.jpg', - 'galaxy.jpg', - 'hills.jpg', - 'rocky-beach.jpg', - ]; - const idx = Math.floor(Math.random() * backgrounds.length); - return `https://assets.tutorbook.org/jpgs/${backgrounds[idx]}`; -} diff --git a/pages/[org]/users/[id]/edit.tsx b/pages/[org]/users/[id]/edit.tsx index c7be64c0..66ea4e9b 100644 --- a/pages/[org]/users/[id]/edit.tsx +++ b/pages/[org]/users/[id]/edit.tsx @@ -71,13 +71,13 @@ export const getStaticProps: GetStaticProps< > = async (ctx: GetStaticPropsContext) => { if (!ctx.params) throw new Error('Cannot fetch org and user w/out params.'); try { - const [org, user] = await Promise.all([ + const [org, usr] = await Promise.all([ getOrg(ctx.params.org), getUser(ctx.params.id), ]); const { props } = await getPageProps(); return { - props: { org: org.toJSON(), user: user.toJSON(), ...props }, + props: { org: org.toJSON(), user: usr.toJSON(), ...props }, revalidate: 1, }; } catch (e) { @@ -88,7 +88,7 @@ export const getStaticProps: GetStaticProps< // TODO: We want to statically generate skeleton loading pages for each org. // @see {@link https://github.com/vercel/next.js/issues/14200} // @see {@link https://github.com/vercel/next.js/discussions/14486} -export const getStaticPaths: GetStaticPaths = async () => ({ +export const getStaticPaths: GetStaticPaths = () => ({ paths: [], fallback: true, }); diff --git a/pages/[org]/users/[id]/hours.tsx b/pages/[org]/users/[id]/hours.tsx index a8cc821f..b14c9bff 100644 --- a/pages/[org]/users/[id]/hours.tsx +++ b/pages/[org]/users/[id]/hours.tsx @@ -5,8 +5,8 @@ import { useRouter } from 'next/router'; import useSWR from 'swr'; import Page from 'components/page'; -import { TabHeader } from 'components/navigation'; import Hours from 'components/user/hours'; +import { TabHeader } from 'components/navigation'; import { Org, OrgJSON } from 'lib/model/org'; import { PageProps, getPageProps } from 'lib/page'; @@ -83,13 +83,13 @@ export const getStaticProps: GetStaticProps< > = async (ctx: GetStaticPropsContext) => { if (!ctx.params) throw new Error('Cannot fetch org and user w/out params.'); try { - const [org, user] = await Promise.all([ + const [org, usr] = await Promise.all([ getOrg(ctx.params.org), getUser(ctx.params.id), ]); const { props } = await getPageProps(); return { - props: { org: org.toJSON(), user: user.toJSON(), ...props }, + props: { org: org.toJSON(), user: usr.toJSON(), ...props }, revalidate: 1, }; } catch (e) { @@ -100,7 +100,7 @@ export const getStaticProps: GetStaticProps< // TODO: We want to statically generate skeleton loading pages for each org. // @see {@link https://github.com/vercel/next.js/issues/14200} // @see {@link https://github.com/vercel/next.js/discussions/14486} -export const getStaticPaths: GetStaticPaths = async () => ({ +export const getStaticPaths: GetStaticPaths = () => ({ paths: [], fallback: true, }); diff --git a/pages/[org]/users/[id]/index.tsx b/pages/[org]/users/[id]/index.tsx index 322cd456..372cf1d2 100644 --- a/pages/[org]/users/[id]/index.tsx +++ b/pages/[org]/users/[id]/index.tsx @@ -161,6 +161,6 @@ export const getStaticProps: GetStaticProps< }; export const getStaticPaths: GetStaticPaths = - async () => ({ paths: [], fallback: true }); + () => ({ paths: [], fallback: true }); export default withI18n(UserDisplayPage, { common, error, match3rd, user3rd }); diff --git a/pages/[org]/users/[id]/vet.tsx b/pages/[org]/users/[id]/vet.tsx index 1ab37708..2d7bc5fe 100644 --- a/pages/[org]/users/[id]/vet.tsx +++ b/pages/[org]/users/[id]/vet.tsx @@ -71,13 +71,13 @@ export const getStaticProps: GetStaticProps< > = async (ctx: GetStaticPropsContext) => { if (!ctx.params) throw new Error('Cannot fetch org and user w/out params.'); try { - const [org, user] = await Promise.all([ + const [org, usr] = await Promise.all([ getOrg(ctx.params.org), getUser(ctx.params.id), ]); const { props } = await getPageProps(); return { - props: { org: org.toJSON(), user: user.toJSON(), ...props }, + props: { org: org.toJSON(), user: usr.toJSON(), ...props }, revalidate: 1, }; } catch (e) { @@ -88,7 +88,7 @@ export const getStaticProps: GetStaticProps< // TODO: We want to statically generate skeleton loading pages for each org. // @see {@link https://github.com/vercel/next.js/issues/14200} // @see {@link https://github.com/vercel/next.js/discussions/14486} -export const getStaticPaths: GetStaticPaths = async () => ({ +export const getStaticPaths: GetStaticPaths = () => ({ paths: [], fallback: true, }); diff --git a/pages/[org]/users/index.tsx b/pages/[org]/users/index.tsx index e39fdc80..ee0a1ff8 100644 --- a/pages/[org]/users/index.tsx +++ b/pages/[org]/users/index.tsx @@ -14,10 +14,10 @@ import { withI18n } from 'lib/intl'; import common from 'locales/en/common.json'; import query from 'locales/en/query.json'; -import user from 'locales/en/user.json'; -import users from 'locales/en/users.json'; import request from 'locales/en/request.json'; import search from 'locales/en/search.json'; +import user from 'locales/en/user.json'; +import users from 'locales/en/users.json'; function UsersPage(props: PageProps): JSX.Element { const { orgs } = useUser(); diff --git a/pages/api/logout.ts b/pages/api/logout.ts index 7dcca635..a12fad40 100644 --- a/pages/api/logout.ts +++ b/pages/api/logout.ts @@ -5,7 +5,7 @@ import { serialize } from 'cookie'; * GET - Logs the user out by removing the HttpOnly authentication cookie and * redirecting to the login page. */ -export default async function logout(req: Req, res: Res): Promise { +export default function logout(req: Req, res: Res): void { if (req.method !== 'GET') { res.setHeader('Allow', ['GET']); res.status(405).end(`Method ${req.method as string} Not Allowed`); diff --git a/pages/api/orgs/[id]/index.ts b/pages/api/orgs/[id]/index.ts index b92a35be..1ac932f5 100644 --- a/pages/api/orgs/[id]/index.ts +++ b/pages/api/orgs/[id]/index.ts @@ -1,8 +1,8 @@ import { NextApiRequest, NextApiResponse } from 'next'; -import { APIError } from 'lib/model/error'; import fetchOrg, { FetchOrgRes } from 'lib/api/routes/orgs/fetch'; import updateOrg, { UpdateOrgRes } from 'lib/api/routes/orgs/update'; +import { APIError } from 'lib/model/error'; /** * GET - Fetches the org's profile document.