Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed hosting banner close function #1161

Merged
merged 2 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 20 additions & 18 deletions pcweb/components/hosting_banner.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,34 +21,36 @@ def hide_banner(self):
def hosting_banner() -> rx.Component:
return rx.cond(
HostingBannerState.show_banner,
rx.link(
rx.box(
rx.hstack(
rx.link(
rx.box(
rx.text(
"Reflex Cloud - ",
rx.el.span(
"Fast, secure & scalable hosting. One command to deploy.",
class_name="text-slate-12 font-medium text-sm",
rx.box(
rx.text(
"Reflex Cloud - ",
rx.el.span(
"Fast, secure & scalable hosting. One command to deploy.",
class_name="text-slate-12 font-medium text-sm",
),
class_name="text-slate-12 font-semibold text-sm z-[1]",
),
class_name="text-slate-12 font-semibold text-sm z-[1]",
),
rx.el.button(
"Live Now!",
class_name="text-green-11 h-[1.5rem] rounded-md bg-green-4 px-1.5 text-sm font-semibold z-[1] items-center justify-center shrink-0",
rx.el.button(
"Live Now!",
class_name="text-green-11 h-[1.5rem] rounded-md bg-green-4 px-1.5 text-sm font-semibold z-[1] items-center justify-center shrink-0",
),
class_name="flex items-center gap-4",
),
class_name="flex items-center gap-4",
),
glow(),
href=REFLEX_CLOUD_URL,
underline="none",
is_external=True,
),
rx.icon(
"x",
on_click=HostingBannerState.hide_banner,
size=16,
class_name="z-[1] cursor-pointer hover:!text-slate-11 transition-color !text-slate-9 absolute right-4",
class_name="cursor-pointer hover:!text-slate-11 transition-color !text-slate-9 absolute right-4 z-10",
),
glow(),
href=REFLEX_CLOUD_URL,
underline="none",
is_external=True,
class_name="px-4 lg:px-6 w-screen h-auto lg:h-[3.5rem] shadow-[inset_0_-1px_0_0_var(--c-slate-3)] flex items-center justify-center bg-slate-1 flex-row gap-4 overflow-hidden relative lg:py-0 py-2 max-w-full",
),
)
3 changes: 0 additions & 3 deletions pcweb/pcweb.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
# higher and the prod build fails with EMFILE error.
WINDOWS_MAX_ROUTES = int(os.environ.get("REFLEX_WEB_WINDOWS_MAX_ROUTES", "100"))


# Execute all the exec blocks in the documents.
for doc, href in outblocks:
exec_blocks(doc, href)
Expand Down Expand Up @@ -49,7 +48,6 @@
],
)


# XXX: The app is TOO BIG to build on Windows, so explicitly disallow it except for testing
if sys.platform == "win32":
if not os.environ.get("REFLEX_WEB_WINDOWS_OVERRIDE"):
Expand All @@ -59,7 +57,6 @@
)
routes = routes[:WINDOWS_MAX_ROUTES]


# Add the pages to the app.
for route in routes:
# print(f"Adding route: {route}")
Expand Down
17 changes: 9 additions & 8 deletions pcweb/whitelist.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
# A list of whitelist paths that should be built.
# If the list is empty, all pages will be built.
# A list of whitelist paths that should be built.
# If the list is empty, all pages will be built.

# Tips:
# - Ensure that the path starts with a forward slash '/'.
# - Ensure that the path starts with a forward slash '/'.
# - Do not include a trailing slash '/' at the end of the path.

# Examples:
# - Correct: WHITELISTED_PAGES = ["/docs/getting-started/introduction"]
# - Correct: WHITELISTED_PAGES = ["/docs/getting-started/introduction"]
# - Incorrect: WHITELISTED_PAGES = ["/docs/getting-started/introduction/"]

WHITELISTED_PAGES = []
WHITELISTED_PAGES = []


def _check_whitelisted_path(path):
if len(WHITELISTED_PAGES) == 0:
return True
return True

# If the path is the root, always build it.
if path == "/":
return True

if len(WHITELISTED_PAGES) == 1 and WHITELISTED_PAGES[0] == "/":
return False

for whitelisted_path in WHITELISTED_PAGES:
if path.startswith(whitelisted_path):
return True
Expand Down
Loading