Update app.py
Browse files
app.py
CHANGED
|
@@ -779,9 +779,21 @@ with st.sidebar:
|
|
| 779 |
st.rerun()
|
| 780 |
|
| 781 |
# MAIN CONTENT AREA
|
| 782 |
-
#
|
| 783 |
-
|
| 784 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 785 |
# If a task is selected, show task details
|
| 786 |
if selected_task_id:
|
| 787 |
# Get task details
|
|
@@ -790,9 +802,7 @@ if selected_task_id:
|
|
| 790 |
if not task_df.empty:
|
| 791 |
# Back to board button
|
| 792 |
if st.button("← Back to Board", key="back_btn"):
|
| 793 |
-
|
| 794 |
-
for key in list(st.query_params.keys()):
|
| 795 |
-
del st.query_params[key]
|
| 796 |
st.rerun()
|
| 797 |
|
| 798 |
# Get task data
|
|
@@ -958,33 +968,29 @@ else:
|
|
| 958 |
|
| 959 |
# Format dates for display - shorter format
|
| 960 |
date_started_str = task['Date Started'].strftime('%m/%d') if 'Date Started' in task and pd.notna(task['Date Started']) else "Not set"
|
| 961 |
-
date_to_finish_str = task['Date to Finish'].strftime('%m/%d') if 'Date to Finish' in task and pd.notna(task['Date to Finish']) else "Not set"
|
| 962 |
-
|
| 963 |
-
#
|
| 964 |
-
|
| 965 |
-
|
| 966 |
-
|
| 967 |
-
|
| 968 |
-
|
| 969 |
-
|
| 970 |
-
|
| 971 |
-
|
| 972 |
-
|
| 973 |
-
|
| 974 |
-
|
| 975 |
-
|
| 976 |
-
|
| 977 |
-
|
| 978 |
-
|
| 979 |
-
|
| 980 |
-
|
| 981 |
-
|
| 982 |
-
|
| 983 |
-
|
| 984 |
-
st.markdown('</div>', unsafe_allow_html=True)
|
| 985 |
-
|
| 986 |
-
# Close container
|
| 987 |
-
st.markdown('</div>', unsafe_allow_html=True)
|
| 988 |
|
| 989 |
# Add JavaScript for better interactivity
|
| 990 |
st.markdown("""
|
|
|
|
| 779 |
st.rerun()
|
| 780 |
|
| 781 |
# MAIN CONTENT AREA
|
| 782 |
+
# Get selected task ID from URL parameters
|
| 783 |
+
url_task_id = st.query_params.get('task_id', None)
|
| 784 |
|
| 785 |
+
# Update session state based on URL parameter
|
| 786 |
+
if url_task_id:
|
| 787 |
+
st.session_state.selected_task_id = url_task_id
|
| 788 |
+
|
| 789 |
+
# Use session state for selected task ID
|
| 790 |
+
selected_task_id = st.session_state.selected_task_id
|
| 791 |
+
|
| 792 |
+
# If a back button is clicked, clear selection
|
| 793 |
+
if st.button("← Back to Board", key="back_btn"):
|
| 794 |
+
st.session_state.selected_task_id = None
|
| 795 |
+
st.rerun()
|
| 796 |
+
|
| 797 |
# If a task is selected, show task details
|
| 798 |
if selected_task_id:
|
| 799 |
# Get task details
|
|
|
|
| 802 |
if not task_df.empty:
|
| 803 |
# Back to board button
|
| 804 |
if st.button("← Back to Board", key="back_btn"):
|
| 805 |
+
st.session_state.selected_task_id = None
|
|
|
|
|
|
|
| 806 |
st.rerun()
|
| 807 |
|
| 808 |
# Get task data
|
|
|
|
| 968 |
|
| 969 |
# Format dates for display - shorter format
|
| 970 |
date_started_str = task['Date Started'].strftime('%m/%d') if 'Date Started' in task and pd.notna(task['Date Started']) else "Not set"
|
| 971 |
+
date_to_finish_str = task['Date to Finish'].strftime('%m/%d') if 'Date to Finish' in task and pd.notna(task['Date to Finish']) else "Not set"
|
| 972 |
+
|
| 973 |
+
# With this direct Streamlit approach:
|
| 974 |
+
with st.container():
|
| 975 |
+
col1, col2 = st.columns([4, 1])
|
| 976 |
+
with col1:
|
| 977 |
+
st.markdown(f"""
|
| 978 |
+
<div class="task-card" data-task-id="{task_id}">
|
| 979 |
+
<div class="card-header {status_class}">
|
| 980 |
+
<span class="task-id">{task_id}</span>
|
| 981 |
+
</div>
|
| 982 |
+
<div class="task-title">{task['Title']}</div>
|
| 983 |
+
<div class="task-assignee">{task['Assignee']}</div>
|
| 984 |
+
<div class="task-dates">
|
| 985 |
+
<span class="date-display">Start: {date_started_str}</span>
|
| 986 |
+
<span class="date-display">Finish: {date_to_finish_str}</span>
|
| 987 |
+
</div>
|
| 988 |
+
</div>
|
| 989 |
+
""", unsafe_allow_html=True)
|
| 990 |
+
with col2:
|
| 991 |
+
if st.button("View", key=f"view_{task_id}"):
|
| 992 |
+
st.session_state.selected_task_id = task_id
|
| 993 |
+
st.rerun()
|
|
|
|
|
|
|
|
|
|
|
|
|
| 994 |
|
| 995 |
# Add JavaScript for better interactivity
|
| 996 |
st.markdown("""
|