moved pages to own files for clarity

This commit is contained in:
Death916 2025-04-19 05:08:05 -07:00
parent a1ca14a3a3
commit 1b45b76491
5 changed files with 248 additions and 230 deletions

38
deathsite/blog_page.py Normal file
View file

@ -0,0 +1,38 @@
import reflex as rx
from deathsite.deathsite import page_content
@rx.page(route="/blog")
def blog():
return page_content(
rx.vstack(
rx.heading("Things", size="5", color="#ffffff"),
rx.text("Random Musings on what im working on or saw interesting", color="#ffffff"),
rx.scroll_area(
rx.flex(
rx.markdown(
"""# April 19 2025
Been using a new IRC client called Halloy. Its written in rust and has a very nice interface. Its pretty much my go to now.
Its made me want to get my rust skills back up again and drop some contributions. Heres the link to the project: [halloy](https://github.com/squidowl/halloy)
# April 05 2025
## Starting this site
I wanted to finally have a central place for all my doings. Figured now was the time to get a personal site going when I saw the reflex framework for python. I really didnt like always having to drop to JS or something for web"""
),
direction="column",
spacing="4",
),
type="always",
scrollbars="vertical",
style={"height": 580},
),
padding="2em",
spacing="1",
)
)

View file

@ -47,7 +47,6 @@ NAV_BUTTON_STYLE = {
},
}
class State(rx.State):
current_page: str = "Home"
page_title: str = "Death916's Site" # Added page_title attribute
@ -71,7 +70,6 @@ def navigation_button(text: str) -> rx.Component:
style=NAV_BUTTON_STYLE,
)
def header() -> rx.Component:
"""Site header and navigation."""
return rx.box(
@ -103,7 +101,6 @@ def header() -> rx.Component:
),
)
def footer() -> rx.Component:
return rx.box(
rx.text(
@ -121,105 +118,6 @@ def footer() -> rx.Component:
)
# (setq eldoc-echo-area-use-multiline-p nil)
@rx.page(route="/")
@rx.page(route="/home")
def home():
return page_content(
rx.box(
rx.vstack(
rx.container(
rx.vstack(
rx.heading(
"Welcome to my domain",
color="#ffffff",
style={"text_align": "center"},
),
rx.text(
"This is a personal site for my projects and streams. Never really made a full site for myself before so this will be a work in progress.",
color="#ffffff",
style={"text_align": "center"},
),
spacing="1",
width="100%",
align_items="center",
justify="center",
),
padding="2em",
width="100%",
align_items="center",
justify="center",
),
align_items="center",
justify="center",
width="100%",
),
rx.hstack(
rx.vstack(
rx.heading("Whats New:", size="8", color="#ffffff"),
rx.html(
f"""
<iframe width="350" height="200" src="{YOUTUBE_EMBED_URL}" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
"""
),
rx.text("Stream: ", color="#ffffff"),
rx.html(
f"""
<iframe width="350" height="200" src="{TWITCH_EMBED_URL}" title="Twitch video player" frameborder="0" autoplay="false" allowfullscreen></iframe>
"""
),
align_items="start",
spacing="2",
justify="start",
),
rx.vstack(
rx.heading(
"Links",
size="8",
color="#ffffff",
),
rx.link(
"GitHub",
href=GITHUB_URL,
color="#736E77",
size="4",
effect="underline",
is_external=True,
padding="0.5em",
),
rx.spacer(
min_height="15em"
),
rx.heading(
"Contact",
size="8",
color="#ffffff",
),
rx.link(
"Email",
href="mailto:mail@death916.xyz.com",
color="#736E77",
size="4",
effect="underline",
),
padding="2em",
spacing="1",
height="100%",
align_items="end",
width="100%",
),
),
align_items="start",
width="100%",
)
)
def page_content(content):
## Wraps the content in a box with a dark background and padding
return rx.box(
@ -255,142 +153,22 @@ def page_content(content):
},
)
@rx.page(route="/projects")
def projects() -> rx.Component:
"""Renders the projects page."""
return page_content(
rx.vstack(
rx.box(
rx.heading("Projects", size="7", margin_bottom="1em"),
rx.cond(
State.projects,
rx.foreach(State.projects, render_project),
rx.text("No projects listed yet."),
),
padding="2em",
spacing="1",
width="100%",
align_items="start",
),
rx.hstack(
github_graph(),
spacing="2",
align_items="center",
justify="center",
),
align_items="start", width="100%",
)
)
def render_project(project: dict) -> rx.Component:
"""Renders a single project card."""
return rx.vstack(
rx.heading(project["title"], size="5"),
rx.badge(
project["status"],
color_scheme=rx.cond(
project["status"] == "Ongoing", "blue",
rx.cond(
project["status"] == "Completed", "green",
rx.cond(
project["status"] == "Planning", "yellow",
rx.cond(
project["status"] == "Paused", "red",
"gray"
)
)
)
),
margin_y="0.3em",
),
rx.text(project["description"], margin_y="0.5em"),
rx.cond(
project["link"],
rx.link(project["title"], href=project["link"], is_external=True),
rx.fragment(),
),
padding_bottom="1.5em", margin_bottom="1.5em",
border_bottom="1px solid #e9ecef", align_items="start", width="100%",
_last={"border_bottom": "none"},
)
@rx.page(route="/blog")
def blog():
return page_content(
rx.vstack(
rx.heading("Things", size="5", color="#ffffff"),
rx.text("Random Musings on what im working on or saw interesting", color="#ffffff"),
rx.scroll_area(
rx.flex(
rx.markdown(
"# April 19 2025\n\n"
"Been using a new IRC client called Halloy. Its written in rust and has a very nice interface. Its pretty much my go to now."
"Its made me want to get my rust skills back up again and drop some contributions. You can catch me on Libera.Chat pretty much always. Heres the link to the project:"
),
rx.link("Halloy", href="https://github.com/squidowl/halloy", is_external=True),
rx.markdown(
"# April 05 2025\n\n## Starting this site\n\n"
"I wanted to finally have a central place for all my doings. Figured now was the time to get a personal site going when I saw the reflex framework for python. I really didnt like always having to drop to JS or something for web"
),
direction="column",
spacing="4",
),
type="always",
scrollbars="vertical",
style={"height": 580},
),
padding="2em",
spacing="1",
)
)
@rx.page(route="/videos")
def videos():
return page_content(
rx.vstack(
rx.heading("Videos Page", size="3", color="#ffffff"),
rx.text("NEWEST VIDEOS:", color="#ffffff"),
rx.link(
"YouTube Channel",
href=YOUTUBE_URL,
color="#ffffff",
is_external=True,
),
padding="2em",
spacing="1",
)
)
def github_graph():
return rx.box(
rx.html(
#get the graph from github specifically
"""
<img src="https://ghchart.rshah.org/Death916" alt="GitHub Chart" style="width: 100%; height: auto;">
""",
),
padding="2em",
spacing="1",
)
app = rx.App(
theme=rx.theme(
appearance="dark",
has_background=True,
accent_color="violet", # Dark purple accent color
accent_color="violet",
background_color="#212529", # Dark background color
text_color="#ffffff", # Light text color
)
)
from deathsite.home_page import home
from deathsite.projects_page import projects
from deathsite.blog_page import blog
from deathsite.videos_page import videos
app.add_page(home)
app.add_page(projects)
app.add_page(blog)
@ -398,8 +176,8 @@ app.add_page(videos)
# TODO add guild page
# TODO add unzip to requirements for system
# TODO add unzip to requirements for system?
# TODO move project data to a json file or something
# TODO add a contact page or link
# TODO add live printer stream
# TODO update videos using youtube api

