44
55import reflex as rx
66from pcweb .components .docpage .navbar .state import NavbarState
7- from . sidebar_items . cloud import cloud_items
7+ from pcweb . pages . docs import cloud_cliref
88from .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
1111from .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 ),
0 commit comments