Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into refactor/mainjs
Browse files Browse the repository at this point in the history
  • Loading branch information
setchy committed Jun 10, 2024
2 parents 0e204c7 + 7c62dd8 commit 3f0d016
Show file tree
Hide file tree
Showing 31 changed files with 369 additions and 242 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ jobs:
APPLEID_TEAM_ID: ${{ secrets.appleid_teamid }}
CSC_LINK: ${{ secrets.mac_certs }}
CSC_KEY_PASSWORD: ${{ secrets.mac_certs_password }}
GH_TOKEN: ${{ secrets.gh_token }}
NOTARIZE: true
- uses: actions/upload-artifact@v4
with:
Expand All @@ -55,8 +54,6 @@ jobs:
OAUTH_CLIENT_ID: ${{ secrets.oauth_client_id }}
OAUTH_CLIENT_SECRET: ${{ secrets.oauth_client_secret }}
- run: pnpm make:win --publish onTagOrDraft
env:
GH_TOKEN: ${{ secrets.gh_token }}
- uses: actions/upload-artifact@v4
with:
name: Gitify-release-win
Expand All @@ -80,8 +77,6 @@ jobs:
OAUTH_CLIENT_ID: ${{ secrets.oauth_client_id }}
OAUTH_CLIENT_SECRET: ${{ secrets.oauth_client_secret }}
- run: pnpm make:linux --publish onTagOrDraft
env:
GH_TOKEN: ${{ secrets.gh_token }}
- uses: actions/upload-artifact@v4
with:
name: Gitify-release-linux
Expand Down
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Gitify [![Build Workflow][build-workflow-badge]][github-actions] [![Release Workflow][release-workflow-badge]][github-actions] [![Coveralls][coveralls-badge]][coveralls] [![Renovate enabled][renovate-badge]][renovate] [![Contributors][contributors-badge]][github] [![Downloads - Total][downloads-total-badge]][website] [![Downloads - Latest Release][downloads-latest-badge]][website] [![OSS License][license-badge]][license] [![Latest Release][github-release-badge]][github-releases] [![Homebrew Cask][homebrew-cask-badge]][homebrew-cask]
# Gitify [![Build Workflow][build-workflow-badge]][github-actions] [![Release Workflow][release-workflow-badge]][github-actions] [![Coveralls][coveralls-badge]][coveralls] [![Renovate enabled][renovate-badge]][renovate] [![Libraries.io dependency status][librariesio-badge]][librariesio] [![Contributors][contributors-badge]][github] [![Downloads - Total][downloads-total-badge]][website] [![Downloads - Latest Release][downloads-latest-badge]][website] [![OSS License][license-badge]][license] [![Latest Release][github-release-badge]][github-releases] [![Homebrew Cask][homebrew-cask-badge]][homebrew-cask]

> GitHub Notifications on your menu bar. Available on macOS, Windows and Linux.
Expand Down Expand Up @@ -46,7 +46,9 @@ The release process is automated. Follow the steps below.

### Tests

There are 2 checks - one for biome (linter & formatter) and one for the unit tests with `jest`.
There are 2 checks:
1. linter & formatter with [biome][biome-website]
2. unit tests with [jest][jest-website]