100
deathsite/home_page.py Normal file
View file

@ -0,0 +1,100 @@
import reflex as rx
from deathsite.deathsite import page_content, YOUTUBE_EMBED_URL, TWITCH_EMBED_URL, GITHUB_URL
@rx.page(route="/")
@rx.page(route="/home")
def home():
return page_content(
rx.box(
rx.vstack(
rx.container(
rx.vstack(
rx.heading(
"Welcome to my domain",
color="#ffffff",
style={"text_align": "center"},
),
rx.text(
"This is a personal site for my projects and streams. Never really made a full site for myself before so this will be a work in progress.",
color="#ffffff",
style={"text_align": "center"},
),
spacing="1",
width="100%",
align_items="center",
justify="center",
),
padding="2em",
width="100%",
align_items="center",
justify="center",
),
align_items="center",
justify="center",
width="100%",
),
rx.hstack(
rx.vstack(
rx.heading("Whats New:", size="8", color="#ffffff"),
rx.html(
f"""
<iframe width="350" height="200" src="{YOUTUBE_EMBED_URL}" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
"""
),
rx.text("Stream: ", color="#ffffff"),
rx.html(
f"""
<iframe width="350" height="200" src="{TWITCH_EMBED_URL}" title="Twitch video player" frameborder="0" autoplay="false" allowfullscreen></iframe>
"""
),
align_items="start",
spacing="2",
justify="start",
),
rx.vstack(
rx.heading(
"Links",
size="8",
color="#ffffff",
),
rx.link(
"GitHub",
href=GITHUB_URL,
color="#736E77",
size="4",
effect="underline",
is_external=True,
padding="0.5em",
),
rx.spacer(
min_height="15em"
),
rx.heading(
"Contact",
size="8",
color="#ffffff",
),
rx.link(
"Email",
href="mailto:mail@death916.xyz.com",
color="#736E77",
size="4",
effect="underline",
),
padding="2em",
spacing="1",
height="100%",
align_items="end",
width="100%",
),
),
align_items="start",
width="100%",
)
)

