Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +37 -9
src/streamlit_app.py
CHANGED
|
@@ -3,6 +3,9 @@ import pandas as pd
|
|
| 3 |
import random
|
| 4 |
import os
|
| 5 |
|
|
|
|
|
|
|
|
|
|
| 6 |
# Load movie data
|
| 7 |
BASE_DIR = os.path.dirname(__file__)
|
| 8 |
MOVIES_PATH = os.path.join(BASE_DIR, "movies.csv")
|
|
@@ -24,7 +27,7 @@ if "rated" not in st.session_state:
|
|
| 24 |
if "quiz_history" not in st.session_state:
|
| 25 |
st.session_state.quiz_history = []
|
| 26 |
|
| 27 |
-
# Navigation
|
| 28 |
st.markdown("""
|
| 29 |
<style>
|
| 30 |
.nav-bar {
|
|
@@ -33,26 +36,51 @@ st.markdown("""
|
|
| 33 |
align-items: center;
|
| 34 |
background-color: #1b263b;
|
| 35 |
padding: 1rem;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
}
|
| 37 |
.nav-item {
|
| 38 |
color: white;
|
| 39 |
font-size: 20px;
|
| 40 |
text-decoration: none;
|
| 41 |
-
margin:
|
| 42 |
-
cursor: pointer;
|
| 43 |
}
|
| 44 |
-
.search-
|
| 45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
padding: 0.5rem;
|
| 47 |
font-size: 16px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
}
|
| 49 |
</style>
|
| 50 |
<div class="nav-bar">
|
| 51 |
-
<
|
| 52 |
-
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
| 54 |
</form>
|
| 55 |
-
<
|
|
|
|
|
|
|
| 56 |
</div>
|
| 57 |
""", unsafe_allow_html=True)
|
| 58 |
|
|
|
|
| 3 |
import random
|
| 4 |
import os
|
| 5 |
|
| 6 |
+
# Page config to use full width
|
| 7 |
+
st.set_page_config(layout="wide")
|
| 8 |
+
|
| 9 |
# Load movie data
|
| 10 |
BASE_DIR = os.path.dirname(__file__)
|
| 11 |
MOVIES_PATH = os.path.join(BASE_DIR, "movies.csv")
|
|
|
|
| 27 |
if "quiz_history" not in st.session_state:
|
| 28 |
st.session_state.quiz_history = []
|
| 29 |
|
| 30 |
+
# Navigation and search
|
| 31 |
st.markdown("""
|
| 32 |
<style>
|
| 33 |
.nav-bar {
|
|
|
|
| 36 |
align-items: center;
|
| 37 |
background-color: #1b263b;
|
| 38 |
padding: 1rem;
|
| 39 |
+
width: 100%;
|
| 40 |
+
}
|
| 41 |
+
.nav-left, .nav-right {
|
| 42 |
+
display: flex;
|
| 43 |
+
align-items: center;
|
| 44 |
}
|
| 45 |
.nav-item {
|
| 46 |
color: white;
|
| 47 |
font-size: 20px;
|
| 48 |
text-decoration: none;
|
| 49 |
+
margin-right: 1rem;
|
|
|
|
| 50 |
}
|
| 51 |
+
.search-form {
|
| 52 |
+
display: flex;
|
| 53 |
+
width: 100%;
|
| 54 |
+
max-width: 700px;
|
| 55 |
+
}
|
| 56 |
+
.search-input {
|
| 57 |
+
flex: 1;
|
| 58 |
padding: 0.5rem;
|
| 59 |
font-size: 16px;
|
| 60 |
+
border: none;
|
| 61 |
+
border-radius: 4px 0 0 4px;
|
| 62 |
+
}
|
| 63 |
+
.search-button {
|
| 64 |
+
padding: 0.5rem 1rem;
|
| 65 |
+
font-size: 16px;
|
| 66 |
+
background-color: #0d6efd;
|
| 67 |
+
color: white;
|
| 68 |
+
border: none;
|
| 69 |
+
border-radius: 0 4px 4px 0;
|
| 70 |
+
cursor: pointer;
|
| 71 |
}
|
| 72 |
</style>
|
| 73 |
<div class="nav-bar">
|
| 74 |
+
<div class="nav-left">
|
| 75 |
+
<a class="nav-item" href="/?home=true">๐ Home</a>
|
| 76 |
+
</div>
|
| 77 |
+
<form class="search-form" action="/" method="get">
|
| 78 |
+
<input type="text" name="search" class="search-input" placeholder="Search movies...">
|
| 79 |
+
<button type="submit" class="search-button">๐</button>
|
| 80 |
</form>
|
| 81 |
+
<div class="nav-right">
|
| 82 |
+
<a class="nav-item" href="/?recommend=true">๐ฏ Quiz</a>
|
| 83 |
+
</div>
|
| 84 |
</div>
|
| 85 |
""", unsafe_allow_html=True)
|
| 86 |
|