Skip to content

Commit

Permalink
Merge branch 'main' into remove-demo-for-llama-index
Browse files Browse the repository at this point in the history
  • Loading branch information
amsraman authored Jan 29, 2025
2 parents 865120b + f801a6e commit 1bf9de6
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 94 deletions.
30 changes: 1 addition & 29 deletions pcweb/github.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,8 @@
"""Github stars count for the reflex repository."""

import asyncio
import httpx

import reflex as rx
import contextlib

GITHUB_API_URL = "https://api.github.com/repos/reflex-dev/reflex"


def get_stars_on_build():
"""Fetch the stars when app is built as default"""
resp = httpx.get(GITHUB_API_URL)
resp.raise_for_status()
data = resp.json()
return int(data.get("stargazers_count", 21000))


REFLEX_STAR_COUNT = get_stars_on_build()


async def fetch_count():
"""Fetch the stars count of the reflex repository."""
try:
while True:
with contextlib.suppress(Exception):
global REFLEX_STAR_COUNT
data = httpx.get(GITHUB_API_URL).json()
REFLEX_STAR_COUNT = int(data["stargazers_count"])
await asyncio.sleep(3600)
except asyncio.CancelledError:
pass
REFLEX_STAR_COUNT = 21500


class GithubStarState(rx.State):
Expand Down
4 changes: 3 additions & 1 deletion pcweb/pages/customers/views/footer.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from datetime import datetime
import reflex as rx
from pcweb.components.icons import get_icon
from pcweb.components.button import button
Expand Down Expand Up @@ -116,6 +117,7 @@ def news_letter() -> rx.Component:
),
)


@rx.memo
def footer() -> rx.Component:
return rx.el.footer(
Expand Down Expand Up @@ -153,7 +155,7 @@ def footer() -> rx.Component:
# Socials
rx.box(
rx.text(
"Copyright © 2024 Pynecone, Inc.",
f"Copyright © {datetime.now().year} Pynecone, Inc.",
class_name="font-small text-slate-9",
),
menu_socials(),
Expand Down
3 changes: 2 additions & 1 deletion pcweb/pages/index/views/footer_index.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from datetime import datetime
import reflex as rx
from pcweb.components.icons import get_icon
from pcweb.components.button import button
Expand Down Expand Up @@ -158,7 +159,7 @@ def footer_index() -> rx.Component:
# Socials
rx.box(
rx.text(
"Copyright © 2024 Pynecone, Inc.",
f"Copyright © {datetime.now().year} Pynecone, Inc.",
class_name="font-small text-slate-9",
),
menu_socials(),
Expand Down
2 changes: 1 addition & 1 deletion pcweb/pages/pricing/faq.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,5 +129,5 @@ def faq() -> rx.Component:
class_name="max-w-[40rem] flex justify-center items-center flex-col mx-auto w-full gap-2",
),
sales_button(),
class_name="flex flex-col gap-8 w-full max-w-[64.19rem] 2xl:border-x border-slate-4 2xl:border-b pb-[6rem]",
class_name="flex flex-col gap-8 w-full max-w-[64.19rem] 2xl:border-x border-slate-4 2xl:border-b pb-[6rem] pt-16",
)
2 changes: 1 addition & 1 deletion pcweb/pages/pricing/header.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
def header() -> rx.Component:
return rx.box(
rx.el.h1(
"Find a plan that's right for you",
"Pricing that scales with you",
class_name="gradient-heading font-semibold text-4xl xl:text-5xl text-center",
),
rx.el.h2(
Expand Down
1 change: 0 additions & 1 deletion pcweb/pages/pricing/pricing.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def pricing() -> rx.Component:
plan_cards(),
comparison_table_hosting(),
comparison_table_oss(),
calculator_section(),
faq(),
class_name="flex flex-col relative justify-center items-center w-full",
),
Expand Down
64 changes: 12 additions & 52 deletions pcweb/pages/pricing/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
display: grid !important;
grid-template-columns: minmax(100px, 1fr) repeat(4, minmax(100px, 1fr)) !important;
padding: 1rem 2.5rem;
gap: 6rem !important;
gap: 1rem !important;
}
.rt-ScrollAreaViewport {
padding-top: 2rem;
Expand All @@ -35,10 +35,8 @@

FRAMEWORK_SECTION = [
("Open Source Framework", True, True, True, True),
("Templates", True, True, True, True),
("One Click Auth", False, False, True, True),
("Embed Reflex Apps", False, False, True, True),
("Built-in Testing", False, False, True, True),
]

REFLEX_BRANDING_SECTION = [
Expand All @@ -49,30 +47,17 @@
("Number of Generations", "5/month", "100/month/seat", "250/month/seat", "Custom"),
]

DATABASE_SECTION = [
("Connect your own SQL DB", True, True, True, True),
("Database Editor UI", False, False, True, True),
("Database Migration Tool", False, False, True, True),
]

HOSTING_TEXT_SECTION = [
("Compute Limits", "1 CPU, .5GB", "5 CPU, 10GB", "Custom", "Custom"),
("Regions", "Single", "Multiple", "Multiple", "Multiple"),
("Build logs", "7 day", "30 days", "90 days", "Custom"),
("Runtime logs", "1 day", "7 days", "30 days", "Custom"),
("Logs", "1 day", "30 days", "90 days", "Custom"),
]

HOSTING_BOOLEAN_SECTION = [
("CLI Deployments", True, True, True, True),
("Automatic CI / CD Deploy (Github)", True, True, True, True),
("Custom Domains", False, True, True, True),
("Automatic CI / CD Deploy (Github)", False, False, True, True),
("Secrets", True, True, True, True),
("Secret Manager", False, False, True, True),
("App Analytics", False, False, True, True),
("Traces", False, False, True, True),
("Custom Alerts", False, False, True, True),
("Rollbacks", False, False, True, True),
("Large File Support", False, False, True, True),
("Secret Manager", False, True, True, True),
("App Analytics", False, True, True, True),
("On Prem Hosting", False, False, False, True),
]

Expand All @@ -81,8 +66,6 @@
("HTTP/SSL", True, True, True, True),
("DDos Protection", True, True, True, True),
("2 Factor Auth", True, True, True, True),
("Rich Permissions Control", False, False, True, True),
("Connect to Analytics Vendors", False, False, True, True),
("Audit Logs", False, False, False, True),
("SSO", False, False, False, True),
]
Expand All @@ -92,10 +75,8 @@
]

