This commit is contained in:
Waylon Walker 2024-05-08 20:45:33 -05:00
commit 0500266b92
No known key found for this signature in database
GPG key ID: 66E2BF2B4190EFE4
21 changed files with 1766 additions and 0 deletions

49
templates/base.html Normal file
View file

@ -0,0 +1,49 @@
<!DOCTYPE html>
<html lang="en">
<head>
{% block head %}
<title>
{% block title %}Play Outside{% endblock %}
</title>
<link rel="icon" type="image/x-icon" href="{{ url_for('get_favicon') }}" />
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="og:title" name="og:title" content="Can I Play Outside" />
<meta name="twitter:title" name="twitter:title" content="Can I Play Outside" />
<meta name="twitter:card" content="summary_large_image">
<meta name="og:image" name="og:image"
content="https://shots.wayl.one/shot/?url=https://play-outside.wayl.one&height=1080&width=1920&scaled_width=1200&scaled_height=600&selectors=" />
<meta name="twitter:image" name="twitter:image"
content="https://shots.wayl.one/shot/?url=https://play-outside.wayl.one&height=1080&width=1920&scaled_width=1280&scaled_height=640&selectors=" />
<meta name="og:image:height" content="640" />
<meta name="og:image:width" content="1280" />
<meta name="og:url" name="og:url" content="https://waylonwalker.com" />
<meta name="description" name="description"
content="Check if my kids can play outside" />
<meta name="og:description" name="Check if my kids can play outside"
content="Check if my kids can play outside" />
<meta name="twitter:description" name="twitter:description"
content="Check if my kids can play outside" />
<link href="{{ url_for('get_app_css') }}" rel="stylesheet" />
<!-- <script src="{{ url_for('get_htmx') }}"></script> -->
{% if config.env == 'local' %}
{{ hot_reload.script(url_for('hot-reload') ) | safe }}
{% endif %}
{% endblock %}
</head>
<body >
<div class='p-4 bg-zinc-900 text-zinc-100 autofill:bg-yellow-500'>
<h2 class='mx-auto max-w-4xl'>
Disclaimer
</h2>
<p class='mx-auto max-w-4xl'>
I use this site to determine if my kids can play outside, each kid is different, use your own discretion before allowing kids outside.
</p>
</div>
{% block body %}
{{ content | safe }}
{% endblock %}
</body>
</html>

70
templates/card.html Normal file
View file

@ -0,0 +1,70 @@
{% if datetime.fromtimestamp(weather.dt).hour == 6 %}
</ul>
<hr>
<h2 class='block mt-24 text-3xl font-black text-center'>
{{ datetime.fromtimestamp(weather.dt).strftime(format = '%A') }}
<br>
<span class='text-xl'>
{{ datetime.fromtimestamp(weather.dt).strftime(format = '%Y-%m-%d') }}
</span>
</h2>
<ul class='list-none'>
{% endif %}
<li <p class='text-center'>
{{ datetime.fromtimestamp(weather.dt).strftime(format = '%I:%M %p') }}
</p>
<div
class='container p-4 my-4 mx-auto max-w-3xl list-none rounded-3xl border-2 {{ weather.play_condition.color.replace("bg-", "border-") }} {{ weather.play_condition.color }} bg-opacity-10'>
<h1 id="title"
class="inline-block pb-0 mx-auto mb-0 text-xl text-8xl font-black leading-tight leading-loose text-transparent bg-clip-text bg-gradient-to-r from-red-600 via-pink-500 to-yellow-400 ring-red-500 text-shadow-xl text-shadow-zinc-950 ring-5">
{{ weather.play_condition.message.replace('.', '<br />') | safe }}
</h1>
<p>
{{ weather.name }}
</p>
<p>
Feels Like: {{ weather.main.feels_like }}
</p>
<ul class='list-none'>
{% for w in weather.weather %}
<li>
<p>
{{ w.description }}
<img src='https://openweathermap.org/img/wn/{{ w.icon }}.png' class='inline-block my-[-1rem]' />
</p>
</li>
{% endfor %}
</ul>
<p>
Air Quality: {{ air_quality.list.0.main.aqi }}
</p>
<p>
Sunset: {{ datetime.fromtimestamp(sunset) }}
</p>
{% if weather.sys.sunset %}
{% if (datetime.fromtimestamp(weather.sys.sunset) - datetime.fromtimestamp(weather.dt)).total_seconds() > 0
%}
<p>
Time till sunset: {{ datetime.fromtimestamp(weather.sys.sunset) - datetime.fromtimestamp(weather.dt) }}
</p>
{% else %}
<p>
Its after sunset
</p>
{% endif %}
{% endif %}
<p>
Visibility: {{ weather.visibility }}
</p>
{% if weather.wind.speed > 5 %}
<p>
Wind Speed: {{ weather.wind.speed }}
</p>
{% endif %}
</div>
</li>

12
templates/card.txt Normal file
View file

@ -0,0 +1,12 @@
{% set w = int((len(weather.play_condition.message) - len(datetime.fromtimestamp(weather.dt).strftime(format = '%A %I:%M %p')))-1) %}
╭─ {{ datetime.fromtimestamp(weather.dt).strftime(format = '%A %I:%M %p')}} {{ '─'*w }}╮
│ {%if color %}{{ weather.play_condition.ansi_color }}{%endif%}{{ weather.play_condition.message | safe }}{%if color%}\033[0m{%endif%} │
╰─{{ '─'* len(weather.play_condition.message) }}─╯
{{ weather.name }}
Feels Like: {{ weather.main.feels_like }}
Air Quality: {{ air_quality.list.0.main.aqi }}
Sunset: {{ datetime.fromtimestamp(sunset).strftime(format = '%I:%M %p') }}
Visibility: {{ weather.visibility }}
{% if weather.wind.speed > 5 -%}
Wind Speed: {{ weather.wind.speed }}
{% endif -%}

View file

@ -0,0 +1,6 @@
<div class='bg-green-500 border-green-500'>
</div>
<div class='bg-red-500 border-red-500'>
</div>
<div class='bg-yellow-500 border-yellow-500'>
</div>

13
templates/index.html Normal file
View file

@ -0,0 +1,13 @@
{% extends "base.html" %}
{% block body %}
<h2 class='block mt-24 text-3xl font-black text-center'>Currently</h2>
<ul class='list-none'>
{% include "card.html" %}
</ul>
<h2 class='block mt-24 text-3xl font-black text-center'>5 Day Forecast</h2>
<ul class='list-none'>
{% for weather in forecast %}
{% include "card.html" %}
{% endfor %}
</ul>
{% endblock %}

4
templates/index.txt Normal file
View file

@ -0,0 +1,4 @@
{% include "card.txt" %}
{% for weather in forecast %}
{% include "card.txt" %}
{% endfor %}