@conorheffron/ironoc-frontend 7.2.7 → 7.2.9
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 +1 -1
- package/public/index.html +1 -1
- package/src/App.css +1 -1
- package/src/App.test.js +9 -1
- package/src/AppNavbar.js +61 -53
- package/src/components/About.js +0 -2
- package/src/components/CoffeeHome.js +0 -2
- package/src/components/ControlledCarousel.js +0 -2
- package/src/components/Donate.js +32 -101
- package/src/components/Home.js +0 -2
- package/src/components/NotFound.js +0 -2
- package/src/components/RepoDetails.js +0 -3
- package/src/components/RepoIssues.js +0 -3
- package/src/components/__tests__/Donate.test.js +66 -45
- package/src/index.js +9 -1
package/package.json
CHANGED
package/public/index.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<meta name="theme-color" content="#000000" />
|
|
8
8
|
<meta
|
|
9
9
|
name="Personal Portfolio for Conor Heffron"
|
package/src/App.css
CHANGED
package/src/App.test.js
CHANGED
|
@@ -68,10 +68,18 @@ describe('AppNavBar', () => {
|
|
|
68
68
|
const githubProjectsDropdown = screen.getByText('GitHub Projects');
|
|
69
69
|
expect(githubProjectsDropdown).toBeInTheDocument();
|
|
70
70
|
|
|
71
|
-
// Check if the "
|
|
71
|
+
// Check if the "Charity Options" dropdown is present
|
|
72
72
|
const donateDropdown = screen.getByText('Charity Options');
|
|
73
73
|
expect(donateDropdown).toBeInTheDocument();
|
|
74
74
|
|
|
75
|
+
// Check if the "Donate" dropdown is present
|
|
76
|
+
const donate = screen.getByText('Donate');
|
|
77
|
+
expect(donate).toBeInTheDocument();
|
|
78
|
+
|
|
79
|
+
// Check if the "GraphQL PG" dropdown is present
|
|
80
|
+
const graphQLDropdown = screen.getByText('GraphQL PG');
|
|
81
|
+
expect(graphQLDropdown).toBeInTheDocument();
|
|
82
|
+
|
|
75
83
|
// Check if the "Home" link is present
|
|
76
84
|
const homeLink = screen.getByText('Home');
|
|
77
85
|
expect(homeLink).toBeInTheDocument();
|
package/src/AppNavbar.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
2
|
import "bootstrap/dist/css/bootstrap.min.css";
|
|
3
|
-
import {Navbar, NavbarText, Container, Collapse, NavbarBrand, Nav, UncontrolledDropdown, DropdownToggle, DropdownItem, DropdownMenu } from "reactstrap";
|
|
3
|
+
import {Navbar, NavbarText, Container, Collapse, NavbarBrand, NavbarToggler, Nav, UncontrolledDropdown, DropdownToggle, DropdownItem, DropdownMenu } from "reactstrap";
|
|
4
4
|
import logo from './img/robot-logo.png';
|
|
5
5
|
import "@fontsource/montserrat/700.css";
|
|
6
6
|
import "@fontsource/open-sans/400-italic.css";
|
|
@@ -14,7 +14,7 @@ class AppNavBar extends Component {
|
|
|
14
14
|
dark = true,
|
|
15
15
|
fixed = 'top',
|
|
16
16
|
container = true,
|
|
17
|
-
expand =
|
|
17
|
+
expand = 'xxl', // Changed for responsive behavior per device type
|
|
18
18
|
className = 'nav-bar'
|
|
19
19
|
} = props;
|
|
20
20
|
|
|
@@ -25,12 +25,17 @@ class AppNavBar extends Component {
|
|
|
25
25
|
fixed,
|
|
26
26
|
container,
|
|
27
27
|
expand,
|
|
28
|
-
className
|
|
28
|
+
className,
|
|
29
|
+
isOpen: false // State to handle collapse toggle
|
|
29
30
|
};
|
|
30
31
|
}
|
|
31
32
|
|
|
33
|
+
toggleNavbar = () => {
|
|
34
|
+
this.setState({ isOpen: !this.state.isOpen });
|
|
35
|
+
};
|
|
36
|
+
|
|
32
37
|
render() {
|
|
33
|
-
const { color, light, dark, fixed, container, expand, className } = this.state;
|
|
38
|
+
const { color, light, dark, fixed, container, expand, className, isOpen } = this.state;
|
|
34
39
|
|
|
35
40
|
return (
|
|
36
41
|
<div>
|
|
@@ -39,55 +44,58 @@ class AppNavBar extends Component {
|
|
|
39
44
|
<NavbarBrand href="/">
|
|
40
45
|
<img alt="" src={logo} width="30" height="30" className="d-inline-block align-top"/>
|
|
41
46
|
</NavbarBrand>
|
|
42
|
-
<
|
|
43
|
-
<
|
|
44
|
-
<
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
<
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
<
|
|
56
|
-
|
|
57
|
-
<
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
<
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
<
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
<
|
|
83
|
-
|
|
84
|
-
<
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
47
|
+
<NavbarToggler onClick={this.toggleNavbar} /> {/* Toggle button */}
|
|
48
|
+
<Collapse isOpen={isOpen} navbar>
|
|
49
|
+
<Nav className="me-auto" navbar>
|
|
50
|
+
<UncontrolledDropdown inNavbar nav>
|
|
51
|
+
<DropdownToggle caret nav>iRonoc</DropdownToggle>
|
|
52
|
+
<DropdownMenu end>
|
|
53
|
+
<DropdownItem href="/about">About</DropdownItem>
|
|
54
|
+
<DropdownItem href="/portfolio">Portfolio</DropdownItem>
|
|
55
|
+
<DropdownItem href="/brews">Brews</DropdownItem>
|
|
56
|
+
<DropdownItem divider />
|
|
57
|
+
<DropdownItem href="https://linktr.ee/conorheffron" target="_blank" rel="noreferrer">Link Tree</DropdownItem>
|
|
58
|
+
</DropdownMenu>
|
|
59
|
+
</UncontrolledDropdown>
|
|
60
|
+
<UncontrolledDropdown inNavbar nav>
|
|
61
|
+
<DropdownToggle caret nav>GitHub PM</DropdownToggle>
|
|
62
|
+
<DropdownMenu end>
|
|
63
|
+
<DropdownItem href="/projects/conorheffron">Projects</DropdownItem>
|
|
64
|
+
<DropdownItem href="/issues/conorheffron/ironoc">Issues</DropdownItem>
|
|
65
|
+
</DropdownMenu>
|
|
66
|
+
</UncontrolledDropdown>
|
|
67
|
+
<UncontrolledDropdown inNavbar nav>
|
|
68
|
+
<DropdownToggle caret nav>GitHub API</DropdownToggle>
|
|
69
|
+
<DropdownMenu end>
|
|
70
|
+
<DropdownItem target="_blank" href="/swagger-ui-ironoc.html">Swagger Doc</DropdownItem>
|
|
71
|
+
<DropdownItem divider />
|
|
72
|
+
<DropdownItem target="_blank" href="/api/get-repo-detail?username=conorheffron">GET Projects</DropdownItem>
|
|
73
|
+
<DropdownItem target="_blank" href="/api/get-repo-issue/conorheffron/ironoc/">GET Issues</DropdownItem>
|
|
74
|
+
</DropdownMenu>
|
|
75
|
+
</UncontrolledDropdown>
|
|
76
|
+
<UncontrolledDropdown inNavbar nav>
|
|
77
|
+
<DropdownToggle caret nav>GitHub Projects</DropdownToggle>
|
|
78
|
+
<DropdownMenu end>
|
|
79
|
+
<DropdownItem target="_blank" href="https://github.com/conorheffron/ironoc">iRonoc</DropdownItem>
|
|
80
|
+
<DropdownItem divider />
|
|
81
|
+
<DropdownItem target="_blank" href="https://github.com/conorheffron/ironoc-db">iRonoc-DB</DropdownItem>
|
|
82
|
+
<DropdownItem target="_blank" href="https://github.com/conorheffron/booking-sys">Booking System Sample</DropdownItem>
|
|
83
|
+
<DropdownItem target="_blank" href="https://github.com/conorheffron/nba-stats">NBA Stats Analysis</DropdownItem>
|
|
84
|
+
<DropdownItem target="_blank" href="https://github.com/conorheffron/ironoc-pytest">PyTest GitHub Client Package</DropdownItem>
|
|
85
|
+
</DropdownMenu>
|
|
86
|
+
</UncontrolledDropdown>
|
|
87
|
+
<UncontrolledDropdown inNavbar nav>
|
|
88
|
+
<DropdownToggle caret nav>Charity Options</DropdownToggle>
|
|
89
|
+
<DropdownMenu end>
|
|
90
|
+
<DropdownItem href="/donate">Donate</DropdownItem>
|
|
91
|
+
<DropdownItem divider />
|
|
92
|
+
<DropdownItem target="_blank" href="/graphiql?path=/graphql">GraphQL PG</DropdownItem>
|
|
93
|
+
</DropdownMenu>
|
|
94
|
+
</UncontrolledDropdown>
|
|
95
|
+
</Nav>
|
|
96
|
+
<a href="/">
|
|
97
|
+
<NavbarText href="/">Home</NavbarText>
|
|
98
|
+
</a>
|
|
91
99
|
</Collapse>
|
|
92
100
|
</Container>
|
|
93
101
|
</Navbar>
|
package/src/components/About.js
CHANGED
|
@@ -2,7 +2,6 @@ import React, { Component } from 'react';
|
|
|
2
2
|
import { Container } from 'reactstrap';
|
|
3
3
|
import '.././App.css';
|
|
4
4
|
import AppNavbar from '.././AppNavbar';
|
|
5
|
-
import Footer from '.././Footer';
|
|
6
5
|
|
|
7
6
|
class About extends Component {
|
|
8
7
|
render() {
|
|
@@ -48,7 +47,6 @@ class About extends Component {
|
|
|
48
47
|
</a><br />
|
|
49
48
|
</header>
|
|
50
49
|
</Container>
|
|
51
|
-
<Footer />
|
|
52
50
|
</div>
|
|
53
51
|
);
|
|
54
52
|
}
|
|
@@ -3,7 +3,6 @@ import { Container } from 'reactstrap';
|
|
|
3
3
|
import axios from 'axios';
|
|
4
4
|
import AppNavbar from '.././AppNavbar';
|
|
5
5
|
import CoffeeCarousel from './CoffeeCarousel';
|
|
6
|
-
import Footer from '.././Footer';
|
|
7
6
|
import LoadingSpinner from '.././LoadingSpinner';
|
|
8
7
|
|
|
9
8
|
class CoffeeHome extends Component {
|
|
@@ -39,7 +38,6 @@ class CoffeeHome extends Component {
|
|
|
39
38
|
</>
|
|
40
39
|
)}
|
|
41
40
|
</Container>
|
|
42
|
-
<Footer/>
|
|
43
41
|
</div>
|
|
44
42
|
);
|
|
45
43
|
}
|
|
@@ -4,7 +4,6 @@ import 'bootstrap/dist/css/bootstrap.css';
|
|
|
4
4
|
import '.././App.css';
|
|
5
5
|
import { Container } from 'reactstrap';
|
|
6
6
|
import AppNavbar from '.././AppNavbar';
|
|
7
|
-
import Footer from '.././Footer';
|
|
8
7
|
import navy from '.././img/darkblue-bg.png';
|
|
9
8
|
import teal from '.././img/teal-bg.png';
|
|
10
9
|
import red from '.././img/red-bg.png';
|
|
@@ -93,7 +92,6 @@ class ControlledCarousel extends Component {
|
|
|
93
92
|
))}
|
|
94
93
|
</Carousel>
|
|
95
94
|
</Container>
|
|
96
|
-
<Footer />
|
|
97
95
|
</div>
|
|
98
96
|
);
|
|
99
97
|
}
|
package/src/components/Donate.js
CHANGED
|
@@ -2,119 +2,51 @@ import React, { Component } from 'react';
|
|
|
2
2
|
import Carousel from 'react-bootstrap/Carousel';
|
|
3
3
|
import 'bootstrap/dist/css/bootstrap.css';
|
|
4
4
|
import '../App.css';
|
|
5
|
-
import { Container } from 'reactstrap';
|
|
6
5
|
import AppNavbar from '../AppNavbar';
|
|
7
|
-
import Footer from '../Footer';
|
|
8
6
|
import red from '../img/red-bg.png';
|
|
7
|
+
import { Container } from 'reactstrap';
|
|
8
|
+
import LoadingSpinner from '.././LoadingSpinner';
|
|
9
|
+
|
|
10
|
+
class Donate extends Component {
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
phone: "+353 (045) 894 538"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
donate: "https://vi.ie/supporting-us/donate-now/",
|
|
26
|
-
link: "https://linktr.ee/vision_ireland",
|
|
27
|
-
img: red,
|
|
28
|
-
alt: "red2",
|
|
29
|
-
name: "Vision Ireland, the new name for NCBI",
|
|
30
|
-
overview: `Vision Ireland, the name for NCBI is Ireland’s national charity working for the rising number of people affected by sight loss.
|
|
31
|
-
Our practical and emotional advice and support help 8,000 people and their families confidently face their futures every year.`,
|
|
32
|
-
founded: 1931,
|
|
33
|
-
phone: "+353 (0)1 830 7033"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
donate: "https://www.childrenshealth.ie/donate/",
|
|
37
|
-
link: "https://www.childrenshealthireland.ie/",
|
|
38
|
-
img: red,
|
|
39
|
-
alt: "red3",
|
|
40
|
-
name: "Temple Street Children’s University Hospital",
|
|
41
|
-
overview: `Temple Street, is an acute national paediatric hospital. Seven major specialties at Temple Street today include
|
|
42
|
-
neonatal & paediatric surgery, neurology, neurosurgery, nephrology, orthopaedics, ENT & plastic surgery.
|
|
43
|
-
Temple Street cares for 145,000 children per year including 45,000 who attend the Emergency Department (ED) every year.
|
|
44
|
-
A staff of 85 Consultants& over 950 other full-time & part-time HSCPs (Health & Social
|
|
45
|
-
Care Professionals) % other staff deliver care & services.`,
|
|
46
|
-
founded: 1872,
|
|
47
|
-
phone: `<br/><b>Temple Street:</b> +353 01 878 4200,
|
|
48
|
-
<b>Tallaght:</b> +353 01 693 7500,<br />
|
|
49
|
-
<b>Crumlin:</b> +353 01 409 6100,
|
|
50
|
-
<b>Connolly:</b> +353 01 640 7500`
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
donate: "https://donors.cancer.ie/page/FUNDZAZBHHS",
|
|
54
|
-
link: "https://www.cancer.ie/",
|
|
55
|
-
img: red,
|
|
56
|
-
alt: "red4",
|
|
57
|
-
name: "Irish Cancer Society",
|
|
58
|
-
overview: `We are a community of patients, survivors, volunteers, supporters, health and social care professionals and researchers.
|
|
59
|
-
Together we are transforming the experiences and outcomes of people affected by cancer through our advocacy, support services and research.`,
|
|
60
|
-
founded: 1963,
|
|
61
|
-
phone: "+353 (0) 1800200700"
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
donate: "https://www.svp.ie/donate/",
|
|
65
|
-
link: "https://www.svp.ie/",
|
|
66
|
-
img: red,
|
|
67
|
-
alt: "red5",
|
|
68
|
-
name: "The Society of Saint Vincent de Paul",
|
|
69
|
-
overview: `The Society of Saint Vincent de Paul exists to fight poverty. The Society of St. Vincent de Paul is the largest, voluntary, charitable organisation in Ireland.
|
|
70
|
-
Its membership of over 11,000 volunteer members throughout the country are supported by 600 staff, working for social justice and the creation of a more just,
|
|
71
|
-
caring nation. This unique network of social concern also gives practical support to those experiencing poverty and social exclusion, by providing a wide range
|
|
72
|
-
of services to people in need.`,
|
|
73
|
-
founded: 1844,
|
|
74
|
-
phone: "+353 1 884 8200"
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
donate: "https://www.dubsimon.ie/donate",
|
|
78
|
-
link: "https://www.dubsimon.ie/",
|
|
79
|
-
img: red,
|
|
80
|
-
alt: "red6",
|
|
81
|
-
name: "Dublin Simon Community",
|
|
82
|
-
overview: `Covering counties Meath, Cavan, Monaghan & Louth. We provide services at all stages of homelessness and enable people to move to a place they can call home.
|
|
83
|
-
At Simon, we listen to people who turn to us for help and do everything we can to support them to move out of homelessness into independent living.
|
|
84
|
-
We strive to empower people to access, secure and retain a home of their own by reducing the reliance on short-term emergency accommodation and providing
|
|
85
|
-
permanent supported housing for people to sustain a home in their local community. Moving people into supported housing produces life-enhancing and
|
|
86
|
-
life-saving results and is more cost-effective in the long run.`,
|
|
87
|
-
founded: 1969,
|
|
88
|
-
phone: "+353 (01) 671 5551"
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
donate: "https://www.debra.ie/donate/",
|
|
92
|
-
link: "https://www.debra.ie/",
|
|
93
|
-
img: red,
|
|
94
|
-
alt: "red7",
|
|
95
|
-
name: "Debra Ireland",
|
|
96
|
-
overview: `We are dedicated to transforming the lives of people living with Epidermolysis Bullosa (EB), caring for someone with EB, or bereaved by EB, through care,
|
|
97
|
-
research and advocacy. EB is an incurable genetic condition that affects the body's largest organ; the skin. People living with EB are missing the
|
|
98
|
-
essential proteins that bind the skin's layers together, so any minor friction, movement or trauma causes it to break, tear, and blister.
|
|
99
|
-
It is as fragile as a butterfly wing. That's why we're here. To be a positive force for all those living with EB and all whose lives have been impacted by EB.`,
|
|
100
|
-
founded: 1988,
|
|
101
|
-
phone: "+353 (0)1 4126924"
|
|
12
|
+
constructor(props) {
|
|
13
|
+
super(props);
|
|
14
|
+
this.state = {
|
|
15
|
+
donateItems: [],
|
|
16
|
+
loading: true
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async componentDidMount() {
|
|
21
|
+
const response = await fetch("/api/donate-items");
|
|
22
|
+
const body = await response.json();
|
|
23
|
+
this.setState({ donateItems: body, loading: false });
|
|
102
24
|
}
|
|
103
|
-
];
|
|
104
25
|
|
|
105
|
-
class Donate extends Component {
|
|
106
26
|
render() {
|
|
107
|
-
const {
|
|
27
|
+
const { donateItems, loading} = this.state;
|
|
28
|
+
|
|
29
|
+
if (loading) {
|
|
30
|
+
return (
|
|
31
|
+
<div className="App">
|
|
32
|
+
<AppNavbar />
|
|
33
|
+
<Container>
|
|
34
|
+
<br /><br /><br />
|
|
35
|
+
<LoadingSpinner />
|
|
36
|
+
</Container>
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
108
40
|
|
|
109
41
|
return (
|
|
110
42
|
<div>
|
|
111
43
|
<AppNavbar />
|
|
112
44
|
<Container>
|
|
113
45
|
<Carousel className="App-header">
|
|
114
|
-
{
|
|
46
|
+
{donateItems.map((item, index) => (
|
|
115
47
|
<Carousel.Item key={index} interval={500}>
|
|
116
48
|
<a href={item.donate} target="_blank" rel="noreferrer">
|
|
117
|
-
<img className="d-block w-100" src={
|
|
49
|
+
<img className="d-block w-100" src={red} alt={item.alt} />
|
|
118
50
|
<Carousel.Caption>
|
|
119
51
|
<h1>
|
|
120
52
|
<u>{item.name}</u>
|
|
@@ -123,7 +55,7 @@ class Donate extends Component {
|
|
|
123
55
|
<b>Contact & Help by Phone: </b><span dangerouslySetInnerHTML={{ __html: item.phone }} />
|
|
124
56
|
</h8><br />
|
|
125
57
|
<h7>
|
|
126
|
-
<b>Home page: </b><a href={item.link}>{item.link}</a>
|
|
58
|
+
<b>Home page: </b><a href={item.link} target="_blank" rel="noreferrer">{item.link}</a>
|
|
127
59
|
</h7><br /><br />
|
|
128
60
|
<h11 className="overview-text">
|
|
129
61
|
<b>Overview:</b> Founded in {item.founded}, {item.overview}
|
|
@@ -134,7 +66,6 @@ class Donate extends Component {
|
|
|
134
66
|
))}
|
|
135
67
|
</Carousel>
|
|
136
68
|
</Container>
|
|
137
|
-
<Footer />
|
|
138
69
|
</div>
|
|
139
70
|
);
|
|
140
71
|
}
|
package/src/components/Home.js
CHANGED
|
@@ -2,7 +2,6 @@ import React, { Component } from 'react';
|
|
|
2
2
|
import { Container } from 'reactstrap';
|
|
3
3
|
import '.././App.css';
|
|
4
4
|
import AppNavbar from '.././AppNavbar';
|
|
5
|
-
import Footer from '.././Footer';
|
|
6
5
|
import logo from '.././img/robot-logo.png';
|
|
7
6
|
|
|
8
7
|
class Home extends Component {
|
|
@@ -58,7 +57,6 @@ class Home extends Component {
|
|
|
58
57
|
</p>
|
|
59
58
|
</header>
|
|
60
59
|
</Container>
|
|
61
|
-
<Footer />
|
|
62
60
|
</div>
|
|
63
61
|
);
|
|
64
62
|
}
|
|
@@ -2,7 +2,6 @@ import React, { Component } from 'react';
|
|
|
2
2
|
import { Container } from 'reactstrap';
|
|
3
3
|
import '.././App.css';
|
|
4
4
|
import AppNavbar from '.././AppNavbar';
|
|
5
|
-
import Footer from '.././Footer';
|
|
6
5
|
|
|
7
6
|
class NotFound extends Component {
|
|
8
7
|
render() {
|
|
@@ -20,7 +19,6 @@ class NotFound extends Component {
|
|
|
20
19
|
<p id="my-intro">{message}</p>
|
|
21
20
|
</header>
|
|
22
21
|
</Container>
|
|
23
|
-
<Footer />
|
|
24
22
|
</div>
|
|
25
23
|
);
|
|
26
24
|
}
|
|
@@ -3,7 +3,6 @@ import { Button, ButtonGroup, Container, InputGroup, Table } from 'reactstrap';
|
|
|
3
3
|
import '.././App.css';
|
|
4
4
|
import Form from 'react-bootstrap/Form';
|
|
5
5
|
import AppNavbar from '.././AppNavbar';
|
|
6
|
-
import Footer from '.././Footer';
|
|
7
6
|
import { Link } from 'react-router-dom';
|
|
8
7
|
import LoadingSpinner from '.././LoadingSpinner';
|
|
9
8
|
|
|
@@ -51,7 +50,6 @@ class RepoDetails extends Component {
|
|
|
51
50
|
<br /><br /><br />
|
|
52
51
|
<LoadingSpinner />
|
|
53
52
|
</Container>
|
|
54
|
-
<Footer />
|
|
55
53
|
</div>
|
|
56
54
|
);
|
|
57
55
|
}
|
|
@@ -104,7 +102,6 @@ class RepoDetails extends Component {
|
|
|
104
102
|
<tbody>{repoList}</tbody>
|
|
105
103
|
</Table>
|
|
106
104
|
</Container>
|
|
107
|
-
<Footer />
|
|
108
105
|
</div>
|
|
109
106
|
);
|
|
110
107
|
}
|
|
@@ -3,7 +3,6 @@ import { Button, Container, InputGroup, Table } from 'reactstrap';
|
|
|
3
3
|
import '.././App.css';
|
|
4
4
|
import Form from 'react-bootstrap/Form';
|
|
5
5
|
import AppNavbar from '.././AppNavbar';
|
|
6
|
-
import Footer from '.././Footer';
|
|
7
6
|
import LoadingSpinner from '.././LoadingSpinner';
|
|
8
7
|
|
|
9
8
|
class RepoIssues extends Component {
|
|
@@ -52,7 +51,6 @@ class RepoIssues extends Component {
|
|
|
52
51
|
<br /><br /><br />
|
|
53
52
|
<LoadingSpinner />
|
|
54
53
|
</Container>
|
|
55
|
-
<Footer />
|
|
56
54
|
</div>
|
|
57
55
|
);
|
|
58
56
|
}
|
|
@@ -100,7 +98,6 @@ class RepoIssues extends Component {
|
|
|
100
98
|
<tbody>{repoList}</tbody>
|
|
101
99
|
</Table>
|
|
102
100
|
</Container>
|
|
103
|
-
<Footer />
|
|
104
101
|
</div>
|
|
105
102
|
);
|
|
106
103
|
}
|
|
@@ -1,55 +1,76 @@
|
|
|
1
|
-
import { render, screen } from '@testing-library/react';
|
|
1
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
2
|
+
import App from '../../App';
|
|
3
|
+
import { createMemoryHistory } from 'history';
|
|
4
|
+
import { Router } from 'react-router-dom';
|
|
2
5
|
import Donate from '../Donate';
|
|
6
|
+
import LoadingSpinner from '../../LoadingSpinner';
|
|
3
7
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
overview: `Vision Ireland, the name for NCBI is Ireland’s national charity working for the rising number of people affected by sight loss.
|
|
25
|
-
Our practical and emotional advice and support help 8,000 people and their families confidently face their futures every year.`,
|
|
26
|
-
founded: 1931,
|
|
27
|
-
phone: "+353 (0)1 830 7033"
|
|
28
|
-
}
|
|
29
|
-
// Add more items as needed
|
|
8
|
+
// Mock API response
|
|
9
|
+
const mockDonateItems = [
|
|
10
|
+
{
|
|
11
|
+
donate: 'https://example.com/donate1',
|
|
12
|
+
alt: 'Item 1 Alt Text',
|
|
13
|
+
name: 'Item 1',
|
|
14
|
+
phone: '+123456789',
|
|
15
|
+
link: 'https://example.com/home1',
|
|
16
|
+
founded: '2001',
|
|
17
|
+
overview: 'This is an overview of Item 1.',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
donate: 'https://example.com/donate2',
|
|
21
|
+
alt: 'Item 2 Alt Text',
|
|
22
|
+
name: 'Item 2',
|
|
23
|
+
phone: '+987654321',
|
|
24
|
+
link: 'https://example.com/home2',
|
|
25
|
+
founded: '1999',
|
|
26
|
+
overview: 'This is an overview of Item 2.',
|
|
27
|
+
},
|
|
30
28
|
];
|
|
31
29
|
|
|
32
|
-
describe('Donate
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
expect(screen.getByText('Vision Ireland, the new name for NCBI')).toBeInTheDocument();
|
|
30
|
+
describe('Donate', () => {
|
|
31
|
+
beforeEach(() => {
|
|
32
|
+
jest.spyOn(global, 'fetch').mockResolvedValue({
|
|
33
|
+
json: jest.fn().mockResolvedValue(mockDonateItems)
|
|
37
34
|
});
|
|
35
|
+
});
|
|
38
36
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
37
|
+
afterEach(() => {
|
|
38
|
+
jest.restoreAllMocks();
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test('renders AppNavbar component', () => {
|
|
42
|
+
render(<App />);
|
|
43
|
+
expect(screen.getByRole('banner')).toBeInTheDocument();
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
test('renders loading state initially', () => {
|
|
47
|
+
render(<Donate />);
|
|
48
|
+
expect(screen.getByText('Loading...')).toBeInTheDocument();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
test('displays charity options after fetching data', async () => {
|
|
52
|
+
const history = createMemoryHistory();
|
|
53
|
+
const { container } = render(
|
|
54
|
+
<Router history={history}>
|
|
55
|
+
<Donate />
|
|
56
|
+
</Router>
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
// Wait for the component to finish loading
|
|
60
|
+
await waitFor(() => {
|
|
61
|
+
expect(screen.queryByText('Loading...')).not.toBeInTheDocument();
|
|
47
62
|
});
|
|
48
63
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
64
|
+
// Check that repo details are displayed
|
|
65
|
+
mockDonateItems.forEach(item => {
|
|
66
|
+
expect(screen.getByText(item.name)).toBeInTheDocument();
|
|
67
|
+
expect(screen.getByText(new RegExp(`Founded in ${item.founded}`))).toBeInTheDocument();
|
|
68
|
+
expect(screen.getByText(item.phone)).toBeInTheDocument();
|
|
69
|
+
expect(screen.getByText(new RegExp(item.link))).toBeInTheDocument();
|
|
54
70
|
});
|
|
71
|
+
|
|
72
|
+
// Verify that the component does not show the loading spinner
|
|
73
|
+
expect(container.querySelector('.LoadingSpinner')).not.toBeInTheDocument();
|
|
74
|
+
});
|
|
55
75
|
});
|
|
76
|
+
|
package/src/index.js
CHANGED
|
@@ -4,11 +4,19 @@ import reportWebVitals from './reportWebVitals';
|
|
|
4
4
|
import 'bootstrap/dist/css/bootstrap.min.css';
|
|
5
5
|
import './index.css';
|
|
6
6
|
import App from './App';
|
|
7
|
+
import AppNavBar from './AppNavbar';
|
|
8
|
+
import Footer from './Footer';
|
|
7
9
|
|
|
8
10
|
const root = ReactDOM.createRoot(document.getElementById('root'));
|
|
9
11
|
root.render(
|
|
10
12
|
<React.StrictMode>
|
|
11
|
-
<
|
|
13
|
+
<div className="app-wrapper">
|
|
14
|
+
<AppNavBar />
|
|
15
|
+
<div className="content-inner">
|
|
16
|
+
<App />
|
|
17
|
+
</div>
|
|
18
|
+
<Footer />
|
|
19
|
+
</div>
|
|
12
20
|
</React.StrictMode>
|
|
13
21
|
);
|
|
14
22
|
|