za3karia commited on
Commit
ec8ccdd
·
verified ·
1 Parent(s): b2a38ee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import streamlit as st
2
  import reveal_slides as rs
3
  import time
 
4
 
5
  # Initialize session state variables if they don't exist
6
  if 'recap_period' not in st.session_state:
@@ -42,12 +43,9 @@ mock_repos = {
42
  "private": ["repo_private_1", "repo_private_2", "repo_private_3"]
43
  }
44
 
45
- mock_branches = ["main", "dev", "feature-1", "bugfix-a"]
46
- mock_contributors = ["Alice", "Bob", "Charlie", "Diana"]
47
 
48
  # App title
49
  st.title("GitHub Contributors Recap")
50
- st.title(st.secrets["OPEN_AI_TOKEN"])
51
 
52
  # Recap period selection
53
  st.session_state['recap_period'] = st.selectbox("Choose recap period", options=["month", "3 months", "6 months", "year"], index=0)
@@ -66,18 +64,20 @@ if st.button("sync"):
66
  st.session_state['sync'] = True
67
  # Load button to fetch repo data (simulated with mock data)
68
  if st.session_state['sync']:
69
- time.sleep(1)
70
- st.session_state['selected_branches'] = mock_branches # Simulate fetching branches
 
 
71
  st.session_state['selected_contributor'] = '' # Reset selected contributor
72
 
73
  # Branch selection
74
  branch_option = st.radio("Select branches:", options=["all", "specific"])
75
 
76
  if branch_option == "specific":
77
- st.session_state['selected_branches'] = st.multiselect("Select branches", options=mock_branches, default=mock_branches)
78
 
79
  # Contributor selection
80
- st.session_state['selected_contributor'] = st.selectbox("Select contributor name", options=mock_contributors)
81
 
82
  # Get recap button
83
  if st.button("Get Recap"):
 
1
  import streamlit as st
2
  import reveal_slides as rs
3
  import time
4
+ from functions import *
5
 
6
  # Initialize session state variables if they don't exist
7
  if 'recap_period' not in st.session_state:
 
43
  "private": ["repo_private_1", "repo_private_2", "repo_private_3"]
44
  }
45
 
 
 
46
 
47
  # App title
48
  st.title("GitHub Contributors Recap")
 
49
 
50
  # Recap period selection
51
  st.session_state['recap_period'] = st.selectbox("Choose recap period", options=["month", "3 months", "6 months", "year"], index=0)
 
64
  st.session_state['sync'] = True
65
  # Load button to fetch repo data (simulated with mock data)
66
  if st.session_state['sync']:
67
+ contributors_list = get_contributors(repo, updated_token=st.session_state['private_token'])
68
+ branches_list = get_repo_branches(repo, updated_token=st.session_state['private_token'])
69
+
70
+ st.session_state['selected_branches'] = branches_list
71
  st.session_state['selected_contributor'] = '' # Reset selected contributor
72
 
73
  # Branch selection
74
  branch_option = st.radio("Select branches:", options=["all", "specific"])
75
 
76
  if branch_option == "specific":
77
+ st.session_state['selected_branches'] = st.multiselect("Select branches", options=branches_list, default=mock_branches)
78
 
79
  # Contributor selection
80
+ st.session_state['selected_contributor'] = st.selectbox("Select contributor name", options=contributors_list)
81
 
82
  # Get recap button
83
  if st.button("Get Recap"):