SUPPORT_BOOLEAN_SECTION = [
("White Glove Onboarding", False, False, False, True),
("Support SLAs Available", False, False, False, True),
("Migrate Existing Apps", False, False, False, True),
("Priority Support with Reflex Engineering Team", False, False, False, True),
("Personalized Onboarding", False, False, False, True),
("", "", "", "", ""),
]

Expand Down Expand Up @@ -164,7 +145,7 @@ def create_table_row_header(name: list, coming_soon: bool = False) -> rx.Compone
rx.table.column_header_cell("Team", class_name=STYLES["header_cell_sub"]),
rx.table.column_header_cell("Enterprise", class_name=STYLES["header_cell_sub"])
],
class_name="w-full [&>*:not(:first-child)]:text-center bg-slate-2 border border-slate-3 rounded-2xl z-[6] !h-[3.625rem] relative",
class_name="w-full [&>*:not(:first-child)]:text-center bg-slate-2 border border-slate-3 rounded-2xl z-[6] !h-[3.625rem] relative align-content center",
padding_x="5rem !important",
)

Expand Down Expand Up @@ -261,44 +242,23 @@ def table_body_hosting() -> rx.Component:

def table_body_oss() -> rx.Component:
return rx.table.root(
rx.el.style(TABLE_STYLE),
rx.table.header(
create_table_row_header("Framework"),
create_table_row_header("AI", coming_soon=True),
class_name="relative",
),
create_table_body(
*[
create_checkmark_row(feature, checks)
for feature, *checks in FRAMEWORK_SECTION
],
*[create_table_row(row) for row in REFLEX_BRANDING_SECTION],
*[create_table_row(row) for row in REFLEX_AI_SECTION],
),
rx.table.header(
create_table_row_header("Database"),
create_table_row_header("Framework"),
class_name="relative",
),
create_table_body(
*[
create_checkmark_row(feature, checks)
for feature, *checks in DATABASE_SECTION
for feature, *checks in FRAMEWORK_SECTION
],
),
rx.table.header(
create_table_row_header("AI", coming_soon=True),
class_name="relative",
),
create_table_body(
*[create_table_row(row) for row in REFLEX_AI_SECTION],
),
create_table_body(
rx.table.row(
rx.table.cell(),
*[
rx.table.cell(create_action_button(text, variant, extra))
for text, variant, extra in PLAN_BUTTONS
],
class_name="w-full [&>*:not(:first-child)]:text-center bg-slate-1 !py-[1.25rem] border-y border-slate-4 !h-[76px] relative",
),
*[create_table_row(row) for row in REFLEX_BRANDING_SECTION],
),
create_table_body(
*[create_table_row(row) for row in ASTERIX_SECTION],
Expand Down
3 changes: 0 additions & 3 deletions pcweb/pcweb.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import reflex as rx
from pcweb import styles
from pcweb.github import fetch_count
from pcweb.pages import page404, routes
from pcweb.pages.docs import outblocks, exec_blocks
from pcweb.whitelist import _check_whitelisted_path
Expand Down Expand Up @@ -144,5 +143,3 @@
app.add_page(lambda: rx.fragment(), route=source, on_load=rx.redirect(target))

app.add_page(page404.component, route=page404.path)

app.register_lifespan_task(fetch_count)
8 changes: 6 additions & 2 deletions pcweb/templates/docpage/docpage.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Template for documentation pages."""

from datetime import datetime
from typing import Callable

import reflex as rx
Expand All @@ -14,6 +15,7 @@
from pcweb.components.button import button
from reflex.utils.format import to_title_case, to_snake_case


def footer_link(text: str, href: str):
return rx.link(
text,
Expand Down Expand Up @@ -230,7 +232,7 @@ def docpage_footer(path: str):
),
rx.box(
rx.text(
"Copyright © 2024 Pynecone, Inc.",
f"Copyright © {datetime.now().year} Pynecone, Inc.",
class_name="font-small text-slate-9",
),
menu_socials(),
Expand Down Expand Up @@ -287,6 +289,7 @@ def breadcrumb(path: str, nav_sidebar: rx.Component):
)
)
from pcweb.components.hosting_banner import HostingBannerState

# Return the list of breadcrumb items with separators
return rx.box(
docs_sidebar_drawer(
Expand All @@ -303,7 +306,8 @@ def breadcrumb(path: str, nav_sidebar: rx.Component):
rx.icon(tag="chevron-down", size=14, class_name="!text-slate-9"),
class_name="p-[0.563rem] mobile-only",
),
class_name="relative z-10 flex flex-row justify-between items-center gap-4 lg:gap-0 border-slate-4 bg-slate-1 mt-12 mb-6 lg:mb-12 p-[0.5rem_1rem_0.5rem_1rem] lg:p-0 border-b lg:border-none w-full" + rx.cond(
class_name="relative z-10 flex flex-row justify-between items-center gap-4 lg:gap-0 border-slate-4 bg-slate-1 mt-12 mb-6 lg:mb-12 p-[0.5rem_1rem_0.5rem_1rem] lg:p-0 border-b lg:border-none w-full"
+ rx.cond(
HostingBannerState.show_banner,
" lg:mt-[175px]",
" lg:mt-[119px]",
Expand Down
15 changes: 12 additions & 3 deletions pcweb/views/footer.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from datetime import datetime
import reflex as rx
from pcweb.components.icons.icons import get_icon
from pcweb.pages.gallery import gallery
Expand Down Expand Up @@ -52,8 +53,16 @@ def menu_socials() -> rx.Component:
return rx.box(
rx.box(
social_menu_item("github", GITHUB_URL),
social_menu_item("twitter", TWITTER_URL, class_name="border-l border-slate-5 border-solid border-y-0 border-r-0"),
social_menu_item("forum", FORUM_URL, class_name="!border-l !border-r border-slate-5 border-solid border-y-0"),
social_menu_item(
"twitter",
TWITTER_URL,
class_name="border-l border-slate-5 border-solid border-y-0 border-r-0",
),
social_menu_item(
"forum",
FORUM_URL,
class_name="!border-l !border-r border-slate-5 border-solid border-y-0",
),
social_menu_item("discord", DISCORD_URL),
class_name="flex flex-row h-full align-center divide-x divide-slate-5 border-solid",
),
Expand Down Expand Up @@ -126,7 +135,7 @@ def footer() -> rx.Component:
rx.box(
menu_socials(),
rx.text(
2024 Pynecone, Inc.",
f{datetime.now().year} Pynecone, Inc.",
class_name="font-small text-slate-9",
),
class_name="flex flex-col justify-between items-start gap-4 self-stretch",
Expand Down

0 comments on commit 1bf9de6

Please sign in to comment.