Giter Club home page Giter Club logo

meet's Introduction

Hello world! ๐Ÿ‘‹

This is my first project. Iโ€™m Tim, currently an out-of-work Product Manager. Gotta love 2023. Iโ€™ve worked at companies like Google, Meta and Tripadvisor (as a PM), but have always enjoyed hobbyist coding.

For some weird reason, Iโ€™ve been interested in a personal self-scheduling solution (like Calendly, Cal.com), but one that's simple, free, and without branding or bloat.

So, I made my own Calendly alternative, and wanted to share with the world and walk through it.

Walkthrough

The current solution is intentionally lightweight and opinionated, but hopefully flexible enough should you want to extend it.

  • Requires Google Calendar and Gmail APIs (sorry, no Outlook, iCloud; but parsing an ICS feed isn't hard to do!)
  • Supports multiple calendars for calculating availability.
  • Only has basic availability configuration built in, e.g. you can specify working hours based on day of week only.
  • Currently optimized for meetings via phone or Google Meet (vs. in-person or using resources).

The workflow is simple enough, and we'll walk through it later, but basically:

  1. A user requests an appointment.
  2. The system emails you asking you to confirm or deny.
  3. Once confirmed, it's emailed to the user and added to both of your calendars.

As I mentioned, it's opinionated and designed for simple use cases for individuals in mind. ๐Ÿ˜

Some technical notes:

  • Uses Next.js 13 and Typescript with Tailwind.
  • Has (some) testing on the more trickier functions.
  • Uses minimal libraries. For instance, I built my own lightweight wrapper to hit Google APIs directly to avoid importing googleapis.
  • Probably has some over-engineered bits that feel nice, like lru-cache limiting on API endpoints, a more intuitive timezone selection piece, and formatted emails.

I welcome feedback and suggestions; and have fun!

See related post at https://dev.to/timfee/build-and-host-your-own-calendy-like-scheduling-page-using-nextjs-and-google-apis-5ack

meet's People

Contributors

spiteless avatar timfee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

meet's Issues

TODAY Availability ending at 5pm regardless of additional availability

Issue

Today availability ends at 5pm PST even if availability extends beyond 5pm. This is likely because PST is -7 UTC, so when the application is creating dates, the remaining slots are being shunted to the following day.

Details

This issue ties in with #14 , it's probably the same bug.

Steps to reproduce

  • Edit ending hours in config to greater than current set value of 17
  • View appointments later than current date on localhost or online
const DEFAULT_WORKDAY = [
  {
    start: {
      hour: 9,
    },
    end: {
      hour: 23, // <-- Changed 17 to 23
    },
  },
]

Vercel Branch Deploy

Screenshots

View Screenshot image image image

Direct user to first appointment bug

Expected Behavior

Loading the base website / should direct the user to the first available day of appointments, eg Friday

Observed Behavior

During certain time windows the application loads / and directs the user to the following day, eg Saturday

Details

This is likely because the useEffect hook isn't consdering timezone when offering suggestions of date.

// index.ts
  useEffect(() => {
    if (!selectedDate && slots.length > 0) {
      dispatch({
        type: "SET_SELECTED_DATE",
        payload: Day.dayFromDate(slots[0].start), // <-- Doesn't take into account frontend timezone
      })
    }
  }, [])

Screenshots

image
View Screenshots image

Potential Appointment Sorting Bug

Issue

When increasing DEFAULT_WORKDAY hours from 17 to 23, potential appointment slots in future days sort out of order in regard to Los Angeles timezone (hasn't been tested with other timezones at time of writing).

Steps to reproduce

  • Edit ending hours in config to greater than current set value of 17
  • View appointments later than current date on localhost or online
const DEFAULT_WORKDAY = [
  {
    start: {
      hour: 9,
    },
    end: {
      hour: 23, // <-- Changed 17 to 23
    },
  },
]

Vercel Branch Deploy

Screenshots

View Screenshot image

Auto timezone improvement setter

Love the project! I had a similar urge to make a simple white-labeled scheduler. Happy this is already out there!

One small improvement from a UX perspective is that the browser has timezone available via Intl.DateTimeFormat().resolvedOptions().timeZone.

Wrapping a setter in a UseEffect, e.g.:

import { useEffect } from 'react';
import { useProvider } from "@/context/AvailabilityContext"
import getTimezoneData from "@/lib/timezones"

const { groupLookupMap, timeZoneMap } = getTimezoneData()

export default function TimezonePicker() {
  const {
    state: { timeZone },
    dispatch,
  } = useProvider()

  useEffect(() => {
    // Set the timezone from the browser when the component mounts
    const browserTimezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
    dispatch({
      type: "SET_TIMEZONE",
      payload: browserTimezone,
    });
  }, [dispatch]);

  // ... rest of TimezonePicker.ts

... automatically selects the user's browser's timezone without them having to go fish for it.

Thank you for this and kudos!

Availability bug, no availability for TODAY

Expected Behavior

Available slots for TODAY extending from NOW until 11PM PST

Observed Behavior

No more available openings for today despite those hours being open as defined by DEFAULT_WORKDAY

Screenshot

IMG_1234

Can't get access token

Has anyone gotten an error where they were unable to use the refresh token to retrieve a new access token? I'm getting this error

Error: Couldn't get access token: {
"error": "unauthorized_client",
"error_description": "Unauthorized"
}
even though I got the refresh token as instructed in the environment setup.

Timezone Bug with getDateRangeInterval

Overview

Same timezone bug as before, differnt part of the app (Now in days of calendar rendering). Forcing timezone to UTC resolves.

Screenshots

screenshots

Before

image

After -- with fix

image

Multiple users/calendars

This is so good self-scheduling project! Thanks for sharing ๐Ÿ™

Is it possible to extend this so that it can handle a few different users/calendars? Maybe a dropdown like Timezone but with all users added and when you select a user the calendar is based on that users availability? Do you know if this is difficult to integrate and solve?

Range error with varied local time string

Hi, I've noticed if changing the owner timezone to another country i.e. something like Australia, (in config.ts -> OWNER_TIMEZONE), I get an error:
error lib\availability\helpers.ts (68:20) @ toLocaleTimeString

  • error Error [RangeError]: Value longGeneric out of range for Date.prototype.toLocaleTimeString options property timeZoneName
    at Date.toLocaleTimeString ()

    I've noticed this problem goes away by removing the timezonename: "longGeneric" clause in request.ts interval to human string fx ->
    '''
    function intervalToHumanString({
    start,
    end,
    timeZone,
    }: DateTimeIntervalWithTimezone): string {
    return ${formatLocalDate(start, { month: "long", day: "numeric", hour: "numeric", minute: "numeric", weekday: "long", timeZone, })} โ€“ ${formatLocalTime(end, { hour: "numeric", minute: "numeric", timeZone, timeZoneName: "longGeneric", })}
    }
    '''
    when removing timezonename: "longGeneric" i no longer have this problem i.e.
    '''
    function intervalToHumanString({
    start,
    end,
    timeZone,
    }: DateTimeIntervalWithTimezone): string {
    return `${formatLocalDate(start, {
    month: "long",
    day: "numeric",
    hour: "numeric",
    minute: "numeric",
    weekday: "long",
    timeZone,
    })} โ€“ ${formatLocalTime(end, {
    hour: "numeric",
    minute: "numeric",
    timeZone,

    })}`
    }
    '''

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.