-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
93 lines (81 loc) · 2.96 KB
/
main.py
File metadata and controls
93 lines (81 loc) · 2.96 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import streamlit as st
from streamlit_option_menu import option_menu
from page.single_flight_page import single_flight_page
from page.multi_city_page import multi_city_page
from page.return_flight_page import return_flight_page
import ui_controller
import configuration as config
# Set page config to wide mode at the very start
st.set_page_config(
page_title="Flight Discovery Central",
layout="wide", # This sets the default to wide mode
initial_sidebar_state="auto"
)
# Add fixed background CSS
st.markdown(
"""
<style>
body {
background-attachment: fixed !important;
}
.stApp {
background-attachment: fixed !important;
}
</style>
""",
unsafe_allow_html=True
)
cols = st.columns([6, 4, 2]) # Adjusted column ratios for better spacing
# Headings in first column
cols[0].markdown('<h1 style="color: white; margin: 0;">✈️ Kickstart International Adventures </h1>', unsafe_allow_html=True)
cols[0].markdown('<h2 style="color: white; margin: 0;">Plan your next journey effortlessly!</h2>', unsafe_allow_html=True)
# Empty middle column for spacing
cols[1].write("")
# Currency selector in last column with white label and reduced spacing
cols[2].markdown('<p style="color: #FFFFFF; margin-bottom: 5px;">Select Currency</p>', unsafe_allow_html=True)
config.SELECTED_CURRENCY = cols[2].selectbox(
" ", # Empty label since we're using custom label above
ui_controller.get_list_of_currency(),
index=ui_controller.get_list_of_currency().index("SGD"),
label_visibility="collapsed" # Hides the empty label
)
# Initialize all session state variables
if 'search_results' not in st.session_state:
st.session_state.search_results = None
if 'live_prices' not in st.session_state:
st.session_state.live_prices = {}
if 'last_page' not in st.session_state:
st.session_state.last_page = None
# Navigation Menu
selected = option_menu(
menu_title=None,
options=["One Way","Round Trip", "Multi-City"],
icons=["arrow-right-circle","arrow-repeat", "globe"],
menu_icon="cast",
default_index=0,
orientation="horizontal",
styles={
"container": {"width": "100%", "max-width": "100%"}, # Make container full width
"nav": {"width": "100%"}, # Make nav element full width
"nav-link-selected": {
"background-color": "#0099FF", # Changed from red to blue
"color": "white", # Keep text white
}
}
)
if selected != st.session_state.last_page:
st.session_state.search_results = None
st.session_state.selected_route = None
st.session_state.last_page = selected
# Handle navigation
if selected == "Round Trip":
return_flight_page()
elif selected == "Multi-City":
multi_city_page()
elif selected == "One Way":
single_flight_page()
def load_css(file_name):
with open(f'static/styles/{file_name}.css') as f:
st.markdown(f'<style>{f.read()}</style>', unsafe_allow_html=True)
# Load CSS at the start
load_css('return_flight')