Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: grubersjoe/react-github-calendar
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 06052914972073cf4dd07beabf62386b5ba0daa4
Choose a base ref
...
head repository: grubersjoe/react-github-calendar
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 46ad6786ae59084dd3acc20cccc437a30d8a4a93
Choose a head ref
  • 3 commits
  • 17 files changed
  • 2 contributors

Commits on Jan 13, 2025

  1. Bump the dependencies group across 1 directory with 9 updates

    Bumps the dependencies group with 9 updates in the / directory:
    
    | Package | From | To |
    | --- | --- | --- |
    | [@eslint/compat](https://github.com/eslint/rewrite) | `1.2.4` | `1.2.5` |
    | [@eslint/js](https://github.com/eslint/eslint/tree/HEAD/packages/js) | `9.17.0` | `9.18.0` |
    | [@ianvs/prettier-plugin-sort-imports](https://github.com/ianvs/prettier-plugin-sort-imports) | `4.4.0` | `4.4.1` |
    | [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) | `19.0.2` | `19.0.6` |
    | [eslint](https://github.com/eslint/eslint) | `9.17.0` | `9.18.0` |
    | [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) | `7.37.3` | `7.37.4` |
    | [rollup](https://github.com/rollup/rollup) | `4.29.1` | `4.30.1` |
    | [typescript](https://github.com/microsoft/TypeScript) | `5.7.2` | `5.7.3` |
    | [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint) | `8.19.0` | `8.20.0` |
    
    
    
    Updates `@eslint/compat` from 1.2.4 to 1.2.5
    - [Release notes](https://github.com/eslint/rewrite/releases)
    - [Changelog](https://github.com/eslint/rewrite/blob/main/release-please-config.json)
    - [Commits](eslint/rewrite@compat-v1.2.4...compat-v1.2.5)
    
    Updates `@eslint/js` from 9.17.0 to 9.18.0
    - [Release notes](https://github.com/eslint/eslint/releases)
    - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
    - [Commits](https://github.com/eslint/eslint/commits/v9.18.0/packages/js)
    
    Updates `@ianvs/prettier-plugin-sort-imports` from 4.4.0 to 4.4.1
    - [Release notes](https://github.com/ianvs/prettier-plugin-sort-imports/releases)
    - [Changelog](https://github.com/IanVS/prettier-plugin-sort-imports/blob/main/CHANGELOG.md)
    - [Commits](IanVS/prettier-plugin-sort-imports@v4.4.0...v4.4.1)
    
    Updates `@types/react` from 19.0.2 to 19.0.6
    - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
    - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react)
    
    Updates `eslint` from 9.17.0 to 9.18.0
    - [Release notes](https://github.com/eslint/eslint/releases)
    - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
    - [Commits](eslint/eslint@v9.17.0...v9.18.0)
    
    Updates `eslint-plugin-react` from 7.37.3 to 7.37.4
    - [Release notes](https://github.com/jsx-eslint/eslint-plugin-react/releases)
    - [Changelog](https://github.com/jsx-eslint/eslint-plugin-react/blob/master/CHANGELOG.md)
    - [Commits](jsx-eslint/eslint-plugin-react@v7.37.3...v7.37.4)
    
    Updates `rollup` from 4.29.1 to 4.30.1
    - [Release notes](https://github.com/rollup/rollup/releases)
    - [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
    - [Commits](rollup/rollup@v4.29.1...v4.30.1)
    
    Updates `typescript` from 5.7.2 to 5.7.3
    - [Release notes](https://github.com/microsoft/TypeScript/releases)
    - [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml)
    - [Commits](microsoft/TypeScript@v5.7.2...v5.7.3)
    
    Updates `typescript-eslint` from 8.19.0 to 8.20.0
    - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
    - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/typescript-eslint/CHANGELOG.md)
    - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.20.0/packages/typescript-eslint)
    
    ---
    updated-dependencies:
    - dependency-name: "@eslint/compat"
      dependency-type: direct:development
      update-type: version-update:semver-patch
      dependency-group: dependencies
    - dependency-name: "@eslint/js"
      dependency-type: direct:development
      update-type: version-update:semver-minor
      dependency-group: dependencies
    - dependency-name: "@ianvs/prettier-plugin-sort-imports"
      dependency-type: direct:development
      update-type: version-update:semver-patch
      dependency-group: dependencies
    - dependency-name: "@types/react"
      dependency-type: direct:development
      update-type: version-update:semver-patch
      dependency-group: dependencies
    - dependency-name: eslint
      dependency-type: direct:development
      update-type: version-update:semver-minor
      dependency-group: dependencies
    - dependency-name: eslint-plugin-react
      dependency-type: direct:development
      update-type: version-update:semver-patch
      dependency-group: dependencies
    - dependency-name: rollup
      dependency-type: direct:development
      update-type: version-update:semver-minor
      dependency-group: dependencies
    - dependency-name: typescript
      dependency-type: direct:development
      update-type: version-update:semver-patch
      dependency-group: dependencies
    - dependency-name: typescript-eslint
      dependency-type: direct:development
      update-type: version-update:semver-minor
      dependency-group: dependencies
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored and grubersjoe committed Jan 13, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    a9be0af View commit details
  2. Remove semicolons

    grubersjoe committed Jan 13, 2025
    Copy the full SHA
    3153684 View commit details
  3. Upgrades

    grubersjoe committed Jan 13, 2025
    Copy the full SHA
    46ad678 View commit details
5 changes: 3 additions & 2 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -2,9 +2,10 @@
"plugins": ["@ianvs/prettier-plugin-sort-imports"],
"importOrder": ["<BUILTIN_MODULES>", "^react$", "<THIRD_PARTY_MODULES>", "^[.]"],
"importOrderParserPlugins": ["typescript", "jsx", "importAttributes"],
"importOrderTypeScriptVersion": "5.5.0",
"importOrderTypeScriptVersion": "5.7.0",
"arrowParens": "avoid",
"printWidth": 100,
"proseWrap": "always",
"singleQuote": true
"singleQuote": true,
"semi": false
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -19,9 +19,9 @@ npm install react-github-calendar
## Usage

```tsx
import GitHubCalendar from 'react-github-calendar';
import GitHubCalendar from 'react-github-calendar'

<GitHubCalendar username="grubersjoe" />;
;<GitHubCalendar username="grubersjoe" />
```

## FAQ
14 changes: 7 additions & 7 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// @ts-check
import { fixupPluginRules } from '@eslint/compat';
import eslint from '@eslint/js';
import { fixupPluginRules } from '@eslint/compat'
import eslint from '@eslint/js'
// @ts-ignore
import reactHooks from 'eslint-plugin-react-hooks';
import reactHooks from 'eslint-plugin-react-hooks'
// @ts-ignore
import react from 'eslint-plugin-react/configs/recommended.js';
import globals from 'globals';
import typescript from 'typescript-eslint';
import react from 'eslint-plugin-react/configs/recommended.js'
import globals from 'globals'
import typescript from 'typescript-eslint'

export default typescript.config(
eslint.configs.recommended,
@@ -59,4 +59,4 @@ export default typescript.config(
...reactHooks.configs.recommended.rules,
},
},
);
)
2 changes: 1 addition & 1 deletion example/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "react-github-calendar-example",
"homepage": "https://grubersjoe.github.io/react-github-calendar/",
"version": "4.5.2",
"version": "4.5.4",
"license": "MIT",
"private": true,
"scripts": {
12 changes: 6 additions & 6 deletions example/src/components/CodeBlock.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
import { tomorrow as theme } from 'react-syntax-highlighter/dist/esm/styles/prism';
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'
import { tomorrow as theme } from 'react-syntax-highlighter/dist/esm/styles/prism'

type Props = {
children: string;
};
children: string
}

const CodeBlock = ({ children }: Props) => (
<SyntaxHighlighter
@@ -21,6 +21,6 @@ const CodeBlock = ({ children }: Props) => (
>
{children}
</SyntaxHighlighter>
);
)

export default CodeBlock;
export default CodeBlock
70 changes: 35 additions & 35 deletions example/src/components/Docs.tsx
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
import { useEffect, useState, type FormEventHandler } from 'react';
import { ErrorBoundary } from 'react-error-boundary';
import GitHubButton from 'react-github-btn';
import GitHubCalendar, { type Props } from 'react-github-calendar';
import { useSearchParams } from 'react-router';
import pkg from '../../package.json';
import CodeBlock from './CodeBlock';
import { errorRenderer } from './Error';
import '../styles.scss';
import ForkMe from './ForkMe';
import { useEffect, useState, type FormEventHandler } from 'react'
import { ErrorBoundary } from 'react-error-boundary'
import GitHubButton from 'react-github-btn'
import GitHubCalendar, { type Props } from 'react-github-calendar'
import { useSearchParams } from 'react-router'
import pkg from '../../package.json'
import CodeBlock from './CodeBlock'
import { errorRenderer } from './Error'
import '../styles.scss'
import ForkMe from './ForkMe'

const defaultUsername = 'grubersjoe';
const defaultUsername = 'grubersjoe'

const Docs = () => {
const [searchParams, setSearchParams] = useSearchParams();
const initialUsername = searchParams.get('user') ?? defaultUsername;
const [searchParams, setSearchParams] = useSearchParams()
const initialUsername = searchParams.get('user') ?? defaultUsername

const [username, setUsername] = useState(initialUsername);
const [input, setInput] = useState(initialUsername);
const [username, setUsername] = useState(initialUsername)
const [input, setInput] = useState(initialUsername)

useEffect(() => {
if (initialUsername !== username) {
setUsername(initialUsername);
setInput(initialUsername);
setUsername(initialUsername)
setInput(initialUsername)
}
}, [initialUsername, username]);
}, [initialUsername, username])

const onUsernameSubmit: FormEventHandler = event => {
event.preventDefault();
const val = input.trim();
event.preventDefault()
const val = input.trim()
if (val && val !== username) {
setSearchParams({ user: val.toLowerCase() });
setSearchParams({ user: val.toLowerCase() })
}
};
}

return (
<div>
@@ -46,7 +46,7 @@ const Docs = () => {
placeholder="Enter your GitHub username"
value={input}
onChange={event => {
setInput(event.target.value);
setInput(event.target.value)
}}
autoComplete="on"
required
@@ -497,32 +497,32 @@ function transformData(data: Array<Activity>): Array<Activity>;`}
<p style={{ marginTop: '3rem' }}>
<button
onClick={() => {
window.scroll({ top: 0, behavior: 'smooth' });
window.scroll({ top: 0, behavior: 'smooth' })
}}
>
Back to top
</button>
</p>
</main>
</div>
);
};
)
}

const selectLastHalfYear: Props['transformData'] = contributions => {
const currentYear = new Date().getFullYear();
const currentMonth = new Date().getMonth();
const shownMonths = 6;
const currentYear = new Date().getFullYear()
const currentMonth = new Date().getMonth()
const shownMonths = 6

return contributions.filter(activity => {
const date = new Date(activity.date);
const monthOfDay = date.getMonth();
const date = new Date(activity.date)
const monthOfDay = date.getMonth()

return (
date.getFullYear() === currentYear &&
monthOfDay > currentMonth - shownMonths &&
monthOfDay <= currentMonth
);
});
};
)
})
}

export default Docs;
export default Docs
4 changes: 2 additions & 2 deletions example/src/components/Error.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { FallbackProps } from 'react-error-boundary';
import type { FallbackProps } from 'react-error-boundary'

export const errorRenderer = ({ error }: FallbackProps) => (
<div className="error">
@@ -10,4 +10,4 @@ export const errorRenderer = ({ error }: FallbackProps) => (
</>
) : null}
</div>
);
)
8 changes: 4 additions & 4 deletions example/src/components/ForkMe.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type { CSSProperties } from 'react';
import type { CSSProperties } from 'react'

const style: CSSProperties = {
position: 'absolute',
top: 0,
right: 0,
border: 0,
fill: 'currentcolor',
};
}

const ForkMe = () => (
<a
@@ -27,6 +27,6 @@ const ForkMe = () => (
/>
</svg>
</a>
);
)

export default ForkMe;
export default ForkMe
20 changes: 10 additions & 10 deletions example/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import { createHashRouter } from 'react-router';
import { RouterProvider } from 'react-router/dom';
import Docs from './components/Docs';
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import { createHashRouter } from 'react-router'
import { RouterProvider } from 'react-router/dom'
import Docs from './components/Docs'

const container = document.getElementById('root');
const container = document.getElementById('root')

if (!container) {
throw Error('#root not found');
throw Error('#root not found')
}

const root = createRoot(container);
const root = createRoot(container)

const router = createHashRouter([
{
path: '/*',
element: <Docs />,
},
]);
])

root.render(
<StrictMode>
<RouterProvider router={router} />
</StrictMode>,
);
)
16 changes: 8 additions & 8 deletions example/sync-version.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#!/usr/bin/env node

/* eslint-disable */
const fs = require('fs');
const path = require('path');
const fs = require('fs')
const path = require('path')

const parentPkgFile = String(fs.readFileSync(path.join(__dirname, '../package.json')));
const parentPkg = JSON.parse(parentPkgFile);
const parentPkgFile = String(fs.readFileSync(path.join(__dirname, '../package.json')))
const parentPkg = JSON.parse(parentPkgFile)

const pkgFile = String(fs.readFileSync(path.join(__dirname, './package.json')));
const pkg = JSON.parse(pkgFile);
const pkgFile = String(fs.readFileSync(path.join(__dirname, './package.json')))
const pkg = JSON.parse(pkgFile)

pkg.version = parentPkg.version;
pkg.version = parentPkg.version

fs.writeFileSync(path.join(__dirname, './package.json'), JSON.stringify(pkg, null, 2) + '\n');
fs.writeFileSync(path.join(__dirname, './package.json'), JSON.stringify(pkg, null, 2) + '\n')
6 changes: 3 additions & 3 deletions example/vite.config.mts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react'
import { defineConfig } from 'vite'

export default defineConfig({
plugins: [react()],
@@ -17,4 +17,4 @@ export default defineConfig({
include: [/react-github-calendar/],
},
},
});
})
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-github-calendar",
"version": "4.5.3",
"version": "4.5.4",
"description": " React component to display a GitHub contributions calendar",
"author": "Jonathan Gruber <gruberjonathan@gmail.com>",
"license": "MIT",
@@ -24,7 +24,7 @@
"prepublishOnly": "pnpm check && pnpm build"
},
"dependencies": {
"react-activity-calendar": "^2.7.6",
"react-activity-calendar": "^2.7.7",
"react-error-boundary": "^5.0.0"
},
"devDependencies": {
@@ -38,7 +38,7 @@
"@rollup/plugin-babel": "^6.0.3",
"@rollup/plugin-node-resolve": "^16.0.0",
"@types/eslint__js": "^8.42.3",
"@types/node": "^22.10.5",
"@types/node": "^22.10.6",
"@types/react": "^19.0.2",
"@types/tinycolor2": "^1.4.6",
"dts-bundle-generator": "^9.5.1",
@@ -48,7 +48,7 @@
"gh-pages": "^6.3.0",
"globals": "^15.14.0",
"husky": "^9.1.7",
"postcss": "^8.4.49",
"postcss": "^8.5.0",
"prettier": "^3.4.2",
"react": "^19.0.0",
"rollup": "^4.29.1",
Loading