Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -590,13 +590,18 @@ elif st.session_state.current_index == len(st.session_state.data):
|
|
590 |
else:
|
591 |
st.write(f"Thank you for taking part in this study!")
|
592 |
|
593 |
-
|
594 |
-
if st.session_state.current_index > 0:
|
595 |
-
if st.button("Previous"):
|
596 |
-
navigate(-1)
|
597 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
598 |
|
599 |
-
|
600 |
if 0 <= st.session_state.current_index < len(st.session_state.data):
|
601 |
st.write(f"Page {st.session_state.current_index + 1} out of {len(st.session_state.data)}")
|
602 |
|
@@ -605,20 +610,18 @@ def navigate_to_index():
|
|
605 |
go_to_index = int(st.session_state.go_to)
|
606 |
# Check if the index is within the valid range
|
607 |
if 0 <= go_to_index < len(st.session_state.data):
|
|
|
608 |
navigate_to_row(go_to_index)
|
609 |
else:
|
610 |
st.info(f"{go_to_index} is not in the range of data.")
|
611 |
except ValueError:
|
612 |
st.error("The page number must be an integer.")
|
613 |
|
614 |
-
|
615 |
-
with col2:
|
616 |
with st.form(key="nav_form"):
|
617 |
st.number_input("Go to Index: ", key="go_to", format="%.0f")
|
618 |
st.form_submit_button("Go", on_click=navigate_to_index)
|
619 |
-
|
620 |
-
go_to_index = get_start_index()
|
621 |
-
navigate_to_row(go_to_index)
|
622 |
|
623 |
|
624 |
|
|
|
590 |
else:
|
591 |
st.write(f"Thank you for taking part in this study!")
|
592 |
|
593 |
+
col1, col2, col3 = st.columns([2, 2, 1.5])
|
|
|
|
|
|
|
594 |
|
595 |
+
# Navigation buttons
|
596 |
+
with col1:
|
597 |
+
if st.session_state.current_index > 0:
|
598 |
+
if st.button("Previous"):
|
599 |
+
navigate(-1)
|
600 |
+
with col3:
|
601 |
+
if st.button("Last edited instance"):
|
602 |
+
go_to_index = get_start_index()
|
603 |
+
navigate_to_row(go_to_index)
|
604 |
|
|
|
605 |
if 0 <= st.session_state.current_index < len(st.session_state.data):
|
606 |
st.write(f"Page {st.session_state.current_index + 1} out of {len(st.session_state.data)}")
|
607 |
|
|
|
610 |
go_to_index = int(st.session_state.go_to)
|
611 |
# Check if the index is within the valid range
|
612 |
if 0 <= go_to_index < len(st.session_state.data):
|
613 |
+
st.session_state.go_to = 0
|
614 |
navigate_to_row(go_to_index)
|
615 |
else:
|
616 |
st.info(f"{go_to_index} is not in the range of data.")
|
617 |
except ValueError:
|
618 |
st.error("The page number must be an integer.")
|
619 |
|
620 |
+
with col3:
|
|
|
621 |
with st.form(key="nav_form"):
|
622 |
st.number_input("Go to Index: ", key="go_to", format="%.0f")
|
623 |
st.form_submit_button("Go", on_click=navigate_to_index)
|
624 |
+
|
|
|
|
|
625 |
|
626 |
|
627 |
|