Skip to content

Commit

Permalink
fixed hosting banner close function (#1161)
Browse files Browse the repository at this point in the history
* fixed hosting banner close function

* Removed whitespace

---------

Co-authored-by: pourhakimi <[email protected]>
  • Loading branch information
LineIndent and LineIndent authored Jan 7, 2025
1 parent 02ee94c commit 34e8b68
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 29 deletions.
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

0 comments on commit 34e8b68

Please sign in to comment.