Skip to content

Commit b474716

Browse files
committed
added bidding portal logic
1 parent 7adf04a commit b474716

File tree

4 files changed

+44
-26
lines changed

4 files changed

+44
-26
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
.streamlit/secrets.toml
1+
.streamlit/secrets.toml
2+
data

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Bidding Portal
2+
3+
## This repo is an extension of [sAuction - Smart Auction Portal](https://sauction.streamlit.app/) - [repo link](https://github.com/hirawatt/sAuction)

bidding.py

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import streamlit as st
2+
import pandas as pd
3+
4+
st.markdown("<h1 style='text-align: center; color: blue;'>Bidding Portal</h1>", unsafe_allow_html=True)
5+
# add 3 digit login code to enter
6+
team_list = pd.read_csv("./data/redis-team.csv")
7+
team_creds_list = team_list['Creds'].tolist()
8+
9+
# Main Bidding Logic
10+
def bid(team_name):
11+
amount = st.number_input("Bid Amount", value=100, step=100, min_value=100, label_visibility="collapsed")
12+
bid_success = st.button("Bid", use_container_width=True, type="primary")
13+
bid_info = {team_name: amount}
14+
15+
# FIXME: create this function connecting to redis server
16+
#send_message(bid_info)
17+
18+
# FIXME: add button logic
19+
co1, co2 = st.columns(2)
20+
#co1.button("Exit bid", use_container_width=True)
21+
co2.button("Refresh", use_container_width=True)
22+
23+
if bid_success:
24+
st.write(bid_info)
25+
st.toast(f'Bid for {amount} was successfull!', icon='✅')
26+
else:
27+
st.info("Press Bid button to enter")
28+
#st.toast(f'Bid for {amount} unsuccessfull!', icon='❌')
29+
30+
# Login Check Screen
31+
login_code = st.text_input("Enter code:")
32+
if login_code:
33+
try:
34+
team_index = team_creds_list.index(int(login_code))
35+
team_name = team_list['Team'][team_index]
36+
st.subheader(f"Welcome {team_name},")
37+
bid(team_name)
38+
except:
39+
st.warning("Incorrect Code. Try again")

dashboard.py

-25
This file was deleted.

0 commit comments

Comments
 (0)