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

mozaik-ext-calendar

v0.3.1

Published

Mozaik Google calendar widgets

Downloads

3

Readme

mozaik-ext-calendar

Google Calendar widgets for Mozaïk dashboard.

preview-page-views

Table of contents

Setup

Follow the steps to install and configure widget into dashboard

  • Install modules from npmjs:

    npm install mozaik-ext-calendar
  • Register client api by adding to dashboard app.js:

    import calendar from 'mozaik-ext-calendar/client';
    mozaik.bus.registerApi('calendar', calendar);
  • Register widgets by adding to dashboard src/App.jsx:

    import calendar from 'mozaik-ext-calendar';
    mozaik.addBatch('calendar', calendar);
  • Build the dashboard:

    npm run build-assets
  • Create Google service account for reading the calendar events

    • Create a project and service account in Google Developer Console if you don't have one yet

    • Enable API: Calendar API

    • Collect service email and .p12 file

    • Convert .p12 file into .PEM

    • Configure service key and .PEM file into dashboard config.js file and environment variables / .env file:

      api: {
        calendar: {
          googleServiceEmail: process.env.GOOGLE_SERVICE_EMAIL,
          googleServiceKeypath: process.env.GOOGLE_SERVICE_KEYPATH
        }
      }
  • Share the calendar(s) and collect id(s)

    • Login to Google Calendar
    • Select calendar you want to show in dashboard > Share this Calendar
    • Add service email address to list
    • Collect the Calendar ID from Calendar Details page (needed in widget configuration)
  • Configure widgets (see next sections)

  • Run the dashboard:

    npm start

Widget: calendar.next_event

Show next upcoming or ongoing event from calendar(s). If multiple calendars are defined, the event closest to current moment is shown.

preview-page-views

parameters

key | required | description --------------|----------|--------------- calendars | yes | A list of calendar ids to read. Each entry must have id and title. Example: [{ id: '[email protected]', title: 'User' }, { id: '[email protected]', title: 'Another' }] ordinal | no | The ordinal of the calendar event. 0 (default) shows the next/current, 1 shows the next after current etc. Handy with meeting room reseravation calendars

usage

// dashboard config.js

// Calendars variable for widget configuration
var calendars = [
  { title: 'Meeting room 1', id: '[email protected]' },
  { title: 'Meeting room 2', id: '[email protected]' }
];

module.exports = {
  // Configure api
  api: {
    calendar: {
      googleServiceEmail: process.env.GOOGLE_SERVICE_EMAIL,
      googleServiceKeypath: process.env.GOOGLE_SERVICE_KEYPATH
    },
    // Other services ...
  },

  // Set widgets
  dashboards: [
    columns: 2,
    rows: 2,
    // See next sections for details
    widgets: [
      {
        type: 'calendar.next_event',
        calendars: calendars,
        ordinal: 0, // closest event to current moment
        columns: 1, rows: 1,
        x: 0, y: 0
      },
      {
        type: 'calendar.next_event',
        calendars: calendars,
        ordinal: 1, // event after closest one
        columns: 1, rows: 1,
        x: 1, y: 0
      },
    ]
  ]
}

Widget: calendar.list

List upcoming events in a list

preview-page-views

parameters

key | required | description --------------|----------|--------------- calendars | yes | A list of calendar ids to read. Each entry must have id and title. Example: [{ id: '[email protected]', title: 'User' }, { id: '[email protected]', title: 'Another' }] title | no | Title to show. Defaults to Calendar dateFormat | no | Show event start time with Moment.js supported format. Default: LL limit | no | Maximum number of events to show. Defaults to 0 which means no limit

usage

  // Widget usage
  dashboards: [
    columns: 2,
    rows: 2,
    widgets: [
      {
        type: 'calendar.list',
        calendars: calendars,
        title: 'Upcoming events',
        dateFormat: 'LLL',
        limit: 5,
        columns: 1, rows: 1,
        x: 0, y: 0
      }
    ]
  ]
}

Changelog

Release 0.3.1

  • Handle calendar reading error gracefully

Release 0.3.0

  • New widget: List

Release 0.2.0

  • Updated support against Mozaik 1.4
  • Linted code
  • Moved to ES6

Release 0.1.3

  • Added missing almanac.js file in repo

Release 0.1.2

  • Added previews in documentation

Release 0.1.1

  • Fixed the documentation

Release 0.1.0

  • Initial release

License

Distributed under the MIT license

Credit

The module is backed by SC5