forked from reflex-dev/reflex-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpcweb.py
64 lines (58 loc) · 2.25 KB
/
pcweb.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
"""The main Reflex website."""
import reflex as rx
import reflex.components.radix.themes as rdxt
from pcweb import styles
from pcweb.pages import page404, routes
# Create the app.
app = rx.App(
style=styles.BASE_STYLE,
stylesheets=styles.STYLESHEETS,
theme=rdxt.theme(
appearance="light", has_background=True, radius="large", accent_color="teal"
),
head_components=[
rx.script(src="https://www.googletagmanager.com/gtag/js?id=G-4T7C8ZD9TR"),
rx.script(
"""
window.dataLayer = window.dataLayer || [];
function gtag(){window.dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-4T7C8ZD9TR');
"""
),
],
)
# Add the pages to the app.
for route in routes:
app.add_page(
route.component,
route.path,
route.title,
description="Performant, customizable web apps in pure Python. Deploy in seconds.",
image="/previews/index_preview.png",
)
# Add redirects
redirects = [
("/docs", "/docs/getting-started/introduction"),
("/docs/getting-started", "/docs/getting-started/introduction"),
("/docs/components", "/docs/components/overview"),
("/docs/state", "/docs/state/overview"),
("/docs/styling", "/docs/styling/overview"),
("/docs/database", "/docs/database/overview"),
("/docs/hosting", "/docs/hosting/self-hosting"),
("/docs/advanced-guide", "/docs/advanced-guide/custom-vars"),
("/docs/library/typography", "/docs/library/typography/text"),
("/docs/library/forms", "/docs/library/forms/form"),
("/docs/library/layout", "/docs/library/layout/box"),
("/docs/library/navigation", "/docs/library/navigation/link"),
("/docs/library/datadisplay", "/docs/library/datadisplay/badge"),
("/docs/library/graphing", "/docs/library/graphing/chart"),
("/docs/library/disclosure", "/docs/library/disclosure/accordion"),
("/docs/library/feedback", "/docs/library/feedback/alert"),
("/docs/library/media", "/docs/library/media/image"),
("/docs/library/overlay", "/docs/library/overlay/alertdialog"),
("/docs/library/other", "/docs/library/other/html"),
]
for source, target in redirects:
app.add_page(lambda: rx.fragment(), route=source, on_load=rx.redirect(target))
app.add_custom_404_page(page404.component)