Skip to content

Commit 29aaf5a

Browse files
committed
nav
1 parent 6c40df1 commit 29aaf5a

File tree

10 files changed

+218
-187
lines changed

10 files changed

+218
-187
lines changed

pcweb/components/docpage/navbar/navbar.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def link_item(name: str, url: str, active_str: str = ""):
7474
if active_str == "framework":
7575
is_home = router_path == "/"
7676
is_docs = router_path.contains("docs")
77-
not_cloud = ~router_path.contains("cloud")
77+
not_cloud = ~(router_path.contains("cloud") | router_path.contains("hosting"))
7878
not_ai_builder = ~router_path.contains("ai-builder")
7979

8080
active = rx.cond(
@@ -345,14 +345,17 @@ def logo() -> rx.Component:
345345
def doc_section():
346346
from pcweb.pages.docs.ai_builder import pages as ai_pages
347347
from pcweb.pages.docs.cloud import pages as cloud_pages
348+
from pcweb.pages.docs import hosting as hosting_page
348349

349350
return nav_menu.content(
350351
rx.el.ul(
351352
# resource_item("AI Builder Docs", ai_pages[0].path, "bot", 0),
352353
resource_item(
353354
"Framework Docs", getting_started.introduction.path, "frame", 0
354355
),
355-
resource_item("Cloud Docs", cloud_pages[0].path, "server", 0),
356+
resource_item(
357+
"Cloud Docs", hosting_page.deploy_quick_start.path, "server", 0
358+
),
356359
class_name="items-start gap-1.5 gap-x-1.5 grid grid-cols-1 m-0 p-1.5 w-[280px] min-w-max",
357360
),
358361
)
@@ -361,6 +364,7 @@ def doc_section():
361364
def new_component_section() -> rx.Component:
362365
from pcweb.pages.docs.ai_builder import pages as ai_pages
363366
from pcweb.pages.docs.cloud import pages as cloud_pages
367+
from pcweb.pages.docs import hosting as hosting_page
364368

365369
return nav_menu.root(
366370
nav_menu.list(
@@ -379,7 +383,9 @@ def new_component_section() -> rx.Component:
379383
),
380384
),
381385
nav_menu.item(
382-
link_item("Cloud", cloud_pages[0].path, "hosting"),
386+
link_item(
387+
"Cloud", hosting_page.deploy_quick_start.path, "hosting"
388+
),
383389
),
384390
class_name="desktop-only flex flex-row items-center gap-0 lg:gap-7 m-0 h-full list-none",
385391
),

pcweb/components/docpage/sidebar/sidebar.py

Lines changed: 121 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
import reflex as rx
66
from pcweb.components.docpage.navbar.state import NavbarState
7-
from .sidebar_items.cloud import cloud_items
7+
from pcweb.pages.docs import cloud_cliref
88
from .state import SidebarState, SideBarItem, SideBarBase
99

