Skip to content

Commit 0f3c5bf

Browse files
adhami3310amsraman
andauthored
remove demo for llama index (#1197)
* remove demo for llama index * woops * cond on app demo --------- Co-authored-by: Aditya Sundaram <[email protected]>
1 parent f801a6e commit 0f3c5bf

File tree

4 files changed

+37
-26
lines changed

4 files changed

+37
-26
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.states
12
**/*.db
23
**/*.pyc
34
**/*.swp

pcweb/components/code_card.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
from reflex.components.datadisplay.shiki_code_block import copy_script
44

55

6-
def install_command(command: str, show_dollar_sign: bool = True, **props) -> rx.Component:
6+
def install_command(
7+
command: str, show_dollar_sign: bool = True, **props
8+
) -> rx.Component:
79
return rx.el.button(
810
rx.icon("copy", size=14, margin_left="5px"),
911
rx.text(
@@ -115,16 +117,22 @@ def gallery_app_card(app: dict) -> rx.Component:
115117
rx.vstack(
116118
rx.box(
117119
rx.hstack(
118-
install_command(f"reflex init --template {app['title']}"),
119-
rx.hstack(
120-
repo(app["demo"]),
121-
justify="start",
122-
120+
install_command(
121+
f"reflex init --template {app['title']}"
122+
),
123+
*(
124+
[
125+
rx.hstack(
126+
repo(app["demo"]),
127+
justify="start",
128+
)
129+
]
130+
if "demo" in app
131+
else []
123132
),
124133
),
125134
width="310px",
126135
max_width="310px",
127-
128136
),
129137
rx.cond(
130138
"Reflex" in app["author"],
@@ -146,10 +154,8 @@ def gallery_app_card(app: dict) -> rx.Component:
146154
),
147155
),
148156
align_items="start",
149-
class_name="brother-john"
157+
class_name="brother-john",
150158
),
151-
152-
153159
class_name="flex flex-row items-center gap-[6px] justify-between w-full",
154160
),
155161
class_name="flex flex-col justify-between items-start gap-1 p-[0.625rem_0.75rem_0.625rem_0.75rem] w-full h-full",

pcweb/pages/gallery/apps.py

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ def get_route(path: str):
3131

3232

3333
def more_posts(current_post: dict) -> rx.Component:
34-
3534
posts = []
3635
app_items = list(gallery_apps_data_copy.items())
3736
current_index = next(
@@ -49,8 +48,8 @@ def more_posts(current_post: dict) -> rx.Component:
4948
selected_posts = app_items[-3:]
5049
else:
5150
# Create a list of all posts except the current one
52-
other_posts = app_items[:current_index] + app_items[current_index + 1:]
53-
51+
other_posts = app_items[:current_index] + app_items[current_index + 1 :]
52+
5453
if len(other_posts) <= 3:
5554
# If there are 3 or fewer other posts, show all of them
5655
selected_posts = other_posts
@@ -63,9 +62,9 @@ def more_posts(current_post: dict) -> rx.Component:
6362
else:
6463
# For all other cases, show one before and two after (or two before and one after if we're near the end)
6564
if current_index < len(app_items) - 2:
66-
selected_posts = other_posts[current_index-1:current_index+2]
65+
selected_posts = other_posts[current_index - 1 : current_index + 2]
6766
else:
68-
selected_posts = other_posts[current_index-2:current_index+1]
67+
selected_posts = other_posts[current_index - 2 : current_index + 1]
6968

7069
for path, document in selected_posts:
7170
meta = document.metadata
@@ -131,14 +130,20 @@ def page(document) -> rx.Component:
131130
class_name="flex flex-col gap-3 p-8",
132131
),
133132
rx.box(
134-
rx.link(
135-
button_with_icon(
136-
"View Demo",
137-
icon="new_tab",
138-
class_name="!w-full flex-row-reverse gap-2",
139-
),
140-
is_external=True,
141-
href=meta["demo"],
133+
*(
134+
[
135+
rx.link(
136+
button_with_icon(
137+
"View Demo",
138+
icon="new_tab",
139+
class_name="!w-full flex-row-reverse gap-2",
140+
),
141+
is_external=True,
142+
href=meta["demo"],
143+
)
144+
]
145+
if meta.get("demo")
146+
else []
142147
),
143148
rx.link(
144149
button("View Code", variant="muted", class_name="!w-full"),
@@ -192,9 +197,9 @@ def page(document) -> rx.Component:
192197
title=document.metadata["title"],
193198
description=document.metadata["description"],
194199
image=document.metadata["image"],
195-
demo=document.metadata["demo"],
200+
demo=document.metadata["demo"] if "demo" in document.metadata else None,
196201
meta=document.metadata["meta"],
197202
)(lambda doc=document: page(doc))
198203

199204
# Add the route to the list of routes.
200-
gallery_apps_routes.append(comp)
205+
gallery_apps_routes.append(comp)

templates/llamaindex-app.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ title: reflex-llamaindex-template
33
description: "A minimal chat app using LLamaIndex"
44
author: "Reflex"
55
image: "llamaindex.png"
6-
demo: "https://frontend-gold-orca.dev.reflexcorp.run/"
76
source: "https://github.com/reflex-dev/reflex-llamaindex-template"
87
meta: [
98
{"name": "keywords", "content": ""},

0 commit comments

Comments
 (0)