instruction stringlengths 0 1k | input stringlengths 1 1k | output stringlengths 10 6.51k |
|---|---|---|
import reflex as rx
from reflex.style import toggle_color_mode
from pcweb.components.icons.icons import get_icon
from pcweb.constants import DISCORD_URL, GITHUB_URL, TWITTER_URL
from pcweb.pages.blog import blogs
from pcweb.pages.docs import getting_started
from pcweb.pages.docs.library import library
|
from pcweb.pages.gallery import gallery
from pcweb.pages.hosting.hosting import hosting_landing
def social_menu_item(
icon: str,
url="/",
border: bool = False,
) -> rx.Component:
return rx.link(
get_icon(icon=icon, class_name="!text-slate-9"),
class_name="flex justify-center items-center gap-2 hover:bg-slate-3 px-4 py-[0.875rem] w-full h-[47px] transition-bg overflow-hidden"
+ (" border-slate-4 border-x border-solid border-y-0" if border else ""),
href=url,
is_external=True,
)
def drawer_socials() -> rx.Component:
return rx.box(
social_menu_item("github", GITHUB_URL),
social_menu_item(
"twitter",
TWITTER_URL,
border=True,
),
social_menu_item("discord", DISCORD_URL),
class_name="flex flex-row items-center border-slate-4 border-y-0 !border-b w-full",
)
def drawer_item(text: str, url: str, active_str: str = "") -> rx.Component:
router_p | from pcweb.pages.framework.framework import framework |
import reflex as rx
from reflex.style import toggle_color_mode
from pcweb.components.icons.icons import get_icon
from pcweb.constants import DISCORD_URL, GITHUB_URL, TWITTER_URL
from pcweb.pages.blog import blogs
from pcweb.pages.docs import getting_started
from pcweb.pages.docs.library import library
from pcweb.pages.framework.framework import framework
|
from pcweb.pages.hosting.hosting import hosting_landing
def social_menu_item(
icon: str,
url="/",
border: bool = False,
) -> rx.Component:
return rx.link(
get_icon(icon=icon, class_name="!text-slate-9"),
class_name="flex justify-center items-center gap-2 hover:bg-slate-3 px-4 py-[0.875rem] w-full h-[47px] transition-bg overflow-hidden"
+ (" border-slate-4 border-x border-solid border-y-0" if border else ""),
href=url,
is_external=True,
)
def drawer_socials() -> rx.Component:
return rx.box(
social_menu_item("github", GITHUB_URL),
social_menu_item(
"twitter",
TWITTER_URL,
border=True,
),
social_menu_item("discord", DISCORD_URL),
class_name="flex flex-row items-center border-slate-4 border-y-0 !border-b w-full",
)
def drawer_item(text: str, url: str, active_str: str = "") -> rx.Component:
router_path = rx.State.router.page.path
if n | from pcweb.pages.gallery import gallery |
import reflex as rx
from reflex.style import toggle_color_mode
from pcweb.components.icons.icons import get_icon
from pcweb.constants import DISCORD_URL, GITHUB_URL, TWITTER_URL
from pcweb.pages.blog import blogs
from pcweb.pages.docs import getting_started
from pcweb.pages.docs.library import library
from pcweb.pages.framework.framework import framework
from pcweb.pages.gallery import gallery
|
def social_menu_item(
icon: str,
url="/",
border: bool = False,
) -> rx.Component:
return rx.link(
get_icon(icon=icon, class_name="!text-slate-9"),
class_name="flex justify-center items-center gap-2 hover:bg-slate-3 px-4 py-[0.875rem] w-full h-[47px] transition-bg overflow-hidden"
+ (" border-slate-4 border-x border-solid border-y-0" if border else ""),
href=url,
is_external=True,
)
def drawer_socials() -> rx.Component:
return rx.box(
social_menu_item("github", GITHUB_URL),
social_menu_item(
"twitter",
TWITTER_URL,
border=True,
),
social_menu_item("discord", DISCORD_URL),
class_name="flex flex-row items-center border-slate-4 border-y-0 !border-b w-full",
)
def drawer_item(text: str, url: str, active_str: str = "") -> rx.Component:
router_path = rx.State.router.page.path
if not url.endswith("/"):
url += "/"
active = ro | from pcweb.pages.hosting.hosting import hosting_landing |
import reflex as rx
from reflex.style import toggle_color_mode
from pcweb.components.icons.icons import get_icon
from pcweb.constants import DISCORD_URL, GITHUB_URL, TWITTER_URL
from pcweb.pages.blog import blogs
from pcweb.pages.docs import getting_started
from pcweb.pages.docs.library import library
from pcweb.pages.framework.framework import framework
from pcweb.pages.gallery import gallery
from pcweb.pages.hosting.hosting import hosting_landing
|
def drawer_socials() -> rx.Component:
return rx.box(
social_menu_item("github", GITHUB_URL),
social_menu_item(
"twitter",
TWITTER_URL,
border=True,
),
social_menu_item("discord", DISCORD_URL),
class_name="flex flex-row items-center border-slate-4 border-y-0 !border-b w-full",
)
def drawer_item(text: str, url: str, active_str: str = "") -> rx.Component:
router_path = rx.State.router.page.path
if not url.endswith("/"):
url += "/"
active = router_path.contains(active_str)
if active_str == "docs":
active = rx.cond(
router_path.contains("hosting")
| router_path.contains("library")
| router_path.contains("gallery"),
False,
active,
)
if active_str == "":
active = False
return rx.link(
text,
href=url,
underline="none",
color=rx.cond(active, "var(--c-violet-9)", | def social_menu_item(
icon: str,
url="/",
border: bool = False,
) -> rx.Component:
return rx.link(
get_icon(icon=icon, class_name="!text-slate-9"),
class_name="flex justify-center items-center gap-2 hover:bg-slate-3 px-4 py-[0.875rem] w-full h-[47px] transition-bg overflow-hidden"
+ (" border-slate-4 border-x border-solid border-y-0" if border else ""),
href=url,
is_external=True,
) |
import reflex as rx
from reflex.style import toggle_color_mode
from pcweb.components.icons.icons import get_icon
from pcweb.constants import DISCORD_URL, GITHUB_URL, TWITTER_URL
from pcweb.pages.blog import blogs
from pcweb.pages.docs import getting_started
from pcweb.pages.docs.library import library
from pcweb.pages.framework.framework import framework
from pcweb.pages.gallery import gallery
from pcweb.pages.hosting.hosting import hosting_landing
def social_menu_item(
icon: str,
url="/",
border: bool = False,
) -> rx.Component:
return rx.link(
get_icon(icon=icon, class_name="!text-slate-9"),
class_name="flex justify-center items-center gap-2 hover:bg-slate-3 px-4 py-[0.875rem] w-full h-[47px] transition-bg overflow-hidden"
+ (" border-slate-4 border-x border-solid border-y-0" if border else ""),
href=url,
is_external=True,
)
|
def drawer_item(text: str, url: str, active_str: str = "") -> rx.Component:
router_path = rx.State.router.page.path
if not url.endswith("/"):
url += "/"
active = router_path.contains(active_str)
if active_str == "docs":
active = rx.cond(
router_path.contains("hosting")
| router_path.contains("library")
| router_path.contains("gallery"),
False,
active,
)
if active_str == "":
active = False
return rx.link(
text,
href=url,
underline="none",
color=rx.cond(active, "var(--c-violet-9)", "var(--c-slate-9)"),
class_name="flex justify-center items-center border-slate-4 px-4 py-[0.875rem] border-t-0 border-b border-solid w-full font-small hover:!text-violet-9 border-x-0",
)
def navbar_sidebar_drawer(trigger) -> rx.Component:
return rx.drawer.root(
rx.drawer.trigger(
trigger,
),
rx.drawer.portal( | def drawer_socials() -> rx.Component:
return rx.box(
social_menu_item("github", GITHUB_URL),
social_menu_item(
"twitter",
TWITTER_URL,
border=True,
),
social_menu_item("discord", DISCORD_URL),
class_name="flex flex-row items-center border-slate-4 border-y-0 !border-b w-full",
) |
ramework
from pcweb.pages.gallery import gallery
from pcweb.pages.hosting.hosting import hosting_landing
def social_menu_item(
icon: str,
url="/",
border: bool = False,
) -> rx.Component:
return rx.link(
get_icon(icon=icon, class_name="!text-slate-9"),
class_name="flex justify-center items-center gap-2 hover:bg-slate-3 px-4 py-[0.875rem] w-full h-[47px] transition-bg overflow-hidden"
+ (" border-slate-4 border-x border-solid border-y-0" if border else ""),
href=url,
is_external=True,
)
def drawer_socials() -> rx.Component:
return rx.box(
social_menu_item("github", GITHUB_URL),
social_menu_item(
"twitter",
TWITTER_URL,
border=True,
),
social_menu_item("discord", DISCORD_URL),
class_name="flex flex-row items-center border-slate-4 border-y-0 !border-b w-full",
)
def drawer_item(text: str, url: str, active_str: str = "") -> rx.Component:
|
if not url.endswith("/"):
url += "/"
active = router_path.contains(active_str)
if active_str == "docs":
active = rx.cond(
router_path.contains("hosting")
| router_path.contains("library")
| router_path.contains("gallery"),
False,
active,
)
if active_str == "":
active = False
return rx.link(
text,
href=url,
underline="none",
color=rx.cond(active, "var(--c-violet-9)", "var(--c-slate-9)"),
class_name="flex justify-center items-center border-slate-4 px-4 py-[0.875rem] border-t-0 border-b border-solid w-full font-small hover:!text-violet-9 border-x-0",
)
def navbar_sidebar_drawer(trigger) -> rx.Component:
return rx.drawer.root(
rx.drawer.trigger(
trigger,
),
rx.drawer.portal(
rx.drawer.content(
rx.box(
drawer_item("Docs", getting_started.introducti | router_path = rx.State.router.page.path |
lery
from pcweb.pages.hosting.hosting import hosting_landing
def social_menu_item(
icon: str,
url="/",
border: bool = False,
) -> rx.Component:
return rx.link(
get_icon(icon=icon, class_name="!text-slate-9"),
class_name="flex justify-center items-center gap-2 hover:bg-slate-3 px-4 py-[0.875rem] w-full h-[47px] transition-bg overflow-hidden"
+ (" border-slate-4 border-x border-solid border-y-0" if border else ""),
href=url,
is_external=True,
)
def drawer_socials() -> rx.Component:
return rx.box(
social_menu_item("github", GITHUB_URL),
social_menu_item(
"twitter",
TWITTER_URL,
border=True,
),
social_menu_item("discord", DISCORD_URL),
class_name="flex flex-row items-center border-slate-4 border-y-0 !border-b w-full",
)
def drawer_item(text: str, url: str, active_str: str = "") -> rx.Component:
router_path = rx.State.router.page.path
|
active = router_path.contains(active_str)
if active_str == "docs":
active = rx.cond(
router_path.contains("hosting")
| router_path.contains("library")
| router_path.contains("gallery"),
False,
active,
)
if active_str == "":
active = False
return rx.link(
text,
href=url,
underline="none",
color=rx.cond(active, "var(--c-violet-9)", "var(--c-slate-9)"),
class_name="flex justify-center items-center border-slate-4 px-4 py-[0.875rem] border-t-0 border-b border-solid w-full font-small hover:!text-violet-9 border-x-0",
)
def navbar_sidebar_drawer(trigger) -> rx.Component:
return rx.drawer.root(
rx.drawer.trigger(
trigger,
),
rx.drawer.portal(
rx.drawer.content(
rx.box(
drawer_item("Docs", getting_started.introduction.path, "docs"),
drawer_item | if not url.endswith("/"):
url += "/" |
ing_landing
def social_menu_item(
icon: str,
url="/",
border: bool = False,
) -> rx.Component:
return rx.link(
get_icon(icon=icon, class_name="!text-slate-9"),
class_name="flex justify-center items-center gap-2 hover:bg-slate-3 px-4 py-[0.875rem] w-full h-[47px] transition-bg overflow-hidden"
+ (" border-slate-4 border-x border-solid border-y-0" if border else ""),
href=url,
is_external=True,
)
def drawer_socials() -> rx.Component:
return rx.box(
social_menu_item("github", GITHUB_URL),
social_menu_item(
"twitter",
TWITTER_URL,
border=True,
),
social_menu_item("discord", DISCORD_URL),
class_name="flex flex-row items-center border-slate-4 border-y-0 !border-b w-full",
)
def drawer_item(text: str, url: str, active_str: str = "") -> rx.Component:
router_path = rx.State.router.page.path
if not url.endswith("/"):
url += "/"
|
if active_str == "docs":
active = rx.cond(
router_path.contains("hosting")
| router_path.contains("library")
| router_path.contains("gallery"),
False,
active,
)
if active_str == "":
active = False
return rx.link(
text,
href=url,
underline="none",
color=rx.cond(active, "var(--c-violet-9)", "var(--c-slate-9)"),
class_name="flex justify-center items-center border-slate-4 px-4 py-[0.875rem] border-t-0 border-b border-solid w-full font-small hover:!text-violet-9 border-x-0",
)
def navbar_sidebar_drawer(trigger) -> rx.Component:
return rx.drawer.root(
rx.drawer.trigger(
trigger,
),
rx.drawer.portal(
rx.drawer.content(
rx.box(
drawer_item("Docs", getting_started.introduction.path, "docs"),
drawer_item("Templates", gallery.path, "gallery"),
| active = router_path.contains(active_str) |
str,
url="/",
border: bool = False,
) -> rx.Component:
return rx.link(
get_icon(icon=icon, class_name="!text-slate-9"),
class_name="flex justify-center items-center gap-2 hover:bg-slate-3 px-4 py-[0.875rem] w-full h-[47px] transition-bg overflow-hidden"
+ (" border-slate-4 border-x border-solid border-y-0" if border else ""),
href=url,
is_external=True,
)
def drawer_socials() -> rx.Component:
return rx.box(
social_menu_item("github", GITHUB_URL),
social_menu_item(
"twitter",
TWITTER_URL,
border=True,
),
social_menu_item("discord", DISCORD_URL),
class_name="flex flex-row items-center border-slate-4 border-y-0 !border-b w-full",
)
def drawer_item(text: str, url: str, active_str: str = "") -> rx.Component:
router_path = rx.State.router.page.path
if not url.endswith("/"):
url += "/"
active = router_path.contains(active_str)
|
if active_str == "":
active = False
return rx.link(
text,
href=url,
underline="none",
color=rx.cond(active, "var(--c-violet-9)", "var(--c-slate-9)"),
class_name="flex justify-center items-center border-slate-4 px-4 py-[0.875rem] border-t-0 border-b border-solid w-full font-small hover:!text-violet-9 border-x-0",
)
def navbar_sidebar_drawer(trigger) -> rx.Component:
return rx.drawer.root(
rx.drawer.trigger(
trigger,
),
rx.drawer.portal(
rx.drawer.content(
rx.box(
drawer_item("Docs", getting_started.introduction.path, "docs"),
drawer_item("Templates", gallery.path, "gallery"),
drawer_item("Blog", blogs.path, "blog"),
drawer_item("Case Studies", "/customers", "customers"),
drawer_item("Components", library.path, "library"),
drawer_item("Open | if active_str == "docs":
active = rx.cond(
router_path.contains("hosting")
| router_path.contains("library")
| router_path.contains("gallery"),
False,
active,
) |
l = False,
) -> rx.Component:
return rx.link(
get_icon(icon=icon, class_name="!text-slate-9"),
class_name="flex justify-center items-center gap-2 hover:bg-slate-3 px-4 py-[0.875rem] w-full h-[47px] transition-bg overflow-hidden"
+ (" border-slate-4 border-x border-solid border-y-0" if border else ""),
href=url,
is_external=True,
)
def drawer_socials() -> rx.Component:
return rx.box(
social_menu_item("github", GITHUB_URL),
social_menu_item(
"twitter",
TWITTER_URL,
border=True,
),
social_menu_item("discord", DISCORD_URL),
class_name="flex flex-row items-center border-slate-4 border-y-0 !border-b w-full",
)
def drawer_item(text: str, url: str, active_str: str = "") -> rx.Component:
router_path = rx.State.router.page.path
if not url.endswith("/"):
url += "/"
active = router_path.contains(active_str)
if active_str == "docs":
|
if active_str == "":
active = False
return rx.link(
text,
href=url,
underline="none",
color=rx.cond(active, "var(--c-violet-9)", "var(--c-slate-9)"),
class_name="flex justify-center items-center border-slate-4 px-4 py-[0.875rem] border-t-0 border-b border-solid w-full font-small hover:!text-violet-9 border-x-0",
)
def navbar_sidebar_drawer(trigger) -> rx.Component:
return rx.drawer.root(
rx.drawer.trigger(
trigger,
),
rx.drawer.portal(
rx.drawer.content(
rx.box(
drawer_item("Docs", getting_started.introduction.path, "docs"),
drawer_item("Templates", gallery.path, "gallery"),
drawer_item("Blog", blogs.path, "blog"),
drawer_item("Case Studies", "/customers", "customers"),
drawer_item("Components", library.path, "library"),
drawer_item("Open | active = rx.cond(
router_path.contains("hosting")
| router_path.contains("library")
| router_path.contains("gallery"),
False,
active,
) |
h-[47px] transition-bg overflow-hidden"
+ (" border-slate-4 border-x border-solid border-y-0" if border else ""),
href=url,
is_external=True,
)
def drawer_socials() -> rx.Component:
return rx.box(
social_menu_item("github", GITHUB_URL),
social_menu_item(
"twitter",
TWITTER_URL,
border=True,
),
social_menu_item("discord", DISCORD_URL),
class_name="flex flex-row items-center border-slate-4 border-y-0 !border-b w-full",
)
def drawer_item(text: str, url: str, active_str: str = "") -> rx.Component:
router_path = rx.State.router.page.path
if not url.endswith("/"):
url += "/"
active = router_path.contains(active_str)
if active_str == "docs":
active = rx.cond(
router_path.contains("hosting")
| router_path.contains("library")
| router_path.contains("gallery"),
False,
active,
)
|
return rx.link(
text,
href=url,
underline="none",
color=rx.cond(active, "var(--c-violet-9)", "var(--c-slate-9)"),
class_name="flex justify-center items-center border-slate-4 px-4 py-[0.875rem] border-t-0 border-b border-solid w-full font-small hover:!text-violet-9 border-x-0",
)
def navbar_sidebar_drawer(trigger) -> rx.Component:
return rx.drawer.root(
rx.drawer.trigger(
trigger,
),
rx.drawer.portal(
rx.drawer.content(
rx.box(
drawer_item("Docs", getting_started.introduction.path, "docs"),
drawer_item("Templates", gallery.path, "gallery"),
drawer_item("Blog", blogs.path, "blog"),
drawer_item("Case Studies", "/customers", "customers"),
drawer_item("Components", library.path, "library"),
drawer_item("Open Source", framework.path, "open-source"),
| if active_str == "":
active = False |
low-hidden"
+ (" border-slate-4 border-x border-solid border-y-0" if border else ""),
href=url,
is_external=True,
)
def drawer_socials() -> rx.Component:
return rx.box(
social_menu_item("github", GITHUB_URL),
social_menu_item(
"twitter",
TWITTER_URL,
border=True,
),
social_menu_item("discord", DISCORD_URL),
class_name="flex flex-row items-center border-slate-4 border-y-0 !border-b w-full",
)
def drawer_item(text: str, url: str, active_str: str = "") -> rx.Component:
router_path = rx.State.router.page.path
if not url.endswith("/"):
url += "/"
active = router_path.contains(active_str)
if active_str == "docs":
active = rx.cond(
router_path.contains("hosting")
| router_path.contains("library")
| router_path.contains("gallery"),
False,
active,
)
if active_str == "":
|
return rx.link(
text,
href=url,
underline="none",
color=rx.cond(active, "var(--c-violet-9)", "var(--c-slate-9)"),
class_name="flex justify-center items-center border-slate-4 px-4 py-[0.875rem] border-t-0 border-b border-solid w-full font-small hover:!text-violet-9 border-x-0",
)
def navbar_sidebar_drawer(trigger) -> rx.Component:
return rx.drawer.root(
rx.drawer.trigger(
trigger,
),
rx.drawer.portal(
rx.drawer.content(
rx.box(
drawer_item("Docs", getting_started.introduction.path, "docs"),
drawer_item("Templates", gallery.path, "gallery"),
drawer_item("Blog", blogs.path, "blog"),
drawer_item("Case Studies", "/customers", "customers"),
drawer_item("Components", library.path, "library"),
drawer_item("Open Source", framework.path, "open-source"),
| active = False |
"""Logic for the sidebar component."""
|
import reflex as rx
from pcweb.components.docpage.navbar.state import NavbarState
from pcweb.styles.colors import c_color
from .sidebar_items.ai import (
ai_builder_integrations,
ai_builder_overview_items,
mcp_items,
)
from .sidebar_items.component_lib import component_lib, graphing_libs
from .sidebar_items.enterprise import (
enterprise_component_items,
enterprise_items,
enterprise_usage_items,
)
from .sidebar_items.learn import backend, cli_ref, frontend, hosting, learn
from .sidebar_items.recipes import recipes
from .sidebar_items.reference import api_reference
from .state import SideBarBase, SideBarItem, SidebarState
Scrollable_SideBar = """
function scrollToActiveSidebarLink() {
const currentPath = window.location.pathname.replace(/\\/+$|\\/$/g, "") + "/";
const activeLink = document.querySelector(`#sidebar-container a[href="${currentPath}"]`) ||
document.querySelector(`#sidebar-container a[href="${currentPath.slice(0, -1)}"]`) | from __future__ import annotations |
"""Logic for the sidebar component."""
from __future__ import annotations
|
from pcweb.components.docpage.navbar.state import NavbarState
from pcweb.styles.colors import c_color
from .sidebar_items.ai import (
ai_builder_integrations,
ai_builder_overview_items,
mcp_items,
)
from .sidebar_items.component_lib import component_lib, graphing_libs
from .sidebar_items.enterprise import (
enterprise_component_items,
enterprise_items,
enterprise_usage_items,
)
from .sidebar_items.learn import backend, cli_ref, frontend, hosting, learn
from .sidebar_items.recipes import recipes
from .sidebar_items.reference import api_reference
from .state import SideBarBase, SideBarItem, SidebarState
Scrollable_SideBar = """
function scrollToActiveSidebarLink() {
const currentPath = window.location.pathname.replace(/\\/+$|\\/$/g, "") + "/";
const activeLink = document.querySelector(`#sidebar-container a[href="${currentPath}"]`) ||
document.querySelector(`#sidebar-container a[href="${currentPath.slice(0, -1)}"]`);
if (activeLink) | import reflex as rx |
"""Logic for the sidebar component."""
from __future__ import annotations
import reflex as rx
|
from pcweb.styles.colors import c_color
from .sidebar_items.ai import (
ai_builder_integrations,
ai_builder_overview_items,
mcp_items,
)
from .sidebar_items.component_lib import component_lib, graphing_libs
from .sidebar_items.enterprise import (
enterprise_component_items,
enterprise_items,
enterprise_usage_items,
)
from .sidebar_items.learn import backend, cli_ref, frontend, hosting, learn
from .sidebar_items.recipes import recipes
from .sidebar_items.reference import api_reference
from .state import SideBarBase, SideBarItem, SidebarState
Scrollable_SideBar = """
function scrollToActiveSidebarLink() {
const currentPath = window.location.pathname.replace(/\\/+$|\\/$/g, "") + "/";
const activeLink = document.querySelector(`#sidebar-container a[href="${currentPath}"]`) ||
document.querySelector(`#sidebar-container a[href="${currentPath.slice(0, -1)}"]`);
if (activeLink) {
activeLink.scrollIntoView({
block: "center",
}) | from pcweb.components.docpage.navbar.state import NavbarState |
"""Logic for the sidebar component."""
from __future__ import annotations
import reflex as rx
from pcweb.components.docpage.navbar.state import NavbarState
|
from .sidebar_items.ai import (
ai_builder_integrations,
ai_builder_overview_items,
mcp_items,
)
from .sidebar_items.component_lib import component_lib, graphing_libs
from .sidebar_items.enterprise import (
enterprise_component_items,
enterprise_items,
enterprise_usage_items,
)
from .sidebar_items.learn import backend, cli_ref, frontend, hosting, learn
from .sidebar_items.recipes import recipes
from .sidebar_items.reference import api_reference
from .state import SideBarBase, SideBarItem, SidebarState
Scrollable_SideBar = """
function scrollToActiveSidebarLink() {
const currentPath = window.location.pathname.replace(/\\/+$|\\/$/g, "") + "/";
const activeLink = document.querySelector(`#sidebar-container a[href="${currentPath}"]`) ||
document.querySelector(`#sidebar-container a[href="${currentPath.slice(0, -1)}"]`);
if (activeLink) {
activeLink.scrollIntoView({
block: "center",
});
}
}
setTimeout(scrollToActiveSideba | from pcweb.styles.colors import c_color |
"""Logic for the sidebar component."""
from __future__ import annotations
import reflex as rx
from pcweb.components.docpage.navbar.state import NavbarState
from pcweb.styles.colors import c_color
|
from .sidebar_items.component_lib import component_lib, graphing_libs
from .sidebar_items.enterprise import (
enterprise_component_items,
enterprise_items,
enterprise_usage_items,
)
from .sidebar_items.learn import backend, cli_ref, frontend, hosting, learn
from .sidebar_items.recipes import recipes
from .sidebar_items.reference import api_reference
from .state import SideBarBase, SideBarItem, SidebarState
Scrollable_SideBar = """
function scrollToActiveSidebarLink() {
const currentPath = window.location.pathname.replace(/\\/+$|\\/$/g, "") + "/";
const activeLink = document.querySelector(`#sidebar-container a[href="${currentPath}"]`) ||
document.querySelector(`#sidebar-container a[href="${currentPath.slice(0, -1)}"]`);
if (activeLink) {
activeLink.scrollIntoView({
block: "center",
});
}
}
setTimeout(scrollToActiveSidebarLink, 100);
window.addEventListener("popstate", () => {
setTimeout(scrollToActiveSidebarLink, 100);
});
d | from .sidebar_items.ai import (
ai_builder_integrations,
ai_builder_overview_items,
mcp_items,
) |
"""Logic for the sidebar component."""
from __future__ import annotations
import reflex as rx
from pcweb.components.docpage.navbar.state import NavbarState
from pcweb.styles.colors import c_color
from .sidebar_items.ai import (
ai_builder_integrations,
ai_builder_overview_items,
mcp_items,
)
|
from .sidebar_items.enterprise import (
enterprise_component_items,
enterprise_items,
enterprise_usage_items,
)
from .sidebar_items.learn import backend, cli_ref, frontend, hosting, learn
from .sidebar_items.recipes import recipes
from .sidebar_items.reference import api_reference
from .state import SideBarBase, SideBarItem, SidebarState
Scrollable_SideBar = """
function scrollToActiveSidebarLink() {
const currentPath = window.location.pathname.replace(/\\/+$|\\/$/g, "") + "/";
const activeLink = document.querySelector(`#sidebar-container a[href="${currentPath}"]`) ||
document.querySelector(`#sidebar-container a[href="${currentPath.slice(0, -1)}"]`);
if (activeLink) {
activeLink.scrollIntoView({
block: "center",
});
}
}
setTimeout(scrollToActiveSidebarLink, 100);
window.addEventListener("popstate", () => {
setTimeout(scrollToActiveSidebarLink, 100);
});
document.addEventListener('click', (e) => {
const link = e.target.clo | from .sidebar_items.component_lib import component_lib, graphing_libs |
"""Logic for the sidebar component."""
from __future__ import annotations
import reflex as rx
from pcweb.components.docpage.navbar.state import NavbarState
from pcweb.styles.colors import c_color
from .sidebar_items.ai import (
ai_builder_integrations,
ai_builder_overview_items,
mcp_items,
)
from .sidebar_items.component_lib import component_lib, graphing_libs
|
from .sidebar_items.learn import backend, cli_ref, frontend, hosting, learn
from .sidebar_items.recipes import recipes
from .sidebar_items.reference import api_reference
from .state import SideBarBase, SideBarItem, SidebarState
Scrollable_SideBar = """
function scrollToActiveSidebarLink() {
const currentPath = window.location.pathname.replace(/\\/+$|\\/$/g, "") + "/";
const activeLink = document.querySelector(`#sidebar-container a[href="${currentPath}"]`) ||
document.querySelector(`#sidebar-container a[href="${currentPath.slice(0, -1)}"]`);
if (activeLink) {
activeLink.scrollIntoView({
block: "center",
});
}
}
setTimeout(scrollToActiveSidebarLink, 100);
window.addEventListener("popstate", () => {
setTimeout(scrollToActiveSidebarLink, 100);
});
document.addEventListener('click', (e) => {
const link = e.target.closest('a[href^="/docs"]');
if (link) {
setTimeout(scrollToActiveSidebarLink, 200);
}
});
"""
def sidebar_link(*chil | from .sidebar_items.enterprise import (
enterprise_component_items,
enterprise_items,
enterprise_usage_items,
) |
"""Logic for the sidebar component."""
from __future__ import annotations
import reflex as rx
from pcweb.components.docpage.navbar.state import NavbarState
from pcweb.styles.colors import c_color
from .sidebar_items.ai import (
ai_builder_integrations,
ai_builder_overview_items,
mcp_items,
)
from .sidebar_items.component_lib import component_lib, graphing_libs
from .sidebar_items.enterprise import (
enterprise_component_items,
enterprise_items,
enterprise_usage_items,
)
|
from .sidebar_items.recipes import recipes
from .sidebar_items.reference import api_reference
from .state import SideBarBase, SideBarItem, SidebarState
Scrollable_SideBar = """
function scrollToActiveSidebarLink() {
const currentPath = window.location.pathname.replace(/\\/+$|\\/$/g, "") + "/";
const activeLink = document.querySelector(`#sidebar-container a[href="${currentPath}"]`) ||
document.querySelector(`#sidebar-container a[href="${currentPath.slice(0, -1)}"]`);
if (activeLink) {
activeLink.scrollIntoView({
block: "center",
});
}
}
setTimeout(scrollToActiveSidebarLink, 100);
window.addEventListener("popstate", () => {
setTimeout(scrollToActiveSidebarLink, 100);
});
document.addEventListener('click', (e) => {
const link = e.target.closest('a[href^="/docs"]');
if (link) {
setTimeout(scrollToActiveSidebarLink, 200);
}
});
"""
def sidebar_link(*children, **props):
"""Create a sidebar link that closes the sidebar when cl | from .sidebar_items.learn import backend, cli_ref, frontend, hosting, learn |
"""Logic for the sidebar component."""
from __future__ import annotations
import reflex as rx
from pcweb.components.docpage.navbar.state import NavbarState
from pcweb.styles.colors import c_color
from .sidebar_items.ai import (
ai_builder_integrations,
ai_builder_overview_items,
mcp_items,
)
from .sidebar_items.component_lib import component_lib, graphing_libs
from .sidebar_items.enterprise import (
enterprise_component_items,
enterprise_items,
enterprise_usage_items,
)
from .sidebar_items.learn import backend, cli_ref, frontend, hosting, learn
|
from .sidebar_items.reference import api_reference
from .state import SideBarBase, SideBarItem, SidebarState
Scrollable_SideBar = """
function scrollToActiveSidebarLink() {
const currentPath = window.location.pathname.replace(/\\/+$|\\/$/g, "") + "/";
const activeLink = document.querySelector(`#sidebar-container a[href="${currentPath}"]`) ||
document.querySelector(`#sidebar-container a[href="${currentPath.slice(0, -1)}"]`);
if (activeLink) {
activeLink.scrollIntoView({
block: "center",
});
}
}
setTimeout(scrollToActiveSidebarLink, 100);
window.addEventListener("popstate", () => {
setTimeout(scrollToActiveSidebarLink, 100);
});
document.addEventListener('click', (e) => {
const link = e.target.closest('a[href^="/docs"]');
if (link) {
setTimeout(scrollToActiveSidebarLink, 200);
}
});
"""
def sidebar_link(*children, **props):
"""Create a sidebar link that closes the sidebar when clicked."""
return rx.link(
*chil | from .sidebar_items.recipes import recipes |
"""Logic for the sidebar component."""
from __future__ import annotations
import reflex as rx
from pcweb.components.docpage.navbar.state import NavbarState
from pcweb.styles.colors import c_color
from .sidebar_items.ai import (
ai_builder_integrations,
ai_builder_overview_items,
mcp_items,
)
from .sidebar_items.component_lib import component_lib, graphing_libs
from .sidebar_items.enterprise import (
enterprise_component_items,
enterprise_items,
enterprise_usage_items,
)
from .sidebar_items.learn import backend, cli_ref, frontend, hosting, learn
from .sidebar_items.recipes import recipes
|
from .state import SideBarBase, SideBarItem, SidebarState
Scrollable_SideBar = """
function scrollToActiveSidebarLink() {
const currentPath = window.location.pathname.replace(/\\/+$|\\/$/g, "") + "/";
const activeLink = document.querySelector(`#sidebar-container a[href="${currentPath}"]`) ||
document.querySelector(`#sidebar-container a[href="${currentPath.slice(0, -1)}"]`);
if (activeLink) {
activeLink.scrollIntoView({
block: "center",
});
}
}
setTimeout(scrollToActiveSidebarLink, 100);
window.addEventListener("popstate", () => {
setTimeout(scrollToActiveSidebarLink, 100);
});
document.addEventListener('click', (e) => {
const link = e.target.closest('a[href^="/docs"]');
if (link) {
setTimeout(scrollToActiveSidebarLink, 200);
}
});
"""
def sidebar_link(*children, **props):
"""Create a sidebar link that closes the sidebar when clicked."""
return rx.link(
*children,
on_click=props.pop("on_click", Navbar | from .sidebar_items.reference import api_reference |
"""Logic for the sidebar component."""
from __future__ import annotations
import reflex as rx
from pcweb.components.docpage.navbar.state import NavbarState
from pcweb.styles.colors import c_color
from .sidebar_items.ai import (
ai_builder_integrations,
ai_builder_overview_items,
mcp_items,
)
from .sidebar_items.component_lib import component_lib, graphing_libs
from .sidebar_items.enterprise import (
enterprise_component_items,
enterprise_items,
enterprise_usage_items,
)
from .sidebar_items.learn import backend, cli_ref, frontend, hosting, learn
from .sidebar_items.recipes import recipes
from .sidebar_items.reference import api_reference
|
Scrollable_SideBar = """
function scrollToActiveSidebarLink() {
const currentPath = window.location.pathname.replace(/\\/+$|\\/$/g, "") + "/";
const activeLink = document.querySelector(`#sidebar-container a[href="${currentPath}"]`) ||
document.querySelector(`#sidebar-container a[href="${currentPath.slice(0, -1)}"]`);
if (activeLink) {
activeLink.scrollIntoView({
block: "center",
});
}
}
setTimeout(scrollToActiveSidebarLink, 100);
window.addEventListener("popstate", () => {
setTimeout(scrollToActiveSidebarLink, 100);
});
document.addEventListener('click', (e) => {
const link = e.target.closest('a[href^="/docs"]');
if (link) {
setTimeout(scrollToActiveSidebarLink, 200);
}
});
"""
def sidebar_link(*children, **props):
"""Create a sidebar link that closes the sidebar when clicked."""
return rx.link(
*children,
on_click=props.pop("on_click", NavbarState.set_sidebar_open(False)),
underline="none",
| from .state import SideBarBase, SideBarItem, SidebarState |
"""Logic for the sidebar component."""
from __future__ import annotations
import reflex as rx
from pcweb.components.docpage.navbar.state import NavbarState
from pcweb.styles.colors import c_color
from .sidebar_items.ai import (
ai_builder_integrations,
ai_builder_overview_items,
mcp_items,
)
from .sidebar_items.component_lib import component_lib, graphing_libs
from .sidebar_items.enterprise import (
enterprise_component_items,
enterprise_items,
enterprise_usage_items,
)
from .sidebar_items.learn import backend, cli_ref, frontend, hosting, learn
from .sidebar_items.recipes import recipes
from .sidebar_items.reference import api_reference
from .state import SideBarBase, SideBarItem, SidebarState
|
def sidebar_link(*children, **props):
"""Create a sidebar link that closes the sidebar when clicked."""
return rx.link(
*children,
on_click=props.pop("on_click", NavbarState.set_sidebar_open(False)),
underline="none",
**props,
)
def sidebar_leaf(
item_index: str,
item: SideBarItem,
url: str,
) -> rx.Component:
"""Get the leaf node of the sidebar."""
item.link = item.link.replace("_", "-").rstrip("/") + "/"
return (
rx.accordion.item(
rx.accordion.header(
sidebar_link(
rx.flex(
rx.text(
item.names,
color=rx.cond(
item.link == url,
c_color("violet", 9),
c_color("slate", 9),
),
_hover={
"color": c_color | Scrollable_SideBar = """
function scrollToActiveSidebarLink() {
const currentPath = window.location.pathname.replace(/\\/+$|\\/$/g, "") + "/";
const activeLink = document.querySelector(`#sidebar-container a[href="${currentPath}"]`) ||
document.querySelector(`#sidebar-container a[href="${currentPath.slice(0, -1)}"]`);
if (activeLink) {
activeLink.scrollIntoView({
block: "center",
});
}
}
setTimeout(scrollToActiveSidebarLink, 100);
window.addEventListener("popstate", () => {
setTimeout(scrollToActiveSidebarLink, 100);
});
document.addEventListener('click', (e) => {
const link = e.target.closest('a[href^="/docs"]');
if (link) {
setTimeout(scrollToActiveSidebarLink, 200);
}
});
""" |
erprise_usage_items,
)
from .sidebar_items.learn import backend, cli_ref, frontend, hosting, learn
from .sidebar_items.recipes import recipes
from .sidebar_items.reference import api_reference
from .state import SideBarBase, SideBarItem, SidebarState
Scrollable_SideBar = """
function scrollToActiveSidebarLink() {
const currentPath = window.location.pathname.replace(/\\/+$|\\/$/g, "") + "/";
const activeLink = document.querySelector(`#sidebar-container a[href="${currentPath}"]`) ||
document.querySelector(`#sidebar-container a[href="${currentPath.slice(0, -1)}"]`);
if (activeLink) {
activeLink.scrollIntoView({
block: "center",
});
}
}
setTimeout(scrollToActiveSidebarLink, 100);
window.addEventListener("popstate", () => {
setTimeout(scrollToActiveSidebarLink, 100);
});
document.addEventListener('click', (e) => {
const link = e.target.closest('a[href^="/docs"]');
if (link) {
setTimeout(scrollToActiveSidebarLink, 200);
}
});
"""
|
def sidebar_leaf(
item_index: str,
item: SideBarItem,
url: str,
) -> rx.Component:
"""Get the leaf node of the sidebar."""
item.link = item.link.replace("_", "-").rstrip("/") + "/"
return (
rx.accordion.item(
rx.accordion.header(
sidebar_link(
rx.flex(
rx.text(
item.names,
color=rx.cond(
item.link == url,
c_color("violet", 9),
c_color("slate", 9),
),
_hover={
"color": c_color("slate", 11),
},
margin="0.5em 0.5em 0.2em 0.5em",
width="100%",
class_name="transition-color",
),
),
| def sidebar_link(*children, **props):
"""Create a sidebar link that closes the sidebar when clicked."""
return rx.link(
*children,
on_click=props.pop("on_click", NavbarState.set_sidebar_open(False)),
underline="none",
**props,
) |
"
function scrollToActiveSidebarLink() {
const currentPath = window.location.pathname.replace(/\\/+$|\\/$/g, "") + "/";
const activeLink = document.querySelector(`#sidebar-container a[href="${currentPath}"]`) ||
document.querySelector(`#sidebar-container a[href="${currentPath.slice(0, -1)}"]`);
if (activeLink) {
activeLink.scrollIntoView({
block: "center",
});
}
}
setTimeout(scrollToActiveSidebarLink, 100);
window.addEventListener("popstate", () => {
setTimeout(scrollToActiveSidebarLink, 100);
});
document.addEventListener('click', (e) => {
const link = e.target.closest('a[href^="/docs"]');
if (link) {
setTimeout(scrollToActiveSidebarLink, 200);
}
});
"""
def sidebar_link(*children, **props):
"""Create a sidebar link that closes the sidebar when clicked."""
return rx.link(
*children,
on_click=props.pop("on_click", NavbarState.set_sidebar_open(False)),
underline="none",
**props,
)
|
def sidebar_icon(name):
icon_map = {
"Getting Started": "rocket",
"Advanced Onboarding": "newspaper",
"Components": "layers",
"Pages": "sticky-note",
"Styling": "palette",
"Assets": "folder-open-dot",
"Wrapping React": "atom",
"Vars": "variable",
"Events": "arrow-left-right",
"State Structure": "boxes",
"API Routes": "route",
"Client Storage": "package-open",
"Database": "database",
"Authentication": "lock-keyhole",
"Utility Methods": "cog",
"Deploy Quick Start": "earth",
"CLI Reference": "square-terminal",
"App": "blocks",
"Project": "server",
"Self Hosting": "server",
"Custom Components": "blocks",
"Usage": "chart-column",
}
return (
rx.icon(tag=icon_map.get(name), size=16, class_name="mr-5")
if name in icon_map
else rx.fragment()
)
def sidebar_item_comp(
item_i | def sidebar_leaf(
item_index: str,
item: SideBarItem,
url: str,
) -> rx.Component:
"""Get the leaf node of the sidebar."""
item.link = item.link.replace("_", "-").rstrip("/") + "/"
return (
rx.accordion.item(
rx.accordion.header(
sidebar_link(
rx.flex(
rx.text(
item.names,
color=rx.cond(
item.link == url,
c_color("violet", 9),
c_color("slate", 9),
),
_hover={
"color": c_color("slate", 11),
},
margin="0.5em 0.5em 0.2em 0.5em",
width="100%",
class_name="transition-color",
),
),
href=item.link,
),
),
value=item_index,
border="none",
width="100%",
class_name="!overflow-visible",
)
if item.outer
else rx.accordion.item(
rx.accordion.header(
rx.cond(
item.link == url,
sidebar_link(
rx.flex(
rx.text(
item.names,
class_name="font-small text-violet-9 transition-color",
),
padding="0px 8px 0px 28px",
class_name="border-l-[1.5px] border-violet-9",
),
href=item.link,
),
sidebar_link(
rx.flex(
rx.text(
item.names,
class_name="font-small text-slate-9 transition-color hover:text-slate-11 w-full",
),
padding="0px 8px 0px 28px",
class_name="border-l-[1.5px] border-slate-4 hover:border-slate-8",
),
href=item.link,
),
),
),
border="none",
value=item_index,
width="100%",
class_name="!overflow-visible",
)
) |
document.querySelector(`#sidebar-container a[href="${currentPath}"]`) ||
document.querySelector(`#sidebar-container a[href="${currentPath.slice(0, -1)}"]`);
if (activeLink) {
activeLink.scrollIntoView({
block: "center",
});
}
}
setTimeout(scrollToActiveSidebarLink, 100);
window.addEventListener("popstate", () => {
setTimeout(scrollToActiveSidebarLink, 100);
});
document.addEventListener('click', (e) => {
const link = e.target.closest('a[href^="/docs"]');
if (link) {
setTimeout(scrollToActiveSidebarLink, 200);
}
});
"""
def sidebar_link(*children, **props):
"""Create a sidebar link that closes the sidebar when clicked."""
return rx.link(
*children,
on_click=props.pop("on_click", NavbarState.set_sidebar_open(False)),
underline="none",
**props,
)
def sidebar_leaf(
item_index: str,
item: SideBarItem,
url: str,
) -> rx.Component:
"""Get the leaf node of the sidebar."""
|
return (
rx.accordion.item(
rx.accordion.header(
sidebar_link(
rx.flex(
rx.text(
item.names,
color=rx.cond(
item.link == url,
c_color("violet", 9),
c_color("slate", 9),
),
_hover={
"color": c_color("slate", 11),
},
margin="0.5em 0.5em 0.2em 0.5em",
width="100%",
class_name="transition-color",
),
),
href=item.link,
),
),
value=item_index,
border="none",
width="100%",
class_name="!overflow-visible",
)
if i | item.link = item.link.replace("_", "-").rstrip("/") + "/" |
l text-violet-9 transition-color",
),
padding="0px 8px 0px 28px",
class_name="border-l-[1.5px] border-violet-9",
),
href=item.link,
),
sidebar_link(
rx.flex(
rx.text(
item.names,
class_name="font-small text-slate-9 transition-color hover:text-slate-11 w-full",
),
padding="0px 8px 0px 28px",
class_name="border-l-[1.5px] border-slate-4 hover:border-slate-8",
),
href=item.link,
),
),
),
border="none",
value=item_index,
width="100%",
class_name="!overflow-visible",
)
)
|
def sidebar_item_comp(
item_index: str,
item: SideBarItem,
index: list[int],
url: str,
):
index = rx.Var.create(index)
return (
sidebar_leaf(item_index=item_index, item=item, url=url)
if not item.children
else rx.accordion.item(
rx.accordion.header(
rx.accordion.trigger(
sidebar_icon(item.names),
rx.text(
item.names,
class_name="font-small",
),
rx.box(class_name="flex-grow"),
rx.accordion.icon(
class_name="size-4 !text-slate-9 group-hover:!text-violet-9"
),
class_name="!px-0 flex items-center !bg-transparent !hover:bg-transparent !py-2 !pr-0 w-full !text-slate-9 aria-expanded:text-slate-11 hover:!text-slate-11 transition-color group",
),
),
rx.accordion.content | def sidebar_icon(name):
icon_map = {
"Getting Started": "rocket",
"Advanced Onboarding": "newspaper",
"Components": "layers",
"Pages": "sticky-note",
"Styling": "palette",
"Assets": "folder-open-dot",
"Wrapping React": "atom",
"Vars": "variable",
"Events": "arrow-left-right",
"State Structure": "boxes",
"API Routes": "route",
"Client Storage": "package-open",
"Database": "database",
"Authentication": "lock-keyhole",
"Utility Methods": "cog",
"Deploy Quick Start": "earth",
"CLI Reference": "square-terminal",
"App": "blocks",
"Project": "server",
"Self Hosting": "server",
"Custom Components": "blocks",
"Usage": "chart-column",
}
return (
rx.icon(tag=icon_map.get(name), size=16, class_name="mr-5")
if name in icon_map
else rx.fragment()
) |
olor",
),
padding="0px 8px 0px 28px",
class_name="border-l-[1.5px] border-violet-9",
),
href=item.link,
),
sidebar_link(
rx.flex(
rx.text(
item.names,
class_name="font-small text-slate-9 transition-color hover:text-slate-11 w-full",
),
padding="0px 8px 0px 28px",
class_name="border-l-[1.5px] border-slate-4 hover:border-slate-8",
),
href=item.link,
),
),
),
border="none",
value=item_index,
width="100%",
class_name="!overflow-visible",
)
)
def sidebar_icon(name):
|
return (
rx.icon(tag=icon_map.get(name), size=16, class_name="mr-5")
if name in icon_map
else rx.fragment()
)
def sidebar_item_comp(
item_index: str,
item: SideBarItem,
index: list[int],
url: str,
):
index = rx.Var.create(index)
return (
sidebar_leaf(item_index=item_index, item=item, url=url)
if not item.children
else rx.accordion.item(
rx.accordion.header(
rx.accordion.trigger(
sidebar_icon(item.names),
rx.text(
item.names,
class_name="font-small",
),
rx.box(class_name="flex-grow"),
rx.accordion.icon(
class_name="size-4 !text-slate-9 group-hover:!text-violet-9"
),
class_name="!px-0 flex items-center !bg-transparent !hover:bg-transparent !py-2 !pr-0 w-full !text-slate | icon_map = {
"Getting Started": "rocket",
"Advanced Onboarding": "newspaper",
"Components": "layers",
"Pages": "sticky-note",
"Styling": "palette",
"Assets": "folder-open-dot",
"Wrapping React": "atom",
"Vars": "variable",
"Events": "arrow-left-right",
"State Structure": "boxes",
"API Routes": "route",
"Client Storage": "package-open",
"Database": "database",
"Authentication": "lock-keyhole",
"Utility Methods": "cog",
"Deploy Quick Start": "earth",
"CLI Reference": "square-terminal",
"App": "blocks",
"Project": "server",
"Self Hosting": "server",
"Custom Components": "blocks",
"Usage": "chart-column",
} |
verflow-visible",
)
)
def sidebar_icon(name):
icon_map = {
"Getting Started": "rocket",
"Advanced Onboarding": "newspaper",
"Components": "layers",
"Pages": "sticky-note",
"Styling": "palette",
"Assets": "folder-open-dot",
"Wrapping React": "atom",
"Vars": "variable",
"Events": "arrow-left-right",
"State Structure": "boxes",
"API Routes": "route",
"Client Storage": "package-open",
"Database": "database",
"Authentication": "lock-keyhole",
"Utility Methods": "cog",
"Deploy Quick Start": "earth",
"CLI Reference": "square-terminal",
"App": "blocks",
"Project": "server",
"Self Hosting": "server",
"Custom Components": "blocks",
"Usage": "chart-column",
}
return (
rx.icon(tag=icon_map.get(name), size=16, class_name="mr-5")
if name in icon_map
else rx.fragment()
)
|
def calculate_index(sidebar_items, url: str) -> list[int]:
sidebar_items = (
sidebar_items if isinstance(sidebar_items, list) else [sidebar_items]
)
index_list = []
if not url:
return index_list
url = url.rstrip("/") + "/"
for item in sidebar_items:
item.link = item.link.rstrip("/") + "/"
sub = 0
for i, item in enumerate(sidebar_items):
if not item.children:
sub += 1
if item.link == url:
return [i - sub]
index = calculate_index(item.children, url)
if index:
return [i - sub, *index]
return index_list
def append_to_items(items, flat_items):
for item in items:
if not item.children:
flat_items.append(item)
append_to_items(item.children, flat_items)
flat_items = []
append_to_items(
learn
+ frontend
+ backend
+ hosting
+ component_lib
+ graphing_libs
+ recipes
+ ai_builder_overview_items
+ | def sidebar_item_comp(
item_index: str,
item: SideBarItem,
index: list[int],
url: str,
):
index = rx.Var.create(index)
return (
sidebar_leaf(item_index=item_index, item=item, url=url)
if not item.children
else rx.accordion.item(
rx.accordion.header(
rx.accordion.trigger(
sidebar_icon(item.names),
rx.text(
item.names,
class_name="font-small",
),
rx.box(class_name="flex-grow"),
rx.accordion.icon(
class_name="size-4 !text-slate-9 group-hover:!text-violet-9"
),
class_name="!px-0 flex items-center !bg-transparent !hover:bg-transparent !py-2 !pr-0 w-full !text-slate-9 aria-expanded:text-slate-11 hover:!text-slate-11 transition-color group",
),
),
rx.accordion.content(
rx.accordion.root(
*[
sidebar_item_comp(
item_index="index" + str(child_index),
item=child,
index=index[1:],
url=url,
)
for child_index, child in enumerate(item.children)
],
type="multiple",
collapsible=True,
default_value=index[:1].foreach(lambda x: "index" + x.to_string()),
class_name="!my-2 flex flex-col items-start gap-4 !ml-[10px] list-none [box-shadow:inset_1.25px_0_0_0_var(--c-slate-4)_!important] !bg-transparent !rounded-none",
),
class_name="!p-0 w-full !bg-transparent before:!h-0 after:!h-0",
),
value=item_index,
class_name="border-none w-full !bg-transparent",
)
) |
t",
"Advanced Onboarding": "newspaper",
"Components": "layers",
"Pages": "sticky-note",
"Styling": "palette",
"Assets": "folder-open-dot",
"Wrapping React": "atom",
"Vars": "variable",
"Events": "arrow-left-right",
"State Structure": "boxes",
"API Routes": "route",
"Client Storage": "package-open",
"Database": "database",
"Authentication": "lock-keyhole",
"Utility Methods": "cog",
"Deploy Quick Start": "earth",
"CLI Reference": "square-terminal",
"App": "blocks",
"Project": "server",
"Self Hosting": "server",
"Custom Components": "blocks",
"Usage": "chart-column",
}
return (
rx.icon(tag=icon_map.get(name), size=16, class_name="mr-5")
if name in icon_map
else rx.fragment()
)
def sidebar_item_comp(
item_index: str,
item: SideBarItem,
index: list[int],
url: str,
):
|
return (
sidebar_leaf(item_index=item_index, item=item, url=url)
if not item.children
else rx.accordion.item(
rx.accordion.header(
rx.accordion.trigger(
sidebar_icon(item.names),
rx.text(
item.names,
class_name="font-small",
),
rx.box(class_name="flex-grow"),
rx.accordion.icon(
class_name="size-4 !text-slate-9 group-hover:!text-violet-9"
),
class_name="!px-0 flex items-center !bg-transparent !hover:bg-transparent !py-2 !pr-0 w-full !text-slate-9 aria-expanded:text-slate-11 hover:!text-slate-11 transition-color group",
),
),
rx.accordion.content(
rx.accordion.root(
*[
sidebar_item_comp(
item_index | index = rx.Var.create(index) |
ordion.content(
rx.accordion.root(
*[
sidebar_item_comp(
item_index="index" + str(child_index),
item=child,
index=index[1:],
url=url,
)
for child_index, child in enumerate(item.children)
],
type="multiple",
collapsible=True,
default_value=index[:1].foreach(lambda x: "index" + x.to_string()),
class_name="!my-2 flex flex-col items-start gap-4 !ml-[10px] list-none [box-shadow:inset_1.25px_0_0_0_var(--c-slate-4)_!important] !bg-transparent !rounded-none",
),
class_name="!p-0 w-full !bg-transparent before:!h-0 after:!h-0",
),
value=item_index,
class_name="border-none w-full !bg-transparent",
)
)
|
def append_to_items(items, flat_items):
for item in items:
if not item.children:
flat_items.append(item)
append_to_items(item.children, flat_items)
flat_items = []
append_to_items(
learn
+ frontend
+ backend
+ hosting
+ component_lib
+ graphing_libs
+ recipes
+ ai_builder_overview_items
+ ai_builder_integrations
+ api_reference
+ enterprise_items,
flat_items,
)
def get_prev_next(url):
"""Get the previous and next links in the sidebar."""
url = url.strip("/")
for i, item in enumerate(flat_items):
if item.link.strip("/") == url:
prev_link = flat_items[i - 1] if i > 0 else None
next_link = flat_items[i + 1] if i < len(flat_items) - 1 else None
return prev_link, next_link
return None, None
def filter_out_non_sidebar_items(items: list[SideBarBase]) -> list[SideBarItem]:
"""Filter out non-sidebar items making sure only SideBarItems are prese | def calculate_index(sidebar_items, url: str) -> list[int]:
sidebar_items = (
sidebar_items if isinstance(sidebar_items, list) else [sidebar_items]
)
index_list = []
if not url:
return index_list
url = url.rstrip("/") + "/"
for item in sidebar_items:
item.link = item.link.rstrip("/") + "/"
sub = 0
for i, item in enumerate(sidebar_items):
if not item.children:
sub += 1
if item.link == url:
return [i - sub]
index = calculate_index(item.children, url)
if index:
return [i - sub, *index]
return index_list |
*[
sidebar_item_comp(
item_index="index" + str(child_index),
item=child,
index=index[1:],
url=url,
)
for child_index, child in enumerate(item.children)
],
type="multiple",
collapsible=True,
default_value=index[:1].foreach(lambda x: "index" + x.to_string()),
class_name="!my-2 flex flex-col items-start gap-4 !ml-[10px] list-none [box-shadow:inset_1.25px_0_0_0_var(--c-slate-4)_!important] !bg-transparent !rounded-none",
),
class_name="!p-0 w-full !bg-transparent before:!h-0 after:!h-0",
),
value=item_index,
class_name="border-none w-full !bg-transparent",
)
)
def calculate_index(sidebar_items, url: str) -> list[int]:
|
index_list = []
if not url:
return index_list
url = url.rstrip("/") + "/"
for item in sidebar_items:
item.link = item.link.rstrip("/") + "/"
sub = 0
for i, item in enumerate(sidebar_items):
if not item.children:
sub += 1
if item.link == url:
return [i - sub]
index = calculate_index(item.children, url)
if index:
return [i - sub, *index]
return index_list
def append_to_items(items, flat_items):
for item in items:
if not item.children:
flat_items.append(item)
append_to_items(item.children, flat_items)
flat_items = []
append_to_items(
learn
+ frontend
+ backend
+ hosting
+ component_lib
+ graphing_libs
+ recipes
+ ai_builder_overview_items
+ ai_builder_integrations
+ api_reference
+ enterprise_items,
flat_items,
)
def get_prev_next(url):
"""Get the previous and next links in the sidebar. | sidebar_items = (
sidebar_items if isinstance(sidebar_items, list) else [sidebar_items]
) |
(child_index),
item=child,
index=index[1:],
url=url,
)
for child_index, child in enumerate(item.children)
],
type="multiple",
collapsible=True,
default_value=index[:1].foreach(lambda x: "index" + x.to_string()),
class_name="!my-2 flex flex-col items-start gap-4 !ml-[10px] list-none [box-shadow:inset_1.25px_0_0_0_var(--c-slate-4)_!important] !bg-transparent !rounded-none",
),
class_name="!p-0 w-full !bg-transparent before:!h-0 after:!h-0",
),
value=item_index,
class_name="border-none w-full !bg-transparent",
)
)
def calculate_index(sidebar_items, url: str) -> list[int]:
sidebar_items = (
sidebar_items if isinstance(sidebar_items, list) else [sidebar_items]
)
|
if not url:
return index_list
url = url.rstrip("/") + "/"
for item in sidebar_items:
item.link = item.link.rstrip("/") + "/"
sub = 0
for i, item in enumerate(sidebar_items):
if not item.children:
sub += 1
if item.link == url:
return [i - sub]
index = calculate_index(item.children, url)
if index:
return [i - sub, *index]
return index_list
def append_to_items(items, flat_items):
for item in items:
if not item.children:
flat_items.append(item)
append_to_items(item.children, flat_items)
flat_items = []
append_to_items(
learn
+ frontend
+ backend
+ hosting
+ component_lib
+ graphing_libs
+ recipes
+ ai_builder_overview_items
+ ai_builder_integrations
+ api_reference
+ enterprise_items,
flat_items,
)
def get_prev_next(url):
"""Get the previous and next links in the sidebar."""
url = url.st | index_list = [] |
item=child,
index=index[1:],
url=url,
)
for child_index, child in enumerate(item.children)
],
type="multiple",
collapsible=True,
default_value=index[:1].foreach(lambda x: "index" + x.to_string()),
class_name="!my-2 flex flex-col items-start gap-4 !ml-[10px] list-none [box-shadow:inset_1.25px_0_0_0_var(--c-slate-4)_!important] !bg-transparent !rounded-none",
),
class_name="!p-0 w-full !bg-transparent before:!h-0 after:!h-0",
),
value=item_index,
class_name="border-none w-full !bg-transparent",
)
)
def calculate_index(sidebar_items, url: str) -> list[int]:
sidebar_items = (
sidebar_items if isinstance(sidebar_items, list) else [sidebar_items]
)
index_list = []
|
url = url.rstrip("/") + "/"
for item in sidebar_items:
item.link = item.link.rstrip("/") + "/"
sub = 0
for i, item in enumerate(sidebar_items):
if not item.children:
sub += 1
if item.link == url:
return [i - sub]
index = calculate_index(item.children, url)
if index:
return [i - sub, *index]
return index_list
def append_to_items(items, flat_items):
for item in items:
if not item.children:
flat_items.append(item)
append_to_items(item.children, flat_items)
flat_items = []
append_to_items(
learn
+ frontend
+ backend
+ hosting
+ component_lib
+ graphing_libs
+ recipes
+ ai_builder_overview_items
+ ai_builder_integrations
+ api_reference
+ enterprise_items,
flat_items,
)
def get_prev_next(url):
"""Get the previous and next links in the sidebar."""
url = url.strip("/")
for i, item in enumerate(flat_ | if not url:
return index_list |
index=index[1:],
url=url,
)
for child_index, child in enumerate(item.children)
],
type="multiple",
collapsible=True,
default_value=index[:1].foreach(lambda x: "index" + x.to_string()),
class_name="!my-2 flex flex-col items-start gap-4 !ml-[10px] list-none [box-shadow:inset_1.25px_0_0_0_var(--c-slate-4)_!important] !bg-transparent !rounded-none",
),
class_name="!p-0 w-full !bg-transparent before:!h-0 after:!h-0",
),
value=item_index,
class_name="border-none w-full !bg-transparent",
)
)
def calculate_index(sidebar_items, url: str) -> list[int]:
sidebar_items = (
sidebar_items if isinstance(sidebar_items, list) else [sidebar_items]
)
index_list = []
if not url:
return index_list
|
for item in sidebar_items:
item.link = item.link.rstrip("/") + "/"
sub = 0
for i, item in enumerate(sidebar_items):
if not item.children:
sub += 1
if item.link == url:
return [i - sub]
index = calculate_index(item.children, url)
if index:
return [i - sub, *index]
return index_list
def append_to_items(items, flat_items):
for item in items:
if not item.children:
flat_items.append(item)
append_to_items(item.children, flat_items)
flat_items = []
append_to_items(
learn
+ frontend
+ backend
+ hosting
+ component_lib
+ graphing_libs
+ recipes
+ ai_builder_overview_items
+ ai_builder_integrations
+ api_reference
+ enterprise_items,
flat_items,
)
def get_prev_next(url):
"""Get the previous and next links in the sidebar."""
url = url.strip("/")
for i, item in enumerate(flat_items):
if item.link.stri | url = url.rstrip("/") + "/" |
:],
url=url,
)
for child_index, child in enumerate(item.children)
],
type="multiple",
collapsible=True,
default_value=index[:1].foreach(lambda x: "index" + x.to_string()),
class_name="!my-2 flex flex-col items-start gap-4 !ml-[10px] list-none [box-shadow:inset_1.25px_0_0_0_var(--c-slate-4)_!important] !bg-transparent !rounded-none",
),
class_name="!p-0 w-full !bg-transparent before:!h-0 after:!h-0",
),
value=item_index,
class_name="border-none w-full !bg-transparent",
)
)
def calculate_index(sidebar_items, url: str) -> list[int]:
sidebar_items = (
sidebar_items if isinstance(sidebar_items, list) else [sidebar_items]
)
index_list = []
if not url:
return index_list
url = url.rstrip("/") + "/"
|
sub = 0
for i, item in enumerate(sidebar_items):
if not item.children:
sub += 1
if item.link == url:
return [i - sub]
index = calculate_index(item.children, url)
if index:
return [i - sub, *index]
return index_list
def append_to_items(items, flat_items):
for item in items:
if not item.children:
flat_items.append(item)
append_to_items(item.children, flat_items)
flat_items = []
append_to_items(
learn
+ frontend
+ backend
+ hosting
+ component_lib
+ graphing_libs
+ recipes
+ ai_builder_overview_items
+ ai_builder_integrations
+ api_reference
+ enterprise_items,
flat_items,
)
def get_prev_next(url):
"""Get the previous and next links in the sidebar."""
url = url.strip("/")
for i, item in enumerate(flat_items):
if item.link.strip("/") == url:
prev_link = flat_items[i - 1] if i > 0 else None
| for item in sidebar_items:
item.link = item.link.rstrip("/") + "/" |
=url,
)
for child_index, child in enumerate(item.children)
],
type="multiple",
collapsible=True,
default_value=index[:1].foreach(lambda x: "index" + x.to_string()),
class_name="!my-2 flex flex-col items-start gap-4 !ml-[10px] list-none [box-shadow:inset_1.25px_0_0_0_var(--c-slate-4)_!important] !bg-transparent !rounded-none",
),
class_name="!p-0 w-full !bg-transparent before:!h-0 after:!h-0",
),
value=item_index,
class_name="border-none w-full !bg-transparent",
)
)
def calculate_index(sidebar_items, url: str) -> list[int]:
sidebar_items = (
sidebar_items if isinstance(sidebar_items, list) else [sidebar_items]
)
index_list = []
if not url:
return index_list
url = url.rstrip("/") + "/"
for item in sidebar_items:
|
sub = 0
for i, item in enumerate(sidebar_items):
if not item.children:
sub += 1
if item.link == url:
return [i - sub]
index = calculate_index(item.children, url)
if index:
return [i - sub, *index]
return index_list
def append_to_items(items, flat_items):
for item in items:
if not item.children:
flat_items.append(item)
append_to_items(item.children, flat_items)
flat_items = []
append_to_items(
learn
+ frontend
+ backend
+ hosting
+ component_lib
+ graphing_libs
+ recipes
+ ai_builder_overview_items
+ ai_builder_integrations
+ api_reference
+ enterprise_items,
flat_items,
)
def get_prev_next(url):
"""Get the previous and next links in the sidebar."""
url = url.strip("/")
for i, item in enumerate(flat_items):
if item.link.strip("/") == url:
prev_link = flat_items[i - 1] if i > 0 else None
| item.link = item.link.rstrip("/") + "/" |
for child_index, child in enumerate(item.children)
],
type="multiple",
collapsible=True,
default_value=index[:1].foreach(lambda x: "index" + x.to_string()),
class_name="!my-2 flex flex-col items-start gap-4 !ml-[10px] list-none [box-shadow:inset_1.25px_0_0_0_var(--c-slate-4)_!important] !bg-transparent !rounded-none",
),
class_name="!p-0 w-full !bg-transparent before:!h-0 after:!h-0",
),
value=item_index,
class_name="border-none w-full !bg-transparent",
)
)
def calculate_index(sidebar_items, url: str) -> list[int]:
sidebar_items = (
sidebar_items if isinstance(sidebar_items, list) else [sidebar_items]
)
index_list = []
if not url:
return index_list
url = url.rstrip("/") + "/"
for item in sidebar_items:
item.link = item.link.rstrip("/") + "/"
sub = 0
|
return index_list
def append_to_items(items, flat_items):
for item in items:
if not item.children:
flat_items.append(item)
append_to_items(item.children, flat_items)
flat_items = []
append_to_items(
learn
+ frontend
+ backend
+ hosting
+ component_lib
+ graphing_libs
+ recipes
+ ai_builder_overview_items
+ ai_builder_integrations
+ api_reference
+ enterprise_items,
flat_items,
)
def get_prev_next(url):
"""Get the previous and next links in the sidebar."""
url = url.strip("/")
for i, item in enumerate(flat_items):
if item.link.strip("/") == url:
prev_link = flat_items[i - 1] if i > 0 else None
next_link = flat_items[i + 1] if i < len(flat_items) - 1 else None
return prev_link, next_link
return None, None
def filter_out_non_sidebar_items(items: list[SideBarBase]) -> list[SideBarItem]:
"""Filter out non-sidebar items making sure only | for i, item in enumerate(sidebar_items):
if not item.children:
sub += 1
if item.link == url:
return [i - sub]
index = calculate_index(item.children, url)
if index:
return [i - sub, *index] |
)
],
type="multiple",
collapsible=True,
default_value=index[:1].foreach(lambda x: "index" + x.to_string()),
class_name="!my-2 flex flex-col items-start gap-4 !ml-[10px] list-none [box-shadow:inset_1.25px_0_0_0_var(--c-slate-4)_!important] !bg-transparent !rounded-none",
),
class_name="!p-0 w-full !bg-transparent before:!h-0 after:!h-0",
),
value=item_index,
class_name="border-none w-full !bg-transparent",
)
)
def calculate_index(sidebar_items, url: str) -> list[int]:
sidebar_items = (
sidebar_items if isinstance(sidebar_items, list) else [sidebar_items]
)
index_list = []
if not url:
return index_list
url = url.rstrip("/") + "/"
for item in sidebar_items:
item.link = item.link.rstrip("/") + "/"
sub = 0
for i, item in enumerate(sidebar_items):
|
if item.link == url:
return [i - sub]
index = calculate_index(item.children, url)
if index:
return [i - sub, *index]
return index_list
def append_to_items(items, flat_items):
for item in items:
if not item.children:
flat_items.append(item)
append_to_items(item.children, flat_items)
flat_items = []
append_to_items(
learn
+ frontend
+ backend
+ hosting
+ component_lib
+ graphing_libs
+ recipes
+ ai_builder_overview_items
+ ai_builder_integrations
+ api_reference
+ enterprise_items,
flat_items,
)
def get_prev_next(url):
"""Get the previous and next links in the sidebar."""
url = url.strip("/")
for i, item in enumerate(flat_items):
if item.link.strip("/") == url:
prev_link = flat_items[i - 1] if i > 0 else None
next_link = flat_items[i + 1] if i < len(flat_items) - 1 else None
return prev_link, ne | if not item.children:
sub += 1 |
multiple",
collapsible=True,
default_value=index[:1].foreach(lambda x: "index" + x.to_string()),
class_name="!my-2 flex flex-col items-start gap-4 !ml-[10px] list-none [box-shadow:inset_1.25px_0_0_0_var(--c-slate-4)_!important] !bg-transparent !rounded-none",
),
class_name="!p-0 w-full !bg-transparent before:!h-0 after:!h-0",
),
value=item_index,
class_name="border-none w-full !bg-transparent",
)
)
def calculate_index(sidebar_items, url: str) -> list[int]:
sidebar_items = (
sidebar_items if isinstance(sidebar_items, list) else [sidebar_items]
)
index_list = []
if not url:
return index_list
url = url.rstrip("/") + "/"
for item in sidebar_items:
item.link = item.link.rstrip("/") + "/"
sub = 0
for i, item in enumerate(sidebar_items):
if not item.children:
sub += 1
|
index = calculate_index(item.children, url)
if index:
return [i - sub, *index]
return index_list
def append_to_items(items, flat_items):
for item in items:
if not item.children:
flat_items.append(item)
append_to_items(item.children, flat_items)
flat_items = []
append_to_items(
learn
+ frontend
+ backend
+ hosting
+ component_lib
+ graphing_libs
+ recipes
+ ai_builder_overview_items
+ ai_builder_integrations
+ api_reference
+ enterprise_items,
flat_items,
)
def get_prev_next(url):
"""Get the previous and next links in the sidebar."""
url = url.strip("/")
for i, item in enumerate(flat_items):
if item.link.strip("/") == url:
prev_link = flat_items[i - 1] if i > 0 else None
next_link = flat_items[i + 1] if i < len(flat_items) - 1 else None
return prev_link, next_link
return None, None
def filter_out_non_sidebar | if item.link == url:
return [i - sub] |
default_value=index[:1].foreach(lambda x: "index" + x.to_string()),
class_name="!my-2 flex flex-col items-start gap-4 !ml-[10px] list-none [box-shadow:inset_1.25px_0_0_0_var(--c-slate-4)_!important] !bg-transparent !rounded-none",
),
class_name="!p-0 w-full !bg-transparent before:!h-0 after:!h-0",
),
value=item_index,
class_name="border-none w-full !bg-transparent",
)
)
def calculate_index(sidebar_items, url: str) -> list[int]:
sidebar_items = (
sidebar_items if isinstance(sidebar_items, list) else [sidebar_items]
)
index_list = []
if not url:
return index_list
url = url.rstrip("/") + "/"
for item in sidebar_items:
item.link = item.link.rstrip("/") + "/"
sub = 0
for i, item in enumerate(sidebar_items):
if not item.children:
sub += 1
if item.link == url:
return [i - sub]
|
if index:
return [i - sub, *index]
return index_list
def append_to_items(items, flat_items):
for item in items:
if not item.children:
flat_items.append(item)
append_to_items(item.children, flat_items)
flat_items = []
append_to_items(
learn
+ frontend
+ backend
+ hosting
+ component_lib
+ graphing_libs
+ recipes
+ ai_builder_overview_items
+ ai_builder_integrations
+ api_reference
+ enterprise_items,
flat_items,
)
def get_prev_next(url):
"""Get the previous and next links in the sidebar."""
url = url.strip("/")
for i, item in enumerate(flat_items):
if item.link.strip("/") == url:
prev_link = flat_items[i - 1] if i > 0 else None
next_link = flat_items[i + 1] if i < len(flat_items) - 1 else None
return prev_link, next_link
return None, None
def filter_out_non_sidebar_items(items: list[SideBarBase]) -> list[SideBarItem | index = calculate_index(item.children, url) |
"index" + x.to_string()),
class_name="!my-2 flex flex-col items-start gap-4 !ml-[10px] list-none [box-shadow:inset_1.25px_0_0_0_var(--c-slate-4)_!important] !bg-transparent !rounded-none",
),
class_name="!p-0 w-full !bg-transparent before:!h-0 after:!h-0",
),
value=item_index,
class_name="border-none w-full !bg-transparent",
)
)
def calculate_index(sidebar_items, url: str) -> list[int]:
sidebar_items = (
sidebar_items if isinstance(sidebar_items, list) else [sidebar_items]
)
index_list = []
if not url:
return index_list
url = url.rstrip("/") + "/"
for item in sidebar_items:
item.link = item.link.rstrip("/") + "/"
sub = 0
for i, item in enumerate(sidebar_items):
if not item.children:
sub += 1
if item.link == url:
return [i - sub]
index = calculate_index(item.children, url)
|
return index_list
def append_to_items(items, flat_items):
for item in items:
if not item.children:
flat_items.append(item)
append_to_items(item.children, flat_items)
flat_items = []
append_to_items(
learn
+ frontend
+ backend
+ hosting
+ component_lib
+ graphing_libs
+ recipes
+ ai_builder_overview_items
+ ai_builder_integrations
+ api_reference
+ enterprise_items,
flat_items,
)
def get_prev_next(url):
"""Get the previous and next links in the sidebar."""
url = url.strip("/")
for i, item in enumerate(flat_items):
if item.link.strip("/") == url:
prev_link = flat_items[i - 1] if i > 0 else None
next_link = flat_items[i + 1] if i < len(flat_items) - 1 else None
return prev_link, next_link
return None, None
def filter_out_non_sidebar_items(items: list[SideBarBase]) -> list[SideBarItem]:
"""Filter out non-sidebar items making sure only | if index:
return [i - sub, *index] |
ex-col items-start gap-4 !ml-[10px] list-none [box-shadow:inset_1.25px_0_0_0_var(--c-slate-4)_!important] !bg-transparent !rounded-none",
),
class_name="!p-0 w-full !bg-transparent before:!h-0 after:!h-0",
),
value=item_index,
class_name="border-none w-full !bg-transparent",
)
)
def calculate_index(sidebar_items, url: str) -> list[int]:
sidebar_items = (
sidebar_items if isinstance(sidebar_items, list) else [sidebar_items]
)
index_list = []
if not url:
return index_list
url = url.rstrip("/") + "/"
for item in sidebar_items:
item.link = item.link.rstrip("/") + "/"
sub = 0
for i, item in enumerate(sidebar_items):
if not item.children:
sub += 1
if item.link == url:
return [i - sub]
index = calculate_index(item.children, url)
if index:
return [i - sub, *index]
return index_list
|
flat_items = []
append_to_items(
learn
+ frontend
+ backend
+ hosting
+ component_lib
+ graphing_libs
+ recipes
+ ai_builder_overview_items
+ ai_builder_integrations
+ api_reference
+ enterprise_items,
flat_items,
)
def get_prev_next(url):
"""Get the previous and next links in the sidebar."""
url = url.strip("/")
for i, item in enumerate(flat_items):
if item.link.strip("/") == url:
prev_link = flat_items[i - 1] if i > 0 else None
next_link = flat_items[i + 1] if i < len(flat_items) - 1 else None
return prev_link, next_link
return None, None
def filter_out_non_sidebar_items(items: list[SideBarBase]) -> list[SideBarItem]:
"""Filter out non-sidebar items making sure only SideBarItems are present.
Args:
items: The items to filter.
Return:
The filtered side bar items.
"""
return [item for item in items if isinstance(item, SideBarItem)]
de | def append_to_items(items, flat_items):
for item in items:
if not item.children:
flat_items.append(item)
append_to_items(item.children, flat_items) |
e [box-shadow:inset_1.25px_0_0_0_var(--c-slate-4)_!important] !bg-transparent !rounded-none",
),
class_name="!p-0 w-full !bg-transparent before:!h-0 after:!h-0",
),
value=item_index,
class_name="border-none w-full !bg-transparent",
)
)
def calculate_index(sidebar_items, url: str) -> list[int]:
sidebar_items = (
sidebar_items if isinstance(sidebar_items, list) else [sidebar_items]
)
index_list = []
if not url:
return index_list
url = url.rstrip("/") + "/"
for item in sidebar_items:
item.link = item.link.rstrip("/") + "/"
sub = 0
for i, item in enumerate(sidebar_items):
if not item.children:
sub += 1
if item.link == url:
return [i - sub]
index = calculate_index(item.children, url)
if index:
return [i - sub, *index]
return index_list
def append_to_items(items, flat_items):
|
flat_items = []
append_to_items(
learn
+ frontend
+ backend
+ hosting
+ component_lib
+ graphing_libs
+ recipes
+ ai_builder_overview_items
+ ai_builder_integrations
+ api_reference
+ enterprise_items,
flat_items,
)
def get_prev_next(url):
"""Get the previous and next links in the sidebar."""
url = url.strip("/")
for i, item in enumerate(flat_items):
if item.link.strip("/") == url:
prev_link = flat_items[i - 1] if i > 0 else None
next_link = flat_items[i + 1] if i < len(flat_items) - 1 else None
return prev_link, next_link
return None, None
def filter_out_non_sidebar_items(items: list[SideBarBase]) -> list[SideBarItem]:
"""Filter out non-sidebar items making sure only SideBarItems are present.
Args:
items: The items to filter.
Return:
The filtered side bar items.
"""
return [item for item in items if isinstance(item, SideBarItem)]
de | for item in items:
if not item.children:
flat_items.append(item)
append_to_items(item.children, flat_items) |
0_0_0_var(--c-slate-4)_!important] !bg-transparent !rounded-none",
),
class_name="!p-0 w-full !bg-transparent before:!h-0 after:!h-0",
),
value=item_index,
class_name="border-none w-full !bg-transparent",
)
)
def calculate_index(sidebar_items, url: str) -> list[int]:
sidebar_items = (
sidebar_items if isinstance(sidebar_items, list) else [sidebar_items]
)
index_list = []
if not url:
return index_list
url = url.rstrip("/") + "/"
for item in sidebar_items:
item.link = item.link.rstrip("/") + "/"
sub = 0
for i, item in enumerate(sidebar_items):
if not item.children:
sub += 1
if item.link == url:
return [i - sub]
index = calculate_index(item.children, url)
if index:
return [i - sub, *index]
return index_list
def append_to_items(items, flat_items):
for item in items:
|
append_to_items(item.children, flat_items)
flat_items = []
append_to_items(
learn
+ frontend
+ backend
+ hosting
+ component_lib
+ graphing_libs
+ recipes
+ ai_builder_overview_items
+ ai_builder_integrations
+ api_reference
+ enterprise_items,
flat_items,
)
def get_prev_next(url):
"""Get the previous and next links in the sidebar."""
url = url.strip("/")
for i, item in enumerate(flat_items):
if item.link.strip("/") == url:
prev_link = flat_items[i - 1] if i > 0 else None
next_link = flat_items[i + 1] if i < len(flat_items) - 1 else None
return prev_link, next_link
return None, None
def filter_out_non_sidebar_items(items: list[SideBarBase]) -> list[SideBarItem]:
"""Filter out non-sidebar items making sure only SideBarItems are present.
Args:
items: The items to filter.
Return:
The filtered side bar items.
"""
return [item for i | if not item.children:
flat_items.append(item) |
e="!p-0 w-full !bg-transparent before:!h-0 after:!h-0",
),
value=item_index,
class_name="border-none w-full !bg-transparent",
)
)
def calculate_index(sidebar_items, url: str) -> list[int]:
sidebar_items = (
sidebar_items if isinstance(sidebar_items, list) else [sidebar_items]
)
index_list = []
if not url:
return index_list
url = url.rstrip("/") + "/"
for item in sidebar_items:
item.link = item.link.rstrip("/") + "/"
sub = 0
for i, item in enumerate(sidebar_items):
if not item.children:
sub += 1
if item.link == url:
return [i - sub]
index = calculate_index(item.children, url)
if index:
return [i - sub, *index]
return index_list
def append_to_items(items, flat_items):
for item in items:
if not item.children:
flat_items.append(item)
append_to_items(item.children, flat_items)
|
append_to_items(
learn
+ frontend
+ backend
+ hosting
+ component_lib
+ graphing_libs
+ recipes
+ ai_builder_overview_items
+ ai_builder_integrations
+ api_reference
+ enterprise_items,
flat_items,
)
def get_prev_next(url):
"""Get the previous and next links in the sidebar."""
url = url.strip("/")
for i, item in enumerate(flat_items):
if item.link.strip("/") == url:
prev_link = flat_items[i - 1] if i > 0 else None
next_link = flat_items[i + 1] if i < len(flat_items) - 1 else None
return prev_link, next_link
return None, None
def filter_out_non_sidebar_items(items: list[SideBarBase]) -> list[SideBarItem]:
"""Filter out non-sidebar items making sure only SideBarItems are present.
Args:
items: The items to filter.
Return:
The filtered side bar items.
"""
return [item for item in items if isinstance(item, SideBarItem)]
def sidebar_category | flat_items = [] |
sidebar_items if isinstance(sidebar_items, list) else [sidebar_items]
)
index_list = []
if not url:
return index_list
url = url.rstrip("/") + "/"
for item in sidebar_items:
item.link = item.link.rstrip("/") + "/"
sub = 0
for i, item in enumerate(sidebar_items):
if not item.children:
sub += 1
if item.link == url:
return [i - sub]
index = calculate_index(item.children, url)
if index:
return [i - sub, *index]
return index_list
def append_to_items(items, flat_items):
for item in items:
if not item.children:
flat_items.append(item)
append_to_items(item.children, flat_items)
flat_items = []
append_to_items(
learn
+ frontend
+ backend
+ hosting
+ component_lib
+ graphing_libs
+ recipes
+ ai_builder_overview_items
+ ai_builder_integrations
+ api_reference
+ enterprise_items,
flat_items,
)
|
def filter_out_non_sidebar_items(items: list[SideBarBase]) -> list[SideBarItem]:
"""Filter out non-sidebar items making sure only SideBarItems are present.
Args:
items: The items to filter.
Return:
The filtered side bar items.
"""
return [item for item in items if isinstance(item, SideBarItem)]
def sidebar_category(name: str, url: str, icon: str, index: int):
return rx.el.li(
rx.el.div(
rx.box(
rx.box(
rx.box(
rx.icon(
tag=icon,
size=16,
class_name="!text-slate-9",
),
class_name="flex justify-center items-center border-slate-4 bg-white-1 shadow-medium border rounded-md size-8",
),
rx.el.h3(
name,
class_name="font-small"
+ | def get_prev_next(url):
"""Get the previous and next links in the sidebar."""
url = url.strip("/")
for i, item in enumerate(flat_items):
if item.link.strip("/") == url:
prev_link = flat_items[i - 1] if i > 0 else None
next_link = flat_items[i + 1] if i < len(flat_items) - 1 else None
return prev_link, next_link
return None, None |
ex_list = []
if not url:
return index_list
url = url.rstrip("/") + "/"
for item in sidebar_items:
item.link = item.link.rstrip("/") + "/"
sub = 0
for i, item in enumerate(sidebar_items):
if not item.children:
sub += 1
if item.link == url:
return [i - sub]
index = calculate_index(item.children, url)
if index:
return [i - sub, *index]
return index_list
def append_to_items(items, flat_items):
for item in items:
if not item.children:
flat_items.append(item)
append_to_items(item.children, flat_items)
flat_items = []
append_to_items(
learn
+ frontend
+ backend
+ hosting
+ component_lib
+ graphing_libs
+ recipes
+ ai_builder_overview_items
+ ai_builder_integrations
+ api_reference
+ enterprise_items,
flat_items,
)
def get_prev_next(url):
"""Get the previous and next links in the sidebar."""
|
for i, item in enumerate(flat_items):
if item.link.strip("/") == url:
prev_link = flat_items[i - 1] if i > 0 else None
next_link = flat_items[i + 1] if i < len(flat_items) - 1 else None
return prev_link, next_link
return None, None
def filter_out_non_sidebar_items(items: list[SideBarBase]) -> list[SideBarItem]:
"""Filter out non-sidebar items making sure only SideBarItems are present.
Args:
items: The items to filter.
Return:
The filtered side bar items.
"""
return [item for item in items if isinstance(item, SideBarItem)]
def sidebar_category(name: str, url: str, icon: str, index: int):
return rx.el.li(
rx.el.div(
rx.box(
rx.box(
rx.box(
rx.icon(
tag=icon,
size=16,
class_name="!text-slate-9",
),
| url = url.strip("/") |
url:
return index_list
url = url.rstrip("/") + "/"
for item in sidebar_items:
item.link = item.link.rstrip("/") + "/"
sub = 0
for i, item in enumerate(sidebar_items):
if not item.children:
sub += 1
if item.link == url:
return [i - sub]
index = calculate_index(item.children, url)
if index:
return [i - sub, *index]
return index_list
def append_to_items(items, flat_items):
for item in items:
if not item.children:
flat_items.append(item)
append_to_items(item.children, flat_items)
flat_items = []
append_to_items(
learn
+ frontend
+ backend
+ hosting
+ component_lib
+ graphing_libs
+ recipes
+ ai_builder_overview_items
+ ai_builder_integrations
+ api_reference
+ enterprise_items,
flat_items,
)
def get_prev_next(url):
"""Get the previous and next links in the sidebar."""
url = url.strip("/")
|
return None, None
def filter_out_non_sidebar_items(items: list[SideBarBase]) -> list[SideBarItem]:
"""Filter out non-sidebar items making sure only SideBarItems are present.
Args:
items: The items to filter.
Return:
The filtered side bar items.
"""
return [item for item in items if isinstance(item, SideBarItem)]
def sidebar_category(name: str, url: str, icon: str, index: int):
return rx.el.li(
rx.el.div(
rx.box(
rx.box(
rx.box(
rx.icon(
tag=icon,
size=16,
class_name="!text-slate-9",
),
class_name="flex justify-center items-center border-slate-4 bg-white-1 shadow-medium border rounded-md size-8",
),
rx.el.h3(
name,
class_name="font-small"
| for i, item in enumerate(flat_items):
if item.link.strip("/") == url:
prev_link = flat_items[i - 1] if i > 0 else None
next_link = flat_items[i + 1] if i < len(flat_items) - 1 else None
return prev_link, next_link |
rstrip("/") + "/"
for item in sidebar_items:
item.link = item.link.rstrip("/") + "/"
sub = 0
for i, item in enumerate(sidebar_items):
if not item.children:
sub += 1
if item.link == url:
return [i - sub]
index = calculate_index(item.children, url)
if index:
return [i - sub, *index]
return index_list
def append_to_items(items, flat_items):
for item in items:
if not item.children:
flat_items.append(item)
append_to_items(item.children, flat_items)
flat_items = []
append_to_items(
learn
+ frontend
+ backend
+ hosting
+ component_lib
+ graphing_libs
+ recipes
+ ai_builder_overview_items
+ ai_builder_integrations
+ api_reference
+ enterprise_items,
flat_items,
)
def get_prev_next(url):
"""Get the previous and next links in the sidebar."""
url = url.strip("/")
for i, item in enumerate(flat_items):
|
return None, None
def filter_out_non_sidebar_items(items: list[SideBarBase]) -> list[SideBarItem]:
"""Filter out non-sidebar items making sure only SideBarItems are present.
Args:
items: The items to filter.
Return:
The filtered side bar items.
"""
return [item for item in items if isinstance(item, SideBarItem)]
def sidebar_category(name: str, url: str, icon: str, index: int):
return rx.el.li(
rx.el.div(
rx.box(
rx.box(
rx.box(
rx.icon(
tag=icon,
size=16,
class_name="!text-slate-9",
),
class_name="flex justify-center items-center border-slate-4 bg-white-1 shadow-medium border rounded-md size-8",
),
rx.el.h3(
name,
class_name="font-small"
| if item.link.strip("/") == url:
prev_link = flat_items[i - 1] if i > 0 else None
next_link = flat_items[i + 1] if i < len(flat_items) - 1 else None
return prev_link, next_link |
ems:
item.link = item.link.rstrip("/") + "/"
sub = 0
for i, item in enumerate(sidebar_items):
if not item.children:
sub += 1
if item.link == url:
return [i - sub]
index = calculate_index(item.children, url)
if index:
return [i - sub, *index]
return index_list
def append_to_items(items, flat_items):
for item in items:
if not item.children:
flat_items.append(item)
append_to_items(item.children, flat_items)
flat_items = []
append_to_items(
learn
+ frontend
+ backend
+ hosting
+ component_lib
+ graphing_libs
+ recipes
+ ai_builder_overview_items
+ ai_builder_integrations
+ api_reference
+ enterprise_items,
flat_items,
)
def get_prev_next(url):
"""Get the previous and next links in the sidebar."""
url = url.strip("/")
for i, item in enumerate(flat_items):
if item.link.strip("/") == url:
|
next_link = flat_items[i + 1] if i < len(flat_items) - 1 else None
return prev_link, next_link
return None, None
def filter_out_non_sidebar_items(items: list[SideBarBase]) -> list[SideBarItem]:
"""Filter out non-sidebar items making sure only SideBarItems are present.
Args:
items: The items to filter.
Return:
The filtered side bar items.
"""
return [item for item in items if isinstance(item, SideBarItem)]
def sidebar_category(name: str, url: str, icon: str, index: int):
return rx.el.li(
rx.el.div(
rx.box(
rx.box(
rx.box(
rx.icon(
tag=icon,
size=16,
class_name="!text-slate-9",
),
class_name="flex justify-center items-center border-slate-4 bg-white-1 shadow-medium border rounded-md size-8",
| prev_link = flat_items[i - 1] if i > 0 else None |
= 0
for i, item in enumerate(sidebar_items):
if not item.children:
sub += 1
if item.link == url:
return [i - sub]
index = calculate_index(item.children, url)
if index:
return [i - sub, *index]
return index_list
def append_to_items(items, flat_items):
for item in items:
if not item.children:
flat_items.append(item)
append_to_items(item.children, flat_items)
flat_items = []
append_to_items(
learn
+ frontend
+ backend
+ hosting
+ component_lib
+ graphing_libs
+ recipes
+ ai_builder_overview_items
+ ai_builder_integrations
+ api_reference
+ enterprise_items,
flat_items,
)
def get_prev_next(url):
"""Get the previous and next links in the sidebar."""
url = url.strip("/")
for i, item in enumerate(flat_items):
if item.link.strip("/") == url:
prev_link = flat_items[i - 1] if i > 0 else None
|
return prev_link, next_link
return None, None
def filter_out_non_sidebar_items(items: list[SideBarBase]) -> list[SideBarItem]:
"""Filter out non-sidebar items making sure only SideBarItems are present.
Args:
items: The items to filter.
Return:
The filtered side bar items.
"""
return [item for item in items if isinstance(item, SideBarItem)]
def sidebar_category(name: str, url: str, icon: str, index: int):
return rx.el.li(
rx.el.div(
rx.box(
rx.box(
rx.box(
rx.icon(
tag=icon,
size=16,
class_name="!text-slate-9",
),
class_name="flex justify-center items-center border-slate-4 bg-white-1 shadow-medium border rounded-md size-8",
),
rx.el.h3(
name,
| next_link = flat_items[i + 1] if i < len(flat_items) - 1 else None |
return [i - sub]
index = calculate_index(item.children, url)
if index:
return [i - sub, *index]
return index_list
def append_to_items(items, flat_items):
for item in items:
if not item.children:
flat_items.append(item)
append_to_items(item.children, flat_items)
flat_items = []
append_to_items(
learn
+ frontend
+ backend
+ hosting
+ component_lib
+ graphing_libs
+ recipes
+ ai_builder_overview_items
+ ai_builder_integrations
+ api_reference
+ enterprise_items,
flat_items,
)
def get_prev_next(url):
"""Get the previous and next links in the sidebar."""
url = url.strip("/")
for i, item in enumerate(flat_items):
if item.link.strip("/") == url:
prev_link = flat_items[i - 1] if i > 0 else None
next_link = flat_items[i + 1] if i < len(flat_items) - 1 else None
return prev_link, next_link
return None, None
|
def sidebar_category(name: str, url: str, icon: str, index: int):
return rx.el.li(
rx.el.div(
rx.box(
rx.box(
rx.box(
rx.icon(
tag=icon,
size=16,
class_name="!text-slate-9",
),
class_name="flex justify-center items-center border-slate-4 bg-white-1 shadow-medium border rounded-md size-8",
),
rx.el.h3(
name,
class_name="font-small"
+ rx.cond(
SidebarState.sidebar_index == index,
" text-slate-11",
" text-slate-9",
),
),
class_name="flex flex-row justify-start items-center gap-3 w-full",
),
| def filter_out_non_sidebar_items(items: list[SideBarBase]) -> list[SideBarItem]:
"""Filter out non-sidebar items making sure only SideBarItems are present.
Args:
items: The items to filter.
Return:
The filtered side bar items.
"""
return [item for item in items if isinstance(item, SideBarItem)] |
s)
flat_items = []
append_to_items(
learn
+ frontend
+ backend
+ hosting
+ component_lib
+ graphing_libs
+ recipes
+ ai_builder_overview_items
+ ai_builder_integrations
+ api_reference
+ enterprise_items,
flat_items,
)
def get_prev_next(url):
"""Get the previous and next links in the sidebar."""
url = url.strip("/")
for i, item in enumerate(flat_items):
if item.link.strip("/") == url:
prev_link = flat_items[i - 1] if i > 0 else None
next_link = flat_items[i + 1] if i < len(flat_items) - 1 else None
return prev_link, next_link
return None, None
def filter_out_non_sidebar_items(items: list[SideBarBase]) -> list[SideBarItem]:
"""Filter out non-sidebar items making sure only SideBarItems are present.
Args:
items: The items to filter.
Return:
The filtered side bar items.
"""
return [item for item in items if isinstance(item, SideBarItem)]
|
def create_sidebar_section(
section_title: str,
section_url: str,
items: list[SideBarItem],
index: rx.Var[list[str]] | list[str],
url: rx.Var[str] | str,
) -> rx.Component:
# Check if the section has any nested sections (Like the Other Libraries Section)
nested = any(len(child.children) > 0 for item in items for child in item.children)
# Make sure the index is a list
index = index.to(list)
return rx.el.li(
rx.link(
rx.el.h5(
section_title,
class_name="font-smbold text-[0.875rem] text-slate-12 hover:text-violet-9 leading-5 tracking-[-0.01313rem] transition-color",
),
underline="none",
href=section_url,
class_name="py-3",
),
rx.accordion.root(
*[
sidebar_item_comp(
item_index="index" + str(item_index),
item=item,
index=index[1:] if nested else [ | def sidebar_category(name: str, url: str, icon: str, index: int):
return rx.el.li(
rx.el.div(
rx.box(
rx.box(
rx.box(
rx.icon(
tag=icon,
size=16,
class_name="!text-slate-9",
),
class_name="flex justify-center items-center border-slate-4 bg-white-1 shadow-medium border rounded-md size-8",
),
rx.el.h3(
name,
class_name="font-small"
+ rx.cond(
SidebarState.sidebar_index == index,
" text-slate-11",
" text-slate-9",
),
),
class_name="flex flex-row justify-start items-center gap-3 w-full",
),
rx.box(
class_name="bg-violet-9 rounded-full shrink-0 size-[7px]"
+ rx.cond(
SidebarState.sidebar_index == index, " visible", " hidden"
),
),
class_name="cursor-pointer flex flex-row justify-between items-center hover:bg-slate-3 p-[0.5rem_1rem_0.5rem_0.5rem] rounded-2xl w-full transition-bg self-stretch"
+ rx.cond(
SidebarState.sidebar_index == index,
" bg-slate-3",
" bg-transparent",
),
),
rx.el.a(
to=url,
on_click=rx.prevent_default,
class_name="inset-0 absolute z-[-1]",
),
class_name="w-full text-slate-9 hover:!text-slate-9 relative",
on_click=[SidebarState.set_sidebar_index(index), rx.redirect(url)],
),
class_name="w-full",
) |
),
rx.box(
class_name="bg-violet-9 rounded-full shrink-0 size-[7px]"
+ rx.cond(
SidebarState.sidebar_index == index, " visible", " hidden"
),
),
class_name="cursor-pointer flex flex-row justify-between items-center hover:bg-slate-3 p-[0.5rem_1rem_0.5rem_0.5rem] rounded-2xl w-full transition-bg self-stretch"
+ rx.cond(
SidebarState.sidebar_index == index,
" bg-slate-3",
" bg-transparent",
),
),
rx.el.a(
to=url,
on_click=rx.prevent_default,
class_name="inset-0 absolute z-[-1]",
),
class_name="w-full text-slate-9 hover:!text-slate-9 relative",
on_click=[SidebarState.set_sidebar_index(index), rx.redirect(url)],
),
class_name="w-full",
)
|
@rx.memo
def sidebar_comp(
url: str,
learn_index: list[int],
component_lib_index: list[int],
frontend_index: list[int],
backend_index: list[int],
hosting_index: list[int],
graphing_libs_index: list[int],
api_reference_index: list[int],
recipes_index: list[int],
enterprise_usage_index: list[int],
enterprise_component_index: list[int],
mcp_index: list[int],
#
cli_ref_index: list[int],
ai_builder_overview_index: list[int],
ai_builder_integrations_index: list[int],
tutorials_index: list[int],
width: str = "100%",
):
from pcweb.pages.docs import ai_builder as ai_builder_pages
from pcweb.pages.docs import enterprise, getting_started, state, ui
from pcweb.pages.docs import hosting as hosting_page
from pcweb.pages.docs.apiref import pages
from pcweb.pages.docs.custom_components import custom_components
from pcweb.pages.docs.library import library
from pcweb.pages.docs.recipes_overview import | def create_sidebar_section(
section_title: str,
section_url: str,
items: list[SideBarItem],
index: rx.Var[list[str]] | list[str],
url: rx.Var[str] | str,
) -> rx.Component:
# Check if the section has any nested sections (Like the Other Libraries Section)
nested = any(len(child.children) > 0 for item in items for child in item.children)
# Make sure the index is a list
index = index.to(list)
return rx.el.li(
rx.link(
rx.el.h5(
section_title,
class_name="font-smbold text-[0.875rem] text-slate-12 hover:text-violet-9 leading-5 tracking-[-0.01313rem] transition-color",
),
underline="none",
href=section_url,
class_name="py-3",
),
rx.accordion.root(
*[
sidebar_item_comp(
item_index="index" + str(item_index),
item=item,
index=index[1:] if nested else [],
url=url,
)
for item_index, item in enumerate(items)
],
type="multiple",
collapsible=True,
default_value=index[:1].foreach(lambda x: "index" + x.to_string()),
class_name="ml-0 pl-0 w-full !bg-transparent !shadow-none rounded-[0px]",
),
class_name="flex flex-col items-start ml-0 w-full",
) |
lass_name="cursor-pointer flex flex-row justify-between items-center hover:bg-slate-3 p-[0.5rem_1rem_0.5rem_0.5rem] rounded-2xl w-full transition-bg self-stretch"
+ rx.cond(
SidebarState.sidebar_index == index,
" bg-slate-3",
" bg-transparent",
),
),
rx.el.a(
to=url,
on_click=rx.prevent_default,
class_name="inset-0 absolute z-[-1]",
),
class_name="w-full text-slate-9 hover:!text-slate-9 relative",
on_click=[SidebarState.set_sidebar_index(index), rx.redirect(url)],
),
class_name="w-full",
)
def create_sidebar_section(
section_title: str,
section_url: str,
items: list[SideBarItem],
index: rx.Var[list[str]] | list[str],
url: rx.Var[str] | str,
) -> rx.Component:
# Check if the section has any nested sections (Like the Other Libraries Section)
|
# Make sure the index is a list
index = index.to(list)
return rx.el.li(
rx.link(
rx.el.h5(
section_title,
class_name="font-smbold text-[0.875rem] text-slate-12 hover:text-violet-9 leading-5 tracking-[-0.01313rem] transition-color",
),
underline="none",
href=section_url,
class_name="py-3",
),
rx.accordion.root(
*[
sidebar_item_comp(
item_index="index" + str(item_index),
item=item,
index=index[1:] if nested else [],
url=url,
)
for item_index, item in enumerate(items)
],
type="multiple",
collapsible=True,
default_value=index[:1].foreach(lambda x: "index" + x.to_string()),
class_name="ml-0 pl-0 w-full !bg-transparent !shadow-none rounded-[0px]",
),
cl | nested = any(len(child.children) > 0 for item in items for child in item.children) |
-2xl w-full transition-bg self-stretch"
+ rx.cond(
SidebarState.sidebar_index == index,
" bg-slate-3",
" bg-transparent",
),
),
rx.el.a(
to=url,
on_click=rx.prevent_default,
class_name="inset-0 absolute z-[-1]",
),
class_name="w-full text-slate-9 hover:!text-slate-9 relative",
on_click=[SidebarState.set_sidebar_index(index), rx.redirect(url)],
),
class_name="w-full",
)
def create_sidebar_section(
section_title: str,
section_url: str,
items: list[SideBarItem],
index: rx.Var[list[str]] | list[str],
url: rx.Var[str] | str,
) -> rx.Component:
# Check if the section has any nested sections (Like the Other Libraries Section)
nested = any(len(child.children) > 0 for item in items for child in item.children)
# Make sure the index is a list
|
return rx.el.li(
rx.link(
rx.el.h5(
section_title,
class_name="font-smbold text-[0.875rem] text-slate-12 hover:text-violet-9 leading-5 tracking-[-0.01313rem] transition-color",
),
underline="none",
href=section_url,
class_name="py-3",
),
rx.accordion.root(
*[
sidebar_item_comp(
item_index="index" + str(item_index),
item=item,
index=index[1:] if nested else [],
url=url,
)
for item_index, item in enumerate(items)
],
type="multiple",
collapsible=True,
default_value=index[:1].foreach(lambda x: "index" + x.to_string()),
class_name="ml-0 pl-0 w-full !bg-transparent !shadow-none rounded-[0px]",
),
class_name="flex flex-col items-start ml-0 w-full",
)
@rx.m | index = index.to(list) |
url=url,
)
for item_index, item in enumerate(items)
],
type="multiple",
collapsible=True,
default_value=index[:1].foreach(lambda x: "index" + x.to_string()),
class_name="ml-0 pl-0 w-full !bg-transparent !shadow-none rounded-[0px]",
),
class_name="flex flex-col items-start ml-0 w-full",
)
@rx.memo
def sidebar_comp(
url: str,
learn_index: list[int],
component_lib_index: list[int],
frontend_index: list[int],
backend_index: list[int],
hosting_index: list[int],
graphing_libs_index: list[int],
api_reference_index: list[int],
recipes_index: list[int],
enterprise_usage_index: list[int],
enterprise_component_index: list[int],
mcp_index: list[int],
#
cli_ref_index: list[int],
ai_builder_overview_index: list[int],
ai_builder_integrations_index: list[int],
tutorials_index: list[int],
width: str = "100%",
):
|
from pcweb.pages.docs import enterprise, getting_started, state, ui
from pcweb.pages.docs import hosting as hosting_page
from pcweb.pages.docs.apiref import pages
from pcweb.pages.docs.custom_components import custom_components
from pcweb.pages.docs.library import library
from pcweb.pages.docs.recipes_overview import overview
return rx.box( # pyright: ignore [reportCallIssue]
# Handle sidebar categories for docs/cloud first
rx.cond( # pyright: ignore [reportCallIssue]
rx.State.router.page.path.startswith("/docs/hosting/"),
rx.el.ul(
sidebar_category(
"Cloud", hosting_page.deploy_quick_start.path, "cloud", 0
),
# sidebar_category(
# "CLI Reference", cloud_pages[0].path, "book-marked", 1
# ),
class_name="flex flex-col items-start gap-1 w-full list-none",
),
rx.cond( # pyrigh | from pcweb.pages.docs import ai_builder as ai_builder_pages |
em in enumerate(items)
],
type="multiple",
collapsible=True,
default_value=index[:1].foreach(lambda x: "index" + x.to_string()),
class_name="ml-0 pl-0 w-full !bg-transparent !shadow-none rounded-[0px]",
),
class_name="flex flex-col items-start ml-0 w-full",
)
@rx.memo
def sidebar_comp(
url: str,
learn_index: list[int],
component_lib_index: list[int],
frontend_index: list[int],
backend_index: list[int],
hosting_index: list[int],
graphing_libs_index: list[int],
api_reference_index: list[int],
recipes_index: list[int],
enterprise_usage_index: list[int],
enterprise_component_index: list[int],
mcp_index: list[int],
#
cli_ref_index: list[int],
ai_builder_overview_index: list[int],
ai_builder_integrations_index: list[int],
tutorials_index: list[int],
width: str = "100%",
):
from pcweb.pages.docs import ai_builder as ai_builder_pages
|
from pcweb.pages.docs import hosting as hosting_page
from pcweb.pages.docs.apiref import pages
from pcweb.pages.docs.custom_components import custom_components
from pcweb.pages.docs.library import library
from pcweb.pages.docs.recipes_overview import overview
return rx.box( # pyright: ignore [reportCallIssue]
# Handle sidebar categories for docs/cloud first
rx.cond( # pyright: ignore [reportCallIssue]
rx.State.router.page.path.startswith("/docs/hosting/"),
rx.el.ul(
sidebar_category(
"Cloud", hosting_page.deploy_quick_start.path, "cloud", 0
),
# sidebar_category(
# "CLI Reference", cloud_pages[0].path, "book-marked", 1
# ),
class_name="flex flex-col items-start gap-1 w-full list-none",
),
rx.cond( # pyright: ignore [reportCallIssue]
rx.State.router.page.path.st | from pcweb.pages.docs import enterprise, getting_started, state, ui |
collapsible=True,
default_value=index[:1].foreach(lambda x: "index" + x.to_string()),
class_name="ml-0 pl-0 w-full !bg-transparent !shadow-none rounded-[0px]",
),
class_name="flex flex-col items-start ml-0 w-full",
)
@rx.memo
def sidebar_comp(
url: str,
learn_index: list[int],
component_lib_index: list[int],
frontend_index: list[int],
backend_index: list[int],
hosting_index: list[int],
graphing_libs_index: list[int],
api_reference_index: list[int],
recipes_index: list[int],
enterprise_usage_index: list[int],
enterprise_component_index: list[int],
mcp_index: list[int],
#
cli_ref_index: list[int],
ai_builder_overview_index: list[int],
ai_builder_integrations_index: list[int],
tutorials_index: list[int],
width: str = "100%",
):
from pcweb.pages.docs import ai_builder as ai_builder_pages
from pcweb.pages.docs import enterprise, getting_started, state, ui
|
from pcweb.pages.docs.apiref import pages
from pcweb.pages.docs.custom_components import custom_components
from pcweb.pages.docs.library import library
from pcweb.pages.docs.recipes_overview import overview
return rx.box( # pyright: ignore [reportCallIssue]
# Handle sidebar categories for docs/cloud first
rx.cond( # pyright: ignore [reportCallIssue]
rx.State.router.page.path.startswith("/docs/hosting/"),
rx.el.ul(
sidebar_category(
"Cloud", hosting_page.deploy_quick_start.path, "cloud", 0
),
# sidebar_category(
# "CLI Reference", cloud_pages[0].path, "book-marked", 1
# ),
class_name="flex flex-col items-start gap-1 w-full list-none",
),
rx.cond( # pyright: ignore [reportCallIssue]
rx.State.router.page.path.startswith("/docs/ai-builder/"),
rx.el.ul(
| from pcweb.pages.docs import hosting as hosting_page |
:1].foreach(lambda x: "index" + x.to_string()),
class_name="ml-0 pl-0 w-full !bg-transparent !shadow-none rounded-[0px]",
),
class_name="flex flex-col items-start ml-0 w-full",
)
@rx.memo
def sidebar_comp(
url: str,
learn_index: list[int],
component_lib_index: list[int],
frontend_index: list[int],
backend_index: list[int],
hosting_index: list[int],
graphing_libs_index: list[int],
api_reference_index: list[int],
recipes_index: list[int],
enterprise_usage_index: list[int],
enterprise_component_index: list[int],
mcp_index: list[int],
#
cli_ref_index: list[int],
ai_builder_overview_index: list[int],
ai_builder_integrations_index: list[int],
tutorials_index: list[int],
width: str = "100%",
):
from pcweb.pages.docs import ai_builder as ai_builder_pages
from pcweb.pages.docs import enterprise, getting_started, state, ui
from pcweb.pages.docs import hosting as hosting_page
|
from pcweb.pages.docs.custom_components import custom_components
from pcweb.pages.docs.library import library
from pcweb.pages.docs.recipes_overview import overview
return rx.box( # pyright: ignore [reportCallIssue]
# Handle sidebar categories for docs/cloud first
rx.cond( # pyright: ignore [reportCallIssue]
rx.State.router.page.path.startswith("/docs/hosting/"),
rx.el.ul(
sidebar_category(
"Cloud", hosting_page.deploy_quick_start.path, "cloud", 0
),
# sidebar_category(
# "CLI Reference", cloud_pages[0].path, "book-marked", 1
# ),
class_name="flex flex-col items-start gap-1 w-full list-none",
),
rx.cond( # pyright: ignore [reportCallIssue]
rx.State.router.page.path.startswith("/docs/ai-builder/"),
rx.el.ul(
sidebar_category(
| from pcweb.pages.docs.apiref import pages |
,
class_name="ml-0 pl-0 w-full !bg-transparent !shadow-none rounded-[0px]",
),
class_name="flex flex-col items-start ml-0 w-full",
)
@rx.memo
def sidebar_comp(
url: str,
learn_index: list[int],
component_lib_index: list[int],
frontend_index: list[int],
backend_index: list[int],
hosting_index: list[int],
graphing_libs_index: list[int],
api_reference_index: list[int],
recipes_index: list[int],
enterprise_usage_index: list[int],
enterprise_component_index: list[int],
mcp_index: list[int],
#
cli_ref_index: list[int],
ai_builder_overview_index: list[int],
ai_builder_integrations_index: list[int],
tutorials_index: list[int],
width: str = "100%",
):
from pcweb.pages.docs import ai_builder as ai_builder_pages
from pcweb.pages.docs import enterprise, getting_started, state, ui
from pcweb.pages.docs import hosting as hosting_page
from pcweb.pages.docs.apiref import pages
|
from pcweb.pages.docs.library import library
from pcweb.pages.docs.recipes_overview import overview
return rx.box( # pyright: ignore [reportCallIssue]
# Handle sidebar categories for docs/cloud first
rx.cond( # pyright: ignore [reportCallIssue]
rx.State.router.page.path.startswith("/docs/hosting/"),
rx.el.ul(
sidebar_category(
"Cloud", hosting_page.deploy_quick_start.path, "cloud", 0
),
# sidebar_category(
# "CLI Reference", cloud_pages[0].path, "book-marked", 1
# ),
class_name="flex flex-col items-start gap-1 w-full list-none",
),
rx.cond( # pyright: ignore [reportCallIssue]
rx.State.router.page.path.startswith("/docs/ai-builder/"),
rx.el.ul(
sidebar_category(
"AI Builder",
ai_builder_page | from pcweb.pages.docs.custom_components import custom_components |
ne rounded-[0px]",
),
class_name="flex flex-col items-start ml-0 w-full",
)
@rx.memo
def sidebar_comp(
url: str,
learn_index: list[int],
component_lib_index: list[int],
frontend_index: list[int],
backend_index: list[int],
hosting_index: list[int],
graphing_libs_index: list[int],
api_reference_index: list[int],
recipes_index: list[int],
enterprise_usage_index: list[int],
enterprise_component_index: list[int],
mcp_index: list[int],
#
cli_ref_index: list[int],
ai_builder_overview_index: list[int],
ai_builder_integrations_index: list[int],
tutorials_index: list[int],
width: str = "100%",
):
from pcweb.pages.docs import ai_builder as ai_builder_pages
from pcweb.pages.docs import enterprise, getting_started, state, ui
from pcweb.pages.docs import hosting as hosting_page
from pcweb.pages.docs.apiref import pages
from pcweb.pages.docs.custom_components import custom_components
|
from pcweb.pages.docs.recipes_overview import overview
return rx.box( # pyright: ignore [reportCallIssue]
# Handle sidebar categories for docs/cloud first
rx.cond( # pyright: ignore [reportCallIssue]
rx.State.router.page.path.startswith("/docs/hosting/"),
rx.el.ul(
sidebar_category(
"Cloud", hosting_page.deploy_quick_start.path, "cloud", 0
),
# sidebar_category(
# "CLI Reference", cloud_pages[0].path, "book-marked", 1
# ),
class_name="flex flex-col items-start gap-1 w-full list-none",
),
rx.cond( # pyright: ignore [reportCallIssue]
rx.State.router.page.path.startswith("/docs/ai-builder/"),
rx.el.ul(
sidebar_category(
"AI Builder",
ai_builder_pages.overview.best_practices.path,
| from pcweb.pages.docs.library import library |
"flex flex-col items-start ml-0 w-full",
)
@rx.memo
def sidebar_comp(
url: str,
learn_index: list[int],
component_lib_index: list[int],
frontend_index: list[int],
backend_index: list[int],
hosting_index: list[int],
graphing_libs_index: list[int],
api_reference_index: list[int],
recipes_index: list[int],
enterprise_usage_index: list[int],
enterprise_component_index: list[int],
mcp_index: list[int],
#
cli_ref_index: list[int],
ai_builder_overview_index: list[int],
ai_builder_integrations_index: list[int],
tutorials_index: list[int],
width: str = "100%",
):
from pcweb.pages.docs import ai_builder as ai_builder_pages
from pcweb.pages.docs import enterprise, getting_started, state, ui
from pcweb.pages.docs import hosting as hosting_page
from pcweb.pages.docs.apiref import pages
from pcweb.pages.docs.custom_components import custom_components
from pcweb.pages.docs.library import library
|
return rx.box( # pyright: ignore [reportCallIssue]
# Handle sidebar categories for docs/cloud first
rx.cond( # pyright: ignore [reportCallIssue]
rx.State.router.page.path.startswith("/docs/hosting/"),
rx.el.ul(
sidebar_category(
"Cloud", hosting_page.deploy_quick_start.path, "cloud", 0
),
# sidebar_category(
# "CLI Reference", cloud_pages[0].path, "book-marked", 1
# ),
class_name="flex flex-col items-start gap-1 w-full list-none",
),
rx.cond( # pyright: ignore [reportCallIssue]
rx.State.router.page.path.startswith("/docs/ai-builder/"),
rx.el.ul(
sidebar_category(
"AI Builder",
ai_builder_pages.overview.best_practices.path,
"bot",
0,
| from pcweb.pages.docs.recipes_overview import overview |
s",
enterprise.components.path,
enterprise_component_items,
enterprise_component_index,
url,
),
class_name="flex flex-col items-start gap-6 p-[0px_1rem_0px_0.5rem] w-full list-none list-style-none",
),
),
),
),
),
),
# Handle general docs sections
style={
"&::-webkit-scrollbar-thumb": {
"background_color": "transparent",
},
"&::-webkit-scrollbar": {
"background_color": "transparent",
},
},
class_name="flex flex-col !pb-24 gap-6 items-start max-h-[90%] p-[1rem_0rem_1rem_1rem] lg-p2 scroll-p-4 fixed w-full overflow-y-scroll hidden-scrollbar lg:max-w-[300px]",
)
|
sb = sidebar(width="100%")
| def sidebar(url=None, width: str = "100%") -> rx.Component:
"""Render the sidebar."""
learn_index = calculate_index(learn, url)
component_lib_index = calculate_index(component_lib, url)
frontend_index = calculate_index(frontend, url)
backend_index = calculate_index(backend, url)
hosting_index = calculate_index(hosting, url)
graphing_libs_index = calculate_index(graphing_libs, url)
api_reference_index = calculate_index(api_reference, url)
recipes_index = calculate_index(recipes, url)
enterprise_usage_index = calculate_index(enterprise_usage_items, url)
enterprise_component_index = calculate_index(enterprise_component_items, url)
cli_ref_index = calculate_index(cli_ref, url)
ai_builder_overview_index = calculate_index(ai_builder_overview_items, url)
ai_builder_integrations_index = calculate_index(ai_builder_integrations, url)
mcp_index = calculate_index(mcp_items, url)
return rx.box(
sidebar_comp(
url=url,
learn_index=learn_index,
component_lib_index=component_lib_index,
frontend_index=frontend_index,
backend_index=backend_index,
hosting_index=hosting_index,
graphing_libs_index=graphing_libs_index,
api_reference_index=api_reference_index,
recipes_index=recipes_index,
enterprise_usage_index=enterprise_usage_index,
enterprise_component_index=enterprise_component_index,
ai_builder_overview_index=ai_builder_overview_index,
ai_builder_integrations_index=ai_builder_integrations_index,
cli_ref_index=cli_ref_index,
mcp_index=mcp_index,
width=width,
),
on_mount=rx.call_script(Scrollable_SideBar),
id=rx.Var.create("sidebar-container"),
class_name="flex justify-end w-full h-full",
) |
enterprise_component_items,
enterprise_component_index,
url,
),
class_name="flex flex-col items-start gap-6 p-[0px_1rem_0px_0.5rem] w-full list-none list-style-none",
),
),
),
),
),
),
# Handle general docs sections
style={
"&::-webkit-scrollbar-thumb": {
"background_color": "transparent",
},
"&::-webkit-scrollbar": {
"background_color": "transparent",
},
},
class_name="flex flex-col !pb-24 gap-6 items-start max-h-[90%] p-[1rem_0rem_1rem_1rem] lg-p2 scroll-p-4 fixed w-full overflow-y-scroll hidden-scrollbar lg:max-w-[300px]",
)
def sidebar(url=None, width: str = "100%") -> rx.Component:
"""Render the sidebar."""
|
component_lib_index = calculate_index(component_lib, url)
frontend_index = calculate_index(frontend, url)
backend_index = calculate_index(backend, url)
hosting_index = calculate_index(hosting, url)
graphing_libs_index = calculate_index(graphing_libs, url)
api_reference_index = calculate_index(api_reference, url)
recipes_index = calculate_index(recipes, url)
enterprise_usage_index = calculate_index(enterprise_usage_items, url)
enterprise_component_index = calculate_index(enterprise_component_items, url)
cli_ref_index = calculate_index(cli_ref, url)
ai_builder_overview_index = calculate_index(ai_builder_overview_items, url)
ai_builder_integrations_index = calculate_index(ai_builder_integrations, url)
mcp_index = calculate_index(mcp_items, url)
return rx.box(
sidebar_comp(
url=url,
learn_index=learn_index,
component_lib_index=component_lib_index,
frontend_index=frontend_index | learn_index = calculate_index(learn, url) |
enterprise_component_index,
url,
),
class_name="flex flex-col items-start gap-6 p-[0px_1rem_0px_0.5rem] w-full list-none list-style-none",
),
),
),
),
),
),
# Handle general docs sections
style={
"&::-webkit-scrollbar-thumb": {
"background_color": "transparent",
},
"&::-webkit-scrollbar": {
"background_color": "transparent",
},
},
class_name="flex flex-col !pb-24 gap-6 items-start max-h-[90%] p-[1rem_0rem_1rem_1rem] lg-p2 scroll-p-4 fixed w-full overflow-y-scroll hidden-scrollbar lg:max-w-[300px]",
)
def sidebar(url=None, width: str = "100%") -> rx.Component:
"""Render the sidebar."""
learn_index = calculate_index(learn, url)
|
frontend_index = calculate_index(frontend, url)
backend_index = calculate_index(backend, url)
hosting_index = calculate_index(hosting, url)
graphing_libs_index = calculate_index(graphing_libs, url)
api_reference_index = calculate_index(api_reference, url)
recipes_index = calculate_index(recipes, url)
enterprise_usage_index = calculate_index(enterprise_usage_items, url)
enterprise_component_index = calculate_index(enterprise_component_items, url)
cli_ref_index = calculate_index(cli_ref, url)
ai_builder_overview_index = calculate_index(ai_builder_overview_items, url)
ai_builder_integrations_index = calculate_index(ai_builder_integrations, url)
mcp_index = calculate_index(mcp_items, url)
return rx.box(
sidebar_comp(
url=url,
learn_index=learn_index,
component_lib_index=component_lib_index,
frontend_index=frontend_index,
backend_index=backend_index,
hosting | component_lib_index = calculate_index(component_lib, url) |
url,
),
class_name="flex flex-col items-start gap-6 p-[0px_1rem_0px_0.5rem] w-full list-none list-style-none",
),
),
),
),
),
),
# Handle general docs sections
style={
"&::-webkit-scrollbar-thumb": {
"background_color": "transparent",
},
"&::-webkit-scrollbar": {
"background_color": "transparent",
},
},
class_name="flex flex-col !pb-24 gap-6 items-start max-h-[90%] p-[1rem_0rem_1rem_1rem] lg-p2 scroll-p-4 fixed w-full overflow-y-scroll hidden-scrollbar lg:max-w-[300px]",
)
def sidebar(url=None, width: str = "100%") -> rx.Component:
"""Render the sidebar."""
learn_index = calculate_index(learn, url)
component_lib_index = calculate_index(component_lib, url)
|
backend_index = calculate_index(backend, url)
hosting_index = calculate_index(hosting, url)
graphing_libs_index = calculate_index(graphing_libs, url)
api_reference_index = calculate_index(api_reference, url)
recipes_index = calculate_index(recipes, url)
enterprise_usage_index = calculate_index(enterprise_usage_items, url)
enterprise_component_index = calculate_index(enterprise_component_items, url)
cli_ref_index = calculate_index(cli_ref, url)
ai_builder_overview_index = calculate_index(ai_builder_overview_items, url)
ai_builder_integrations_index = calculate_index(ai_builder_integrations, url)
mcp_index = calculate_index(mcp_items, url)
return rx.box(
sidebar_comp(
url=url,
learn_index=learn_index,
component_lib_index=component_lib_index,
frontend_index=frontend_index,
backend_index=backend_index,
hosting_index=hosting_index,
graphing_libs_inde | frontend_index = calculate_index(frontend, url) |
),
class_name="flex flex-col items-start gap-6 p-[0px_1rem_0px_0.5rem] w-full list-none list-style-none",
),
),
),
),
),
),
# Handle general docs sections
style={
"&::-webkit-scrollbar-thumb": {
"background_color": "transparent",
},
"&::-webkit-scrollbar": {
"background_color": "transparent",
},
},
class_name="flex flex-col !pb-24 gap-6 items-start max-h-[90%] p-[1rem_0rem_1rem_1rem] lg-p2 scroll-p-4 fixed w-full overflow-y-scroll hidden-scrollbar lg:max-w-[300px]",
)
def sidebar(url=None, width: str = "100%") -> rx.Component:
"""Render the sidebar."""
learn_index = calculate_index(learn, url)
component_lib_index = calculate_index(component_lib, url)
frontend_index = calculate_index(frontend, url)
|
hosting_index = calculate_index(hosting, url)
graphing_libs_index = calculate_index(graphing_libs, url)
api_reference_index = calculate_index(api_reference, url)
recipes_index = calculate_index(recipes, url)
enterprise_usage_index = calculate_index(enterprise_usage_items, url)
enterprise_component_index = calculate_index(enterprise_component_items, url)
cli_ref_index = calculate_index(cli_ref, url)
ai_builder_overview_index = calculate_index(ai_builder_overview_items, url)
ai_builder_integrations_index = calculate_index(ai_builder_integrations, url)
mcp_index = calculate_index(mcp_items, url)
return rx.box(
sidebar_comp(
url=url,
learn_index=learn_index,
component_lib_index=component_lib_index,
frontend_index=frontend_index,
backend_index=backend_index,
hosting_index=hosting_index,
graphing_libs_index=graphing_libs_index,
api_reference_i | backend_index = calculate_index(backend, url) |
class_name="flex flex-col items-start gap-6 p-[0px_1rem_0px_0.5rem] w-full list-none list-style-none",
),
),
),
),
),
),
# Handle general docs sections
style={
"&::-webkit-scrollbar-thumb": {
"background_color": "transparent",
},
"&::-webkit-scrollbar": {
"background_color": "transparent",
},
},
class_name="flex flex-col !pb-24 gap-6 items-start max-h-[90%] p-[1rem_0rem_1rem_1rem] lg-p2 scroll-p-4 fixed w-full overflow-y-scroll hidden-scrollbar lg:max-w-[300px]",
)
def sidebar(url=None, width: str = "100%") -> rx.Component:
"""Render the sidebar."""
learn_index = calculate_index(learn, url)
component_lib_index = calculate_index(component_lib, url)
frontend_index = calculate_index(frontend, url)
backend_index = calculate_index(backend, url)
|
graphing_libs_index = calculate_index(graphing_libs, url)
api_reference_index = calculate_index(api_reference, url)
recipes_index = calculate_index(recipes, url)
enterprise_usage_index = calculate_index(enterprise_usage_items, url)
enterprise_component_index = calculate_index(enterprise_component_items, url)
cli_ref_index = calculate_index(cli_ref, url)
ai_builder_overview_index = calculate_index(ai_builder_overview_items, url)
ai_builder_integrations_index = calculate_index(ai_builder_integrations, url)
mcp_index = calculate_index(mcp_items, url)
return rx.box(
sidebar_comp(
url=url,
learn_index=learn_index,
component_lib_index=component_lib_index,
frontend_index=frontend_index,
backend_index=backend_index,
hosting_index=hosting_index,
graphing_libs_index=graphing_libs_index,
api_reference_index=api_reference_index,
recipes_inde | hosting_index = calculate_index(hosting, url) |
_1rem_0px_0.5rem] w-full list-none list-style-none",
),
),
),
),
),
),
# Handle general docs sections
style={
"&::-webkit-scrollbar-thumb": {
"background_color": "transparent",
},
"&::-webkit-scrollbar": {
"background_color": "transparent",
},
},
class_name="flex flex-col !pb-24 gap-6 items-start max-h-[90%] p-[1rem_0rem_1rem_1rem] lg-p2 scroll-p-4 fixed w-full overflow-y-scroll hidden-scrollbar lg:max-w-[300px]",
)
def sidebar(url=None, width: str = "100%") -> rx.Component:
"""Render the sidebar."""
learn_index = calculate_index(learn, url)
component_lib_index = calculate_index(component_lib, url)
frontend_index = calculate_index(frontend, url)
backend_index = calculate_index(backend, url)
hosting_index = calculate_index(hosting, url)
|
api_reference_index = calculate_index(api_reference, url)
recipes_index = calculate_index(recipes, url)
enterprise_usage_index = calculate_index(enterprise_usage_items, url)
enterprise_component_index = calculate_index(enterprise_component_items, url)
cli_ref_index = calculate_index(cli_ref, url)
ai_builder_overview_index = calculate_index(ai_builder_overview_items, url)
ai_builder_integrations_index = calculate_index(ai_builder_integrations, url)
mcp_index = calculate_index(mcp_items, url)
return rx.box(
sidebar_comp(
url=url,
learn_index=learn_index,
component_lib_index=component_lib_index,
frontend_index=frontend_index,
backend_index=backend_index,
hosting_index=hosting_index,
graphing_libs_index=graphing_libs_index,
api_reference_index=api_reference_index,
recipes_index=recipes_index,
enterprise_usage_index=enterprise | graphing_libs_index = calculate_index(graphing_libs, url) |
),
),
),
),
),
),
# Handle general docs sections
style={
"&::-webkit-scrollbar-thumb": {
"background_color": "transparent",
},
"&::-webkit-scrollbar": {
"background_color": "transparent",
},
},
class_name="flex flex-col !pb-24 gap-6 items-start max-h-[90%] p-[1rem_0rem_1rem_1rem] lg-p2 scroll-p-4 fixed w-full overflow-y-scroll hidden-scrollbar lg:max-w-[300px]",
)
def sidebar(url=None, width: str = "100%") -> rx.Component:
"""Render the sidebar."""
learn_index = calculate_index(learn, url)
component_lib_index = calculate_index(component_lib, url)
frontend_index = calculate_index(frontend, url)
backend_index = calculate_index(backend, url)
hosting_index = calculate_index(hosting, url)
graphing_libs_index = calculate_index(graphing_libs, url)
|
recipes_index = calculate_index(recipes, url)
enterprise_usage_index = calculate_index(enterprise_usage_items, url)
enterprise_component_index = calculate_index(enterprise_component_items, url)
cli_ref_index = calculate_index(cli_ref, url)
ai_builder_overview_index = calculate_index(ai_builder_overview_items, url)
ai_builder_integrations_index = calculate_index(ai_builder_integrations, url)
mcp_index = calculate_index(mcp_items, url)
return rx.box(
sidebar_comp(
url=url,
learn_index=learn_index,
component_lib_index=component_lib_index,
frontend_index=frontend_index,
backend_index=backend_index,
hosting_index=hosting_index,
graphing_libs_index=graphing_libs_index,
api_reference_index=api_reference_index,
recipes_index=recipes_index,
enterprise_usage_index=enterprise_usage_index,
enterprise_component_index=enterpris | api_reference_index = calculate_index(api_reference, url) |
),
),
),
),
# Handle general docs sections
style={
"&::-webkit-scrollbar-thumb": {
"background_color": "transparent",
},
"&::-webkit-scrollbar": {
"background_color": "transparent",
},
},
class_name="flex flex-col !pb-24 gap-6 items-start max-h-[90%] p-[1rem_0rem_1rem_1rem] lg-p2 scroll-p-4 fixed w-full overflow-y-scroll hidden-scrollbar lg:max-w-[300px]",
)
def sidebar(url=None, width: str = "100%") -> rx.Component:
"""Render the sidebar."""
learn_index = calculate_index(learn, url)
component_lib_index = calculate_index(component_lib, url)
frontend_index = calculate_index(frontend, url)
backend_index = calculate_index(backend, url)
hosting_index = calculate_index(hosting, url)
graphing_libs_index = calculate_index(graphing_libs, url)
api_reference_index = calculate_index(api_reference, url)
|
enterprise_usage_index = calculate_index(enterprise_usage_items, url)
enterprise_component_index = calculate_index(enterprise_component_items, url)
cli_ref_index = calculate_index(cli_ref, url)
ai_builder_overview_index = calculate_index(ai_builder_overview_items, url)
ai_builder_integrations_index = calculate_index(ai_builder_integrations, url)
mcp_index = calculate_index(mcp_items, url)
return rx.box(
sidebar_comp(
url=url,
learn_index=learn_index,
component_lib_index=component_lib_index,
frontend_index=frontend_index,
backend_index=backend_index,
hosting_index=hosting_index,
graphing_libs_index=graphing_libs_index,
api_reference_index=api_reference_index,
recipes_index=recipes_index,
enterprise_usage_index=enterprise_usage_index,
enterprise_component_index=enterprise_component_index,
ai_builder_overview | recipes_index = calculate_index(recipes, url) |
),
# Handle general docs sections
style={
"&::-webkit-scrollbar-thumb": {
"background_color": "transparent",
},
"&::-webkit-scrollbar": {
"background_color": "transparent",
},
},
class_name="flex flex-col !pb-24 gap-6 items-start max-h-[90%] p-[1rem_0rem_1rem_1rem] lg-p2 scroll-p-4 fixed w-full overflow-y-scroll hidden-scrollbar lg:max-w-[300px]",
)
def sidebar(url=None, width: str = "100%") -> rx.Component:
"""Render the sidebar."""
learn_index = calculate_index(learn, url)
component_lib_index = calculate_index(component_lib, url)
frontend_index = calculate_index(frontend, url)
backend_index = calculate_index(backend, url)
hosting_index = calculate_index(hosting, url)
graphing_libs_index = calculate_index(graphing_libs, url)
api_reference_index = calculate_index(api_reference, url)
recipes_index = calculate_index(recipes, url)
|
enterprise_component_index = calculate_index(enterprise_component_items, url)
cli_ref_index = calculate_index(cli_ref, url)
ai_builder_overview_index = calculate_index(ai_builder_overview_items, url)
ai_builder_integrations_index = calculate_index(ai_builder_integrations, url)
mcp_index = calculate_index(mcp_items, url)
return rx.box(
sidebar_comp(
url=url,
learn_index=learn_index,
component_lib_index=component_lib_index,
frontend_index=frontend_index,
backend_index=backend_index,
hosting_index=hosting_index,
graphing_libs_index=graphing_libs_index,
api_reference_index=api_reference_index,
recipes_index=recipes_index,
enterprise_usage_index=enterprise_usage_index,
enterprise_component_index=enterprise_component_index,
ai_builder_overview_index=ai_builder_overview_index,
ai_builder_integrations_inde | enterprise_usage_index = calculate_index(enterprise_usage_items, url) |
::-webkit-scrollbar-thumb": {
"background_color": "transparent",
},
"&::-webkit-scrollbar": {
"background_color": "transparent",
},
},
class_name="flex flex-col !pb-24 gap-6 items-start max-h-[90%] p-[1rem_0rem_1rem_1rem] lg-p2 scroll-p-4 fixed w-full overflow-y-scroll hidden-scrollbar lg:max-w-[300px]",
)
def sidebar(url=None, width: str = "100%") -> rx.Component:
"""Render the sidebar."""
learn_index = calculate_index(learn, url)
component_lib_index = calculate_index(component_lib, url)
frontend_index = calculate_index(frontend, url)
backend_index = calculate_index(backend, url)
hosting_index = calculate_index(hosting, url)
graphing_libs_index = calculate_index(graphing_libs, url)
api_reference_index = calculate_index(api_reference, url)
recipes_index = calculate_index(recipes, url)
enterprise_usage_index = calculate_index(enterprise_usage_items, url)
|
cli_ref_index = calculate_index(cli_ref, url)
ai_builder_overview_index = calculate_index(ai_builder_overview_items, url)
ai_builder_integrations_index = calculate_index(ai_builder_integrations, url)
mcp_index = calculate_index(mcp_items, url)
return rx.box(
sidebar_comp(
url=url,
learn_index=learn_index,
component_lib_index=component_lib_index,
frontend_index=frontend_index,
backend_index=backend_index,
hosting_index=hosting_index,
graphing_libs_index=graphing_libs_index,
api_reference_index=api_reference_index,
recipes_index=recipes_index,
enterprise_usage_index=enterprise_usage_index,
enterprise_component_index=enterprise_component_index,
ai_builder_overview_index=ai_builder_overview_index,
ai_builder_integrations_index=ai_builder_integrations_index,
cli_ref_index=cli_ref_index,
| enterprise_component_index = calculate_index(enterprise_component_items, url) |
},
"&::-webkit-scrollbar": {
"background_color": "transparent",
},
},
class_name="flex flex-col !pb-24 gap-6 items-start max-h-[90%] p-[1rem_0rem_1rem_1rem] lg-p2 scroll-p-4 fixed w-full overflow-y-scroll hidden-scrollbar lg:max-w-[300px]",
)
def sidebar(url=None, width: str = "100%") -> rx.Component:
"""Render the sidebar."""
learn_index = calculate_index(learn, url)
component_lib_index = calculate_index(component_lib, url)
frontend_index = calculate_index(frontend, url)
backend_index = calculate_index(backend, url)
hosting_index = calculate_index(hosting, url)
graphing_libs_index = calculate_index(graphing_libs, url)
api_reference_index = calculate_index(api_reference, url)
recipes_index = calculate_index(recipes, url)
enterprise_usage_index = calculate_index(enterprise_usage_items, url)
enterprise_component_index = calculate_index(enterprise_component_items, url)
|
ai_builder_overview_index = calculate_index(ai_builder_overview_items, url)
ai_builder_integrations_index = calculate_index(ai_builder_integrations, url)
mcp_index = calculate_index(mcp_items, url)
return rx.box(
sidebar_comp(
url=url,
learn_index=learn_index,
component_lib_index=component_lib_index,
frontend_index=frontend_index,
backend_index=backend_index,
hosting_index=hosting_index,
graphing_libs_index=graphing_libs_index,
api_reference_index=api_reference_index,
recipes_index=recipes_index,
enterprise_usage_index=enterprise_usage_index,
enterprise_component_index=enterprise_component_index,
ai_builder_overview_index=ai_builder_overview_index,
ai_builder_integrations_index=ai_builder_integrations_index,
cli_ref_index=cli_ref_index,
mcp_index=mcp_index,
width=width,
| cli_ref_index = calculate_index(cli_ref, url) |
"background_color": "transparent",
},
},
class_name="flex flex-col !pb-24 gap-6 items-start max-h-[90%] p-[1rem_0rem_1rem_1rem] lg-p2 scroll-p-4 fixed w-full overflow-y-scroll hidden-scrollbar lg:max-w-[300px]",
)
def sidebar(url=None, width: str = "100%") -> rx.Component:
"""Render the sidebar."""
learn_index = calculate_index(learn, url)
component_lib_index = calculate_index(component_lib, url)
frontend_index = calculate_index(frontend, url)
backend_index = calculate_index(backend, url)
hosting_index = calculate_index(hosting, url)
graphing_libs_index = calculate_index(graphing_libs, url)
api_reference_index = calculate_index(api_reference, url)
recipes_index = calculate_index(recipes, url)
enterprise_usage_index = calculate_index(enterprise_usage_items, url)
enterprise_component_index = calculate_index(enterprise_component_items, url)
cli_ref_index = calculate_index(cli_ref, url)
|
ai_builder_integrations_index = calculate_index(ai_builder_integrations, url)
mcp_index = calculate_index(mcp_items, url)
return rx.box(
sidebar_comp(
url=url,
learn_index=learn_index,
component_lib_index=component_lib_index,
frontend_index=frontend_index,
backend_index=backend_index,
hosting_index=hosting_index,
graphing_libs_index=graphing_libs_index,
api_reference_index=api_reference_index,
recipes_index=recipes_index,
enterprise_usage_index=enterprise_usage_index,
enterprise_component_index=enterprise_component_index,
ai_builder_overview_index=ai_builder_overview_index,
ai_builder_integrations_index=ai_builder_integrations_index,
cli_ref_index=cli_ref_index,
mcp_index=mcp_index,
width=width,
),
on_mount=rx.call_script(Scrollable_SideBar),
id=rx.Var | ai_builder_overview_index = calculate_index(ai_builder_overview_items, url) |
class_name="flex flex-col !pb-24 gap-6 items-start max-h-[90%] p-[1rem_0rem_1rem_1rem] lg-p2 scroll-p-4 fixed w-full overflow-y-scroll hidden-scrollbar lg:max-w-[300px]",
)
def sidebar(url=None, width: str = "100%") -> rx.Component:
"""Render the sidebar."""
learn_index = calculate_index(learn, url)
component_lib_index = calculate_index(component_lib, url)
frontend_index = calculate_index(frontend, url)
backend_index = calculate_index(backend, url)
hosting_index = calculate_index(hosting, url)
graphing_libs_index = calculate_index(graphing_libs, url)
api_reference_index = calculate_index(api_reference, url)
recipes_index = calculate_index(recipes, url)
enterprise_usage_index = calculate_index(enterprise_usage_items, url)
enterprise_component_index = calculate_index(enterprise_component_items, url)
cli_ref_index = calculate_index(cli_ref, url)
ai_builder_overview_index = calculate_index(ai_builder_overview_items, url)
|
mcp_index = calculate_index(mcp_items, url)
return rx.box(
sidebar_comp(
url=url,
learn_index=learn_index,
component_lib_index=component_lib_index,
frontend_index=frontend_index,
backend_index=backend_index,
hosting_index=hosting_index,
graphing_libs_index=graphing_libs_index,
api_reference_index=api_reference_index,
recipes_index=recipes_index,
enterprise_usage_index=enterprise_usage_index,
enterprise_component_index=enterprise_component_index,
ai_builder_overview_index=ai_builder_overview_index,
ai_builder_integrations_index=ai_builder_integrations_index,
cli_ref_index=cli_ref_index,
mcp_index=mcp_index,
width=width,
),
on_mount=rx.call_script(Scrollable_SideBar),
id=rx.Var.create("sidebar-container"),
class_name="flex justify-end w-full h-full", | ai_builder_integrations_index = calculate_index(ai_builder_integrations, url) |
1rem_1rem] lg-p2 scroll-p-4 fixed w-full overflow-y-scroll hidden-scrollbar lg:max-w-[300px]",
)
def sidebar(url=None, width: str = "100%") -> rx.Component:
"""Render the sidebar."""
learn_index = calculate_index(learn, url)
component_lib_index = calculate_index(component_lib, url)
frontend_index = calculate_index(frontend, url)
backend_index = calculate_index(backend, url)
hosting_index = calculate_index(hosting, url)
graphing_libs_index = calculate_index(graphing_libs, url)
api_reference_index = calculate_index(api_reference, url)
recipes_index = calculate_index(recipes, url)
enterprise_usage_index = calculate_index(enterprise_usage_items, url)
enterprise_component_index = calculate_index(enterprise_component_items, url)
cli_ref_index = calculate_index(cli_ref, url)
ai_builder_overview_index = calculate_index(ai_builder_overview_items, url)
ai_builder_integrations_index = calculate_index(ai_builder_integrations, url)
|
return rx.box(
sidebar_comp(
url=url,
learn_index=learn_index,
component_lib_index=component_lib_index,
frontend_index=frontend_index,
backend_index=backend_index,
hosting_index=hosting_index,
graphing_libs_index=graphing_libs_index,
api_reference_index=api_reference_index,
recipes_index=recipes_index,
enterprise_usage_index=enterprise_usage_index,
enterprise_component_index=enterprise_component_index,
ai_builder_overview_index=ai_builder_overview_index,
ai_builder_integrations_index=ai_builder_integrations_index,
cli_ref_index=cli_ref_index,
mcp_index=mcp_index,
width=width,
),
on_mount=rx.call_script(Scrollable_SideBar),
id=rx.Var.create("sidebar-container"),
class_name="flex justify-end w-full h-full",
)
sb = sidebar(width="100%")
| mcp_index = calculate_index(mcp_items, url) |
index = calculate_index(mcp_items, url)
return rx.box(
sidebar_comp(
url=url,
learn_index=learn_index,
component_lib_index=component_lib_index,
frontend_index=frontend_index,
backend_index=backend_index,
hosting_index=hosting_index,
graphing_libs_index=graphing_libs_index,
api_reference_index=api_reference_index,
recipes_index=recipes_index,
enterprise_usage_index=enterprise_usage_index,
enterprise_component_index=enterprise_component_index,
ai_builder_overview_index=ai_builder_overview_index,
ai_builder_integrations_index=ai_builder_integrations_index,
cli_ref_index=cli_ref_index,
mcp_index=mcp_index,
width=width,
),
on_mount=rx.call_script(Scrollable_SideBar),
id=rx.Var.create("sidebar-container"),
class_name="flex justify-end w-full h-full",
)
| sb = sidebar(width="100%") | |
"""The state of the sidebar component."""
|
import reflex as rx
from reflex.base import Base
class SideBarBase(Base):
"""Base class for the Side bar."""
# The name to display in the sidebar.
names: str = ""
alt_name_for_next_prev: str = ""
# The link to navigate to when the item is clicked.
link: str = ""
# The children items.
children: list[SideBarItem] = []
# Whether the item is a category. Occurs if a single item is at the top level of the sidebar for aesthetics.
outer = False
class SideBarItem(SideBarBase):
"""A single item in the sidebar."""
...
class SideBarSection(SideBarBase):
"""A section in the sidebar."""
...
class SidebarState(rx.State):
_sidebar_index: int = -1
@rx.event(temporal=True)
def set_sidebar_index(self, num) -> int:
self._sidebar_index = num
@rx.var(initial_value=-1)
def sidebar_index(self) -> int:
route = self.router.url.path
if self._sidebar_index < 0:
if "library" in route:
| from __future__ import annotations |
"""The state of the sidebar component."""
from __future__ import annotations
|
from reflex.base import Base
class SideBarBase(Base):
"""Base class for the Side bar."""
# The name to display in the sidebar.
names: str = ""
alt_name_for_next_prev: str = ""
# The link to navigate to when the item is clicked.
link: str = ""
# The children items.
children: list[SideBarItem] = []
# Whether the item is a category. Occurs if a single item is at the top level of the sidebar for aesthetics.
outer = False
class SideBarItem(SideBarBase):
"""A single item in the sidebar."""
...
class SideBarSection(SideBarBase):
"""A section in the sidebar."""
...
class SidebarState(rx.State):
_sidebar_index: int = -1
@rx.event(temporal=True)
def set_sidebar_index(self, num) -> int:
self._sidebar_index = num
@rx.var(initial_value=-1)
def sidebar_index(self) -> int:
route = self.router.url.path
if self._sidebar_index < 0:
if "library" in route:
retur | import reflex as rx |
"""The state of the sidebar component."""
from __future__ import annotations
import reflex as rx
|
class SideBarBase(Base):
"""Base class for the Side bar."""
# The name to display in the sidebar.
names: str = ""
alt_name_for_next_prev: str = ""
# The link to navigate to when the item is clicked.
link: str = ""
# The children items.
children: list[SideBarItem] = []
# Whether the item is a category. Occurs if a single item is at the top level of the sidebar for aesthetics.
outer = False
class SideBarItem(SideBarBase):
"""A single item in the sidebar."""
...
class SideBarSection(SideBarBase):
"""A section in the sidebar."""
...
class SidebarState(rx.State):
_sidebar_index: int = -1
@rx.event(temporal=True)
def set_sidebar_index(self, num) -> int:
self._sidebar_index = num
@rx.var(initial_value=-1)
def sidebar_index(self) -> int:
route = self.router.url.path
if self._sidebar_index < 0:
if "library" in route:
return 1
elif "hosting | from reflex.base import Base |
"""The state of the sidebar component."""
from __future__ import annotations
import reflex as rx
from reflex.base import Base
class SideBarBase(Base):
"""Base class for the Side bar."""
# The name to display in the sidebar.
names: str = ""
alt_name_for_next_prev: str = ""
# The link to navigate to when the item is clicked.
link: str = ""
# The children items.
children: list[SideBarItem] = []
# Whether the item is a category. Occurs if a single item is at the top level of the sidebar for aesthetics.
|
class SideBarItem(SideBarBase):
"""A single item in the sidebar."""
...
class SideBarSection(SideBarBase):
"""A section in the sidebar."""
...
class SidebarState(rx.State):
_sidebar_index: int = -1
@rx.event(temporal=True)
def set_sidebar_index(self, num) -> int:
self._sidebar_index = num
@rx.var(initial_value=-1)
def sidebar_index(self) -> int:
route = self.router.url.path
if self._sidebar_index < 0:
if "library" in route:
return 1
elif "hosting" in route:
return 0
elif "api-reference" in route:
return 2
elif "enterprise" in route:
return 3
else:
return 0
if "hosting" in route:
return 0
return self._sidebar_index
| outer = False |
"""The state of the sidebar component."""
from __future__ import annotations
import reflex as rx
from reflex.base import Base
class SideBarBase(Base):
"""Base class for the Side bar."""
# The name to display in the sidebar.
names: str = ""
alt_name_for_next_prev: str = ""
# The link to navigate to when the item is clicked.
link: str = ""
# The children items.
children: list[SideBarItem] = []
# Whether the item is a category. Occurs if a single item is at the top level of the sidebar for aesthetics.
outer = False
|
class SideBarSection(SideBarBase):
"""A section in the sidebar."""
...
class SidebarState(rx.State):
_sidebar_index: int = -1
@rx.event(temporal=True)
def set_sidebar_index(self, num) -> int:
self._sidebar_index = num
@rx.var(initial_value=-1)
def sidebar_index(self) -> int:
route = self.router.url.path
if self._sidebar_index < 0:
if "library" in route:
return 1
elif "hosting" in route:
return 0
elif "api-reference" in route:
return 2
elif "enterprise" in route:
return 3
else:
return 0
if "hosting" in route:
return 0
return self._sidebar_index
| class SideBarItem(SideBarBase):
"""A single item in the sidebar."""
... |
"""The state of the sidebar component."""
from __future__ import annotations
import reflex as rx
from reflex.base import Base
class SideBarBase(Base):
"""Base class for the Side bar."""
# The name to display in the sidebar.
names: str = ""
alt_name_for_next_prev: str = ""
# The link to navigate to when the item is clicked.
link: str = ""
# The children items.
children: list[SideBarItem] = []
# Whether the item is a category. Occurs if a single item is at the top level of the sidebar for aesthetics.
outer = False
class SideBarItem(SideBarBase):
"""A single item in the sidebar."""
...
|
class SidebarState(rx.State):
_sidebar_index: int = -1
@rx.event(temporal=True)
def set_sidebar_index(self, num) -> int:
self._sidebar_index = num
@rx.var(initial_value=-1)
def sidebar_index(self) -> int:
route = self.router.url.path
if self._sidebar_index < 0:
if "library" in route:
return 1
elif "hosting" in route:
return 0
elif "api-reference" in route:
return 2
elif "enterprise" in route:
return 3
else:
return 0
if "hosting" in route:
return 0
return self._sidebar_index
| class SideBarSection(SideBarBase):
"""A section in the sidebar."""
... |
"""The state of the sidebar component."""
from __future__ import annotations
import reflex as rx
from reflex.base import Base
class SideBarBase(Base):
"""Base class for the Side bar."""
# The name to display in the sidebar.
names: str = ""
alt_name_for_next_prev: str = ""
# The link to navigate to when the item is clicked.
link: str = ""
# The children items.
children: list[SideBarItem] = []
# Whether the item is a category. Occurs if a single item is at the top level of the sidebar for aesthetics.
outer = False
class SideBarItem(SideBarBase):
"""A single item in the sidebar."""
...
class SideBarSection(SideBarBase):
"""A section in the sidebar."""
...
class SidebarState(rx.State):
_sidebar_index: int = -1
@rx.event(temporal=True)
|
@rx.var(initial_value=-1)
def sidebar_index(self) -> int:
route = self.router.url.path
if self._sidebar_index < 0:
if "library" in route:
return 1
elif "hosting" in route:
return 0
elif "api-reference" in route:
return 2
elif "enterprise" in route:
return 3
else:
return 0
if "hosting" in route:
return 0
return self._sidebar_index
| def set_sidebar_index(self, num) -> int:
self._sidebar_index = num |
"""The state of the sidebar component."""
from __future__ import annotations
import reflex as rx
from reflex.base import Base
class SideBarBase(Base):
"""Base class for the Side bar."""
# The name to display in the sidebar.
names: str = ""
alt_name_for_next_prev: str = ""
# The link to navigate to when the item is clicked.
link: str = ""
# The children items.
children: list[SideBarItem] = []
# Whether the item is a category. Occurs if a single item is at the top level of the sidebar for aesthetics.
outer = False
class SideBarItem(SideBarBase):
"""A single item in the sidebar."""
...
class SideBarSection(SideBarBase):
"""A section in the sidebar."""
...
class SidebarState(rx.State):
_sidebar_index: int = -1
@rx.event(temporal=True)
def set_sidebar_index(self, num) -> int:
|
@rx.var(initial_value=-1)
def sidebar_index(self) -> int:
route = self.router.url.path
if self._sidebar_index < 0:
if "library" in route:
return 1
elif "hosting" in route:
return 0
elif "api-reference" in route:
return 2
elif "enterprise" in route:
return 3
else:
return 0
if "hosting" in route:
return 0
return self._sidebar_index
| self._sidebar_index = num |
"""The state of the sidebar component."""
from __future__ import annotations
import reflex as rx
from reflex.base import Base
class SideBarBase(Base):
"""Base class for the Side bar."""
# The name to display in the sidebar.
names: str = ""
alt_name_for_next_prev: str = ""
# The link to navigate to when the item is clicked.
link: str = ""
# The children items.
children: list[SideBarItem] = []
# Whether the item is a category. Occurs if a single item is at the top level of the sidebar for aesthetics.
outer = False
class SideBarItem(SideBarBase):
"""A single item in the sidebar."""
...
class SideBarSection(SideBarBase):
"""A section in the sidebar."""
...
class SidebarState(rx.State):
_sidebar_index: int = -1
@rx.event(temporal=True)
def set_sidebar_index(self, num) -> int:
self._sidebar_index = num
@rx.var(initial_value=-1)
def sidebar_index(self) -> int:
|
if self._sidebar_index < 0:
if "library" in route:
return 1
elif "hosting" in route:
return 0
elif "api-reference" in route:
return 2
elif "enterprise" in route:
return 3
else:
return 0
if "hosting" in route:
return 0
return self._sidebar_index
| route = self.router.url.path |
es: str = ""
alt_name_for_next_prev: str = ""
# The link to navigate to when the item is clicked.
link: str = ""
# The children items.
children: list[SideBarItem] = []
# Whether the item is a category. Occurs if a single item is at the top level of the sidebar for aesthetics.
outer = False
class SideBarItem(SideBarBase):
"""A single item in the sidebar."""
...
class SideBarSection(SideBarBase):
"""A section in the sidebar."""
...
class SidebarState(rx.State):
_sidebar_index: int = -1
@rx.event(temporal=True)
def set_sidebar_index(self, num) -> int:
self._sidebar_index = num
@rx.var(initial_value=-1)
def sidebar_index(self) -> int:
route = self.router.url.path
if self._sidebar_index < 0:
if "library" in route:
return 1
elif "hosting" in route:
return 0
elif "api-reference" in route:
return 2
|
if "hosting" in route:
return 0
return self._sidebar_index
| elif "enterprise" in route:
return 3
else:
return 0 |
ed.
link: str = ""
# The children items.
children: list[SideBarItem] = []
# Whether the item is a category. Occurs if a single item is at the top level of the sidebar for aesthetics.
outer = False
class SideBarItem(SideBarBase):
"""A single item in the sidebar."""
...
class SideBarSection(SideBarBase):
"""A section in the sidebar."""
...
class SidebarState(rx.State):
_sidebar_index: int = -1
@rx.event(temporal=True)
def set_sidebar_index(self, num) -> int:
self._sidebar_index = num
@rx.var(initial_value=-1)
def sidebar_index(self) -> int:
route = self.router.url.path
if self._sidebar_index < 0:
if "library" in route:
return 1
elif "hosting" in route:
return 0
elif "api-reference" in route:
return 2
elif "enterprise" in route:
return 3
else:
return 0
|
return self._sidebar_index
| if "hosting" in route:
return 0 |
def get_sidebar_items_ai_builder_overview():
from pcweb.pages.docs import ai_builder
return [
create_item(
"Overview",
children=[
ai_builder.overview.best_practices,
ai_builder.overview.what_is_reflex_build,
ai_builder.overview.tutorial,
ai_builder.overview.templates,
],
),
create_item(
"Features",
children=[
ai_builder.features.ide,
ai_builder.features.editor_modes,
ai_builder.features.file_tree,
ai_builder.features.restore_checkpoint,
ai_builder.features.secrets,
ai_builder.features.installing_external_packages,
ai_builder.features.integration_shortcut,
ai_builder.features.connect_to_github,
ai_builder.features.knowledge,
ai_builder.features.image_as_prompt,
| from .item import create_item | |
from .item import create_item
def get_sidebar_items_ai_builder_overview():
|
return [
create_item(
"Overview",
children=[
ai_builder.overview.best_practices,
ai_builder.overview.what_is_reflex_build,
ai_builder.overview.tutorial,
ai_builder.overview.templates,
],
),
create_item(
"Features",
children=[
ai_builder.features.ide,
ai_builder.features.editor_modes,
ai_builder.features.file_tree,
ai_builder.features.restore_checkpoint,
ai_builder.features.secrets,
ai_builder.features.installing_external_packages,
ai_builder.features.integration_shortcut,
ai_builder.features.connect_to_github,
ai_builder.features.knowledge,
ai_builder.features.image_as_prompt,
ai_builder.features.interaction_modes,
ai_builder.features.automated_t | from pcweb.pages.docs import ai_builder |
,
),
create_item(
"App Lifecycle",
children=[
ai_builder.app_lifecycle.general,
ai_builder.app_lifecycle.fork_app,
ai_builder.app_lifecycle.deploy_app,
ai_builder.app_lifecycle.download_app,
ai_builder.app_lifecycle.copy_app,
ai_builder.app_lifecycle.share_app,
],
),
# create_item(
# "Integrations",
# children=[
# ai_builder.integrations.overview,
# ai_builder.integrations.github,
# ai_builder.integrations.database,
# ai_builder.integrations.databricks,
# ai_builder.integrations.azure_auth,
# ai_builder.integrations.okta_auth,
# ai_builder.integrations.google_auth,
# ai_builder.integrations.open_ai,
# ],
# ),
]
def get_ai_builder_integrations():
|
return [
create_item(
"First Class Integrations",
children=[
ai_builder.integrations.overview,
# ai_builder.integrations.airtable,
ai_builder.integrations.anthropic,
ai_builder.integrations.azure_auth,
ai_builder.integrations.cartesia,
ai_builder.integrations.cohere,
ai_builder.integrations.database,
ai_builder.integrations.databricks,
ai_builder.integrations.descope,
ai_builder.integrations.gemini,
ai_builder.integrations.github,
ai_builder.integrations.google_auth,
ai_builder.integrations.groq,
ai_builder.integrations.hubspot,
ai_builder.integrations.hugging_face,
ai_builder.integrations.langchain,
ai_builder.integrations.linear,
ai_builder.integrations.notion,
| from pcweb.pages.docs import ai_builder |
children=[
ai_builder.python_libraries,
],
),
create_item(
"APIs",
children=[
ai_builder.apis,
],
),
create_item(
"Webhooks",
children=[
ai_builder.webhooks,
],
),
create_item(
"URLs",
children=[
ai_builder.urls,
],
),
create_item(
"Databases",
children=[
ai_builder.integrations.database,
],
),
create_item(
"Files",
children=[
ai_builder.files,
],
),
create_item(
"Images",
children=[
ai_builder.images,
],
),
create_item(
"Figma",
children=[
ai_builder.figma,
],
),
]
|
ai_builder_overview_items = get_sidebar_items_ai_builder_overview()
ai_builder_integrations = get_ai_builder_integrations()
mcp_items = get_sidebar_items_mcp()
| def get_sidebar_items_mcp():
from pcweb.pages.docs import ai_builder
return [
create_item(
"MCP Integration",
children=[
ai_builder.integrations.mcp_overview,
ai_builder.integrations.mcp_installation,
],
),
] |
ai_builder.python_libraries,
],
),
create_item(
"APIs",
children=[
ai_builder.apis,
],
),
create_item(
"Webhooks",
children=[
ai_builder.webhooks,
],
),
create_item(
"URLs",
children=[
ai_builder.urls,
],
),
create_item(
"Databases",
children=[
ai_builder.integrations.database,
],
),
create_item(
"Files",
children=[
ai_builder.files,
],
),
create_item(
"Images",
children=[
ai_builder.images,
],
),
create_item(
"Figma",
children=[
ai_builder.figma,
],
),
]
def get_sidebar_items_mcp():
|
return [
create_item(
"MCP Integration",
children=[
ai_builder.integrations.mcp_overview,
ai_builder.integrations.mcp_installation,
],
),
]
ai_builder_overview_items = get_sidebar_items_ai_builder_overview()
ai_builder_integrations = get_ai_builder_integrations()
mcp_items = get_sidebar_items_mcp()
| from pcweb.pages.docs import ai_builder |
er.webhooks,
],
),
create_item(
"URLs",
children=[
ai_builder.urls,
],
),
create_item(
"Databases",
children=[
ai_builder.integrations.database,
],
),
create_item(
"Files",
children=[
ai_builder.files,
],
),
create_item(
"Images",
children=[
ai_builder.images,
],
),
create_item(
"Figma",
children=[
ai_builder.figma,
],
),
]
def get_sidebar_items_mcp():
from pcweb.pages.docs import ai_builder
return [
create_item(
"MCP Integration",
children=[
ai_builder.integrations.mcp_overview,
ai_builder.integrations.mcp_installation,
],
),
]
|
ai_builder_integrations = get_ai_builder_integrations()
mcp_items = get_sidebar_items_mcp()
| ai_builder_overview_items = get_sidebar_items_ai_builder_overview() |
"URLs",
children=[
ai_builder.urls,
],
),
create_item(
"Databases",
children=[
ai_builder.integrations.database,
],
),
create_item(
"Files",
children=[
ai_builder.files,
],
),
create_item(
"Images",
children=[
ai_builder.images,
],
),
create_item(
"Figma",
children=[
ai_builder.figma,
],
),
]
def get_sidebar_items_mcp():
from pcweb.pages.docs import ai_builder
return [
create_item(
"MCP Integration",
children=[
ai_builder.integrations.mcp_overview,
ai_builder.integrations.mcp_installation,
],
),
]
ai_builder_overview_items = get_sidebar_items_ai_builder_overview()
|
mcp_items = get_sidebar_items_mcp()
| ai_builder_integrations = get_ai_builder_integrations() |
ilder.urls,
],
),
create_item(
"Databases",
children=[
ai_builder.integrations.database,
],
),
create_item(
"Files",
children=[
ai_builder.files,
],
),
create_item(
"Images",
children=[
ai_builder.images,
],
),
create_item(
"Figma",
children=[
ai_builder.figma,
],
),
]
def get_sidebar_items_mcp():
from pcweb.pages.docs import ai_builder
return [
create_item(
"MCP Integration",
children=[
ai_builder.integrations.mcp_overview,
ai_builder.integrations.mcp_installation,
],
),
]
ai_builder_overview_items = get_sidebar_items_ai_builder_overview()
ai_builder_integrations = get_ai_builder_integrations()
| mcp_items = get_sidebar_items_mcp() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.