Spaces:
Sleeping
Sleeping
from navigation import make_sidebar | |
import streamlit as st | |
from time import sleep | |
import yaml | |
make_sidebar() | |
# Sample job data | |
with open(f'data/jobs/jobs.yaml', 'r') as file: | |
jobs = yaml.safe_load(file) | |
# job = { | |
# "ssc1": {"description": "This is a new job...", "qualification": "class 10"}, | |
# "ssc2": {"description": "Another exciting job...", "qualification": "class 12"}, | |
# "engineer": {"description": "Engineering job...", "qualification": "B.E/B.Tech"}, | |
# } | |
st.title("Job Listings") | |
hide_st_style = """ | |
<style> | |
#MainMenu {visibility: hidden;} | |
footer {visibility: hidden;} | |
header {visibility: hidden;} | |
</style> | |
""" | |
st.markdown(hide_st_style, unsafe_allow_html=True) | |
# Initialize session state to keep track of which job's details to show | |
if 'selected_job' not in st.session_state: | |
st.session_state.selected_job = None | |
# Loop through all jobs and display them as buttons with title and description | |
for title, details in jobs.items(): | |
# Format title and description in one string | |
button_label = "more details" | |
st.markdown(f""" | |
<div style="border: 2px solid #4CAF50; padding: 15px; border-radius: 6px;"> | |
<p style="font-size:18px; color:black; text-align:center;"> | |
<h2> {title} </h2> | |
Description: {details["description"]} | |
</p> | |
</div> | |
""", unsafe_allow_html=True) | |
if st.button(button_label,key=f"know{title}"): | |
# Set the selected job when the button is clicked | |
st.session_state.selected_job = title | |
sleep(0.5) | |
st.switch_page("pages/job_details.py") | |
# # Show job details if a button was clicked | |
# if st.session_state.selected_job: | |
# selected_title = st.session_state.selected_job | |
# st.subheader(f"Details for {selected_title}") | |
# st.write(f"**Description**: {job[selected_title]['description']}") | |
# st.write(f"**Qualification**: {job[selected_title]['qualification']}") |