diff --git a/README.md b/README.md index 3525e4a..f390e6d 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ This is a simple weather application that allows users to view current weather d **Note:** There is also a backend server directory, which is currently not in use. - You can ignore it for now. ## Usage + 1. Get an API key from [OpenWeatherMap](https://openweathermap.org/api). 2. Click on the "Set API Key" button in the header to enter your API key. 3. Enter a city name in the search bar and press Enter or click the "Get Weather" button. @@ -41,7 +42,9 @@ This is a simple weather application that allows users to view current weather d **Now you can view the current weather data for the specified city!** # Other Information + ## Technologies Used + - React - TypeScript - Tailwind CSS @@ -49,5 +52,5 @@ This is a simple weather application that allows users to view current weather d - Vite ## Version -This project is currently in development. But will be updated regularly and is expected to be stable soon. -> There is also coming a public version of the app, which will be hosted on a server. - **Stay tuned for updates!** \ No newline at end of file + +**1.0.0** diff --git a/frontend/index.html b/frontend/index.html index 6f23522..a332ab6 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -5,7 +5,7 @@ Weather App diff --git a/frontend/src/assets/cloud-sun-fill.png b/frontend/src/assets/cloud-sun-fill.png new file mode 100644 index 0000000..671a403 Binary files /dev/null and b/frontend/src/assets/cloud-sun-fill.png differ diff --git a/frontend/src/assets/icons/logo.psd b/frontend/src/assets/icons/logo.psd new file mode 100644 index 0000000..3969b57 Binary files /dev/null and b/frontend/src/assets/icons/logo.psd differ diff --git a/frontend/src/assets/logo.psd b/frontend/src/assets/logo.psd new file mode 100644 index 0000000..7ecdb4d Binary files /dev/null and b/frontend/src/assets/logo.psd differ diff --git a/frontend/src/components/Header.tsx b/frontend/src/components/Header.tsx index 1b24fb4..61ad92f 100644 --- a/frontend/src/components/Header.tsx +++ b/frontend/src/components/Header.tsx @@ -3,7 +3,7 @@ import ChangeAPI from "./ChangeAPI"; import ChangePreferences from "./ChangePreferences"; import { useState } from "react"; import Cookies from "js-cookie"; -import logo from "../assets/cloud-sun-fill.svg"; +import logo from "../assets/cloud-sun-fill.png"; const Header: React.FC = () => { const [apiCard, setApiCard] = useState(false); @@ -76,7 +76,7 @@ const Header: React.FC = () => { diff --git a/frontend/src/components/WeatherForm.tsx b/frontend/src/components/WeatherForm.tsx index 2333db4..7e459b3 100644 --- a/frontend/src/components/WeatherForm.tsx +++ b/frontend/src/components/WeatherForm.tsx @@ -25,7 +25,7 @@ const WeatherCard: React.FC = () => { pending: "Fetching weather data...", success: "Weather data loaded successfully!", error: - "Failed to load weather data. Please check your entered city name.", + "Failed to load weather data. Please check your entered city name. (Error: x4040)", }) .then(() => { if (localStorage.getItem("weather")) { diff --git a/frontend/src/utils/apiFunc.ts b/frontend/src/utils/apiFunc.ts index 3ebd8c6..8ae31ba 100644 --- a/frontend/src/utils/apiFunc.ts +++ b/frontend/src/utils/apiFunc.ts @@ -10,11 +10,14 @@ export const fetchWeather = async ( `http://api.openweathermap.org/geo/1.0/direct?q=${city}&appid=${apiKey}` ).then((response) => { if (response.status === 401) { - myToast("You are not authorized to access this resource. Please check your API key.", "error"); + myToast( + "You are not authorized to access this resource. Please check your API key. (Error: x4010)", + "error" + ); } else if (response.ok) { return response.json(); } else { - myToast("Error fetching location data: " + response.statusText, "error"); + myToast("Error fetching location data. (Error: x32)", "error"); } }); const lat = location[0].lat; diff --git a/frontend/src/utils/changeAPIcookie.ts b/frontend/src/utils/changeAPIcookie.ts index 6a9995b..7282bb4 100644 --- a/frontend/src/utils/changeAPIcookie.ts +++ b/frontend/src/utils/changeAPIcookie.ts @@ -4,5 +4,16 @@ import { myToast } from "./toastify"; export const changeAPIcookie = (newApiKey: string) => { let apiKey15 = newApiKey.slice(0, 15); Cookies.set("apiKey", newApiKey); - myToast("API key updated successfully!" + " " + "Your new API key: " + apiKey15 + "...", "success"); + if (Cookies.get("apiKey") === newApiKey) { + myToast( + "API key updated successfully!" + + " " + + "Your new API key: " + + apiKey15 + + "...", + "success" + ); + } else { + myToast("Failed to update API key. (Error: x30)", "error"); + } };