
import streamlit.components.v1 as components
from pollination_streamlit.selectors import get_api_client
from pollination_streamlit_io import (create_study, study_progress)

from pollination_streamlit_viewer import viewer
import streamlit as st

env = st.selectbox('Select ENV', options=('Prod', 'Staging'), 
                   index=0)

if env == 'Prod':
    api_client = get_api_client()
else:
    # Use it with staging
    api_client = {
        '_api_token': st.text_input('API key', type='password'),
        '_host': st.text_input('API URL'),
    }

study_info = create_study('st-study',
                          api_client=api_client)
if study_info:
    name, value = study_progress(api_client=api_client,
                                 study_info = study_info,
                                 show_output=True)
    if name:
        if (name.endswith('vtkjs')):
            viewer(key='my-test', content=value)
        
