@conorheffron/ironoc-frontend 7.5.1 → 7.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conorheffron/ironoc-frontend",
3
- "version": "7.5.1",
3
+ "version": "7.5.2",
4
4
  "private": false,
5
5
  "dependencies": {
6
6
  "@apollo/client": "^3.13.8",
@@ -1,27 +1,23 @@
1
- import React, { Component } from 'react';
1
+ import React from 'react';
2
2
  import { Container } from 'reactstrap';
3
3
  import '.././App.css';
4
4
  import AppNavbar from '.././AppNavbar';
5
5
 
6
- class NotFound extends Component {
7
- render() {
8
- const {
9
- title = "404 - Page Not Found",
10
- message = "Sorry, the page you are looking for could not be found."
11
- } = this.props;
12
-
13
- return (
14
- <div className="App">
15
- <AppNavbar />
16
- <Container>
17
- <header className="App-header">
18
- <h1>{title}</h1>
19
- <p id="my-intro">{message}</p>
20
- </header>
21
- </Container>
22
- </div>
23
- );
24
- }
6
+ function NotFound({
7
+ title = "404 - Page Not Found",
8
+ message = "Sorry, the page you are looking for could not be found."
9
+ }) {
10
+ return (
11
+ <div className="App">
12
+ <AppNavbar />
13
+ <Container>
14
+ <header className="App-header">
15
+ <h1>{title}</h1>
16
+ <p id="my-intro">{message}</p>
17
+ </header>
18
+ </Container>
19
+ </div>
20
+ );
25
21
  }
26
22
 
27
23
  export default NotFound;
@@ -10,168 +10,195 @@ import {
10
10
  } from 'material-react-table';
11
11
  import { darken, lighten, useTheme } from '@mui/material';
12
12
 
13
- const RepoIssues = () => {
14
- const params = useParams();
15
- const navigate = useNavigate();
16
- const { id = '', repo = '' } = params;
17
-
18
- const [repoIssueList, setRepoIssueList] = useState([]);
19
- const [isLoading, setIsLoading] = useState(true);
20
- const [value, setValue] = useState('');
13
+ const issueTags = [
14
+ 'enhancement',
15
+ 'bug',
16
+ 'java',
17
+ 'java-be',
18
+ 'javascript',
19
+ 'release',
20
+ 'ui',
21
+ 'frontend',
22
+ 'infra',
23
+ 'dependencies',
24
+ 'python',
25
+ 'python-code',
26
+ ];
21
27
 
22
- useEffect(() => {
23
- const fetchIssues = async () => {
24
- if (id && repo) {
25
- const response = await fetch(`/api/get-repo-issue/${id}/${repo}/`);
26
- const body = await response.json();
27
- setRepoIssueList(body);
28
- }
29
- setIsLoading(false);
30
- };
31
- fetchIssues();
32
- }, [id, repo]);
28
+ const RepoIssues = () => {
29
+ const params = useParams();
30
+ const navigate = useNavigate();
31
+ const { id = '', repo = '' } = params;
33
32
 
34
- const handleChange = event => setValue(event.target.value);
33
+ const [repoIssueList, setRepoIssueList] = useState([]);
34
+ const [isLoading, setIsLoading] = useState(true);
35
+ const [value, setValue] = useState('');
35
36
 
36
- const onSubmit = event => {
37
- event.preventDefault();
38
- navigate(`/issues/${id}/${value}`, {
39
- replace: true,
40
- state: {
41
- id: id,
42
- repo: value
43
- }
44
- });
45
- navigate(0);
37
+ useEffect(() => {
38
+ const fetchIssues = async () => {
39
+ if (id && repo) {
40
+ const response = await fetch(`/api/get-repo-issue/${id}/${repo}/`);
41
+ const body = await response.json();
42
+ setRepoIssueList(body);
43
+ }
44
+ setIsLoading(false);
46
45
  };
46
+ fetchIssues();
47
+ }, [id, repo]);
47
48
 
48
- const projectLink = `/projects/${id}/`;
49
+ const handleChange = (event) => setValue(event.target.value);
49
50
 
50
- const issueTags = ['enhancement', 'bug', 'java', 'javascript', 'release', 'ui', 'frontend', 'infra', 'dependencies', 'python-code']
51
+ const onSubmit = (event) => {
52
+ event.preventDefault();
53
+ navigate(`/issues/${id}/${value}`, {
54
+ replace: true,
55
+ state: {
56
+ id: id,
57
+ repo: value,
58
+ },
59
+ });
60
+ navigate(0);
61
+ };
51
62
 
52
- // MaterialReactTable columns
53
- const columns = useMemo(() => [
54
- {
55
- accessorKey: 'number',
56
- header: 'Issue No.',
57
- Cell: ({ cell }) => {
58
- const issueLink = `https://github.com/${id}/${repo}/issues/${cell.getValue()}/`;
59
- return (
60
- <a href={issueLink} target="_blank" rel="noreferrer">
61
- <b><i>{cell.getValue()}</i></b>
62
- </a>
63
- );
64
- },
65
- size: 40,
66
- },
67
- {
68
- accessorKey: 'state',
69
- header: 'State',
70
- filterVariant: 'multi-select',
71
- size: 40,
72
- },
73
- {
74
- accessorKey: 'labels',
75
- header: 'Labels',
76
- filterVariant: 'multi-select',
77
- filterSelectOptions: issueTags,
78
- Cell: ({ cell }) => <b>{cell.getValue().join(', ')}</b>,
79
- size: 100,
80
- },
81
- {
82
- accessorKey: 'title',
83
- header: 'Title',
84
- size: 150,
85
- Cell: ({ cell }) => <b>{cell.getValue()}</b>,
86
- },
87
- {
88
- accessorKey: 'body',
89
- header: 'Description',
90
- size: 200,
63
+ const projectLink = `/projects/${id}/`;
64
+
65
+ // MaterialReactTable columns
66
+ const columns = useMemo(
67
+ () => [
68
+ {
69
+ accessorKey: 'number',
70
+ header: 'Issue No.',
71
+ Cell: ({ cell }) => {
72
+ const issueLink = `https://github.com/${id}/${repo}/issues/${cell.getValue()}/`;
73
+ return (
74
+ <a href={issueLink} target="_blank" rel="noreferrer">
75
+ <b>
76
+ <i>{cell.getValue()}</i>
77
+ </b>
78
+ </a>
79
+ );
91
80
  },
92
- ], [id, repo]);
81
+ size: 40,
82
+ },
83
+ {
84
+ accessorKey: 'state',
85
+ header: 'State',
86
+ filterVariant: 'multi-select',
87
+ size: 40,
88
+ },
89
+ {
90
+ accessorKey: 'labels',
91
+ header: 'Labels',
92
+ filterVariant: 'multi-select',
93
+ filterSelectOptions: issueTags,
94
+ Cell: ({ cell }) => <b>{cell.getValue().join(', ')}</b>,
95
+ size: 100,
96
+ },
97
+ {
98
+ accessorKey: 'title',
99
+ header: 'Title',
100
+ size: 150,
101
+ Cell: ({ cell }) => <b>{cell.getValue()}</b>,
102
+ },
103
+ {
104
+ accessorKey: 'body',
105
+ header: 'Description',
106
+ size: 200,
107
+ },
108
+ ],
109
+ [id, repo]
110
+ );
93
111
 
94
- const theme = useTheme();
112
+ const theme = useTheme();
95
113
 
96
- //light or dark green
97
- const baseBackgroundColor =
114
+ //light or dark green
115
+ const baseBackgroundColor =
98
116
  theme.palette.mode === 'dark'
99
117
  ? 'rgba(3, 44, 43, 1)'
100
118
  : 'rgba(244, 255, 233, 1)';
101
119
 
102
- const table = useMaterialReactTable({
103
- columns,
104
- data: repoIssueList,
105
- enableFacetedValues: true,
106
- enableStickyHeader: true,
107
- initialState: { showColumnFilters: true },
108
- muiTablePaperProps: {
109
- elevation: 0,
110
- sx: {
111
- borderRadius: '0',
112
- },
113
- },
114
- muiTableBodyProps: {
115
- sx: (theme) => ({
116
- '& tr:nth-of-type(odd):not([data-selected="true"]):not([data-pinned="true"]) > td':
117
- {
118
- backgroundColor: darken(baseBackgroundColor, 0.1),
119
- },
120
- '& tr:nth-of-type(odd):not([data-selected="true"]):not([data-pinned="true"]):hover > td':
121
- {
122
- backgroundColor: darken(baseBackgroundColor, 0.2),
123
- },
124
- '& tr:nth-of-type(even):not([data-selected="true"]):not([data-pinned="true"]) > td':
125
- {
126
- backgroundColor: lighten(baseBackgroundColor, 0.1),
127
- },
128
- '& tr:nth-of-type(even):not([data-selected="true"]):not([data-pinned="true"]):hover > td':
129
- {
130
- backgroundColor: darken(baseBackgroundColor, 0.2),
131
- },
132
- }),
133
- },
134
- mrtTheme: (theme) => ({
135
- baseBackgroundColor: baseBackgroundColor,
136
- draggingBorderColor: theme.palette.secondary.main,
137
- }),
138
- });
139
-
140
- if (isLoading) {
141
- return (
142
- <div className="App">
143
- <AppNavbar />
144
- <Container>
145
- <br /><br /><br />
146
- <LoadingSpinner />
147
- </Container>
148
- </div>
149
- );
150
- }
120
+ const table = useMaterialReactTable({
121
+ columns,
122
+ data: repoIssueList,
123
+ enableFacetedValues: true,
124
+ enableStickyHeader: true,
125
+ initialState: { showColumnFilters: true },
126
+ muiTablePaperProps: {
127
+ elevation: 0,
128
+ sx: {
129
+ borderRadius: '0',
130
+ },
131
+ },
132
+ muiTableBodyProps: {
133
+ sx: (theme) => ({
134
+ '& tr:nth-of-type(odd):not([data-selected="true"]):not([data-pinned="true"]) > td': {
135
+ backgroundColor: darken(baseBackgroundColor, 0.1),
136
+ },
137
+ '& tr:nth-of-type(odd):not([data-selected="true"]):not([data-pinned="true"]):hover > td': {
138
+ backgroundColor: darken(baseBackgroundColor, 0.2),
139
+ },
140
+ '& tr:nth-of-type(even):not([data-selected="true"]):not([data-pinned="true"]) > td': {
141
+ backgroundColor: lighten(baseBackgroundColor, 0.1),
142
+ },
143
+ '& tr:nth-of-type(even):not([data-selected="true"]):not([data-pinned="true"]):hover > td': {
144
+ backgroundColor: darken(baseBackgroundColor, 0.2),
145
+ },
146
+ }),
147
+ },
148
+ mrtTheme: (theme) => ({
149
+ baseBackgroundColor: baseBackgroundColor,
150
+ draggingBorderColor: theme.palette.secondary.main,
151
+ }),
152
+ });
151
153
 
154
+ if (isLoading) {
152
155
  return (
153
- <div>
154
- <AppNavbar /><br /><br />
155
- <Container fluid>
156
- <br />
157
- <InputGroup className="mb-3">
158
- <Form.Control
159
- placeholder="Enter Project Name... Example: ironoc-db"
160
- aria-label="Enter Project Name..."
161
- aria-describedby="basic-addon2"
162
- type="text"
163
- value={value}
164
- onChange={handleChange}
165
- />
166
- <Button color="primary" variant="outline-secondary" id="button-addon2" onClick={onSubmit}>Search Issues</Button>
167
- </InputGroup>
168
- <h3 className="table-headers">
169
- Issues for project <b>{repo}</b> and account <a href={projectLink}><b>{id}</b></a>
170
- </h3>
171
- <MaterialReactTable table={table} />
172
- </Container>
173
- </div>
156
+ <div className="App">
157
+ <AppNavbar />
158
+ <Container>
159
+ <br />
160
+ <br />
161
+ <br />
162
+ <LoadingSpinner />
163
+ </Container>
164
+ </div>
174
165
  );
166
+ }
167
+
168
+ return (
169
+ <div>
170
+ <AppNavbar />
171
+ <br />
172
+ <br />
173
+ <Container fluid>
174
+ <br />
175
+ <InputGroup className="mb-3">
176
+ <Form.Control
177
+ placeholder="Enter Project Name... Example: ironoc-db"
178
+ aria-label="Enter Project Name..."
179
+ aria-describedby="basic-addon2"
180
+ type="text"
181
+ value={value}
182
+ onChange={handleChange}
183
+ />
184
+ <Button
185
+ variant="outline-secondary"
186
+ id="button-addon2"
187
+ onClick={onSubmit}
188
+ >
189
+ Search Issues
190
+ </Button>
191
+ </InputGroup>
192
+ <h3 className="table-headers">
193
+ Issues for project <b>{repo}</b> and account{' '}
194
+ <a href={projectLink}>
195
+ <b>{id}</b>
196
+ </a>
197
+ </h3>
198
+ <MaterialReactTable table={table} />
199
+ </Container>
200
+ </div>
201
+ );
175
202
  };
176
203
 
177
204
  export default RepoIssues;