npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@papgooner/papgooner-react-scheduler

v0.0.13

Published

A fork of react-scheduler, original by Bitnoise can be found here: [https://scheduler.bitnoise.pl/](https://scheduler.bitnoise.pl/)

Downloads

87

Readme

A fork of react-scheduler, original by Bitnoise can be found here: https://scheduler.bitnoise.pl/

npm link https://www.npmjs.com/package/@papgooner/papgooner-react-scheduler

Installation

npm i @papgooner/papgooner-react-scheduler

Incase of error about useMemo, put below into package.json:

"react": "18.2.0",
"react-dom": "18.2.0"

Adds an attendee object array property to event objects, and a total attendee count to each event tile.

Adds option to replace default toolbar buttons with custom buttons (while preserving navigation and zoom functionality).

Adds option to render additional elements on end of toolbar.

Provides keys to various children events to prevent errors.

Example:

import { Scheduler, SchedulerData } from "@papgooner/papgooner-react-scheduler";

const eventData: SchedulerData = [
  {
    id: "63faaa80-6074-490c-833d-e08ebece4cb4",
    label: {
      icon: "https://papgooner-public-images.s3.eu-west-2.amazonaws.com/300px-Bald_Guy_Staring.jpg",
      title: "Parties",
      subtitle: "Upcoming parties",
    },
    data: [
      {
        id: "5794086c-cbd5-448d-85b4-d6b81b25211c",
        startDate: new Date("2024-09-08T04:40:27.877Z"),
        endDate: new Date("2024-09-11T04:40:27.877Z"),
        occupancy: 0,
        title: "House party",
        subtitle: "My house",
        description: "A party at my house",
        bgColor: "#D36BEA",
        attendees: [
          {
            service_id: "cf42de91-172e-4848-aa2e-dd84930a144c",
            name: "Shelly Mendoza",
            email: "[email protected]",
            confirmed: true,
            arrived: false,
            attended: false,
          },
        ],
      },
    ],
  },
];

const additionalToolBarBits: React.ReactNode[] = [
  [
    <div key="group1">
      <button>Button one</button>
      <button>Button two</button>
    </div>,
    <div key="group2">
      <button>Button three</button>
      <button>Button four</button>
    </div>,
  ],
];

const buttonsToReplaceDefaults = {
  navBtnWrapper: ({ children }: { children: React.ReactNode }) => (
    <div style={{ display: "flex" }}>{children}</div>
  ),
  navBtn: ({
    children,
    onClick,
    ...props
  }: {
    children: React.ReactNode;
    onClick?: React.MouseEventHandler<HTMLButtonElement>;
  } & React.ButtonHTMLAttributes<HTMLButtonElement>) => {
    const additionalOnClick = () => {
      console.log("yeah");
    };
    const handleClick: React.MouseEventHandler<HTMLButtonElement> = (e) => {
      additionalOnClick();
      if (onClick) {
        onClick(e);
      }
    };
    return (
      <button
        style={{
          display: "flex",
          alignItems: "center",
          fontSize: "0.875rem",
        }}
        onClick={handleClick}
        {...props}
      >
        {children}
      </button>
    );
  },
  todayBtn: ({
    children,
    onClick,
    ...props
  }: {
    children: React.ReactNode;
    onClick?: React.MouseEventHandler<HTMLButtonElement>;
  } & React.ButtonHTMLAttributes<HTMLButtonElement>) => {
    const additionalOnClick = () => {
      console.log("yeah");
    };
    const handleClick: React.MouseEventHandler<HTMLButtonElement> = (e) => {
      additionalOnClick();
      if (onClick) {
        onClick(e);
      }
    };
    return (
      <button
        style={{
          position: "relative",
          fontWeight: "600",
          cursor: "pointer",
        }}
        onClick={handleClick}
        {...props}
      >
        {children}
      </button>
    );
  },
  zoomBtnWrapper: ({ children }: { children: React.ReactNode }) => (
    <div style={{ position: "relative" }}>{children}</div>
  ),
  zoomInBtn: ({
    onClick,
    ...props
  }: {
    onClick?: React.MouseEventHandler<HTMLButtonElement>;
  } & React.ButtonHTMLAttributes<HTMLButtonElement>) => {
    const additionalOnClick = () => {
      console.log("yeah");
    };
    const handleClick: React.MouseEventHandler<HTMLButtonElement> = (e) => {
      additionalOnClick();
      if (onClick) {
        onClick(e);
      }
    };
    return (
      <button onClick={handleClick} {...props}>
        zoom in
      </button>
    );
  },
  zoomOutBtn: ({
    onClick,
    ...props
  }: {
    onClick?: React.MouseEventHandler<HTMLButtonElement>;
  }) => {
    const additionalOnClick = () => {
      console.log("yeah");
    };
    const handleClick: React.MouseEventHandler<HTMLButtonElement> = (e) => {
      additionalOnClick();
      if (onClick) {
        onClick(e);
      }
    };
    return (
      <button onClick={handleClick} {...props}>
        zoom out
      </button>
    );
  },
};

const App = () => {
  return (
    <>
      <Scheduler
        data={eventData}
        isLoading={true}
        renderDefaultButtons={{ navigationButtons: false, zoomButtons: false }}
        buttonsToReplaceDefaults={buttonsToReplaceDefaults}
        additionalToolbarItems={[additionalToolBarBits]}
        onRangeChange={(_newRange) => {}}
        onTileClick={(clickedEventTile) => {}}
        onItemClick={(unitOrStaff) => {}}
        onFilterData={() => {}}
        onClearFilterData={() => {}}
        config={{
          zoom: 1,
          filterButtonState: -1,
          maxRecordsPerPage: 20,
        }}
      />
    </>
  );
};

export default App;