Skip to content

Commit

Permalink
Begin work on refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Pieniazek committed Mar 29, 2024
1 parent bc16e70 commit bcf66e7
Show file tree
Hide file tree
Showing 16 changed files with 390 additions and 278 deletions.
29 changes: 29 additions & 0 deletions assets/index/skills/skills_data.py → assets/asset_data.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
from typing import NamedTuple

# Logo Paths
FOOTER_LOGO = "/shared/icon-inverted.png"
LINKEDIN_LOGO = "/shared/social_icons/linkedin.png"
MEDIUM_LOGO = "/shared/social_icons/medium.png"
GITHUB_LOGO = "/shared/social_icons/github.png"
EMAIL_LOGO = "/shared/social_icons/email.png"
NAVBAR_LOGO = "/shared/icon.png"

# Social Media Links
GITHUB_URL = "https://github.com/jakepenzak"
CONTACT_URL = "mailto:[email protected]"
LINKEDIN_URL = "https://www.linkedin.com/in/japieniazek/"
MEDIUM_URL = "https://medium.com/@jakepenzak"

# Article Links
FWL_URL = "https://towardsdatascience.com/controlling-for-x-9cb51652f7ad"
LOGISTIC_URL = "https://towardsdatascience.com/predictive-parameters-in-a-logistic-regression-making-sense-of-it-all-476bde9825f3"
NM1_URL = "https://towardsdatascience.com/optimization-newtons-method-profit-maximization-part-1-basic-optimization-theory-ff7c5f966565"
NM2_URL = "https://towardsdatascience.com/optimization-newtons-method-profit-maximization-part-2-constrained-optimization-theory-dc18613c5770"
NM3_URL = "https://towardsdatascience.com/optimization-newtons-method-profit-maximization-part-3-applied-profit-maximization-23a8c16167cd"
TSNE_URL = "https://towardsdatascience.com/t-sne-from-scratch-ft-numpy-172ee2a61df7"
DML1_URL = "https://towardsdatascience.com/double-machine-learning-simplified-part-1-basic-causal-inference-applications-3f7afc9852ee"
DML2_URL = "https://towardsdatascience.com/double-machine-learning-simplified-part-2-extensions-the-cate-99926151cac"

# Index Page
skills_data = [
{
"subject": "Econometrics/Causal Inference",
Expand Down Expand Up @@ -109,6 +134,10 @@ class LogoMeta(NamedTuple):
asset_path="/index/skills/tech_logos/powerbi.png",
link="https://powerbi.microsoft.com/en-us/",
),
"Delta Lake": LogoMeta(
asset_path="/index/skills/tech_logos/delta.png",
link="https://delta.io/",
),
}


Expand Down
Binary file added assets/index/skills/tech_logos/delta.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/index/skills/tech_logos/linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/index/skills/tech_logos/powerbi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 0 additions & 15 deletions assets/shared/links.py

This file was deleted.

1 change: 0 additions & 1 deletion personal_website/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
"""Base template for Reflex."""
66 changes: 36 additions & 30 deletions personal_website/components/footer.py
Original file line number Diff line number Diff line change
@@ -1,55 +1,40 @@
import reflex as rx

from assets.shared import links
from assets import asset_data
from personal_website.styles import FOOTER

FOOTER_LOGO = "/shared/icon-inverted.png"
LINKEDIN_LOGO = "/shared/social_icons/linkedin.png"
MEDIUM_LOGO = "/shared/social_icons/medium.png"
GITHUB_LOGO = "/shared/social_icons/github.png"
EMAIL_LOGO = "/shared/social_icons/email.png"


def footer_logo(**style_props):
"""Create a Reflex logo component.
Args:
style_props: The style properties to apply to the component.
def footer() -> rx.Component:
"""
return rx.chakra.link(
rx.chakra.image(
src=FOOTER_LOGO,
**style_props,
),
href="/",
)