10-
from .sidebar_items.learn import learn, frontend, backend, hosting
10+
from .sidebar_items.learn import learn, frontend, backend, hosting, cli_ref
1111
from .sidebar_items.component_lib import (
1212
component_lib,
1313
graphing_libs,
@@ -346,8 +346,8 @@ def sidebar_comp(
346346
api_reference_index: list[int],
347347
recipes_index: list[int],
348348
#
349+
cli_ref_index: list[int],
349350
ai_builder_index: list[int],
350-
cloud_index: list[int],
351351
tutorials_index: list[int],
352352
width: str = "100%",
353353
):
@@ -361,156 +361,158 @@ def sidebar_comp(
361361
hosting as hosting_page,
362362
)
363363
from pcweb.pages.docs.apiref import pages
364-
from pcweb.pages.docs.ai_builder import pages as ai_pages
365364
from pcweb.pages.docs.cloud import pages as cloud_pages
366365

367366
return rx.box(
368-
# ... hide/show the sidebar pills based on which product documentation we are on
369-
# ... ... main docs for the framework
367+
# Handle sidebar categories for docs/cloud first
370368
rx.cond(
371-
rx.State.router.page.path.contains("docs"),
369+
rx.State.router.page.path.startswith("/docs/hosting/"),
372370
rx.el.ul(
373371
sidebar_category(
374-
"Learn", getting_started.introduction.path, "graduation-cap", 0
372+
"Cloud", hosting_page.deploy_quick_start.path, "cloud", 0
375373
),
376-
sidebar_category("Components", library.path, "layout-panel-left", 1),
377-
sidebar_category("API Reference", pages[0].path, "book-text", 2),
374+
# sidebar_category(
375+
# "CLI Reference", cloud_pages[0].path, "book-marked", 1
376+
# ),
378377
class_name="flex flex-col items-start gap-1 w-full list-none",
379378
),
380-
),
381-
# ... ... main docs for the ai builder
382-
# rx.cond(
383-
# rx.State.router.page.path.contains("ai-builder"),
384-
# rx.el.ul(
385-
# sidebar_category("Quickstart", ai_pages[0].path, "trending-up", 0),
386-
# sidebar_category("Integrations", ai_pages[1].path, "blocks", 1),
387-
# class_name="flex flex-col items-start gap-1 w-full list-none",
388-
# ),
389-
# ),
390-
# ... ... main docs for the cloud
391-
rx.cond(
392-
rx.State.router.page.path.contains("cloud"),
393-
rx.el.ul(
394-
sidebar_category("Cloud", cloud_pages[0].path, "cloud", 0),
395-
sidebar_category("CLI Reference", cloud_pages[0].path, "cloud", 1),
396-
class_name="flex flex-col items-start gap-1 w-full list-none",
397-
),
398-
),
399-
# ... hide/show the sidebar items (accordions etc...) based on which pill is selected
400-
# rx.cond(
401-
# rx.State.router.page.path.contains("ai-builder"),
402-
# rx.el.ul(
403-
# create_sidebar_section(
404-
# "AI Builder",
405-
# ai_pages[0].path,
406-
# ai_builder_items,
407-
# ai_builder_index,
408-
# url,
409-
# ),
410-
# class_name="flex flex-col items-start gap-6 p-[0px_1rem_0px_0.5rem] w-full list-none list-style-none",
411-
# ),
412-
# ),
413-
rx.cond(
414-
rx.State.router.page.path.contains("cloud"),
415-
rx.el.ul(
416-
create_sidebar_section(
417-
"Cloud",
418-
cloud_pages[0].path,
419-
cloud_items,
420-
cloud_index,
421-
url,
379+
# If the path doesn't start with /docs/cloud, check for general docs
380+
rx.cond(
381+
rx.State.router.page.path.startswith("/docs/"),
382+
rx.el.ul(
383+
sidebar_category(
384+
"Learn", getting_started.introduction.path, "graduation-cap", 0
385+
),
386+
sidebar_category(
387+
"Components", library.path, "layout-panel-left", 1
388+
),
389+
sidebar_category("API Reference", pages[0].path, "book-text", 2),
390+
class_name="flex flex-col items-start gap-1 w-full list-none",
422391
),
423-
class_name="flex flex-col items-start gap-6 p-[0px_1rem_0px_0.5rem] w-full list-none list-style-none",
424392
),
425393
),
394+
# Handle the sidebar content based on docs/cloud or docs
426395
rx.cond(
427-
rx.State.router.page.path.contains("docs"),
396+
rx.State.router.page.path.startswith("/docs/hosting/"),
428397
rx.match(
429398
SidebarState.sidebar_index,
430399
(
431400
0,
432401
rx.el.ul(
433402
create_sidebar_section(
434-
"Onboarding",
435-
getting_started.introduction.path,
436-
learn,
437-
learn_index,
438-
url,
439-
),
440-
create_sidebar_section(
441-
"User Interface",
442-
ui.overview.path,
443-
filter_out_non_sidebar_items(frontend),
444-
frontend_index,
445-
url,
446-
),
447-
create_sidebar_section(
448-
"State",
449-
state.overview.path,
450-
filter_out_non_sidebar_items(backend),
451-
backend_index,
403+
"Cloud",
404+
hosting_page.deploy_quick_start.path,
405+
hosting,
406+
hosting_index,
452407
url,
453408
),
454-
create_sidebar_section(
455-
"Recipes", overview.path, recipes, recipes_index, url
456-
),
457409
class_name="flex flex-col items-start gap-6 p-[0px_1rem_0px_0.5rem] w-full list-none list-style-none",
458410
),
459411
),
460-
(
461-
1,
462-
rx.el.ul(
463-
create_sidebar_section(
464-
"Core",
465-
library.path,
466-
component_lib,
467-
component_lib_index,
468-
url,
469-
),
470-
create_sidebar_section(
471-
"Graphing",
472-
library.path,
473-
graphing_libs,
474-
graphing_libs_index,
475-
url,
412+
# (
413+
# 1,
414+
# rx.el.ul(
415+
# create_sidebar_section(
416+
# "CLI Reference",
417+
# cloud_pages[0].path,
418+
# cli_ref,
419+
# cli_ref_index,
420+
# url,
421+
# ),
422+
# class_name="flex flex-col items-start gap-6 p-[0px_1rem_0px_0.5rem] w-full list-none list-style-none",
423+
# ),
424+
# ),
425+
),
426+
rx.cond(
427+
rx.State.router.page.path.startswith("/docs/"),
428+
rx.match(
429+
SidebarState.sidebar_index,
430+
(
431+
0,
432+
rx.el.ul(
433+
create_sidebar_section(
434+
"Onboarding",
435+
getting_started.introduction.path,
436+
learn,
437+
learn_index,
438+
url,
439+
),
440+
create_sidebar_section(
441+
"User Interface",
442+
ui.overview.path,
443+
filter_out_non_sidebar_items(frontend),
444+
frontend_index,
445+
url,
446+
),
447+
create_sidebar_section(
448+
"State",
449+
state.overview.path,
450+
filter_out_non_sidebar_items(backend),
451+
backend_index,
452+
url,
453+
),
454+
create_sidebar_section(
455+
"Recipes", overview.path, recipes, recipes_index, url
456+
),
457+
class_name="flex flex-col items-start gap-6 p-[0px_1rem_0px_0.5rem] w-full list-none list-style-none",
476458
),
477-
rx.link(
478-
rx.box(
459+
),
460+
(
461+
1,
462+
rx.el.ul(
463+
create_sidebar_section(
464+
"Core",
465+
library.path,
466+
component_lib,
467+
component_lib_index,
468+
url,
469+
),
470+
create_sidebar_section(
471+
"Graphing",
472+
library.path,
473+
graphing_libs,
474+
graphing_libs_index,
475+
url,
476+
),
477+
rx.link(
479478
rx.box(
480-
rx.icon("atom", size=16),
481-
rx.el.h5(
482-
"Custom Components",
483-
class_name="font-smbold text-[0.875rem] text-slate-12 leading-5 tracking-[-0.01313rem] transition-color",
479+
rx.box(
480+
rx.icon("atom", size=16),
481+
rx.el.h5(
482+
"Custom Components",
483+
class_name="font-smbold text-[0.875rem] text-slate-12 leading-5 tracking-[-0.01313rem] transition-color",
484+
),
485+
class_name="flex flex-row items-center gap-3 text-slate-12",
484486
),
485-
class_name="flex flex-row items-center gap-3 text-slate-12",
486-
),
487-
rx.text(
488-
"See what components people have made with Reflex!",
489-
class_name="font-small text-slate-9",
487+
rx.text(
488+
"See what components people have made with Reflex!",
489+
class_name="font-small text-slate-9",
490+
),
491+
class_name="flex flex-col gap-2 border-slate-5 bg-slate-1 hover:bg-slate-3 shadow-large px-3.5 py-2 border rounded-xl transition-bg",
490492
),
491-
class_name="flex flex-col gap-2 border-slate-5 bg-slate-1 hover:bg-slate-3 shadow-large px-3.5 py-2 border rounded-xl transition-bg",
493+
underline="none",
494+
href=custom_components.path,
492495
),
493-
underline="none",
494-
href=custom_components.path,
496+
class_name="flex flex-col items-start gap-6 p-[0px_1rem_0px_0.5rem] w-full list-none list-style-none",
495497
),
496-
class_name="flex flex-col items-start gap-6 p-[0px_1rem_0px_0.5rem] w-full list-none list-style-none",
497498
),
498-
),
499-
(
500-
2,
501-
rx.el.ul(
502-
create_sidebar_section(
503-
"Reference",
504-
pages[0].path,
505-
api_reference,
506-
api_reference_index,
507-
url,
499+
(
500+
2,
501+
rx.el.ul(
502+
create_sidebar_section(
503+
"Reference",
504+
pages[0].path,
505+
api_reference,
506+
api_reference_index,
507+
url,
508+
),
509+
class_name="flex flex-col items-start gap-6 p-[0px_1rem_0px_0.5rem] w-full list-none list-style-none",
508510
),
509-
class_name="flex flex-col items-start gap-6 p-[0px_1rem_0px_0.5rem] w-full list-none list-style-none",
510511
),
511512
),
512513
),
513514
),
515+
# Handle general docs sections
514516
style={
515517
"&::-webkit-scrollbar-thumb": {
516518
"background_color": "transparent",
@@ -534,7 +536,7 @@ def sidebar(url=None, width: str = "100%") -> rx.Component:
534536
api_reference_index = calculate_index(api_reference, url)
535537
recipes_index = calculate_index(recipes, url)
536538

537-
cloud_index = calculate_index(cloud_items, url)
539+
cli_ref_index = calculate_index(cli_ref, url)
538540
ai_builder_index = calculate_index(ai_builder_items, url)
539541

540542
return rx.box(
@@ -548,9 +550,8 @@ def sidebar(url=None, width: str = "100%") -> rx.Component:
548550
graphing_libs_index=graphing_libs_index,
549551
api_reference_index=api_reference_index,
550552
recipes_index=recipes_index,
551-
#
552-
cloud_index=cloud_index,
553553
ai_builder_index=ai_builder_index,
554+
cli_ref_index=cli_ref_index,
554555
#
555556
width=width,
556557
),
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
from .item import create_item
22

33

4-
def get_sidebar_items_cloud():
5-
from pcweb.pages.docs.cloud import pages as cloud_pages
4+
def get_sidebar_items_cli_ref():
65
from pcweb.pages.docs.cloud_cliref import pages as cloud_cli_pages
76

87
items = [
9-
create_item("Cloud", children=cloud_pages),
108
create_item("CLI Reference", children=cloud_cli_pages),
119
]
1210

1311
return items
1412

1513

16-
cloud_items = get_sidebar_items_cloud()
14+
cli_ref = get_sidebar_items_cli_ref()

pcweb/components/docpage/sidebar/sidebar_items/learn.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,17 @@ def get_sidebar_items_hosting():
240240
return items
241241

242242

243+
def get_sidebar_items_hosting_cli_ref():
244+
from pcweb.pages.docs.cloud_cliref import pages as cloud_pages
245+
246+
items = [
247+
create_item("CLI Reference", children=cloud_cliref.pages),
248+
]
249+
return items
250+
251+
243252
learn = get_sidebar_items_learn()
244253
frontend = get_sidebar_items_frontend()
245254
backend = get_sidebar_items_backend()
246255
hosting = get_sidebar_items_hosting()
256+
cli_ref = get_sidebar_items_hosting_cli_ref()

0 commit comments

Comments
 (0)