```shell
# Run biome to check linting and formatting
Expand Down Expand Up @@ -75,7 +77,8 @@ Please visit our [Gitify FAQs][faqs] for all commonly asked questions.

### License

Gitify is licensed under the MIT Open Source license. For more information, see [LICENSE](LICENSE).
Gitify is licensed under the MIT Open Source license.
For more information, see [LICENSE](LICENSE).


<!-- LINK LABELS -->
Expand All @@ -89,16 +92,20 @@ Gitify is licensed under the MIT Open Source license. For more information, see
[github-website-pulls]: https://github.com/gitify-app/website/pulls
[brew]: http://brew.sh/
[homebrew-cask]: https://formulae.brew.sh/cask/gitify
[biome-website]: biomejs.dev/
[coveralls]: https://coveralls.io/github/gitify-app/gitify
[coveralls-badge]: https://img.shields.io/coverallsCoverage/github/gitify-app/gitify
[build-workflow-badge]: https://github.com/gitify-app/gitify/actions/workflows/build-app.yml/badge.svg
[release-workflow-badge]: https://github.com/gitify-app/gitify/actions/workflows/release.yml/badge.svg
[downloads-total-badge]: https://img.shields.io/github/downloads/gitify-app/gitify/total?label=downloads@all
[downloads-latest-badge]: https://img.shields.io/github/downloads/gitify-app/gitify/latest/total
[contributors-badge]: https://img.shields.io/github/contributors/gitify-app/gitify
[librariesio]: https://libraries.io/
[librariesio-badge]: https://img.shields.io/librariesio/github/gitify-app/gitify
[license]: LICENSE
[license-badge]: https://img.shields.io/github/license/gitify-app/gitify
[github-release-badge]: https://img.shields.io/github/v/release/gitify-app/gitify
[homebrew-cask-badge]: https://img.shields.io/homebrew/cask/v/gitify
[jest-website]: https://jestjs.io/
[renovate]: https://renovatebot.com/
[renovate-badge]: https://img.shields.io/badge/renovate-enabled-brightgreen.svg
File renamed without changes
File renamed without changes
2 changes: 1 addition & 1 deletion biome.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.0/schema.json",
"$schema": "https://biomejs.dev/schemas/1.8.1/schema.json",
"organizeImports": {
"enabled": true
},
Expand Down
15 changes: 14 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { ipcMain: ipc, app, nativeTheme } = require('electron/main');
const { ipcMain: ipc, app, nativeTheme, Menu } = require('electron/main');
const { menubar } = require('menubar');
const { autoUpdater } = require('electron-updater');
const { onFirstRunMaybe } = require('./first-run');
Expand Down Expand Up @@ -27,6 +27,15 @@ const browserWindowOpts = {
},
};

const contextMenu = Menu.buildFromTemplate([
{
label: 'Quit',
click: () => {
app.quit();
},
},
]);

app.whenReady().then(async () => {
await onFirstRunMaybe();

Expand All @@ -46,6 +55,10 @@ app.whenReady().then(async () => {

mb.hideWindow();

mb.tray.on('right-click', (_event, bounds) => {
mb.tray.popUpContextMenu(contextMenu, { x: bounds.x, y: bounds.y });
});

// Force the window to retrieve its previous zoom factor
mb.window.webContents.setZoomFactor(mb.window.webContents.getZoomFactor());

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
"typescript": "5.4.5"
},
"devDependencies": {
"@biomejs/biome": "1.8.0",
"@biomejs/biome": "1.8.1",
"@electron/notarize": "2.3.2",
"@testing-library/react": "16.0.0",
"@types/jest": "29.5.12",
Expand Down Expand Up @@ -153,7 +153,7 @@
"webpack-cli": "5.1.4",
"webpack-merge": "5.10.0"
},
"packageManager": "pnpm@9.2.0",
"packageManager": "pnpm@9.3.0",
"lint-staged": {
"*.{html,js,json,ts,tsx}": "biome format --fix"
}
Expand Down
76 changes: 38 additions & 38 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 10 additions & 8 deletions src/components/NotificationRow.test.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { fireEvent, render, screen } from '@testing-library/react';
import { shell } from 'electron';
import { mockAuth, mockSettings } from '../__mocks__/state-mocks';
import { AppContext } from '../context/App';
import type { Milestone, UserType } from '../typesGitHub';
import { mockSingleNotification } from '../utils/api/__mocks__/response-mocks';
import * as helpers from '../utils/helpers';
import * as comms from '../utils/comms';
import * as links from '../utils/links';
import { NotificationRow } from './NotificationRow';

describe('components/NotificationRow.tsx', () => {
beforeEach(() => {
jest.spyOn(helpers, 'openInBrowser');
jest.spyOn(links, 'openNotification');
});

afterEach(() => {
Expand Down Expand Up @@ -341,7 +341,7 @@ describe('components/NotificationRow.tsx', () => {
);

fireEvent.click(screen.getByRole('main'));
expect(helpers.openInBrowser).toHaveBeenCalledTimes(1);
expect(links.openNotification).toHaveBeenCalledTimes(1);
expect(removeNotificationFromState).toHaveBeenCalledTimes(1);
});

Expand All @@ -366,7 +366,7 @@ describe('components/NotificationRow.tsx', () => {
);

fireEvent.keyDown(screen.getByRole('main'));
expect(helpers.openInBrowser).toHaveBeenCalledTimes(1);
expect(links.openNotification).toHaveBeenCalledTimes(1);
expect(removeNotificationFromState).toHaveBeenCalledTimes(1);
});

Expand All @@ -391,7 +391,7 @@ describe('components/NotificationRow.tsx', () => {
);

fireEvent.click(screen.getByRole('main'));
expect(helpers.openInBrowser).toHaveBeenCalledTimes(1);
expect(links.openNotification).toHaveBeenCalledTimes(1);
expect(markNotificationDone).toHaveBeenCalledTimes(1);
});

Expand Down Expand Up @@ -460,6 +460,8 @@ describe('components/NotificationRow.tsx', () => {
});

it('should open notification user profile', () => {
const openExternalLinkMock = jest.spyOn(comms, 'openExternalLink');

const props = {
notification: {
...mockSingleNotification,
Expand Down Expand Up @@ -490,8 +492,8 @@ describe('components/NotificationRow.tsx', () => {
);

fireEvent.click(screen.getByTitle('View User Profile'));
expect(shell.openExternal).toHaveBeenCalledTimes(1);
expect(shell.openExternal).toHaveBeenCalledWith(
expect(openExternalLinkMock).toHaveBeenCalledTimes(1);
expect(openExternalLinkMock).toHaveBeenCalledWith(
props.notification.subject.user.html_url,
);
});
Expand Down
Loading

0 comments on commit 3f0d016

Please sign in to comment.