Compare commits

..

3 Commits

Author SHA1 Message Date
f87e388ddd feat(build): add project configuration files and dependencies
Add IntelliJ IDEA project settings, TypeScript configuration, and pnpm lock file. Updated `package.json` with new dependencies and refactored API handler to TypeScript.
2024-09-27 11:37:21 +02:00
69d1186333 feat(configs): add city configuration file
Introduced a new JSON configuration file for city settings. This file currently includes the city name "Chambéry".
2024-09-27 11:00:32 +02:00
d3e1b122e4 docs: update README with new repo and install instructions
Changed the repository URL and adjusted installation instructions to use pnpm or yarn instead of npm. Removed outdated feature list and image, updated contributions section to include license information.
2024-09-27 10:52:12 +02:00
16 changed files with 4841 additions and 29 deletions

View File

@@ -1 +1,2 @@
OPENWEATHER_API_KEY=lngstr20
OPENWEATHER_API_KEY=lngstr20
CONFIG_URL=https://git.yidhra.fr/Mathis/forecast/raw/branch/dev/configs/city.json

8
.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

7
.idea/discord.xml generated Normal file
View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="ASK" />
<option name="description" value="" />
</component>
</project>

12
.idea/forecast.iml generated Normal file
View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

6
.idea/git_toolbox_blame.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GitToolBoxBlameSettings">
<option name="version" value="2" />
</component>
</project>

15
.idea/git_toolbox_prj.xml generated Normal file
View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GitToolBoxProjectSettings">
<option name="commitMessageIssueKeyValidationOverride">
<BoolValueOverride>
<option name="enabled" value="true" />
</BoolValueOverride>
</option>
<option name="commitMessageValidationEnabledOverride">
<BoolValueOverride>
<option name="enabled" value="true" />
</BoolValueOverride>
</option>
</component>
</project>

View File

@@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
</profile>
</component>

8
.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/forecast.iml" filepath="$PROJECT_DIR$/.idea/forecast.iml" />
</modules>
</component>
</project>

12
.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CommitMessageInspectionProfile">
<profile version="1.0">
<inspection_tool class="CommitFormat" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="CommitNamingConvention" enabled="true" level="WARNING" enabled_by_default="true" />
</profile>
</component>
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@@ -2,31 +2,18 @@
Check the current weather on any city on the planet. Switch between metric and imperial units.
![Alt img](https://images.ctfassets.net/zlsyc9paq6sa/3uBrJ07WSM40FpolgjInHY/7d886cb4187b52194bf9b63c183a1d3a/1627637330_x.gif)
## Features
1. User's ability to search cities
2. Current local time and date
3. Temperatures and humidity
4. Wind speed and direction
5. Sunrise and sunset times
6. Metric vs Imperial system
7. Error handling and loading info
Currently being redesigned
## Installation
1. `git clone https://github.com/madzadev/weather-app.git`
1. `git clone ssh://git@git.yidhra.fr:3022/Mathis/forecast.git`
2. `cd weather-app`
2. `cd forecast`
3. `npm install`
3. `pnpm install` || `yarn install`
4. Log-in to [Openweathermap.com](https://openweathermap.org/)
@@ -36,11 +23,11 @@ Check the current weather on any city on the planet. Switch between metric and i
7. Paste API key for `OPENWEATHER_API_KEY`
8. `npm run dev`
8. `pnpm dev` || `yarn run dev`
## Contributions
Any feature requests and pull requests are welcome!
You're free to go! For more information, see the license.
## License

3
configs/city.json Normal file
View File

@@ -0,0 +1,3 @@
{
"cityName": "Chambéry"
}

View File

@@ -9,12 +9,16 @@
"lint": "next lint"
},
"dependencies": {
"axios": "^1.7.7",
"next": "11.0.1",
"react": "17.0.2",
"react-dom": "17.0.2"
},
"devDependencies": {
"@biomejs/biome": "^1.9.2",
"@types/node": "^22.7.3",
"eslint": "7.30.0",
"eslint-config-next": "11.0.1"
"eslint-config-next": "11.0.1",
"taze": "^0.17.1"
}
}

View File

@@ -1,8 +0,0 @@
export default async function handler(req, res) {
const { cityInput } = req.body;
const getWeatherData = await fetch(
`https://api.openweathermap.org/data/2.5/weather?q=${cityInput}&units=metric&appid=${process.env.OPENWEATHER_API_KEY}`
);
const data = await getWeatherData.json();
res.status(200).json(data);
}

11
pages/api/data.ts Normal file
View File

@@ -0,0 +1,11 @@
import _config from "../../configs/city.json"
import * as process from "node:process";
export default async function handler(req, res) {
const targetedCity = await fetch(process.env.CONFIG_URL as string) as unknown as typeof _config
const getWeatherData = await fetch(
`https://api.openweathermap.org/data/2.5/weather?q=${targetedCity.cityName}&units=metric&appid=${process.env.OPENWEATHER_API_KEY}`
);
const data = await getWeatherData.json();
res.status(200).json(data);
}

4714
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

26
tsconfig.json Normal file
View File

@@ -0,0 +1,26 @@
{
"compilerOptions": {
"resolveJsonModule": true,
"target": "ES6",
"module": "CommonJS",
"lib": [
"DOM",
"ES6"
],
"jsx": "react",
"moduleResolution": "node",
"esModuleInterop": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noImplicitAny": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
},
"exclude": [
"node_modules",
"dist"
]
}