|
13 | 13 | import json |
14 | 14 |
|
15 | 15 | from contextlib import contextmanager |
| 16 | +from random import choice |
16 | 17 | from urllib.parse import quote |
17 | 18 |
|
18 | 19 |
|
@@ -48,43 +49,34 @@ def json_assignment_script(variable_name: str, value: dict): |
48 | 49 |
|
49 | 50 | @contextmanager |
50 | 51 | def base_html(title: str): |
51 | | - """Create the base HTML structure for our pages. |
52 | | -
|
53 | | - Like a theater stage, we set up the basic structure where our |
54 | | - content will perform. The head section is our backstage area, |
55 | | - where we prepare all the scripts and styles that make the show |
56 | | - possible. |
57 | | - """ |
58 | | - with tag("html"): |
59 | | - with tag("head"): |
60 | | - with tag("title"): |
| 52 | + with tag.html(lang="en"): |
| 53 | + with tag.head(): |
| 54 | + with tag.title(): |
61 | 55 | text(title) |
62 | | - # Our costume department - where we dress up our content |
63 | | - tag("link", rel="stylesheet", href="/static/css/output.css") |
64 | | - tag("link", rel="stylesheet", href="/static/audio-player.css") |
65 | | - # The stage machinery - scripts that make things move |
| 56 | + |
| 57 | + tag.link(rel="stylesheet", href="/static/css/output.css") |
| 58 | + tag.link(rel="stylesheet", href="/static/audio-player.css") |
| 59 | + |
66 | 60 | for script in cdn_scripts: |
67 | | - tag("script", src=script) |
68 | | - tag("script", type="module", src="/static/type-writer.js") |
69 | | - tag("script", type="module", src="/static/voice-writer.js") |
70 | | - tag("script", type="module", src="/static/audio-recorder.js") |
71 | | - tag("script", type="module", src="/static/live.js") |
| 61 | + tag.script(src=script) |
| 62 | + |
| 63 | + tag.script(type="module", src="/static/type-writer.js") |
| 64 | + tag.script(type="module", src="/static/voice-writer.js") |
| 65 | + tag.script(type="module", src="/static/audio-recorder.js") |
| 66 | + tag.script(type="module", src="/static/live.js") |
72 | 67 | json_assignment_script("htmx.config", htmx_config) |
73 | 68 |
|
74 | | - # The stage itself - where the content performs |
75 | | - with tag( |
76 | | - "body", |
| 69 | + with tag.body( |
77 | 70 | classes="bg-white dark:bg-slate-950 text-gray-900 dark:text-stone-50", |
78 | 71 | ): |
79 | 72 | yield |
80 | | - # The encore - scripts that run after the main content |
81 | | - tag("script", type="module", src="/static/audio-player.js") |
82 | | - tag( |
83 | | - "script", |
| 73 | + |
| 74 | + tag.script(type="module", src="/static/audio-player.js") |
| 75 | + tag.script( |
84 | 76 | type="module", |
85 | 77 | src="/static/voice-recorder-writer.js", |
86 | 78 | ) |
87 | | - tag("script", type="module", src="/static/jsonld-socket.js") |
| 79 | + tag.script(type="module", src="/static/jsonld-socket.js") |
88 | 80 |
|
89 | 81 |
|
90 | 82 | def urlquote(id: str): |
@@ -132,8 +124,46 @@ def render_entry(label: str, value: str, href: str | URIRef): |
132 | 124 |
|
133 | 125 | @html.div(classes=status_bar_style) |
134 | 126 | def render_status_bar(): |
| 127 | + advice_texts = [ |
| 128 | + "Do not take notes on criminal conspiracies.", |
| 129 | + "Every system is broken but you can still try.", |
| 130 | + "Your file naming conventions are very interesting.", |
| 131 | + "Write it down—if it's bad, delete it later.", |
| 132 | + "The cloud is just someone else's computer.", |
| 133 | + "You have permission to start poorly. ❤️", |
| 134 | + "All good ideas look bad in the beginning. 😭", |
| 135 | + "This app has no opinions about your life choices.", |
| 136 | + "Make a backup right now. Trust me.", |
| 137 | + "Complexity is very, very seductive. Are you up for it, playboy?", |
| 138 | + "You are not legally obligated to finish everything you start.", |
| 139 | + "This app will remember for you. Do not stress today.", |
| 140 | + "Most thoughts do not deserve a post-it note.", |
| 141 | + "The best version of your idea is the one that exists right now.", |
| 142 | + "No one is grading your to-do list.", |
| 143 | + "Just because it's a draft doesn't mean it's bad in ANY way.", |
| 144 | + "Not every project needs a name. Call this one Freckles.", |
| 145 | + "Begin. The rest is easier.", |
| 146 | + "If you use this app to explain your feelings, use also a napkin.", |
| 147 | + "Your 17th idea today will likely be the good one!.", |
| 148 | + "Being busy is a thing. That happens. I think.", |
| 149 | + "This app is your therapist. Just kidding. Double jinx.", |
| 150 | + "Genius is forgetting bad ideas quickly.", |
| 151 | + "Despite the widespread enthusiasm, we have not yet implemented writer's block.", |
| 152 | + "Congratulations. You're overthinking it.", |
| 153 | + "Perfectionism is not always just a fancy word for procrastination.", |
| 154 | + "Spend more time naming than working.", |
| 155 | + "Write as though you realize that you will not even remember this tomorrow.", |
| 156 | + "Progress doesn't happen according to a plan. Unless you have a pretty good plan.", |
| 157 | + "Your creative process is what I call my existential crisis.", |
| 158 | + "This app contains a roadmap for your life.", |
| 159 | + "There are no rules. Especially syntax ones.", |
| 160 | + ] |
| 161 | + |
135 | 162 | with tag.div(classes="flex items-center"): |
136 | | - pass # todo: add some content here |
| 163 | + with tag.span( |
| 164 | + classes="text-sm text-gray-500 dark:text-gray-400 pl-4" |
| 165 | + ): |
| 166 | + text(choice(advice_texts)) |
137 | 167 |
|
138 | 168 | with tag.div(classes="flex items-center gap-6"): |
139 | 169 | vat = current_vat.get() |
|
0 commit comments