Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/scriptex/gitlab-calendar

Embed your Gitlab calendar everywhere.
https://github.com/scriptex/gitlab-calendar

calendar contributions-calendar gitlab gitlab-calendar

Last synced: 3 months ago
JSON representation

Embed your Gitlab calendar everywhere.

Awesome Lists containing this project

README

        

[![Github Build](https://github.com/scriptex/gitlab-calendar/workflows/Build/badge.svg)](https://github.com/scriptex/gitlab-calendar/actions?query=workflow%3ABuild)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/34d3d75710534dc6a38c3584a1dcd068)](https://www.codacy.com/gh/scriptex/gitlab-calendar/dashboard?utm_source=github.com&utm_medium=referral&utm_content=scriptex/gitlab-calendar&utm_campaign=Badge_Grade)
[![Codebeat Badge](https://codebeat.co/badges/d765a4c8-2c0e-44f2-89c3-fa364fdc14e6)](https://codebeat.co/projects/github-com-scriptex-gitlab-calendar-master)
[![CodeFactor Badge](https://www.codefactor.io/repository/github/scriptex/gitlab-calendar/badge)](https://www.codefactor.io/repository/github/scriptex/gitlab-calendar)
[![DeepScan grade](https://deepscan.io/api/teams/3574/projects/5257/branches/40799/badge/grade.svg)](https://deepscan.io/dashboard#view=project&tid=3574&pid=5257&bid=40799)
[![Analytics](https://ga-beacon-361907.ew.r.appspot.com/UA-83446952-1/github.com/scriptex/gitlab-calendar/README.md?pixel)](https://github.com/scriptex/gitlab-calendar/)

# Gitlab Calendar

> Embed your Gitlab Contributions Calendar anywhere

This package allows you to embed your Gitlab Contributions Calendar in any website.

The package does not handle network requests, this is left to the developer to decide and implement. Gitlab Calendar requires the data as it is provided by the `calendar` endpoint of the Gitlab API (https://gitlab.com/users/$USER/calendar.json).

**This project was inspired by [Github Calendar](https://github.com/Bloggify/github-calendar).**

## Visitor stats

![GitHub stars](https://img.shields.io/github/stars/scriptex/gitlab-calendar?style=social)
![GitHub forks](https://img.shields.io/github/forks/scriptex/gitlab-calendar?style=social)
![GitHub watchers](https://img.shields.io/github/watchers/scriptex/gitlab-calendar?style=social)
![GitHub followers](https://img.shields.io/github/followers/scriptex?style=social)

## Code stats

![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/scriptex/gitlab-calendar)
![GitHub repo size](https://img.shields.io/github/repo-size/scriptex/gitlab-calendar?style=plastic)
![GitHub language count](https://img.shields.io/github/languages/count/scriptex/gitlab-calendar?style=plastic)
![GitHub top language](https://img.shields.io/github/languages/top/scriptex/gitlab-calendar?style=plastic)
![GitHub last commit](https://img.shields.io/github/last-commit/scriptex/gitlab-calendar?style=plastic)

## Live preview ([link](https://atanas.info/stats))

![Gitlab Calendar Screenshot](https://raw.githubusercontent.com/scriptex/gitlab-calendar/master/assets/gitlab-calendar.png)

## Installation

```sh
npm i gitlab-calendar

# or

yarn add gitlab-calendar
```

## Usage

```typescript
import GitlabCalendar from 'gitlab-calendar';

new GitlabCalendar(document.getElementById('gitlab-calendar'), data, options);
```

## Data format

The data is obtained by fetching the `https://gitlab.com/users/$USER/calendar.json` endpoint.

This exercise is left to the developer implementing it.

`gitlab-calendar` requires the data in the following format:

```json
{
"2020-12-07": 1,
"2020-12-09": 2,
"2020-12-10": 5,
...
}
```

## Options

| Name | Type | Default value |
| ------------------- | -------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `daySize` | `number` | 15 |
| `hintText` | `string` | 'Issues, merge requests, pushes, and comments.' |
| `daySpace` | `number` | 1 |
| `utcOffset` | `number` | 0 |
| `dayTitles` | `Record` |

{ 
monday: 'M',
wednesday: 'W',
friday: 'F',
saturday: 'S',
sunday: 'S'
}
|
| `monthsAgo` | `number` | 12 |
| `monthNames` | `string[]` | ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] |
| `inputFormat` | `string` | 'yyyy-MM-dd' |
| `weekdayNames` | `string[]` | ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'] |
| `legendValues` | `ActivityCalendarLegendValue[]` |
[ 
{ title: 'No contributions', min: 0 },
{ title: '1-9 contributions', min: 1 },
{ title: '10-19 contributions', min: 10 },
{ title: '20-29 contributions', min: 20 },
{ title: '30+ contributions', min: 30 }
]
|
| `firstDayOfWeek` | `number` | 0 |
| `tooltipDateFormat` | `string` | 'MMM d, yyyy' |
| `tooltipFormatter` | `(count: number, dayName: string, dateText: string) => string` |
(count: number, dayName: string, dateText: string) => { 
let contribText = 'No contributions';

if (count > 0) {
contribText = count === 1 ? '1 contribution' : `${count} contributions`;

}return `${contribText} on ${dayName} ${dateText}`;
}
|

## LICENSE

MIT

---


Connect with me:






 



 



 



 



 



 



 



 



 



 



 



---


Support and sponsor my work: