Skip to content
This repository was archived by the owner on Oct 20, 2023. It is now read-only.

Commit 8037349

Browse files
authored
Merge pull request #235 from SchoolyB/development
Development
2 parents 711b7c9 + 7e90414 commit 8037349

File tree

13 files changed

+685
-271
lines changed

13 files changed

+685
-271
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ node_modules
88
.env.*
99
.vscode/**/*
1010
.prettierrc
11+
yarn-error.log
12+
```

CONTRIBUTING.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
# Contribute to The International Data Matrix!
22

33
## Making pull requests:
4-
1. Fork the repo and create your branch from `Development`.
5-
2. If you've added/removed dependencies, update the documentation.
6-
3. Make sure your code lints.
7-
4. submit your PR to `Development`
4+
1. Fork the repo and create your branch from `development`.
5+
2. If you've added/removed dependencies please update the `README.md`.
6+
3. When naming your branch please follow these guidelines:
7+
- Prefix all branch names with `client-side/` or `server-side/` depending on where the majority of your contributions will be written in.
8+
- Following the `/` add no more than 4 words separated by `-` explaining what is being worked on in the branch. Examples: `server-side/server-crash-bug-fix` `client-side/nav-menu-styling-change`.
9+
- If the branch has an associated issue add the issue number to the end of the branch name. Example: `client-side/nav-menu-styling-change-300`. If there is no associated issue one is not required.
10+
4. When submitting your PR ask to merge it the `development` branch.
11+
5.
12+

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
![TIDM Logo](./client/assets//Branding/logo-no-background.png)
22

3+
**Contributing**
4+
Please see [CONTRIBUTING.md](https://github.com/SchoolyB/International-Data-Matrix/blob/master/CONTRIBUTING.md)
35
### The Tech Stack -
46
- [TypeScript](https://www.typescriptlang.org/)
57
- [JavaScript](https://www.javascript.com/)
@@ -20,12 +22,13 @@
2022
- [axios](https://www.yarnpkg.com/package/axios)
2123
- [markdown-it](https://www.yarnpkg.com/package/markdown-it)
2224
- <strong><i>Server Side</i></strong>
25+
- [deepl node](https://www.yarnpkg.com/package/deepl-node)
2326
- [dotenv](https://yarnpkg.com/package/dotenv)
2427
- [nodemon](https://www.yarnpkg.com/package/nodemon)
25-
- [express](https://yarnpkg.com/package/express)
2628
- [mongoose](https://www.yarnpkg.com/package/mongoose)
27-
- [axios](https://www.yarnpkg.com/package/axios)
28-
- [deepl node](https://www.yarnpkg.com/package/deepl-node)
29+
- [fastify](https://yarnpkg.com/package/fastify)
30+
- [fastify/mongodb](https://yarnpkg.com/package/@fastify/mongodb)
31+
- [fastify/cors](https://yarnpkg.com/package/@fastify/cors)
2932

3033
<br/>
3134

client/src/App.tsx

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -12,51 +12,51 @@ inject()
1212
// VERCEL ANALYTICS STUFF
1313

1414
export function useCoolerState<Value>(initialValue: Value) {
15-
const [value, setValue] = useState(initialValue)
16-
17-
return {
18-
get value() {
19-
return value
20-
},
21-
set value(value) {
22-
setValue(value)
23-
},
24-
}
15+
const [value, setValue] = useState(initialValue)
16+
17+
return {
18+
get value() {
19+
return value
20+
},
21+
set value(value) {
22+
setValue(value)
23+
},
24+
}
2525
}
2626

2727
export const CountryContext = createContext<CountryListData[]>([])
2828

2929
export const SearchContext = createContext<StateRef<string>>({
30-
value: '',
30+
value: '',
3131
})
3232

3333
export type StateRef<Value> = {
34-
value: Value
34+
value: Value
3535
}
3636

3737
const App = () => {
38-
const [countryList, setCountryList] = useState([])
39-
const search = useCoolerState('')
40-
41-
useEffect(() => {
42-
api
43-
.get('/Countries')
44-
.then((res) => {
45-
setCountryList(res.data)
46-
})
47-
.catch((error) => {
48-
console.error(error)
49-
})
50-
}, [])
51-
52-
return (
53-
<CountryContext.Provider value={countryList}>
54-
<SearchContext.Provider value={search}>
55-
<Header />
56-
{useRoutes(routes)}
57-
<Footer />
58-
</SearchContext.Provider>
59-
</CountryContext.Provider>
60-
)
38+
const [countryList, setCountryList] = useState([])
39+
const search = useCoolerState('')
40+
41+
useEffect(() => {
42+
api
43+
.get('/Countries')
44+
.then(res => {
45+
setCountryList(res.data)
46+
})
47+
.catch(error => {
48+
console.error(error)
49+
})
50+
}, [])
51+
52+
return (
53+
<CountryContext.Provider value={countryList}>
54+
<SearchContext.Provider value={search}>
55+
<Header />
56+
{useRoutes(routes)}
57+
<Footer />
58+
</SearchContext.Provider>
59+
</CountryContext.Provider>
60+
)
6161
}
6262
export default App

client/src/pages/Countries.tsx

Lines changed: 45 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2,53 +2,50 @@ import { useContext } from 'react'
22
import { CountryContext, SearchContext } from '../App'
33

44
export default function Countries() {
5-
const countryList = useContext(CountryContext)
6-
const search = useContext(SearchContext)
5+
const countryList = useContext(CountryContext)
6+
const search = useContext(SearchContext)
77

8-
const countryElement = countryList
9-
.filter((country) => {
10-
return country.name.toLowerCase().includes(search.value.toLowerCase())
11-
})
12-
.map((country) => {
13-
return (
14-
<div className="country">
15-
<h3 className="countryHeading">{country.name}</h3>
16-
<a href={country.link}>
17-
<img
18-
className="flag"
19-
src={country.flag}
20-
alt={country.flagAlt}
21-
loading="lazy"
22-
/>
23-
</a>
24-
</div>
25-
)
26-
})
27-
return (
28-
<div>
29-
<div id="searchBox">
30-
<div id="searchContainer">
31-
<form
32-
id="countryFilterForm"
33-
className="searchForm "
34-
>
35-
<input
36-
placeholder="Search Countries"
37-
id="countryFilter"
38-
name="countryFilter"
39-
type="text"
40-
required
41-
value={search.value}
42-
onChange={(event) => {
43-
search.value = event.target.value
44-
}}
45-
></input>
46-
</form>
47-
</div>
48-
<br />
49-
<br />
50-
</div>
51-
<div id="overAllContainer">{countryElement}</div>
52-
</div>
53-
)
8+
const countryElement = countryList
9+
.filter(country => {
10+
return country.name.toLowerCase().includes(search.value.toLowerCase())
11+
})
12+
.map((country, index) => {
13+
return (
14+
<div key={index} className='country'>
15+
<h3 className='countryHeading'>{country.name}</h3>
16+
<a href={country.link}>
17+
<img
18+
className='flag'
19+
src={country.flag}
20+
alt={country.flagAlt}
21+
loading='lazy'
22+
/>
23+
</a>
24+
</div>
25+
)
26+
})
27+
return (
28+
<div>
29+
<div id='searchBox'>
30+
<div id='searchContainer'>
31+
<form id='countryFilterForm' className='searchForm '>
32+
<input
33+
placeholder='Search Countries'
34+
id='countryFilter'
35+
name='countryFilter'
36+
type='text'
37+
required
38+
value={search.value}
39+
onChange={event => {
40+
search.value = event.target.value
41+
}}
42+
></input>
43+
</form>
44+
</div>
45+
<br />
46+
<br />
47+
</div>
48+
<div id='overAllContainer'>{countryElement}</div>
49+
</div>
50+
)
5451
}

client/src/pages/Country/[id].tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export default function countryPage(
139139
<div className="overallCountryInfoContainer">
140140
<div className="countryInfo">
141141
<h1 id="countryEnglishName">{state.name}</h1>
142-
<h3 id="countryNativeName">a.k.a {state.nativeName}</h3>
142+
<h4 id="countryNativeName">{state.nativeName}</h4>
143143
</div>
144144

145145
{/* Start of information right side of screen */}

0 commit comments

Comments
 (0)