Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -166,6 +166,8 @@ def main():
|
|
| 166 |
st.session_state.search_performed = False
|
| 167 |
if 'filtered_jobs' not in st.session_state:
|
| 168 |
st.session_state.filtered_jobs = pd.DataFrame()
|
|
|
|
|
|
|
| 169 |
|
| 170 |
# Sidebar filters
|
| 171 |
with st.sidebar:
|
|
@@ -196,10 +198,13 @@ def main():
|
|
| 196 |
jobs_df, job_title, location, min_salary, keywords, debug=debug_mode
|
| 197 |
)
|
| 198 |
st.session_state.search_performed = True
|
|
|
|
|
|
|
| 199 |
|
| 200 |
if st.button("Reset Filters", use_container_width=True):
|
| 201 |
st.session_state.search_performed = False
|
| 202 |
st.session_state.filtered_jobs = pd.DataFrame()
|
|
|
|
| 203 |
st.rerun()
|
| 204 |
|
| 205 |
# Display results
|
|
@@ -225,7 +230,20 @@ def main():
|
|
| 225 |
pattern = re.compile(f'({re.escape(keyword)})', re.IGNORECASE)
|
| 226 |
description = pattern.sub(r'**\1**', description)
|
| 227 |
|
| 228 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 229 |
else:
|
| 230 |
st.warning("""
|
| 231 |
No matching jobs found. Try:
|
|
@@ -238,4 +256,4 @@ def main():
|
|
| 238 |
st.info("Use the filters in the sidebar and click 'Search Jobs' to find matching positions.")
|
| 239 |
|
| 240 |
if __name__ == "__main__":
|
| 241 |
-
main()
|
|
|
|
| 166 |
st.session_state.search_performed = False
|
| 167 |
if 'filtered_jobs' not in st.session_state:
|
| 168 |
st.session_state.filtered_jobs = pd.DataFrame()
|
| 169 |
+
if 'expanded_descriptions' not in st.session_state:
|
| 170 |
+
st.session_state.expanded_descriptions = set()
|
| 171 |
|
| 172 |
# Sidebar filters
|
| 173 |
with st.sidebar:
|
|
|
|
| 198 |
jobs_df, job_title, location, min_salary, keywords, debug=debug_mode
|
| 199 |
)
|
| 200 |
st.session_state.search_performed = True
|
| 201 |
+
# Reset expanded descriptions when new search is performed
|
| 202 |
+
st.session_state.expanded_descriptions = set()
|
| 203 |
|
| 204 |
if st.button("Reset Filters", use_container_width=True):
|
| 205 |
st.session_state.search_performed = False
|
| 206 |
st.session_state.filtered_jobs = pd.DataFrame()
|
| 207 |
+
st.session_state.expanded_descriptions = set()
|
| 208 |
st.rerun()
|
| 209 |
|
| 210 |
# Display results
|
|
|
|
| 230 |
pattern = re.compile(f'({re.escape(keyword)})', re.IGNORECASE)
|
| 231 |
description = pattern.sub(r'**\1**', description)
|
| 232 |
|
| 233 |
+
# Check if this description is expanded
|
| 234 |
+
is_expanded = index in st.session_state.expanded_descriptions
|
| 235 |
+
|
| 236 |
+
# Show full or truncated description based on state
|
| 237 |
+
if len(description) > 500 and not is_expanded:
|
| 238 |
+
st.write(description[:500] + "...")
|
| 239 |
+
if st.button("See more", key=f"expand_{index}"):
|
| 240 |
+
st.session_state.expanded_descriptions.add(index)
|
| 241 |
+
st.rerun()
|
| 242 |
+
else:
|
| 243 |
+
st.write(description)
|
| 244 |
+
if len(description) > 500 and st.button("See less", key=f"collapse_{index}"):
|
| 245 |
+
st.session_state.expanded_descriptions.remove(index)
|
| 246 |
+
st.rerun()
|
| 247 |
else:
|
| 248 |
st.warning("""
|
| 249 |
No matching jobs found. Try:
|
|
|
|
| 256 |
st.info("Use the filters in the sidebar and click 'Search Jobs' to find matching positions.")
|
| 257 |
|
| 258 |
if __name__ == "__main__":
|
| 259 |
+
main()
|