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 - Rodrigo Cattoi #176

Open
wants to merge 46 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
250636f
first commit!
RCattoi Aug 4, 2023
e65eb2c
feat: create service api folder
RCattoi Aug 4, 2023
5ec964e
chore: add express
RCattoi Aug 4, 2023
3da9fbd
chore: add cors and node-fetch
RCattoi Aug 5, 2023
c42fbfc
feat: add gitignore file
RCattoi Aug 5, 2023
996cfd3
feat: setup an Express server with /bingImgAPI endpoint
RCattoi Aug 5, 2023
ca3013a
chore: configure CORS to allow requests from localhost
RCattoi Aug 5, 2023
2db93b5
feat: create useFetch custom hook that handles all API calls
RCattoi Aug 5, 2023
736e314
feat: add formattedCurrentDate utility function
RCattoi Aug 5, 2023
46831c7
chore: add concurrently for start api and react app at same time
RCattoi Aug 5, 2023
e95d824
feat: implement Background component for dynamic background image
RCattoi Aug 5, 2023
f0fff94
chore: include .vscode to gitignore
RCattoi Aug 5, 2023
2b29f8b
chore: add dot env in git ignore
RCattoi Aug 5, 2023
b93ba70
feat: add meteocons to the project
RCattoi Aug 5, 2023
9347e66
feat: create search logic using browser geolocalization
RCattoi Aug 5, 2023
8f9ca0e
fix: adjust position of the search bar
RCattoi Aug 5, 2023
12a88de
refactor: improve search bar responsiveness
RCattoi Aug 5, 2023
a24724d
style: add semicolons to all lines in Background component
RCattoi Aug 5, 2023
36e8de7
feat: add forecast data storage and retrieval functions
RCattoi Aug 5, 2023
f6bc6ce
feat: implement search function and implement useDebounce hook for se…
RCattoi Aug 5, 2023
6c2383a
chore: add styled-components
RCattoi Aug 5, 2023
f96ce44
fix: html title name
RCattoi Aug 5, 2023
e78e563
feat: add Error component for handling API city not found
RCattoi Aug 5, 2023
220fbcb
feat: implement Content component thats handles forecast data
RCattoi Aug 6, 2023
351df3f
feat: implement WeatherForecastContainer component thats render the C…
RCattoi Aug 6, 2023
93d51ac
feat: implement temperature conversion function and integrate into We…
RCattoi Aug 7, 2023
0b6ac5c
style: add styles to the temperature converter
RCattoi Aug 7, 2023
0680c6b
style: add styles, setBackgroundColor function and responsive design …
RCattoi Aug 7, 2023
b018fee
refactor: separate Bing Image API call logic into fetchBingImgData fu…
RCattoi Aug 7, 2023
39f6a2a
feat: implement fallback to localStorage in Background Component
RCattoi Aug 7, 2023
dc63cd3
refactor: organize project structure by introducing 'app' folder for …
RCattoi Aug 8, 2023
9e9ce10
feat: create docker
RCattoi Aug 8, 2023
46ebbb3
feat: create .env.example
RCattoi Aug 8, 2023
c78b2a4
feat: create .env.example
RCattoi Aug 8, 2023
44e6ee4
fix: correct name in docker-composer, add depenencie in package.json …
RCattoi Aug 8, 2023
6222d57
fix: correct eslint warnings
RCattoi Aug 8, 2023
f00ae90
chore: remove unnecessary console.log
RCattoi Aug 8, 2023
1e5717e
docs: Update README with project details and instructions
RCattoi Aug 8, 2023
b969a25
docs: update README
RCattoi Aug 8, 2023
2dfc593
docs: update README
RCattoi Aug 8, 2023
000b8d9
docs: add bing api in README
RCattoi Aug 8, 2023
18e6f20
docs: update README.md
RCattoi Aug 8, 2023
9d9cefd
docs: update README
RCattoi Aug 8, 2023
208e40c
Update pull-request.txt
RCattoi Aug 8, 2023
8718b29
merge master
RCattoi Aug 8, 2023
f0ecfae
chore: update pull-request.txt
RCattoi Aug 8, 2023
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
13 changes: 0 additions & 13 deletions .editorconfig

