diff options
author | petrus comestor <petrus@comestor.org> | 2024-10-29 18:40:54 -0400 |
---|---|---|
committer | petrus comestor <petrus@comestor.org> | 2024-10-29 18:40:54 -0400 |
commit | ec98975f926524197ed599ddb47231d0468250b8 (patch) | |
tree | 4c80baea857e448ad954e04d01682352da721262 | |
parent | 99a9ab124c360947854bac3dc8bcddac480afc67 (diff) |
auto
-rwxr-xr-x | generate-schedule.py | 155 | ||||
-rw-r--r-- | index.base | 58 | ||||
-rw-r--r-- | index.html | 260 | ||||
-rw-r--r-- | static/styles.css | 26 |
4 files changed, 411 insertions, 88 deletions
diff --git a/generate-schedule.py b/generate-schedule.py new file mode 100755 index 0000000..1541ca6 --- /dev/null +++ b/generate-schedule.py @@ -0,0 +1,155 @@ +#!/usr/bin/env python3 + +from datetime import date +from dataclasses import dataclass +import calendar + +@dataclass +class Location: + name: str + url: str + neighborhood: str + time: str = None + info: str = None + +@dataclass +class Event: + location: Location + when: date + time: str = None + info: str = None + special: bool = False + cancelled: bool = False + +def render_schedule(events): + s = '' + week = None + for event in events: + weekday = calendar.day_name[event.when.weekday()] + month = calendar.month_name[event.when.month] + day = event.when.day + time = event.time or event.location.time + assert time, 'no time given either in location or event' + info = event.info or event.location.info + infotxt = f'<br><div class="info">{info}</div>' if info else '' + + week_change = False + new_week = event.when.isocalendar()[1] + if week is not None and week != new_week: + week_change = True + week = new_week + + if week_change: + s += '<br>\n' + s += f'''<div class="event {'special' if event.special else ''} {'cancelled' if event.cancelled else ''}"> + <div class="event-data"> + <strong>{weekday}, {month} {day}</strong> · {time} + </div> + <div class="instance"> + <a href="{event.location.url}">{event.location.name}</a>, + <span class="neighborhood">{event.location.neighborhood}</span> + {infotxt} + </div> +</div>''' + + return s + +mccarren = Location( + "Spritzenhaus33", + "https://maps.app.goo.gl/4jKTTTJ3h61dGPyz6", + "Williamsburg", + "6:30p", +) + +jefferson = Location( + "Jefferson Market Library", + "https://maps.app.goo.gl/UTNUqUdEjYCssiMx5", + "Greenwich Village", + "6p", + info="1<sup>st</sup> floor Willa Cather Room; take a left at entrance, straight through children’s room" +) + +nook = Location( + "Nook", + "https://maps.app.goo.gl/X2fYE3EpeHhQhgYD8", + "Bushwick", + "9a", +) + +liz = Location( + "Liz’s Book Bar", + "https://maps.app.goo.gl/6hgstJRcd2TKa96x5", + "Carroll Gardens", + "7p", +) + +abraco = Location( + "Abraço", + "https://maps.app.goo.gl/6w6GzymLNy9vdgqG9", + "East Village", + "6p", +) + +bookclub = Location( + "Book Club Bar", + "https://maps.app.goo.gl/ewGbWuEjp7cedMrb7", + "East Village", + "9p", +) + +dekalblibrary = Location( + "Dekalb Library", + "https://maps.app.goo.gl/G3D2hQ6og5DkBQH86", + "Bushwick", +) + +wyckoffbondgarden = Location( + "Wyckoff-Bond Community Garden", + "https://maps.app.goo.gl/qWKXJhrvvpvLeFLy7", + "Boerum Hill", + info="Hosted by Carroll Gardens Library" +) + +bkcentrallibrary = Location( + "Brooklyn Central Library", + "https://maps.app.goo.gl/fPijDbTN47TbFpFf6", + "Prospect Heights", + info="Trustees Room" +) + +bushwicklibrary = Location( + "Bushwick Library", + "https://maps.app.goo.gl/2mnX1sDSrBv1jKQ3A", + "Bushwick", +) + +schedule = [ + Event(jefferson, date(2024, 10, 30)), + Event(nook, date(2024, 11, 2)), + Event(bookclub, date(2024, 11, 3)), + Event(mccarren, date(2024, 11, 4), info='Book Swap and <a href="https://booksthroughbarsnyc.org/donate/donate-books/">NYC Books Through Bars</a> Book Drive.', special=True), + Event(jefferson, date(2024, 11, 6), info='Elevator in lobby to third floor. Book Swap and <a href="https://booksthroughbarsnyc.org/donate/donate-books/">NYC Books Through Bars</a> Book Drive.', special=True), + Event(nook, date(2024, 11, 9)), + Event(mccarren, date(2024, 11, 11)), + Event(abraco, date(2024, 11, 13), special=True, info='Wednesday Jefferson Market Library Quiet Reading moved for this week.'), + Event(bushwicklibrary, date(2024, 11, 14), time='6p', special=True), + Event(nook, date(2024, 11, 16)), + Event(wyckoffbondgarden, date(2024, 11, 16), time='12p', special=True), + Event(mccarren, date(2024, 11, 18)), + Event(jefferson, date(2024, 11, 20)), + Event(bkcentrallibrary, date(2024, 11, 20), time='6:30p', special=True), + Event(dekalblibrary, date(2024, 11, 21), time='6p', special=True), + Event(nook, date(2024, 11, 23)), + Event(mccarren, date(2024, 11, 25)), + Event(jefferson, date(2024, 11, 27), info='<strong>Cancelled due to Thanksgiving.</strong>', cancelled=True), + Event(nook, date(2024, 11, 30)), + # Event(bookclub, date(2024, 12, 1)), + # Event(liz, date(2024, 12, 3)), +] # maybe autosort it and sort code by event? + +with open('index.base') as base: + txt = base.read() + html = render_schedule(schedule) + txt = txt.replace('{SCHEDULE}', html) + with open('index.html', 'w') as index: + index.write(txt) diff --git a/index.base b/index.base new file mode 100644 index 0000000..68a5d13 --- /dev/null +++ b/index.base @@ -0,0 +1,58 @@ +<!DOCTYPE HTML> +<html> + <head> + <title>Quiet Reading</title> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <link rel="shortcut icon" type="image/x-icon" href="/static/hex.svg"> + <link rel="stylesheet" href="/static/styles.css"> + </head> + <body> + <div class="container"> + <div class="header"> + <img class="logo" src="static/logo2-min.png" alt="Quiet Reading"> + </div> + <div class="subtitle"> + <em>Free weekly events in <br>libraries, parks, and cafes.</em> + <br> + <br> + One reading hour. One social hour.<br><strong>Bring your own book, make a new friend!</strong> + </div> + <br> + <div class="nav"> + <a href="/"><strong>Home</strong></a> + · + <a href="/hosts">Host Your Own</a> + · + <a href="mailto:team@quietreading.org">Email Us</a> + · + <a href="https://instagram.com/quietreading.club">Instagram</a> + </div> + <br> + <hr> + <br> + + {SCHEDULE} + + <br> + <hr> + <div class="about"> + <p> + Bring your own book, read for one hour, and then chat + for one hour about books, literature, and arts. + </p> + <p> + No registration: just show up with a good book!<br>For park events, you can bring a blanket as well. + </p> + </div> + <br> + <div class="wrapper"> + <img class="picture" src="/static/pictures/jefferson.jpg"> + <img class="picture" src="/static/pictures/mccarren.jpg"> + <img class="picture" src="/static/pictures/bookclub.jpg"> + <img class="picture" src="/static/pictures/marthas.jpg"> + </div> + </div> + </body> +</html> + @@ -31,88 +31,184 @@ <br> <hr> <br> - <div class="event"> - <div class="event-data"> - <span class="event-time">Mondays, 6:30p</span> - <br> - <!-- <span class="event-location"><a href="https://maps.app.goo.gl/h4CyTKFKULxWNjXN9">McCarren Park</a></span> --> - <span class="event-location"><a href="https://maps.app.goo.gl/4jKTTTJ3h61dGPyz6">Spritzenhaus33</a></span> - <br> - <span class="neighborhood">Williamsburg</span> - <!-- <div class="info"> --> - <!-- <!-1- <a href="https://maps.app.goo.gl/h4CyTKFKULxWNjXN9">North corner, west side (map)</a> -1-> --> - <!-- <!-1- <br> -1-> --> - <!-- <!-1- If rain: at <a href="https://maps.app.goo.gl/4jKTTTJ3h61dGPyz6">Spritzenhaus33</a> -1-> --> - <!-- </div> --> - </div> - <div class="instance instance-ok"> - <em>Next:</em><br><strong>October 28, November 4…</strong> - <!-- <br> --> - <!-- <small> --> - <!-- 8/19: moved to <a href="https://maps.app.goo.gl/4jKTTTJ3h61dGPyz6">Spritzenhaus33</a> due to rain. --> - <!-- </small> --> - </div> - </div> - <br> - <div class="event"> - <div> - <span class="event-time">1<sup>st</sup> Tuesday/month, 7p</span> - <br> - <span class="event-location"><a href="https://maps.app.goo.gl/6hgstJRcd2TKa96x5">Liz’s Book Bar</a></span> - <br> - <span class="neighborhood">Carroll Gardens</span> - </div> - <div class="instance instance-ok"> - <em>Next:</em> - <br> - <strong>December 3…</strong> - <br><small>11/5 date cancelled.</small> - </div> - </div> - <br> - <div class="event"> - <div> - <span class="event-time">Wednesdays, 6p</span> - <br> - <span class="event-location"><a href="https://maps.app.goo.gl/UTNUqUdEjYCssiMx5">Jefferson Market Library</a></span> - <br> - <span class="neighborhood">Greenwich Village</span> - <div class="info"> - First floor Willa Cather Room - </div> - </div> - <div class="instance instance-ok"> - <em>Next:</em><br><strong>October 30, November 6…</strong> - <br> - <small>Note: Meet on the <em>third floor</em> on 11/6; not the first floor.</small> - </div> - </div> - <br> - <div class="event"> - <div> - <span class="event-time">Saturdays, 9a</span> - <br> - <span class="event-location"><a href="https://maps.app.goo.gl/X2fYE3EpeHhQhgYD8">Nook</a></span> - <br> - <span class="neighborhood">Bushwick</span> - </div> - <div class="instance instance-ok"> - <em>Next:</em><br><strong>October 26, November 2…</strong> - </div> - </div> - <br> - <div class="event"> - <div> - <span class="event-time">1<sup>st</sup> Sunday/month, 9p</span> - <br> - <span class="event-location"><a href="https://maps.app.goo.gl/ewGbWuEjp7cedMrb7">Book Club Bar</a></span> - <br> - <span class="neighborhood">East Village</span> - </div> - <div class="instance instance-ok"> - <em>Next:</em><br><strong>November 3, December 1…</strong> - </div> - </div> + + <div class="event "> + <div class="event-data"> + <strong>Wednesday, October 30</strong> · 6p + </div> + <div class="instance"> + <a href="https://maps.app.goo.gl/UTNUqUdEjYCssiMx5">Jefferson Market Library</a>, + <span class="neighborhood">Greenwich Village</span> + <br><div class="info">1<sup>st</sup> floor Willa Cather Room; take a left at entrance, straight through children’s room</div> + </div> +</div><div class="event "> + <div class="event-data"> + <strong>Saturday, November 2</strong> · 9a + </div> + <div class="instance"> + <a href="https://maps.app.goo.gl/X2fYE3EpeHhQhgYD8">Nook</a>, + <span class="neighborhood">Bushwick</span> + + </div> +</div><div class="event "> + <div class="event-data"> + <strong>Sunday, November 3</strong> · 9p + </div> + <div class="instance"> + <a href="https://maps.app.goo.gl/ewGbWuEjp7cedMrb7">Book Club Bar</a>, + <span class="neighborhood">East Village</span> + + </div> +</div><br> +<div class="event special "> + <div class="event-data"> + <strong>Monday, November 4</strong> · 6:30p + </div> + <div class="instance"> + <a href="https://maps.app.goo.gl/4jKTTTJ3h61dGPyz6">Spritzenhaus33</a>, + <span class="neighborhood">Williamsburg</span> + <br><div class="info">Book Swap and <a href="https://booksthroughbarsnyc.org/donate/donate-books/">NYC Books Through Bars</a> Book Drive.</div> + </div> +</div><div class="event special "> + <div class="event-data"> + <strong>Wednesday, November 6</strong> · 6p + </div> + <div class="instance"> + <a href="https://maps.app.goo.gl/UTNUqUdEjYCssiMx5">Jefferson Market Library</a>, + <span class="neighborhood">Greenwich Village</span> + <br><div class="info">Elevator in lobby to third floor. Book Swap and <a href="https://booksthroughbarsnyc.org/donate/donate-books/">NYC Books Through Bars</a> Book Drive.</div> + </div> +</div><div class="event "> + <div class="event-data"> + <strong>Saturday, November 9</strong> · 9a + </div> + <div class="instance"> + <a href="https://maps.app.goo.gl/X2fYE3EpeHhQhgYD8">Nook</a>, + <span class="neighborhood">Bushwick</span> + + </div> +</div><br> +<div class="event "> + <div class="event-data"> + <strong>Monday, November 11</strong> · 6:30p + </div> + <div class="instance"> + <a href="https://maps.app.goo.gl/4jKTTTJ3h61dGPyz6">Spritzenhaus33</a>, + <span class="neighborhood">Williamsburg</span> + + </div> +</div><div class="event special "> + <div class="event-data"> + <strong>Wednesday, November 13</strong> · 6p + </div> + <div class="instance"> + <a href="https://maps.app.goo.gl/6w6GzymLNy9vdgqG9">Abraço</a>, + <span class="neighborhood">East Village</span> + <br><div class="info">Wednesday Jefferson Market Library Quiet Reading moved for this week.</div> + </div> +</div><div class="event special "> + <div class="event-data"> + <strong>Thursday, November 14</strong> · 6p + </div> + <div class="instance"> + <a href="https://maps.app.goo.gl/2mnX1sDSrBv1jKQ3A">Bushwick Library</a>, + <span class="neighborhood">Bushwick</span> + + </div> +</div><div class="event "> + <div class="event-data"> + <strong>Saturday, November 16</strong> · 9a + </div> + <div class="instance"> + <a href="https://maps.app.goo.gl/X2fYE3EpeHhQhgYD8">Nook</a>, + <span class="neighborhood">Bushwick</span> + + </div> +</div><div class="event special "> + <div class="event-data"> + <strong>Saturday, November 16</strong> · 12p + </div> + <div class="instance"> + <a href="https://maps.app.goo.gl/qWKXJhrvvpvLeFLy7">Wyckoff-Bond Community Garden</a>, + <span class="neighborhood">Boerum Hill</span> + <br><div class="info">Hosted by Carroll Gardens Library</div> + </div> +</div><br> +<div class="event "> + <div class="event-data"> + <strong>Monday, November 18</strong> · 6:30p + </div> + <div class="instance"> + <a href="https://maps.app.goo.gl/4jKTTTJ3h61dGPyz6">Spritzenhaus33</a>, + <span class="neighborhood">Williamsburg</span> + + </div> +</div><div class="event "> + <div class="event-data"> + <strong>Wednesday, November 20</strong> · 6p + </div> + <div class="instance"> + <a href="https://maps.app.goo.gl/UTNUqUdEjYCssiMx5">Jefferson Market Library</a>, + <span class="neighborhood">Greenwich Village</span> + <br><div class="info">1<sup>st</sup> floor Willa Cather Room; take a left at entrance, straight through children’s room</div> + </div> +</div><div class="event special "> + <div class="event-data"> + <strong>Wednesday, November 20</strong> · 6:30p + </div> + <div class="instance"> + <a href="https://maps.app.goo.gl/fPijDbTN47TbFpFf6">Brooklyn Central Library</a>, + <span class="neighborhood">Prospect Heights</span> + <br><div class="info">Trustees Room</div> + </div> +</div><div class="event special "> + <div class="event-data"> + <strong>Thursday, November 21</strong> · 6p + </div> + <div class="instance"> + <a href="https://maps.app.goo.gl/G3D2hQ6og5DkBQH86">Dekalb Library</a>, + <span class="neighborhood">Bushwick</span> + + </div> +</div><div class="event "> + <div class="event-data"> + <strong>Saturday, November 23</strong> · 9a + </div> + <div class="instance"> + <a href="https://maps.app.goo.gl/X2fYE3EpeHhQhgYD8">Nook</a>, + <span class="neighborhood">Bushwick</span> + + </div> +</div><br> +<div class="event "> + <div class="event-data"> + <strong>Monday, November 25</strong> · 6:30p + </div> + <div class="instance"> + <a href="https://maps.app.goo.gl/4jKTTTJ3h61dGPyz6">Spritzenhaus33</a>, + <span class="neighborhood">Williamsburg</span> + + </div> +</div><div class="event cancelled"> + <div class="event-data"> + <strong>Wednesday, November 27</strong> · 6p + </div> + <div class="instance"> + <a href="https://maps.app.goo.gl/UTNUqUdEjYCssiMx5">Jefferson Market Library</a>, + <span class="neighborhood">Greenwich Village</span> + <br><div class="info"><strong>Cancelled due to Thanksgiving.</strong></div> + </div> +</div><div class="event "> + <div class="event-data"> + <strong>Saturday, November 30</strong> · 9a + </div> + <div class="instance"> + <a href="https://maps.app.goo.gl/X2fYE3EpeHhQhgYD8">Nook</a>, + <span class="neighborhood">Bushwick</span> + + </div> +</div> + <br> <hr> <div class="about"> diff --git a/static/styles.css b/static/styles.css index 4d486d6..a524ed1 100644 --- a/static/styles.css +++ b/static/styles.css @@ -125,7 +125,7 @@ a:hover { .event { border: 1px darkslategrey dotted; - border-radius: 10px; + /* border-radius: 10px; */ padding: 1em; padding-top: .6em; display: grid; @@ -133,7 +133,7 @@ a:hover { gap: 1em; align-items: center; justify-items: end; - max-width: 500px; + max-width: 550px; margin: 0 auto; } @@ -152,10 +152,10 @@ a:hover { .instance { text-align: right; - border: 1px darkslategrey dotted; - border-radius: 5px; - padding: .6em; - padding-top: .2em; + /* border: 1px darkslategrey dotted; */ + /* border-radius: 5px; */ + /* padding: .6em; */ + /* padding-top: .2em; */ width: fit-content; } @@ -199,12 +199,26 @@ hr { } .neighborhood { + letter-spacing: -1px; font-size: 90%; font-style: italic; } +.info { + font-size: 80%; +} + .about { max-width: 40ch; text-align: center; margin: auto; } + +.special { + background: #f3ddff; +} + +.cancelled { + background: #fdd; +} + |