Skip to content

Commit

Permalink
style: prettify files
Browse files Browse the repository at this point in the history
  • Loading branch information
afonsojramos committed Sep 14, 2023
1 parent 7b1191a commit aa7bba3
Show file tree
Hide file tree
Showing 9 changed files with 283 additions and 252 deletions.
8 changes: 4 additions & 4 deletions src/__mocks__/electron.js
Expand Up @@ -31,7 +31,7 @@ let instance;

class BrowserWindow {
constructor() {
if(!instance){
if (!instance) {
instance = this;
}
return instance;
Expand All @@ -43,11 +43,11 @@ class BrowserWindow {
clearStorageData: jest.fn(),
},
};
on(){};
on() {}
close = jest.fn();
hide = jest.fn();
destroy = jest.fn();
};
}

const dialog = {
showErrorBox: jest.fn(),
Expand All @@ -65,7 +65,7 @@ module.exports = {
getLoginItemSettings: jest.fn(),
setLoginItemSettings: () => {},
},
getCurrentWindow: jest.fn(() => instance || new BrowserWindow),
getCurrentWindow: jest.fn(() => instance || new BrowserWindow()),
},
ipcRenderer: {
send: jest.fn(),
Expand Down
220 changes: 110 additions & 110 deletions src/__mocks__/mockedData.ts
Expand Up @@ -276,114 +276,114 @@ export const mockedSingleAccountNotifications: AccountNotifications[] = [
];

export const mockedGraphQLResponse: GraphQLSearch = {
"data": {
"data": {
"search": {
"edges": [
data: {
data: {
search: {
edges: [
{
node: {
viewerSubscription: 'SUBSCRIBED',
title: '1.16.0',
url: 'https://github.com/manosim/notifications-test/discussions/612',
comments: {
edges: [
{
"node": {
"viewerSubscription": "SUBSCRIBED",
"title": "1.16.0",
"url": "https://github.com/manosim/notifications-test/discussions/612",
"comments": {
"edges": [
{
"node": {
"databaseId": 2215656,
"createdAt": "2022-02-20T18:33:39Z",
"replies": {
"edges": []
}
}
},
{
"node": {
"databaseId": 2217789,
"createdAt": "2022-02-21T03:30:42Z",
"replies": {
"edges": []
}
}
},
{
"node": {
"databaseId": 2223243,
"createdAt": "2022-02-21T18:26:27Z",
"replies": {
"edges": [
{
"node": {
"databaseId": 2232922,
"createdAt": "2022-02-23T00:57:58Z"
}
}
]
}
}
},
{
"node": {
"databaseId": 2232921,
"createdAt": "2022-02-23T00:57:49Z",
"replies": {
"edges": []
}
}
},
{
"node": {
"databaseId": 2258799,
"createdAt": "2022-02-27T01:22:20Z",
"replies": {
"edges": [
{
"node": {
"databaseId": 2300902,
"createdAt": "2022-03-05T17:43:52Z"
}
}
]
}
}
},
{
"node": {
"databaseId": 2297637,
"createdAt": "2022-03-04T20:39:44Z",
"replies": {
"edges": [
{
"node": {
"databaseId": 2300893,
"createdAt": "2022-03-05T17:41:04Z"
}
}
]
}
}
},
{
"node": {
"databaseId": 2299763,
"createdAt": "2022-03-05T11:05:42Z",
"replies": {
"edges": [
{
"node": {
"databaseId": 2300895,
"createdAt": "2022-03-05T17:41:44Z"
}
}
]
}
}
}
]
}
}
}
]
}
}
}
}
node: {
databaseId: 2215656,
createdAt: '2022-02-20T18:33:39Z',
replies: {
edges: [],
},
},
},
{
node: {
databaseId: 2217789,
createdAt: '2022-02-21T03:30:42Z',
replies: {
edges: [],
},
},
},
{
node: {
databaseId: 2223243,
createdAt: '2022-02-21T18:26:27Z',
replies: {
edges: [
{
node: {
databaseId: 2232922,
createdAt: '2022-02-23T00:57:58Z',
},
},
],
},
},
},
{
node: {
databaseId: 2232921,
createdAt: '2022-02-23T00:57:49Z',
replies: {
edges: [],
},
},
},
{
node: {
databaseId: 2258799,
createdAt: '2022-02-27T01:22:20Z',
replies: {
edges: [
{
node: {
databaseId: 2300902,
createdAt: '2022-03-05T17:43:52Z',
},
},
],
},
},
},
{
node: {
databaseId: 2297637,
createdAt: '2022-03-04T20:39:44Z',
replies: {
edges: [
{
node: {
databaseId: 2300893,
createdAt: '2022-03-05T17:41:04Z',
},
},
],
},
},
},
{
node: {
databaseId: 2299763,
createdAt: '2022-03-05T11:05:42Z',
replies: {
edges: [
{
node: {
databaseId: 2300895,
createdAt: '2022-03-05T17:41:44Z',
},
},
],
},
},
},
],
},
},
},
],
},
},
},
};
13 changes: 6 additions & 7 deletions src/components/NotificationRow.tsx
Expand Up @@ -16,12 +16,8 @@ export const NotificationRow: React.FC<IProps> = ({
notification,
hostname,
}) => {
const {
settings,
accounts,
markNotification,
unsubscribeNotification,
} = useContext(AppContext);
const { settings, accounts, markNotification, unsubscribeNotification } =
useContext(AppContext);

const pressTitle = useCallback(() => {
openBrowser();
Expand All @@ -31,7 +27,10 @@ export const NotificationRow: React.FC<IProps> = ({
}
}, [settings]);

const openBrowser = useCallback(() => openInBrowser(notification, accounts), [notification]);
const openBrowser = useCallback(
() => openInBrowser(notification, accounts),
[notification]
);

const unsubscribe = (event: React.MouseEvent<HTMLElement>) => {
// Don't trigger onClick of parent element.
Expand Down
7 changes: 1 addition & 6 deletions src/hooks/useNotifications.ts
Expand Up @@ -96,12 +96,7 @@ export const useNotifications = (): NotificationsState => {
]
: [...enterpriseNotifications];

triggerNativeNotifications(
notifications,
data,
settings,
accounts
);
triggerNativeNotifications(notifications, data, settings, accounts);
setNotifications(data);
setIsFetching(false);
})
Expand Down
6 changes: 5 additions & 1 deletion src/routes/LoginWithToken.tsx
Expand Up @@ -63,7 +63,11 @@ export const LoginWithToken: React.FC = () => {
To generate a token, go to GitHub,{' '}
<a
className="underline hover:text-gray-500 dark:hover:text-gray-300 cursor-pointer"
onClick={() => openLink('https://github.com/settings/tokens/new?scopes=notifications,read:user&description=gitify_token')}
onClick={() =>
openLink(
'https://github.com/settings/tokens/new?scopes=notifications,read:user&description=gitify_token'
)
}
>
personal access tokens
</a>{' '}
Expand Down
31 changes: 14 additions & 17 deletions src/typesGithub.ts
Expand Up @@ -22,10 +22,7 @@ export type SubjectType =
| 'RepositoryInvitation'
| 'RepositoryVulnerabilityAlert';

export type ViewerSubscription =
| 'IGNORED'
| 'SUBSCRIBED'
| 'UNSUBSCRIBED'
export type ViewerSubscription = 'IGNORED' | 'SUBSCRIBED' | 'UNSUBSCRIBED';

export interface Notification {
id: string;
Expand Down Expand Up @@ -126,10 +123,10 @@ export interface GraphQLSearch {
data: {
data: {
search: {
edges: DiscussionEdge[]
}
}
}
edges: DiscussionEdge[];
};
};
};
}

export interface DiscussionEdge {
Expand All @@ -138,24 +135,24 @@ export interface DiscussionEdge {
title: string;
url: string;
comments: {
edges: DiscussionCommentEdge[]
}
}
edges: DiscussionCommentEdge[];
};
};
}

export interface DiscussionCommentEdge {
node: {
databaseId: string|number;
databaseId: string | number;
createdAt: string;
replies: {
edges: DiscussionSubcommentEdge[]
}
}
edges: DiscussionSubcommentEdge[];
};
};
}

export interface DiscussionSubcommentEdge {
node: {
databaseId: string|number;
databaseId: string | number;
createdAt: string;
}
};
}

0 comments on commit aa7bba3

Please sign in to comment.