This file was deleted.

27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
.vscode
.env
# dependencies
/node_modules
/app/node_modules
/server/node_modules

/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
73 changes: 29 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,59 +1,44 @@
# <img src="https://avatars1.githubusercontent.com/u/7063040?v=4&s=200.jpg" alt="HU" width="24" /> Charlie Challenge
# Aplicativo de previsão do tempo - Charlie Challenge

[[English](README.md) | [Portuguese](README.pt.md)]
Este desafio frontend do @hurbcom para o cargo de desenvolvedor consiste em criar um site que exibe a previsão do tempo para o dia atual e os dois dias seguintes. Além disso, o usuário pode escolher uma localidade para obter a previsão do tempo. Se a geolocalização do navegador estiver habilitada, o site automaticamente obtém a previsão com base na localização do usuário. Também é possível converter a temperatura entre Celsius e Fahrenheit.

Build a responsive microsite to display the weather forecast at the locations given in the white text box (in the [example](./exemplo.jpg) image is where "Rio de Janeiro, Rio de Janeiro" appears. This text box should be an `input`, where the user can change the location. With the change of location, the weather forecast information for the new location must be loaded.
![image](https://github.com/RCattoi/Weather-forecast-App/assets/109550362/be2fa27a-1295-4e13-a84e-2cb3d527c224)

Once the page is opened, the user's geographic coordinates must be collected by the browser API to discover the city name via _reverse geocode_.
## Stack utilizada

The Bing highlight image should be used as the background. Forecasts for: today, tomorrow and the day after tomorrow should be shown.
- React
- Express
- CSS

Note that there is a gradient superimposed on the original image, in fact this color reflects the current temperature of the place searched for the three dates. For temperatures below 15ºC, shades of blue should be used, for temperatures above 35ºC, shades of red should be used and shades of yellow should be used for other temperatures. When there is no chosen location, shades of gray should be used as the basis for the gradient. If the user clicks on any temperature, the temperatures should be changed from Celsius to Fahrenheit or from Fahrenheit to Celsius.
## APIS utilizadas

The background image URL should be extracted from the [Bing API](https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1&mkt=pt-US).
- Previsão do tempo [OpenWeather](https://openweathermap.org/api)
- Geolocalização [OpenCage](https://opencagedata.com/)
- Imagem de fundo [Bing](https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1&mkt=pt-US)

To consult the weather forecast, use the one from [OpenWeather](http://api.openweathermap.org/data/2.5/weather?q={{location_name}}&APPID=772920597e4ec8f00de8d376dfb3f094) informing the name of the location instead of ` {{location_name}}` using app id `772920597e4ec8f00de8d376dfb3f094`. If necessary, create a new account.
## Como executar o projeto

To convert latitude and longitude to a location use [OpenCage](https://api.opencagedata.com/geocode/v1/json?q={{latitude}},{{longitude}}&key=c63386b4f77e46de817bdf94f552cddf&language=en) using the API key `c63386b4f77e46de817bdf94f552cddf`. If necessary, create a new account.
### Requisitos

Icons can be found at http://www.alessioatzeni.com/meteocons/.
- Instalar na sua máquina:

The layout must be followed, but you can suggest improvements. Describe these improvements in the README and why. You get extra points if these improvements are positive, or lose points otherwise.
- **[Docker](https://docs.docker.com/get-docker/)**

## Requirements
- Com o docker instalado
- **git clone https://github.com/RCattoi/challenge-charlie.git** <br>
- **cd challenge-charlie** <br>
- **Dentro da pasta /app, crie um arquivo .env seguindo o formato do arquivo .env.example. Nesse novo arquivo, preencha as variáveis com as chaves da API OpenWeather e OpenCage.**
- **Na raiz do projeto execute o comando docker-compose up**
- **O servidor é exposto na porta 8000 e o aplicativo é exposto na porta 3000**

- Preferably do it in React, but you can use other libraries or frameworks (Angular, Vue.js, etc) or pure JavaScript (Vanilla JS).
- For the style sheet, you can use whatever you prefer (CSS, SASS, LESS, CSS Modules, CSS-in-JS, etc).
- Preferably use Webpack. If you prefer, you can use [create-react-app](https://github.com/facebook/create-react-app) or similar. Doing your own Webpack setup gives you extra points.
- It is interesting that your application is ready for production. Create in Docker a `stage` for production and one for development of extra points.
- Fork this challenge and create your project (or workspace) using your version of that repository, as soon as you finish the challenge, submit a _pull request_.
- If you have any reason not to submit a _pull request_, create a private repository on Github, do every challenge on the **master** branch and don't forget to fill in the `pull-request.txt` file. As soon as you finish your development, add the user [`automator-hurb`](https://github.com/automator-hurb) to your repository as a contributor and make it available for at least 30 days. **Do not add the `automator-hurb` until development is complete.**
- If you have any problem creating the private repository, at the end of the challenge fill in the file called `pull-request.txt`, compress the project folder - including the `.git` folder - and send it to us by email.
- The code needs to run inside a Docker container.
- To run your code, all you need to do is run the following commands:
- git clone \$your-fork
- cd \$your-fork
- command to install dependencies
- command to run the application
## Alterações de design

## Evaluation criteria
- Ícones de Previsão do Tempo: Incluí ícones que representam a previsão para os 3 dias.
- Temperatura e Descrição da Previsão: Além disso, incluí o texto descritivo e a temperatura para cada dia. Acredito que, em conjunto com os ícones, esses textos fornecem um contexto completo sobre a previsão do tempo, sem sobrecarregar visualmente a interface.
- Botão de Conversão de Temperatura: Introduzi um botão de conversão para que os usuários possam perceber facilmente a possibilidade de realizar essa ação. O botão e a temperatura em si tem um hover, proporcionando um feedback visual imediato.

- **Organization of code**: Separation of modules, view and model, back-end and front-end
- **Clarity**: Does the README explain briefly what the problem is and how can I run the application?
- **Assertiveness**: Is the application doing what is expected? If something is missing, does the README explain why?
- **Code readability** (including comments)
- **Security**: Are there any clear vulnerabilities?
- **Test coverage** (We don't expect full coverage)
- **History of commits** (structure and quality)
- **UX**: Is the interface user-friendly and self-explanatory? Is the API intuitive?
- **Technical choices**: Is the choice of libraries, database, architecture, etc. the best choice for the application?
## Desafios do projeto

## Doubts

Any questions you may have, check the [_issues_](https://github.com/HurbCom/challenge-charlie/issues) to see if someone hasn't already and if you can't find your answer, open one yourself. new issue!

Godspeed! ;)

<p align="center">
<img src="ca.jpg" alt="Challange accepted" />
</p>
- **Imagem Bing**: Obter a imagem do Bing apresentou um desafio, já que não consegui realizar o fetch diretamente. Foi necessário estudar uma solução para esse problema, e descobri que a criação de um servidor com o Express resolveria a questão. Embora tenha sido o meu primeiro contato com express e criação de servidores/api achei a experiência interessante e desafiadora.
- **Docker**: Outro ponto desafiador surgiu quando me deparei com a necessidade de dockerizar o projeto, algo que eu nunca havia feito antes. Aprendi para fazer o desafio e fiquei satisfeito com o resultado.
- **Testes**: Ainda estou aprimorando meus conhecimentos em relação a testes, e por isso não me senti totalmente confiante em implementá-los antes de enviar o desafio.
60 changes: 0 additions & 60 deletions README.pt.md

This file was deleted.

1 change: 1 addition & 0 deletions app/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
4 changes: 4 additions & 0 deletions app/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Replace these values with your actual API keys and configurations

REACT_APP_OPEN_WEATHER_API_KEY =''
REACT_APP_OPEN_CAGE_API_KEY =''
13 changes: 13 additions & 0 deletions app/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:17-alpine

WORKDIR /app

COPY package.json .

RUN npm install

COPY . .

EXPOSE 3000

CMD [ "npm","start"]
Loading