35 |
36 | ### Configure Notifications
37 |
38 |
39 |
40 | ### Options Page
41 |
42 |
43 |
44 | ## How to add a new notification event?
45 |
46 | Please refer to `src/lib/api` for examples.
47 |
48 | Contribution welcomed! You could create a PR to add a new event type to get notifications from.
49 |
50 | ## Buy me a coffee ☕️
51 |
52 | 53 | If you like this extension, consider buying me a coffee. Your support 54 | will help me to continue maintaining this extension for free. 55 |
56 | 61 |
66 |
67 |
--------------------------------------------------------------------------------
/src/lib/services-github/issues.ts:
--------------------------------------------------------------------------------
1 | import { getOctokit } from '../octokit';
2 |
3 | export async function fetchNIssues(
4 | repoFullName: string,
5 | since?: string, // in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ
6 | n: number = 20,
7 | sort: 'updated' | 'created' | 'comments' = 'updated'
8 | ) {
9 | const octokit = await getOctokit();
10 | const { data } = await octokit.request('GET /repos/{owner}/{repo}/issues', {
11 | owner: repoFullName.split('/')[0],
12 | repo: repoFullName.split('/')[1],
13 | // state: 'open',
14 | since,
15 | sort,
16 | page: 1,
17 | per_page: n,
18 | });
19 | return data;
20 | }
21 |
22 | export async function fetchIssueDetails(repoFullName: string, issueNumber: number) {
23 | const octokit = await getOctokit();
24 | const { data } = await octokit.request('GET /repos/{owner}/{repo}/issues/{issue_number}', {
25 | owner: repoFullName.split('/')[0],
26 | repo: repoFullName.split('/')[1],
27 | issue_number: issueNumber,
28 | });
29 | return data;
30 | }
31 |
32 | export async function fetchCommentById(repoFullName: string, commentId: number) {
33 | const octokit = await getOctokit();
34 | const { data } = await octokit.request('GET /repos/{owner}/{repo}/issues/comments/{comment_id}', {
35 | owner: repoFullName.split('/')[0],
36 | repo: repoFullName.split('/')[1],
37 | comment_id: commentId,
38 | });
39 | return data;
40 | }
41 |
42 | // fetchNIssueComments
43 | export async function fetchNIssueComments(
44 | repoFullName: string,
45 | since?: string, // in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ
46 | n: number = 40
47 | ) {
48 | const octokit = await getOctokit();
49 | const { data } = await octokit.request('GET /repos/{owner}/{repo}/issues/comments', {
50 | owner: repoFullName.split('/')[0],
51 | repo: repoFullName.split('/')[1],
52 | // updated since
53 | since,
54 | direction: 'desc',
55 | sort: 'updated',
56 | page: 1,
57 | per_page: n,
58 | });
59 | return data;
60 | }
61 |
62 | /**
63 | * Get labels by repo full_name
64 | */
65 | export async function fetchLabels(repoFullName: string) {
66 | const octokit = await getOctokit();
67 | const { data: page1 } = await octokit.request('GET /repos/{owner}/{repo}/labels', {
68 | owner: repoFullName.split('/')[0],
69 | repo: repoFullName.split('/')[1],
70 | per_page: 100,
71 | page: 1,
72 | });
73 | const { data: page2 } = await octokit.request('GET /repos/{owner}/{repo}/labels', {
74 | owner: repoFullName.split('/')[0],
75 | repo: repoFullName.split('/')[1],
76 | per_page: 100,
77 | page: 2,
78 | });
79 | return [...page1, ...page2];
80 | }
81 |
--------------------------------------------------------------------------------
/src/entrypoints/popup/App.tsx:
--------------------------------------------------------------------------------
1 | import { useEffect, useState } from 'react';
2 | import Alert from '@mui/material/Alert';
3 | import Tabs from '@mui/material/Tabs';
4 | import Tab from '@mui/material/Tab';
5 | import Link from '@mui/material/Link';
6 | import Box from '@mui/material/Box';
7 |
8 | import './App.css';
9 | import useOptionsState from '@/src/lib/hooks/useOptionsState';
10 | import Updates from './components/Updates';
11 | import Settings from './components/Settings';
12 | import { startPollData } from '@/src/lib/api';
13 |
14 | interface TabPanelProps {
15 | children?: React.ReactNode;
16 | index: number;
17 | value: number;
18 | }
19 |
20 | function CustomTabPanel(props: TabPanelProps) {
21 | const { children, value, index, ...other } = props;
22 |
23 | return (
24 | Specify the root URL to your GitHub Enterprise (defaults to https://github.com)
35 | 36 | 54 |55 | 59 | Create a token 60 | {' '} 61 | with the repo permission. 62 |
63 |131 | If you like this extension, consider buying me a coffee. Your support will help me to continue maintaining 132 | this extension for free. 133 |
134 | 135 |
140 |
141 | 146 | Please save and click on the "Github Custom Notifier" extension icon in the browser toolbar to configure which 147 | repos to receive notifications from. 148 |
149 | 150 | 157 |No updates
48 | 51 |