Creates a footer component with links to social media profiles and contact information.
def footer():
return rx.chakra.box(
Returns:
rx.Component: The footer component.
"""
footer = rx.chakra.box(
rx.chakra.hstack(
rx.chakra.hstack(
rx.chakra.link(
rx.chakra.image(src=LINKEDIN_LOGO, height="3em"),
href=links.LINKEDIN_URL,
rx.chakra.image(src=asset_data.LINKEDIN_LOGO, height="3em"),
href=asset_data.LINKEDIN_URL,
style=FOOTER["FOOTER_ITEM_STYLE"],
is_external=True,
),
rx.chakra.link(
rx.chakra.image(src=MEDIUM_LOGO, height="3em"),
href=links.MEDIUM_URL,
rx.chakra.image(src=asset_data.MEDIUM_LOGO, height="3em"),
href=asset_data.MEDIUM_URL,
style=FOOTER["FOOTER_ITEM_STYLE"],
is_external=True,
),
rx.chakra.link(
rx.chakra.image(src=GITHUB_LOGO, height="3em"),
href=links.GITHUB_URL,
rx.chakra.image(src=asset_data.GITHUB_LOGO, height="3em"),
href=asset_data.GITHUB_URL,
style=FOOTER["FOOTER_ITEM_STYLE"],
is_external=True,
),
rx.chakra.link(
rx.chakra.image(src=EMAIL_LOGO, height="3em"),
href=links.CONTACT_URL,
rx.chakra.image(src=asset_data.EMAIL_LOGO, height="3em"),
href=asset_data.CONTACT_URL,
style=FOOTER["FOOTER_ITEM_STYLE"],
),
),
Expand All @@ -61,3 +46,24 @@ def footer():
),
**FOOTER["FOOTER_STYLE"],
)

return footer


def footer_logo(**style_props) -> rx.Component:
"""
Create a Reflex logo component.
Args:
style_props: The style properties to apply to the component.
Returns:
rx.Component: The logo component.
"""
return rx.chakra.link(
rx.chakra.image(
src=asset_data.FOOTER_LOGO,
**style_props,
),
href="/",
)
115 changes: 61 additions & 54 deletions personal_website/components/navbar.py
Original file line number Diff line number Diff line change
@@ -1,67 +1,18 @@
import reflex as rx

from personal_website.styles import NAVBAR
from assets import asset_data

NAVBAR_LOGO = "/shared/icon.png"


def navbar_logo(**style_props):
"""Create a Reflex logo component.
Args:
style_props: The style properties to apply to the component.
def navbar() -> rx.Component:
"""
return rx.chakra.link(
rx.chakra.image(
src=NAVBAR_LOGO,
**style_props,
),
href="/",
)


## For mobile & when screen is small
pages = ["Articles", "Resume", "Research", "Projects"]


def menu_button() -> rx.Component:
"""The menu button on the top right of the page.
Create the navbar component.
Returns:
The menu button component.
rx.Component: The created navbar component.
"""

return rx.chakra.box(
rx.chakra.menu(
rx.chakra.menu_button(
rx.chakra.icon(tag="hamburger", size="4em"),
),
rx.chakra.menu_list(
*[
rx.chakra.menu_item(
rx.chakra.link(
page,
href=f"/{page.lower()}",
width="100%",
)
)
for page in pages
],
),
),
display=["flex", "flex", "flex", "flex", "none", "none"],
)


def navbar(sidebar: rx.Component = None) -> rx.Component:
"""Create the navbar component.
Args:
sidebar: The sidebar component to use.
"""

# Create the navbar component.
return rx.chakra.vstack(
navbar = rx.chakra.vstack(
rx.chakra.box(
rx.chakra.hstack(
navbar_logo(**NAVBAR["NAVBAR_LOGO_STYLE"]),
Expand Down Expand Up @@ -124,3 +75,59 @@ def navbar(sidebar: rx.Component = None) -> rx.Component:
top="0",
z_index="999",
)

return navbar


def navbar_logo(**style_props) -> rx.Component:
"""
Create a Reflex logo component.
Args:
style_props: The style properties to apply to the component.
Returns:
rx.Component: The logo component.
"""
navbar_logo = rx.chakra.link(
rx.chakra.image(
src=asset_data.NAVBAR_LOGO,
**style_props,
),
href="/",
)

return navbar_logo


## For mobile & when screen is small
def menu_button() -> rx.Component:
"""The menu button on the top right of the page.
Returns:
rx.Component: The menu button component.
"""
pages = ["Articles", "Resume", "Research", "Projects"]

menu_button = rx.chakra.box(
rx.chakra.menu(
rx.chakra.menu_button(
rx.chakra.icon(tag="hamburger", size="4em"),
),
rx.chakra.menu_list(
*[
rx.chakra.menu_item(
rx.chakra.link(
page,
href=f"/{page.lower()}",
width="100%",
)
)
for page in pages
],
),
),
display=["flex", "flex", "flex", "flex", "none", "none"],
)

return menu_button
8 changes: 7 additions & 1 deletion personal_website/components/spline.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@ class Spline_Index(rx.Component):
spline_index = Spline_Index.create


def spline_component_index_page():
def spline_component_index_page() -> rx.Component:
"""
Returns a Chakra UI component for the index page of the spline component.
Returns:
rx.Component: The Chakra UI component for the index page.
"""
return rx.chakra.center(
rx.chakra.center(
spline_index(),
Expand Down
28 changes: 10 additions & 18 deletions personal_website/pages/articles.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
"""The articles page."""

import reflex as rx

from assets.shared import links
from assets import asset_data
from personal_website.styles import ARTICLES_PAGE
from personal_website.templates import template
from personal_website.utilities.markdown import read_markdown


def container(*children, **kwargs):
kwargs = {"max_width": "1440px", "padding_x": ["1em", "2em", "3em"], **kwargs}
return rx.chakra.container(
*children,
**kwargs,
)
from personal_website.utilities.container import container


## Articles Header
Expand Down Expand Up @@ -104,7 +96,7 @@ def body():
padding_x="3em",
padding_bottom="3em",
),
href=links.FWL_URL,
href=asset_data.FWL_URL,
is_external=True,
)

Expand All @@ -129,7 +121,7 @@ def body():
padding_x="3em",
padding_bottom="3em",
),
href=links.LOGISTIC_URL,
href=asset_data.LOGISTIC_URL,
is_external=True,
)

Expand All @@ -154,7 +146,7 @@ def body():
padding_x="3em",
padding_bottom="3em",
),
href=links.NM1_URL,
href=asset_data.NM1_URL,
is_external=True,
)

Expand All @@ -179,7 +171,7 @@ def body():
# padding_x="3em", MIDDLE COLUMN
padding_bottom="3em",
),
href=links.NM2_URL,
href=asset_data.NM2_URL,
is_external=True,
)

Expand All @@ -204,7 +196,7 @@ def body():
padding_x="3em",
padding_bottom="3em",
),
href=links.NM3_URL,
href=asset_data.NM3_URL,
is_external=True,
)

Expand All @@ -229,7 +221,7 @@ def body():
padding_x="3em",
padding_bottom="3em",
),
href=links.TSNE_URL,
href=asset_data.TSNE_URL,
is_external=True,
)

Expand All @@ -254,7 +246,7 @@ def body():
# padding_x="3em", MIDDLE COLUMN
padding_bottom="3em",
),
href=links.DML1_URL,
href=asset_data.DML1_URL,
is_external=True,
)

Expand All @@ -279,7 +271,7 @@ def body():
padding_x="3em",
padding_bottom="3em",
),
href=links.DML2_URL,
href=asset_data.DML2_URL,
is_external=True,
)

Expand Down
Loading

0 comments on commit bcf66e7

Please sign in to comment.