View file

@ -0,0 +1,83 @@
import reflex as rx
from deathsite.deathsite import page_content, State
def render_project(project: dict) -> rx.Component:
"""Renders a single project card."""
return rx.vstack(
rx.heading(project["title"], size="5"),
rx.badge(
project["status"],
color_scheme=rx.cond(
project["status"] == "Ongoing", "blue",
rx.cond(
project["status"] == "Completed", "green",
rx.cond(
project["status"] == "Planning", "yellow",
rx.cond(
project["status"] == "Paused", "red",
"gray"
)
)
)
),
margin_y="0.3em",
),
rx.text(project["description"], margin_y="0.5em"),
rx.cond(
project["link"],
rx.link(project["title"], href=project["link"], is_external=True),
rx.fragment(),
),
padding_bottom="1.5em", margin_bottom="1.5em",
border_bottom="1px solid #e9ecef", align_items="start", width="100%",
_last={"border_bottom": "none"},
)
def github_graph():
return rx.box(
rx.html(
#get the graph from github specifically
"""
<img src="https://ghchart.rshah.org/Death916" alt="GitHub Chart" style="width: 100%; height: auto;">
""",
),
padding="2em",
spacing="1",
)
@rx.page(route="/projects")
def projects() -> rx.Component:
"""Renders the projects page."""
return page_content(
rx.vstack(
rx.box(
rx.heading("Projects", size="7", margin_bottom="1em"),
rx.cond(
State.projects,
rx.foreach(State.projects, render_project),
rx.text("No projects listed yet."),
),
padding="2em",
spacing="1",
width="100%",
align_items="start",
),
rx.hstack(
github_graph(),
spacing="2",
align_items="center",
justify="center",
),
align_items="start", width="100%",
)
)

19
deathsite/videos_page.py Normal file
View file

@ -0,0 +1,19 @@
import reflex as rx
from deathsite.deathsite import page_content, YOUTUBE_URL
@rx.page(route="/videos")
def videos():
return page_content(
rx.vstack(
rx.heading("Videos Page", size="3", color="#ffffff"),
rx.text("NEWEST VIDEOS:", color="#ffffff"),
rx.link(
"YouTube Channel",
href=YOUTUBE_URL,
color="#ffffff",
is_external=True,
),
padding="2em",
spacing="1",
)
)