add guide
Browse files- src/components/header.py +68 -49
- src/core/styles.py +41 -26
src/components/header.py
CHANGED
@@ -15,64 +15,83 @@ def get_image_base64(image_path: Path) -> str:
|
|
15 |
|
16 |
def render_contribution_guide():
|
17 |
"""Render the contribution guide section"""
|
18 |
-
|
19 |
-
st.
|
20 |
-
|
21 |
-
How does your device stack up? Benchmark your phone and join the leaderboard!
|
22 |
-
"""
|
23 |
-
)
|
24 |
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
-
col1, col2 = st.columns(2)
|
29 |
-
with col1:
|
30 |
-
# Google Play badge
|
31 |
-
playstore_badge = Path("src/static/images/GetItOnGooglePlay_Badge.png")
|
32 |
-
if playstore_badge.exists():
|
33 |
st.markdown(
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
if appstore_badge.exists():
|
45 |
st.markdown(
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
|
|
|
|
51 |
)
|
52 |
|
53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
-
|
56 |
-
|
57 |
-
"""
|
58 |
-
|
59 |
-
|
60 |
-
2. **Get** your preferred model
|
61 |
-
3. **Run** benchmark
|
62 |
-
4. **Submit** to leaderboard
|
63 |
-
"""
|
64 |
-
)
|
65 |
-
|
66 |
-
# Demo video/gif
|
67 |
-
demo_gif = Path("src/static/images/Bench.gif")
|
68 |
-
if demo_gif.exists():
|
69 |
-
st.markdown(
|
70 |
-
f'<div class="demo-container">'
|
71 |
-
f'<img src="data:image/gif;base64,{get_image_base64(demo_gif)}" '
|
72 |
-
'class="demo-gif" alt="Benchmark Demo">'
|
73 |
-
"</div>",
|
74 |
-
unsafe_allow_html=True,
|
75 |
-
)
|
76 |
|
77 |
|
78 |
def render_header():
|
|
|
15 |
|
16 |
def render_contribution_guide():
|
17 |
"""Render the contribution guide section"""
|
18 |
+
# Session state for visibility
|
19 |
+
if "show_guide" not in st.session_state:
|
20 |
+
st.session_state.show_guide = True
|
|
|
|
|
|
|
21 |
|
22 |
+
if st.session_state.show_guide:
|
23 |
+
# Container for the guide with dismiss button
|
24 |
+
with st.container():
|
25 |
+
col1, col2 = st.columns([0.8, 0.2])
|
26 |
+
with col1:
|
27 |
+
st.markdown("### 🚀 Contribute")
|
28 |
+
with col2:
|
29 |
+
if st.button("✕", help="Dismiss guide"):
|
30 |
+
st.session_state.show_guide = False
|
31 |
+
st.rerun()
|
32 |
|
|
|
|
|
|
|
|
|
|
|
33 |
st.markdown(
|
34 |
+
"""
|
35 |
+
How does your device stack up? Benchmark your phone and join the leaderboard!
|
36 |
+
"""
|
37 |
+
)
|
38 |
+
|
39 |
+
# Store badges in a row container
|
40 |
+
st.markdown('<div class="store-badges-row">', unsafe_allow_html=True)
|
41 |
+
|
42 |
+
# Google Play badge
|
43 |
+
playstore_badge = Path("src/static/images/GetItOnGooglePlay_Badge.png")
|
44 |
+
if playstore_badge.exists():
|
45 |
+
st.markdown(
|
46 |
+
f'<a href="https://play.google.com/store/apps/details?id=com.pocketpalai" target="_blank">'
|
47 |
+
f'<img src="data:image/png;base64,{get_image_base64(playstore_badge)}" '
|
48 |
+
'class="store-badge" alt="Get it on Google Play">'
|
49 |
+
"</a>",
|
50 |
+
unsafe_allow_html=True,
|
51 |
+
)
|
52 |
+
|
53 |
+
# App Store badge
|
54 |
+
appstore_badge = Path(
|
55 |
+
"src/static/images/Download_on_the_App_Store_Badge.svg"
|
56 |
)
|
57 |
+
if appstore_badge.exists():
|
58 |
+
st.markdown(
|
59 |
+
f'<a href="https://apps.apple.com/de/app/pocketpal-ai/id6502579498" target="_blank">'
|
60 |
+
f'<img src="data:image/svg+xml;base64,{get_image_base64(appstore_badge)}" '
|
61 |
+
'class="store-badge" alt="Download on the App Store">'
|
62 |
+
"</a>",
|
63 |
+
unsafe_allow_html=True,
|
64 |
+
)
|
65 |
|
66 |
+
st.markdown("</div>", unsafe_allow_html=True)
|
67 |
+
|
68 |
+
# Quick steps
|
|
|
69 |
st.markdown(
|
70 |
+
"""
|
71 |
+
#### Quick Guide:
|
72 |
+
1. **Download** PocketPal AI
|
73 |
+
2. **Get** your preferred model
|
74 |
+
3. **Run** benchmark
|
75 |
+
4. **Submit** to leaderboard
|
76 |
+
"""
|
77 |
)
|
78 |
|
79 |
+
# Demo video/gif
|
80 |
+
demo_gif = Path("src/static/images/Bench.gif")
|
81 |
+
if demo_gif.exists():
|
82 |
+
st.markdown(
|
83 |
+
f'<div class="demo-container">'
|
84 |
+
f'<img src="data:image/gif;base64,{get_image_base64(demo_gif)}" '
|
85 |
+
'class="demo-gif" alt="Benchmark Demo">'
|
86 |
+
"</div>",
|
87 |
+
unsafe_allow_html=True,
|
88 |
+
)
|
89 |
|
90 |
+
else:
|
91 |
+
# Show restore button when guide is dismissed
|
92 |
+
if st.button("Show Guide", help="Show contribution guide"):
|
93 |
+
st.session_state.show_guide = True
|
94 |
+
st.rerun()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
|
96 |
|
97 |
def render_header():
|
src/core/styles.py
CHANGED
@@ -59,7 +59,46 @@ CUSTOM_CSS = """
|
|
59 |
padding-bottom: 1rem;
|
60 |
max-width: 800px;
|
61 |
}
|
62 |
-
/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
.store-badges-row {
|
64 |
display: flex;
|
65 |
justify-content: center;
|
@@ -75,6 +114,7 @@ CUSTOM_CSS = """
|
|
75 |
.store-badge:hover {
|
76 |
transform: scale(1.05);
|
77 |
}
|
|
|
78 |
.demo-container {
|
79 |
background: #f8f9fa;
|
80 |
padding: 10px;
|
@@ -88,30 +128,5 @@ CUSTOM_CSS = """
|
|
88 |
border-radius: 8px;
|
89 |
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
90 |
}
|
91 |
-
/* Guide Typography */
|
92 |
-
div[data-testid="column"]:last-child h3 {
|
93 |
-
font-size: 1.3rem;
|
94 |
-
margin: 0.5rem 0;
|
95 |
-
color: #1a1a1a;
|
96 |
-
}
|
97 |
-
div[data-testid="column"]:last-child h4 {
|
98 |
-
font-size: 1.1rem;
|
99 |
-
margin: 1rem 0 0.5rem 0;
|
100 |
-
color: #333;
|
101 |
-
}
|
102 |
-
div[data-testid="column"]:last-child ol {
|
103 |
-
padding-left: 1.2rem;
|
104 |
-
margin: 0.5rem 0;
|
105 |
-
}
|
106 |
-
div[data-testid="column"]:last-child li {
|
107 |
-
margin: 0.3rem 0;
|
108 |
-
color: #444;
|
109 |
-
font-size: 0.9rem;
|
110 |
-
}
|
111 |
-
div[data-testid="column"]:last-child p {
|
112 |
-
font-size: 0.95rem;
|
113 |
-
color: #666;
|
114 |
-
margin: 0.5rem 0;
|
115 |
-
}
|
116 |
</style>
|
117 |
"""
|
|
|
59 |
padding-bottom: 1rem;
|
60 |
max-width: 800px;
|
61 |
}
|
62 |
+
/* Guide Typography */
|
63 |
+
div[data-testid="column"]:last-child h3 {
|
64 |
+
font-size: 1.3rem;
|
65 |
+
margin: 0.5rem 0;
|
66 |
+
color: #1a1a1a;
|
67 |
+
}
|
68 |
+
div[data-testid="column"]:last-child h4 {
|
69 |
+
font-size: 1.1rem;
|
70 |
+
margin: 1rem 0 0.5rem 0;
|
71 |
+
color: #333;
|
72 |
+
}
|
73 |
+
div[data-testid="column"]:last-child ol {
|
74 |
+
padding-left: 1.2rem;
|
75 |
+
margin: 0.5rem 0;
|
76 |
+
}
|
77 |
+
div[data-testid="column"]:last-child li {
|
78 |
+
margin: 0.3rem 0;
|
79 |
+
color: #444;
|
80 |
+
font-size: 0.9rem;
|
81 |
+
}
|
82 |
+
div[data-testid="column"]:last-child p {
|
83 |
+
font-size: 0.95rem;
|
84 |
+
color: #666;
|
85 |
+
margin: 0.5rem 0;
|
86 |
+
}
|
87 |
+
/* Dismiss button styling */
|
88 |
+
div[data-testid="column"]:last-child button {
|
89 |
+
float: right;
|
90 |
+
background: transparent;
|
91 |
+
border: none;
|
92 |
+
color: #666;
|
93 |
+
padding: 0.2rem 0.4rem;
|
94 |
+
font-size: 1rem;
|
95 |
+
line-height: 1;
|
96 |
+
transition: all 0.2s;
|
97 |
+
}
|
98 |
+
div[data-testid="column"]:last-child button:hover {
|
99 |
+
color: #333;
|
100 |
+
}
|
101 |
+
/* Store badges styling */
|
102 |
.store-badges-row {
|
103 |
display: flex;
|
104 |
justify-content: center;
|
|
|
114 |
.store-badge:hover {
|
115 |
transform: scale(1.05);
|
116 |
}
|
117 |
+
/* Demo container */
|
118 |
.demo-container {
|
119 |
background: #f8f9fa;
|
120 |
padding: 10px;
|
|
|
128 |
border-radius: 8px;
|
129 |
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
130 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
</style>
|
132 |
"""
|