Kikulika commited on
Commit
94d4aa1
·
verified ·
1 Parent(s): c7e57f1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -32
app.py CHANGED
@@ -779,9 +779,21 @@ with st.sidebar:
779
  st.rerun()
780
 
781
  # MAIN CONTENT AREA
782
- # Check for selected task ID from URL parameters
783
- selected_task_id = st.query_params.get('task_id', None)
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
- # Clear the task_id parameter and rerun
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
- # Create the card HTML with direct query parameter link
964
- card_html = f"""
965
- <a href="?task_id={task_id}" style="text-decoration:none; color:inherit;">
966
- <div class="task-card" data-task-id="{task_id}">
967
- <div class="card-header {status_class}">
968
- <span class="task-id">{task_id}</span>
969
- </div>
970
- <div class="task-title">{task['Title']}</div>
971
- <div class="task-assignee">{task['Assignee']}</div>
972
- <div class="task-dates">
973
- <span class="date-display">Start: {date_started_str}</span>
974
- <span class="date-display">Finish: {date_to_finish_str}</span>
975
- </div>
976
- </div>
977
- </a>
978
- """
979
-
980
- # Render the card
981
- st.markdown(card_html, unsafe_allow_html=True)
982
-
983
- # Close the container
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("""