File size: 2,689 Bytes
f10c25c
75d4140
f10c25c
ad1915b
 
 
 
 
 
 
 
 
 
 
 
f07f21c
ad1915b
 
 
 
 
 
 
 
db2a37e
 
 
 
e9a1e34
 
db2a37e
 
 
 
f10c25c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ad1915b
 
 
 
 
 
 
 
 
 
 
 
 
0c93774
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import streamlit as st
import requests

influencers_data = {
    "influencer1": {
        "onboarded": True,
        "name": "Influencer One",
        "image": "./images/inf1.png",  # Replace with actual image paths
        "details": "Details about Influencer One..."
    },
    "influencer2": {
        "onboarded": True,
        "name": "Influencer Two",
        "image": "./images/inf2.png",
        "details": "Details about Influencer Two..."
    },
    "influencer3": {
        "onboarded": False,
        "name": "Influencer Two",
        "image": "./images/inf2.png"
    }
    # Add more influencers as needed
}

def onboard_single_influencer(handle):
    url = "https://us-central1-steam-cache-277314.cloudfunctions.net/create_insta_task"
    data = {"handle": handle}
    response = requests.post(url, json=data)
    st.write(response)
    if response.status_code == 200:
        st.write("Onboarding influencer! Please wait...")
    else:
        st.write(response["data"]["error"])

def show_onboarding_page():
    st.title("Onboard Influencers")

    # Upload field for multiple influencers
    uploaded_file = st.file_uploader("Upload a file with influencer handles", type=["csv", "xlsx"])
    
    # Input for single influencer handle
    single_handle = st.text_input("...or enter a single influencer handle")

    # Onboard button
    if st.button("Onboard Influencers"):
        if uploaded_file is not None:
            # Process the uploaded file
            onboard_influencers_from_file(uploaded_file)
        elif single_handle:
            # Process the single handle
            onboard_single_influencer(single_handle)
        else:
            st.error("Please upload a file or enter a handle.")

    # Function to display onboarded influencers (placeholder)
    display_onboarded_influencers()

def onboard_influencers_from_file(file):
    # Logic to read and process file to onboard influencers
    pass  # Replace with actual implementation

def display_onboarded_influencers():
    # Display the list of onboarded influencers
    st.write("List of Onboarded Influencers...")
    for influencer_id, influencer_info in influencers_data.items():
        col1, col2 = st.columns([1, 3])
        
        with col1:
            st.image(influencer_info["image"], width=30)
    
        with col2:
            if(influencer_info["onboarded"]):
                with st.expander("Influencer Details"):
                    st.subheader(influencer_info["name"])
                    st.write(influencer_info["details"])
            else:
                with st.expander("Influencer Onboarding - In Progress"):
                    st.write("Onboarding - In Progress")