From 80e5ebc04346b1aba37158dedbdd4045c0a7c042 Mon Sep 17 00:00:00 2001 From: Sam Chudnick Date: Sat, 10 Jun 2023 06:31:09 -0400 Subject: Moved files to src directory. Continued work on frontend. --- src/templates/base.html | 21 +++++++++++ src/templates/index.html | 15 ++++++++ src/templates/location.html | 15 ++++++++ src/templates/weather.html | 91 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 142 insertions(+) create mode 100644 src/templates/base.html create mode 100644 src/templates/index.html create mode 100644 src/templates/location.html create mode 100644 src/templates/weather.html (limited to 'src/templates') diff --git a/src/templates/base.html b/src/templates/base.html new file mode 100644 index 0000000..a909aca --- /dev/null +++ b/src/templates/base.html @@ -0,0 +1,21 @@ + + + + + + {% block title %} {% endblock %} + + + + + +
+ {% block content %} {% endblock %} +
+ + + + diff --git a/src/templates/index.html b/src/templates/index.html new file mode 100644 index 0000000..da2a19a --- /dev/null +++ b/src/templates/index.html @@ -0,0 +1,15 @@ +{% extends 'base.html' %} +{% block content %} +
+
+

Enter a Location

+
+
+
+ {{ form.csrf_token }} + {{ form.location }} + {{ form.submit() }} +
+
+
+{% endblock %} diff --git a/src/templates/location.html b/src/templates/location.html new file mode 100644 index 0000000..fa691ea --- /dev/null +++ b/src/templates/location.html @@ -0,0 +1,15 @@ +{% extends 'base.html' %} +{% block content %} +
+
+

Select a Location

+
+
+
+ {{ form.csrf_token }} + {{ form.location }} + {{ form.submit() }} +
+
+
+{% endblock %} diff --git a/src/templates/weather.html b/src/templates/weather.html new file mode 100644 index 0000000..64aabbd --- /dev/null +++ b/src/templates/weather.html @@ -0,0 +1,91 @@ +{% extends 'base.html' %} +{% block content %} +
+ +
+ {% set is_day = data["current_weather"]["is_day"] %} + {% set weather_code = data["current_weather"]["weathercode"] %} +
+
{{ weather_codes[weather_code] }}
+
{{ data["current_weather"]["temperature"]}}°F
+
+ Wind: {{ data["current_weather"]["windspeed"] }} MPH + +
+
Sunrise: {{ data["daily"]["sunrise"][0] }}
+
Sunset: {{ data["daily"]["sunset"][0] }}
+
+
+ +
+
+

Hourly Forecast

+
+ {% for i in range(hour, hour + 24) %} +
+
+
{{ data["hourly"]["time"][i] }}
+
+ {{ weather_codes[data["hourly"]["weathercode"][i]] }} + {% if data["hourly"]["weathercode"][i] > 50 %} + ({{ data["hourly"]["precipitation"][i] }}in, {{ data["hourly"]["precipitation_probability"][i] }}%) + {% endif %} +
+
{{ data["hourly"]["temperature_2m"][i]}}°F
+
Humidity: {{ data["hourly"]["relativehumidity_2m"][i] }}%
+
+ Wind: {{ data["hourly"]["windspeed_10m"][i] }}MPH + +
+
+
+ {% set time = datetime.datetime.strptime(data["hourly"]["time"][i], "%a %x %I:%M %p") %} + {% set sunrise = datetime.datetime.strptime(data["daily"]["sunrise"][0], "%I:%M %p").replace(year=time.year, month=time.month, day=time.day) %} + + {% set sunset = datetime.datetime.strptime(data["daily"]["sunset"][0], "%I:%M %p").replace(year=time.year, month=time.month, day=time.day) %} + {% set is_day = 1 %} + {% if time > sunrise and time < sunset %} + {% set is_day = 0 %} + {% endif %} + {% set weather_code = data["hourly"]["weathercode"][i] %} + +
+
+ {% endfor %} +
+
+

Daily Forecast

+
+
+ {% for i in range(7) %} +
+
+
{{ data["daily"]["time"][i] }}
+
+ {{ weather_codes[data["daily"]["weathercode"][i]] }} + {% if data["daily"]["weathercode"][i] > 50 %} + ({{ data["daily"]["precipitation_sum"][i] }}in, {{ data["daily"]["precipitation_probability_max"][i] }}%) + {% endif %} +
+
High: {{ data["daily"]["temperature_2m_max"][i] }}°F
+
Low: {{ data["daily"]["temperature_2m_min"][i] }}°F
+
Sunrise: {{ data["daily"]["sunrise"][i] }}
+
Sunset: {{ data["daily"]["sunset"][i] }}
+
+
+ {% set weather_code = data["daily"]["weathercode"][i] %} + +
+
+ {% endfor %} +
+ +
+{% endblock %} + -- cgit v1.2.3