za3karia commited on
Commit
9d032de
·
verified ·
1 Parent(s): 944f19a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +64 -32
app.py CHANGED
@@ -1,53 +1,85 @@
1
  import streamlit as st
2
 
3
- import reveal_slides as rs
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
- # Mock data for demonstration purposes
7
  mock_repos = {
8
  "public": ["repo_public_1", "repo_public_2", "repo_public_3"],
9
  "private": ["repo_private_1", "repo_private_2", "repo_private_3"]
10
  }
11
 
12
- mock_branches = ["main", "dev", "feature-1", "hotfix"]
13
-
14
  mock_contributors = ["Alice", "Bob", "Charlie", "Diana"]
15
 
16
- # Streamlit app layout
17
  st.title("GitHub Contributors Recap")
18
 
19
- # Choosing recap period
20
- period = st.selectbox("Choose recap period", options=["month", "3 months", "6 months", "year"])
 
 
 
 
 
 
 
 
 
 
21
 
22
- # Choosing repo type and potentially asking for a private token
23
- repo_type = st.selectbox("Choose repo type", options=["public", "private"])
24
- if repo_type == "private":
25
- private_token = st.text_input("Enter private token")
26
 
27
- # Choosing repository to recap
28
- chosen_repo = st.text_input("enter repo_name")
29
 
30
- # Button to load the repository's data
31
- if st.button("Sync"):
32
- # For the purpose of this mock, we'll assume the data is loaded and present the next options
33
- st.success(f"Data for {chosen_repo} loaded successfully!")
34
 
35
- # Selecting branches
36
- branch_selection = st.radio("Select branches", options=["all", "specific"])
37
- if branch_selection == "specific":
38
- selected_branches = st.multiselect("Choose branches", options=mock_branches)
39
 
40
- # Selecting contributor
41
- contributor_name = st.selectbox("Select contributor name", options=mock_contributors)
 
 
 
 
42
 
43
- # Getting recap
44
- if st.button("Get Recap"):
45
- # Mock recap using markdown
46
-
47
- rs.slides(st.session_state.github_markdown, height=500)
48
 
49
- # Chat prompt message
50
- chat_prompt = st.text_input("Ask any question about the contributor")
51
- if chat_prompt:
52
- st.write("Feature coming soon!")
53
 
 
1
  import streamlit as st
2
 
3
+ # Initialize session state variables if they don't exist
4
+ if 'recap_period' not in st.session_state:
5
+ st.session_state['recap_period'] = 'month'
6
+ if 'repo_type' not in st.session_state:
7
+ st.session_state['repo_type'] = 'public'
8
+ if 'private_token' not in st.session_state:
9
+ st.session_state['private_token'] = ''
10
+ if 'selected_repo' not in st.session_state:
11
+ st.session_state['selected_repo'] = ''
12
+ if 'branch_option' not in st.session_state:
13
+ st.session_state['branch_option'] = 'all'
14
+ if 'selected_branches' not in st.session_state:
15
+ st.session_state['selected_branches'] = []
16
+ if 'selected_contributor' not in st.session_state:
17
+ st.session_state['selected_contributor'] = ''
18
 
19
+ markdown = r"""
20
+ # GitHub Recap: Repository
21
+ Details about the repository: Lorem ipsum dolor sit amet...
22
+ ---
23
+ # GitHub Recap: Contributor
24
+ Contributions and activities: Consectetur adipiscing elit...
25
+ ---
26
+ # Additional Insights
27
+ Further analysis and statistics: Sed do eiusmod tempor incididunt...
28
+ ---
29
+ ## Conclusion
30
+ Summary and final thoughts.
31
+ """
32
 
33
+ # Mock data
34
  mock_repos = {
35
  "public": ["repo_public_1", "repo_public_2", "repo_public_3"],
36
  "private": ["repo_private_1", "repo_private_2", "repo_private_3"]
37
  }
38
 
39
+ mock_branches = ["main", "dev", "feature-1", "bugfix-a"]
 
40
  mock_contributors = ["Alice", "Bob", "Charlie", "Diana"]
41
 
42
+ # App title
43
  st.title("GitHub Contributors Recap")
44
 
45
+ # Recap period selection
46
+ st.session_state['recap_period'] = st.selectbox("Choose recap period", options=["month", "3 months", "6 months", "year"], index=0)
47
+
48
+ # Repo type selection
49
+ st.session_state['repo_type'] = st.selectbox("Choose repo type", options=["public", "private"], index=0)
50
+
51
+ # If repo type is private, request for private token
52
+ if st.session_state['repo_type'] == "private":
53
+ st.session_state['private_token'] = st.text_input("Enter private token")
54
+
55
+ # Repository selection
56
+ st.session_state['reponame'] = st.text_input("hashicorp/terraform")
57
 
58
+ # Load button to fetch repo data (simulated with mock data)
59
+ if st.button("Load Repository Data"):
60
+ st.session_state['selected_branches'] = mock_branches # Simulate fetching branches
61
+ st.session_state['selected_contributor'] = '' # Reset selected contributor
62
 
63
+ # Branch selection
64
+ branch_option = st.radio("Select branches:", options=["all", "specific"])
65
 
66
+ if branch_option == "specific":
67
+ st.session_state['selected_branches'] = st.multiselect("Select branches", options=mock_branches, default=mock_branches)
 
 
68
 
69
+ # Contributor selection
70
+ st.session_state['selected_contributor'] = st.selectbox("Select contributor name", options=mock_contributors)
 
 
71
 
72
+ # Get recap button
73
+ if st.button("Get Recap"):
74
+
75
+
76
+ # Placeholder for GitHub markdown content
77
+ rs.slides(markdown, height=500)
78
 
79
+ # Chat prompt (future feature)
80
+ st.text_input("Ask any question about the contributor:", on_change=None, key="chat_prompt")
81
+
82
+ if st.button("ask"):
83
+ st.write("Feature coming soon!")
84
 
 
 
 
 
85