Skip to content

Commit f1179bd

Browse files
committed
[HOS-678] add ai builder docs sidebar
1 parent e7df5ba commit f1179bd

File tree

9 files changed

+188
-120
lines changed

9 files changed

+188
-120
lines changed

docs/ai_builder/integrations.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
## Integrations

docs/ai_builder/overview.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
## Overview

docs/ai_builder/quickstart.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

pcweb/components/docpage/navbar/navbar.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -386,10 +386,11 @@ def logo() -> rx.Component:
386386

387387
def doc_section():
388388
from pcweb.pages.docs import hosting as hosting_page
389+
from pcweb.pages.docs import ai_builder as ai_builder_pages
389390

390391
return nav_menu.content(
391392
rx.el.ul(
392-
# resource_item("AI Builder Docs", ai_pages[0].path, "bot", 0),
393+
resource_item("AI Builder Docs", ai_builder_pages.overview.path, "bot", 0),
393394
resource_item(
394395
"Framework Docs", getting_started.introduction.path, "frame", 0
395396
),
@@ -403,6 +404,7 @@ def doc_section():
403404

404405
def new_component_section() -> rx.Component:
405406
from pcweb.pages.docs import hosting as hosting_page
407+
from pcweb.pages.docs import ai_builder as ai_builder_pages
406408

407409
return nav_menu.root(
408410
nav_menu.list(
@@ -429,9 +431,9 @@ def new_component_section() -> rx.Component:
429431
| rx.State.router.page.path.contains("ai-builder")
430432
| rx.State.router.page.path.contains("cloud"),
431433
rx.el.div(
432-
# nav_menu.item(
433-
# link_item("AI Builder", ai_pages[0].path, "builder"),
434-
# ),
434+
nav_menu.item(
435+
link_item("AI Builder", ai_builder_pages.overview.path, "builder"),
436+
),
435437
nav_menu.item(
436438
link_item(
437439
"Framework", getting_started.introduction.path, "framework"

pcweb/components/docpage/sidebar/sidebar.py

Lines changed: 144 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
component_lib,
1313
graphing_libs,
1414
)
15-
from .sidebar_items.ai_builder import ai_builder_items
15+
from .sidebar_items.ai import ai_builder_overview_items, ai_builder_integrations_items
1616
from .sidebar_items.reference import api_reference
1717
from .sidebar_items.recipes import recipes
1818
from pcweb.styles.colors import c_color
@@ -219,7 +219,8 @@ def append_to_items(items, flat_items):
219219
+ component_lib
220220
+ graphing_libs
221221
+ recipes
222-
+ ai_builder_items
222+
+ ai_builder_overview_items
223+
+ ai_builder_integrations_items
223224
+ api_reference,
224225
flat_items,
225226
)
@@ -347,7 +348,8 @@ def sidebar_comp(
347348
recipes_index: list[int],
348349
#
349350
cli_ref_index: list[int],
350-
ai_builder_index: list[int],
351+
ai_builder_overview_index: list[int],
352+
ai_builder_integrations_index: list[int],
351353
tutorials_index: list[int],
352354
width: str = "100%",
353355
):
@@ -358,6 +360,7 @@ def sidebar_comp(
358360
from pcweb.pages.docs.custom_components import custom_components
359361
from pcweb.pages.docs.library import library
360362
from pcweb.pages.docs.recipes_overview import overview
363+
from pcweb.pages.docs import ai_builder as ai_builder_pages
361364

362365
return rx.box( # pyright: ignore [reportCallIssue]
363366
# Handle sidebar categories for docs/cloud first
@@ -372,36 +375,54 @@ def sidebar_comp(
372375
# ),
373376
class_name="flex flex-col items-start gap-1 w-full list-none",
374377
),
375-
# If the path doesn't start with /docs/cloud, check for general docs
376378
rx.cond( # pyright: ignore [reportCallIssue]
377-
rx.State.router.page.path.startswith("/docs/"),
379+
rx.State.router.page.path.startswith("/docs/ai-builder/"),
378380
rx.el.ul(
379381
sidebar_category(
380-
"Learn",
381-
getting_started.introduction.path,
382-
"graduation-cap",
382+
"Overview",
383+
"/docs/ai-builder/overview",
384+
"bot",
383385
0,
384386
),
385387
sidebar_category(
386-
"Components",
387-
library.path,
388-
"layout-panel-left",
388+
"Integrations",
389+
"/docs/ai-builder/integrations",
390+
"layout-panel-top",
389391
1,
390392
),
391-
sidebar_category(
392-
"API Reference",
393-
pages[0].path,
394-
"book-text",
395-
2,
396-
),
397-
sidebar_category(
398-
"Enterprise",
399-
enterprise.overview.path,
400-
"building-2",
401-
3,
402-
),
403393
class_name="flex flex-col items-start gap-1 w-full list-none",
404394
),
395+
# If the path doesn't start with /docs/cloud, check for general docs
396+
rx.cond( # pyright: ignore [reportCallIssue]
397+
rx.State.router.page.path.startswith("/docs/"),
398+
rx.el.ul(
399+
sidebar_category(
400+
"Learn",
401+
getting_started.introduction.path,
402+
"graduation-cap",
403+
0,
404+
),
405+
sidebar_category(
406+
"Components",
407+
library.path,
408+
"layout-panel-left",
409+
1,
410+
),
411+
sidebar_category(
412+
"API Reference",
413+
pages[0].path,
414+
"book-text",
415+
2,
416+
),
417+
sidebar_category(
418+
"Enterprise",
419+
enterprise.overview.path,
420+
"building-2",
421+
3,
422+
),
423+
class_name="flex flex-col items-start gap-1 w-full list-none",
424+
),
425+
),
405426
),
406427
),
407428
# Handle the sidebar content based on docs/cloud or docs
@@ -437,89 +458,127 @@ def sidebar_comp(
437458
# ),
438459
),
439460
rx.cond( # pyright: ignore [reportCallIssue]
440-
rx.State.router.page.path.startswith("/docs/"),
461+
rx.State.router.page.path.startswith("/docs/ai-builder/"),
441462
rx.match( # pyright: ignore [reportCallIssue]
442463
SidebarState.sidebar_index,
443464
(
444465
0,
445466
rx.el.ul(
446467
create_sidebar_section(
447-
"Onboarding",
448-
getting_started.introduction.path,
449-
learn,
450-
learn_index,
468+
"Overview",
469+
ai_builder_pages.overview.path,
470+
ai_builder_overview_items,
471+
ai_builder_overview_index,
451472
url,
452473
),
453-
create_sidebar_section(
454-
"User Interface",
455-
ui.overview.path,
456-
filter_out_non_sidebar_items(frontend),
457-
frontend_index,
458-
url,
459-
),
460-
create_sidebar_section(
461-
"State",
462-
state.overview.path,
463-
filter_out_non_sidebar_items(backend),
464-
backend_index,
465-
url,
466-
),
467-
create_sidebar_section(
468-
"Recipes", overview.path, recipes, recipes_index, url
469-
),
470474
class_name="flex flex-col items-start gap-6 p-[0px_1rem_0px_0.5rem] w-full list-none list-style-none",
471475
),
472476
),
473477
(
474478
1,
475479
rx.el.ul(
476480
create_sidebar_section(
477-
"Core",
478-
library.path,
479-
component_lib,
480-
component_lib_index,
481+
"Integrations",
482+
ai_builder_pages.integrations.path,
483+
ai_builder_integrations_items,
484+
ai_builder_integrations_index,
481485
url,
482486
),
483-
create_sidebar_section(
484-
"Graphing",
485-
library.path,
486-
graphing_libs,
487-
graphing_libs_index,
488-
url,
487+
class_name="flex flex-col items-start gap-6 p-[0px_1rem_0px_0.5rem] w-full list-none list-style-none",
488+
),
489+
),
490+
),
491+
rx.cond( # pyright: ignore [reportCallIssue]
492+
rx.State.router.page.path.startswith("/docs/"),
493+
rx.match( # pyright: ignore [reportCallIssue]
494+
SidebarState.sidebar_index,
495+
(
496+
0,
497+
rx.el.ul(
498+
create_sidebar_section(
499+
"Onboarding",
500+
getting_started.introduction.path,
501+
learn,
502+
learn_index,
503+
url,
504+
),
505+
create_sidebar_section(
506+
"User Interface",
507+
ui.overview.path,
508+
filter_out_non_sidebar_items(frontend),
509+
frontend_index,
510+
url,
511+
),
512+
create_sidebar_section(
513+
"State",
514+
state.overview.path,
515+
filter_out_non_sidebar_items(backend),
516+
backend_index,
517+
url,
518+
),
519+
create_sidebar_section(
520+
"Recipes",
521+
overview.path,
522+
recipes,
523+
recipes_index,
524+
url,
525+
),
526+
class_name="flex flex-col items-start gap-6 p-[0px_1rem_0px_0.5rem] w-full list-none list-style-none",
489527
),
490-
rx.link( # pyright: ignore [reportCallIssue]
491-
rx.box( # pyright: ignore [reportCallIssue]
528+
),
529+
(
530+
1,
531+
rx.el.ul(
532+
create_sidebar_section(
533+
"Core",
534+
library.path,
535+
component_lib,
536+
component_lib_index,
537+
url,
538+
),
539+
create_sidebar_section(
540+
"Graphing",
541+
library.path,
542+
graphing_libs,
543+
graphing_libs_index,
544+
url,
545+
),
546+
rx.link( # pyright: ignore [reportCallIssue]
492547
rx.box( # pyright: ignore [reportCallIssue]
493-
rx.icon("atom", size=16), # pyright: ignore [reportCallIssue]
494-
rx.el.h5(
495-
"Custom Components",
496-
class_name="font-smbold text-[0.875rem] text-slate-12 leading-5 tracking-[-0.01313rem] transition-color",
548+
rx.box( # pyright: ignore [reportCallIssue]
549+
rx.icon(
550+
"atom", size=16
551+
), # pyright: ignore [reportCallIssue]
552+
rx.el.h5(
553+
"Custom Components",
554+
class_name="font-smbold text-[0.875rem] text-slate-12 leading-5 tracking-[-0.01313rem] transition-color",
555+
),
556+
class_name="flex flex-row items-center gap-3 text-slate-12",
497557
),
498-
class_name="flex flex-row items-center gap-3 text-slate-12",
499-
),
500-
rx.text( # pyright: ignore [reportCallIssue]
501-
"See what components people have made with Reflex!",
502-
class_name="font-small text-slate-9",
558+
rx.text( # pyright: ignore [reportCallIssue]
559+
"See what components people have made with Reflex!",
560+
class_name="font-small text-slate-9",
561+
),
562+
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",
503563
),
504-
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",
564+
underline="none",
565+
href=custom_components.path,
505566
),
506-
underline="none",
507-
href=custom_components.path,
567+
class_name="flex flex-col items-start gap-6 p-[0px_1rem_0px_0.5rem] w-full list-none list-style-none",
508568
),
509-
class_name="flex flex-col items-start gap-6 p-[0px_1rem_0px_0.5rem] w-full list-none list-style-none",
510569
),
511-
),
512-
(
513-
2,
514-
rx.el.ul(
515-
create_sidebar_section(
516-
"Reference",
517-
pages[0].path,
518-
api_reference,
519-
api_reference_index,
520-
url,
570+
(
571+
2,
572+
rx.el.ul(
573+
create_sidebar_section(
574+
"Reference",
575+
pages[0].path,
576+
api_reference,
577+
api_reference_index,
578+
url,
579+
),
580+
class_name="flex flex-col items-start gap-6 p-[0px_1rem_0px_0.5rem] w-full list-none list-style-none",
521581
),
522-
class_name="flex flex-col items-start gap-6 p-[0px_1rem_0px_0.5rem] w-full list-none list-style-none",
523582
),
524583
),
525584
),
@@ -550,7 +609,8 @@ def sidebar(url=None, width: str = "100%") -> rx.Component:
550609
recipes_index = calculate_index(recipes, url)
551610

552611
cli_ref_index = calculate_index(cli_ref, url)
553-
ai_builder_index = calculate_index(ai_builder_items, url)
612+
ai_builder_overview_index = calculate_index(ai_builder_overview_items, url)
613+
ai_builder_integrations_index = calculate_index(ai_builder_integrations_items, url)
554614

555615
return rx.box(
556616
sidebar_comp(
@@ -563,7 +623,8 @@ def sidebar(url=None, width: str = "100%") -> rx.Component:
563623
graphing_libs_index=graphing_libs_index,
564624
api_reference_index=api_reference_index,
565625
recipes_index=recipes_index,
566-
ai_builder_index=ai_builder_index,
626+
ai_builder_overview_index=ai_builder_overview_index,
627+
ai_builder_integrations_index=ai_builder_integrations_index,
567628
cli_ref_index=cli_ref_index,
568629
#
569630
width=width,
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
from .item import create_item
2+
3+
4+
def get_sidebar_items_ai_builder_overview():
5+
from pcweb.pages.docs import (
6+
ai_builder,
7+
)
8+
9+
return [
10+
create_item(
11+
"Overview",
12+
children=[
13+
ai_builder.overview,
14+
],
15+
),
16+
]
17+
18+
19+
def get_sidebar_items_ai_builder_integrations():
20+
from pcweb.pages.docs import (
21+
ai_builder,
22+
)
23+
24+
return [
25+
create_item(
26+
"Integrations",
27+
children=[
28+
ai_builder.integrations,
29+
],
30+
),
31+
]
32+
33+
34+
ai_builder_overview_items = get_sidebar_items_ai_builder_overview()
35+
ai_builder_integrations_items = get_sidebar_items_ai_builder_integrations()

0 commit comments

Comments
 (0)