Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Challenge Charlie - Project Delivery #186

Open
wants to merge 58 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
7725d39
chore: npm init
a-martins Jun 29, 2024
ca82e95
chore: adding .gitignore
a-martins Jun 29, 2024
413d2d1
chore: adding typescript support
a-martins Jun 29, 2024
b0ba450
chore: changing ident_size on .editorconfig
a-martins Jun 29, 2024
d1884d5
chore: adding eslint
a-martins Jun 29, 2024
79e676d
chore: adding husky and lint-staged
a-martins Jun 30, 2024
69ee97e
chore: adding husky
a-martins Jun 30, 2024
469f4b3
chore: adding jest and babel
a-martins Jun 30, 2024
e24be61
chore: adding jest and babel
a-martins Jun 30, 2024
3f2def3
chore: adding webpack and babel configuration
a-martins Jul 1, 2024
15e60c4
chore: updating .gitignore
a-martins Jul 1, 2024
49d6225
test: creating app test
a-martins Jul 1, 2024
631fd56
feat: adding react router
a-martins Jul 1, 2024
8b83801
feat: adding react router
a-martins Jul 1, 2024
392db7a
feat: adding geolocation browser api support
a-martins Jul 1, 2024
726bcd2
chore: adding styled-components
a-martins Jul 1, 2024
5cd97b1
feat: adding simple styled component layout
a-martins Jul 1, 2024
1a4ff8b
chore: adding react-query
a-martins Jul 1, 2024
62d108f
feat: adding BFF to get the background url
a-martins Jul 2, 2024
c1a6e48
feat: create a custom hook useBackground to get it from the server
a-martins Jul 2, 2024
5b6cbf5
fix: fixing broken git references
a-martins Jul 5, 2024
76691cf
test: fixing unit tests
a-martins Jul 5, 2024
2cbc59c
feat: weather endpoint
a-martins Jul 8, 2024
156dada
feat: adding useWeather hook
a-martins Jul 8, 2024
0f53cbb
feat: removing days from weather controller/service
a-martins Jul 8, 2024
9435f7a
feat: adding transparency on input
a-martins Jul 8, 2024
f776b65
feat: TodayWeather Component
a-martins Jul 9, 2024
1ed288d
refactor: making just one component for weather details
a-martins Jul 9, 2024
36bc086
refactor: moving Icon component to WeatherDetails component
a-martins Jul 9, 2024
65d5fda
fix: fixing icon alignment
a-martins Jul 9, 2024
2219d2c
refactor: removing unused PropsWithChildren
a-martins Jul 9, 2024
c839227
feat: colors shade depending on the temperature
a-martins Jul 9, 2024
3d6df38
feat: created UserLocationProvider and Context
a-martins Jul 9, 2024
1c5e097
feat: removing unused function
a-martins Jul 9, 2024
68d7ab9
feat: change temperature unit when click on the temperature
a-martins Jul 10, 2024
afe2d4d
feat: Adding skeleton when the data is loading
a-martins Jul 10, 2024
01ca79c
fix: fixing wind conversion unit
a-martins Jul 10, 2024
f20f67c
feat: adding search weather by query/cityname
a-martins Jul 11, 2024
18ad32d
feat: adding search by city name
a-martins Jul 12, 2024
e6ade8a
feat: searching by text with error handling
a-martins Jul 14, 2024
454558c
feat: adding responsivity
a-martins Jul 14, 2024
9dfd747
feat: Configuring Docker and Composer
a-martins Jul 18, 2024
b3889b5
refactor: removing unecessary async
a-martins Jul 18, 2024
706c453
feat: adding placeholder
a-martins Jul 18, 2024
944e519
chore: removing react-query devtool
a-martins Jul 18, 2024
b0f6d8e
test: unit testing for weather details component
a-martins Jul 18, 2024
7a0a686
fix: fixing docker compose
a-martins Jul 18, 2024
60b6b1e
tests: fixing unit tests
a-martins Jul 18, 2024
10e29fe
feat: README update
a-martins Jul 18, 2024
703ee0e
fix: fixing dockerfile for react app
a-martins Jul 18, 2024
c6ee508
feat: removing refetching on focus
a-martins Jul 19, 2024
1d87ea1
chore: adding react-tooltip
a-martins Jul 19, 2024
7a1c999
feat: adding tooltop to temperature conversor and get current locatio…
a-martins Jul 19, 2024
2622ef9
feat: adding padding on main container for mobile view
a-martins Jul 19, 2024
5b00dfa
feat: translate error message on 404 city not found
a-martins Jul 19, 2024
87da89e
feat: adding underline on input text field
a-martins Jul 19, 2024
2ad9a80
fix: fixing README test info
a-martins Jul 19, 2024
60cddb3
feat: updating pull-request.txt
a-martins Jul 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: adding geolocation browser api support
a-martins committed Jul 1, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 392db7a1d34fdc8057fc64d60fdf8c8de047f195
6 changes: 6 additions & 0 deletions src/__tests__/__snapshots__/app.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -7,6 +7,12 @@ exports[`renders app component 1`] = `
role="main"
>
Weather App!
<p>
latitude:
</p>
<p>
longitude:
</p>
</div>
</div>
`;
31 changes: 31 additions & 0 deletions src/pages/Home/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,38 @@
import { useEffect, useState } from "react";

type Coordinates = {
latitude: number;
longitude: number;
};

const Home = () => {
const [userLocation, setUserLocation] = useState<Coordinates>();

const getUserLocation = () => {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(
(position) => {
const { latitude, longitude } = position.coords;
setUserLocation({ latitude, longitude });
},
(error) => {
console.error("Error getting user location", error);
}
);
} else {
console.error("Geolocation is not supported by this browser.");
}
};

useEffect(() => {
getUserLocation();
}, []);

return (
<div id="app" role="main">
Weather App!
<p>latitude: {userLocation?.latitude}</p>
<p>longitude: {userLocation?.longitude}</p>
</div>
);
};
7 changes: 7 additions & 0 deletions src/setupTests.ts
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
import "@testing-library/jest-dom";

const mockGeolocation = {
getCurrentPosition: jest.fn(),
watchPosition: jest.fn(),
};

(global as any).navigator.geolocation = mockGeolocation;