Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
267 changes: 0 additions & 267 deletions docs/tutorial/frontend.md

This file was deleted.

18 changes: 13 additions & 5 deletions pcweb/pages/docs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
from collections import defaultdict
from pathlib import Path
from types import SimpleNamespace

import reflex as rx
Expand All @@ -14,8 +15,6 @@
from pcweb.route import Route
from pcweb.templates.docpage import docpage, get_toc
from pcweb.whitelist import _check_whitelisted_path
from reflex.components.radix.primitives.base import RadixPrimitiveComponent
from reflex.components.radix.themes.base import RadixThemesComponent

from .library import library
from .recipes_overview import overview
Expand Down Expand Up @@ -177,9 +176,18 @@ def get_component(doc: str, title: str):
outblocks.append((d, route))
return

return docpage(set_path=route, t=title2)(
lambda d=d, doc=doc: (get_toc(d, doc), xd.render(d, doc))
)
def comp():
return (get_toc(d, doc), xd.render(d, doc))

doc_path = Path(doc)
doc_module = ".".join(doc_path.parts[:-1])
doc_file = doc_path.stem

comp.__module__ = doc_module
comp.__name__ = doc_file
comp.__qualname__ = doc_file

return docpage(set_path=route, t=title2)(comp)


doc_routes = (
Expand Down
2 changes: 1 addition & 1 deletion pcweb/pages/docs/cloud_cliref.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,6 @@ def generate_docs(source: str):
for module_name, module_value in modules.items():
docs = generate_docs(module_value)
title = module_name.replace("_", " ").title()
page_data = docpage(f"/docs/hosting/{module_name}/", title)(docs)
page_data = docpage(f"/docs/hosting/cli/{module_name}/", title)(docs)
page_data.title = page_data.title.split("·")[0].strip()
pages.append(page_data)
4 changes: 1 addition & 3 deletions pcweb/pcweb.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
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"),
Expand All @@ -97,7 +96,6 @@
("/docs/library/layout/foreach", "/docs/library/dynamic-rendering/foreach"),
("/docs/library/layout/match", "/docs/library/dynamic-rendering/match"),
("/docs/library/layout/cond", "/docs/library/dynamic-rendering/cond"),
("/docs/tutorial", "/docs/tutorial/intro"),
("/docs/components", "/docs/components/props"),
("/docs/pages", "/docs/pages/routes"),
("/docs/assets", "/docs/assets/referencing-assets"),
Expand All @@ -112,6 +110,7 @@
("/docs/utility-methods", "/docs/utility-methods/router-attributes"),
("/docs/datatable-tutorial", "/docs/datatable-tutorial/simple-table"),
("/docs/library/graphing", "/docs/library/graphing/charts"),
("/docs/tutorial", "/docs/getting-started/chatapp-tutorial"),
("/docs/tutorial/intro", "/docs/getting-started/chatapp-tutorial"),
("/docs/tutorial/setup", "/docs/getting-started/chatapp-tutorial"),
("/docs/tutorial/frontend", "/docs/getting-started/chatapp-tutorial"),
Expand All @@ -124,7 +123,6 @@
),
# Recipes
("/docs/recipes/auth", "/docs/recipes"),
("/docs/recipes/auth", "/docs/recipes"),
("/docs/recipes/layout", "/docs/recipes"),
("/docs/recipes/others", "/docs/recipes"),
("/docs/recipes/content", "/docs/recipes"),
Expand Down
2 changes: 2 additions & 0 deletions pcweb/templates/docpage/docpage.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Template for documentation pages."""

from datetime import datetime
import functools
from typing import Callable

import reflex as rx
Expand Down Expand Up @@ -407,6 +408,7 @@ def docpage(contents: Callable[[], Route]) -> Route:
# Set the page title.
title = contents.__name__.replace("_", " ").title() if t is None else t

@functools.wraps(contents)
def wrapper(*args, **kwargs) -> rx.Component:
"""The actual function wrapper.

Expand Down
2 changes: 2 additions & 0 deletions pcweb/templates/gallery_app_page.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import functools
from typing import Callable
import reflex as rx
from pcweb.route import Route
Expand Down Expand Up @@ -39,6 +40,7 @@ def webpage(contents: Callable[[], Route]) -> Route:
The templated route.
"""

@functools.wraps(contents)
def wrapper(*children, **props) -> rx.Component:
"""The template component.

Expand Down
2 changes: 2 additions & 0 deletions pcweb/templates/storypage.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import functools
from typing import Callable

import reflex as rx
Expand Down Expand Up @@ -232,6 +233,7 @@ def webpage(contents: Callable[[], Route]) -> Route:
The templated route.
"""

@functools.wraps(contents)
def wrapper(*children, **props) -> rx.Component:
"""The template component.

Expand Down
Loading