Skip to content

Commit 7db1845

Browse files
committed
Merge branch 'main' into feat/query-merging
Signed-off-by: Adam Setch <[email protected]>
2 parents 7d9b27a + 5e086ae commit 7db1845

File tree

103 files changed

+1166
-1376
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+1166
-1376
lines changed

.gitattributes

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# Snapshots are taken by our test suite and used to determine regressions.
2-
# We don't need to review their code in PRs, so treat them as auto-generated.
1+
# Define auto-generated file patterns to hide within GitHub's PR diff/file preview.
32
# https://docs.github.com/en/repositories/working-with-files/managing-files/customizing-how-changed-files-appear-on-github
3+
4+
# Snapshots are taken by our test suite and used to determine regressions.
45
*.snap linguist-generated=true
6+
7+
# GraphQL Codegen outputs
8+
+ src/renderer/utils/api/graphql/generated/**/*.ts linguist-generated=true

biome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
]
5656
}
5757
},
58-
"useUniqueElementIds": "warn"
58+
"useUniqueElementIds": "off"
5959
},
6060
"style": {
6161
"useDefaultSwitchClause": "error",

renovate.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
33
"extends": [
44
"config:best-practices",
5+
":dependencyDashboardApproval",
56
":enableVulnerabilityAlerts",
67
":separateMultipleMajorReleases",
78
"customManagers:biomeVersions",
89
"schedule:weekly"
910
],
11+
"assignees": ["setchy"],
1012
"labels": ["dependency"],
1113
"rangeStrategy": "pin",
1214
"packageRules": [
@@ -22,7 +24,7 @@
2224
{
2325
"description": "Fetch changelog details for twemoji packages",
2426
"matchPackageNames": ["@discordapp/twemoji"],
25-
"sourceUrl": "https://github.com/jdjdecked/twemoji"
27+
"changelogUrl": "https://github.com/jdjdecked/twemoji"
2628
}
2729
],
2830
"customManagers": [

src/renderer/App.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { useContext } from 'react';
21
import {
32
Navigate,
43
Route,
@@ -10,7 +9,7 @@ import {
109
import { BaseStyles, ThemeProvider } from '@primer/react';
1110

1211
import { AppLayout } from './components/layout/AppLayout';
13-
import { AppContext, AppProvider } from './context/App';
12+
import { AppProvider, useAppContext } from './context/App';
1413
import { AccountsRoute } from './routes/Accounts';
1514
import { FiltersRoute } from './routes/Filters';
1615
import { LoginRoute } from './routes/Login';
@@ -22,7 +21,7 @@ import { SettingsRoute } from './routes/Settings';
2221
import './App.css';
2322

2423
function RequireAuth({ children }) {
25-
const { isLoggedIn } = useContext(AppContext);
24+
const { isLoggedIn } = useAppContext();
2625
const location = useLocation();
2726

2827
return isLoggedIn ? (

src/renderer/__mocks__/notifications-mocks.ts

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
import { Constants } from '../constants';
22
import type {
33
AccountNotifications,
4+
GitifyNotification,
45
GitifyNotificationState,
6+
GitifyRepository,
7+
GitifySubject,
58
Hostname,
6-
} from '../types';
7-
import type {
8-
Notification,
9-
Repository,
10-
Subject,
9+
Link,
1110
SubjectType,
12-
} from '../typesGitHub';
11+
} from '../types';
1312
import {
1413
mockEnterpriseNotifications,
1514
mockGitHubNotifications,
@@ -47,21 +46,21 @@ export function createMockSubject(mocks: {
4746
title?: string;
4847
type?: SubjectType;
4948
state?: GitifyNotificationState;
50-
}): Subject {
49+
}): GitifySubject {
5150
return {
5251
title: mocks.title ?? 'Mock Subject',
5352
type: mocks.type ?? ('Unknown' as SubjectType),
5453
state: mocks.state ?? ('Unknown' as GitifyNotificationState),
5554
url: null,
56-
latest_comment_url: null,
55+
latestCommentUrl: null,
5756
};
5857
}
5958

6059
export function createPartialMockNotification(
61-
subject: Partial<Subject>,
62-
repository?: Partial<Repository>,
63-
): Notification {
64-
const mockNotification: Partial<Notification> = {
60+
subject: Partial<GitifySubject>,
61+
repository?: Partial<GitifyRepository>,
62+
): GitifyNotification {
63+
const mockNotification: Partial<GitifyNotification> = {
6564
account: {
6665
method: 'Personal Access Token',
6766
platform: 'GitHub Cloud',
@@ -70,28 +69,30 @@ export function createPartialMockNotification(
7069
user: mockGitifyUser,
7170
hasRequiredScopes: true,
7271
},
73-
subject: subject as Subject,
72+
subject: subject as GitifySubject,
7473
repository: {
7574
name: 'notifications-test',
76-
full_name: 'gitify-app/notifications-test',
77-
html_url: 'https://github.com/gitify-app/notifications-test',
75+
fullName: 'gitify-app/notifications-test',
76+
htmlUrl: 'https://github.com/gitify-app/notifications-test' as Link,
7877
owner: {
7978
login: 'gitify-app',
79+
avatarUrl: 'https://avatars.githubusercontent.com/u/1' as Link,
80+
type: 'Organization',
8081
},
8182
...repository,
82-
} as Repository,
83+
} as GitifyRepository,
8384
};
8485

85-
return mockNotification as Notification;
86+
return mockNotification as GitifyNotification;
8687
}
8788

8889
export function createMockNotificationForRepoName(
8990
id: string,
9091
repoFullName: string | null,
91-
): Notification {
92+
): GitifyNotification {
9293
return {
9394
id,
94-
repository: repoFullName ? { full_name: repoFullName } : null,
95+
repository: repoFullName ? { fullName: repoFullName } : null,
9596
account: mockGitHubCloudAccount,
96-
} as Notification;
97+
} as GitifyNotification;
9798
}
Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { GitifyUser, Link } from '../types';
2-
import type { User } from '../typesGitHub';
1+
import type { GitifyNotificationUser, GitifyUser, Link } from '../types';
2+
import type { RawUser } from '../utils/api/types';
33

44
export const mockGitifyUser: GitifyUser = {
55
login: 'octocat',
@@ -8,13 +8,24 @@ export const mockGitifyUser: GitifyUser = {
88
avatar: 'https://avatars.githubusercontent.com/u/583231?v=4' as Link,
99
};
1010

11-
export function createPartialMockUser(login: string): User {
12-
const mockUser: Partial<User> = {
11+
export function createPartialMockUser(login: string): RawUser {
12+
const mockUser: Partial<RawUser> = {
1313
login: login,
1414
html_url: `https://github.com/${login}` as Link,
1515
avatar_url: 'https://avatars.githubusercontent.com/u/583231?v=4' as Link,
1616
type: 'User',
1717
};
1818

19-
return mockUser as User;
19+
return mockUser as RawUser;
20+
}
21+
22+
export function createMockNotificationUser(
23+
login: string,
24+
): GitifyNotificationUser {
25+
return {
26+
login: login,
27+
htmlUrl: `https://github.com/${login}` as Link,
28+
avatarUrl: 'https://avatars.githubusercontent.com/u/583231?v=4' as Link,
29+
type: 'User',
30+
};
2031
}

src/renderer/components/AllRead.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { type FC, useContext, useMemo } from 'react';
1+
import { type FC, useMemo } from 'react';
22

33
import { Constants } from '../constants';
4-
import { AppContext } from '../context/App';
4+
import { useAppContext } from '../context/App';
55
import { hasActiveFilters } from '../utils/notifications/filters/filter';
66
import { EmojiSplash } from './layout/EmojiSplash';
77

@@ -12,7 +12,7 @@ interface AllReadProps {
1212
export const AllRead: FC<AllReadProps> = ({
1313
fullHeight = true,
1414
}: AllReadProps) => {
15-
const { settings } = useContext(AppContext);
15+
const { settings } = useAppContext();
1616

1717
const hasFilters = hasActiveFilters(settings);
1818

src/renderer/components/Sidebar.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { type FC, useContext } from 'react';
1+
import type { FC } from 'react';
22
import { useLocation, useNavigate } from 'react-router-dom';
33

44
import {
@@ -15,7 +15,7 @@ import { IconButton, Stack } from '@primer/react';
1515
import { APPLICATION } from '../../shared/constants';
1616

1717
import { Constants } from '../constants';
18-
import { AppContext } from '../context/App';
18+
import { useAppContext } from '../context/App';
1919
import { quitApp } from '../utils/comms';
2020
import {
2121
openGitHubIssues,
@@ -37,7 +37,7 @@ export const Sidebar: FC = () => {
3737
auth,
3838
unreadNotificationCount,
3939
hasUnreadNotifications,
40-
} = useContext(AppContext);
40+
} = useAppContext();
4141

4242
// We naively assume that the first account is the primary account for the purposes of our sidebar quick links
4343
const primaryAccountHostname =

src/renderer/components/avatars/AvatarWithFallback.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import { useState } from 'react';
33

44
import { Avatar, Stack, Truncate } from '@primer/react';
55

6-
import { type Link, Size } from '../../types';
7-
import type { UserType } from '../../typesGitHub';
6+
import { type Link, Size, type UserType } from '../../types';
87
import { getDefaultUserIcon } from '../../utils/icons';
98
import { isNonHumanUser } from '../../utils/notifications/filters/userType';
109

src/renderer/components/filters/FilterSection.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { type ReactNode, useContext } from 'react';
1+
import type { ReactNode } from 'react';
22

33
import type { Icon } from '@primer/octicons-react';
44
import { Stack, Text } from '@primer/react';
55

6-
import { AppContext } from '../../context/App';
6+
import { useAppContext } from '../../context/App';
77
import type { FilterSettingsState, FilterSettingsValue } from '../../types';
88
import type { Filter } from '../../utils/notifications/filters';
99
import { Checkbox } from '../fields/Checkbox';
@@ -29,7 +29,7 @@ export const FilterSection = <T extends FilterSettingsValue>({
2929
tooltip,
3030
layout = 'vertical',
3131
}: FilterSectionProps<T>) => {
32-
const { updateFilter, settings, notifications } = useContext(AppContext);
32+
const { updateFilter, settings, notifications } = useAppContext();
3333

3434
return (
3535
<fieldset id={id}>

0 commit comments

Comments
 (0)