UCS2014 commited on
Commit
8b91916
·
verified ·
1 Parent(s): 5b186ea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +63 -92
app.py CHANGED
@@ -8,18 +8,15 @@ import streamlit as st
8
  BASE_DIR = Path(__file__).parent
9
  ASSETS = BASE_DIR / "assets"
10
 
11
- # ========= META FIRST =========
12
- st.set_page_config(page_title="Smart Thinking - Logging — Apps", page_icon="🧭", layout="wide")
13
 
14
  # ========= BRAND / DATA =========
15
- COMPANY_NAME = "Smart Thinking - Logging"
16
- TAGLINE = "We Deliver Smart AI-Based Solutions For O&G Industry"
17
- SUITE_NAME = "ST_LOG SUITE" # shown in chip + banner
18
 
19
- ACCENT = "#0E7490" # teal start
20
- ACCENT_END = "#14B8A6" # teal end
21
-
22
- # Logos (place in assets/)
23
  HERO_LOGO = ASSETS / "AI_Suite_Log_logo.png"
24
  ICON_GR = ASSETS / "GR_logo.png"
25
  ICON_TS = ASSETS / "Ts_logo.png"
@@ -64,16 +61,14 @@ def img_tag(path: Path, alt: str, cls: str = "", style: str = "") -> str:
64
  style_attr = f' style="{style}"' if style else ""
65
  return f'<img{cls_attr}{style_attr} src="{uri}" alt="{escape(alt)}" />'
66
 
67
- def tiny_icon_html(path: Path, size: int = 18) -> str:
68
- uri = data_uri(path)
69
- return f"<img src='{uri}' alt='icon' style='width:{size}px;height:{size}px;display:block;border-radius:4px;'>" if uri else ""
70
-
71
- # ========= BACKGROUND (simple & safe gradient) =========
72
  st.markdown(f"""
73
  <style>
74
  :root {{
75
  --brand: {ACCENT};
76
  --brand2: {ACCENT_END};
 
 
77
  }}
78
 
79
  html, body, [data-testid="stAppViewContainer"] {{ height: 100%; }}
@@ -81,167 +76,143 @@ st.markdown(f"""
81
  padding-top: 0 !important; padding-bottom: 0 !important;
82
  }}
83
 
84
- /* Page container with calm gradient */
85
  .block-container {{
86
  max-width: 1100px;
87
  min-height: 100vh;
88
  display: flex; flex-direction: column;
89
  gap: 16px;
90
- padding: 100px 0 28px !important;
91
  background:
92
  radial-gradient(980px 460px at 50% -140px,
93
- rgba(20,184,166,0.10) 0%,
94
- rgba(14,116,144,0.06) 26%,
95
  rgba(255,255,255,0.98) 60%,
96
  rgba(255,255,255,1) 100%);
97
  }}
98
 
99
- /* HERO */
100
  .hero {{ text-align:center; margin: 0; }}
101
  .hero img {{
102
- width: 520px; max-width: 92vw; height: auto;
103
- display:block; margin: 0 auto 10px;
104
  filter: drop-shadow(0 6px 16px rgba(0,0,0,.10));
105
  }}
106
- .hero h1 {{
107
- font-size: 2.2rem; line-height: 1.15; margin: .25rem 0 .15rem;
108
- letter-spacing: .2px; color: #0F172A;
109
- }}
110
- .hero p {{
111
- color: #455268; margin: 4px auto 14px; max-width: 800px; font-style: italic;
112
- }}
113
 
114
- /* SUITE BANNER (light) */
115
  .suite-banner {{
116
- display:flex; gap:12px; justify-content:center; align-items:center;
117
- margin: 2px 0 12px;
118
  }}
119
  .suite-pill {{
120
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand2) 100%);
121
- color:#fff; padding:7px 12px; border-radius:999px;
122
  font-weight:700; letter-spacing:.2px;
123
- box-shadow: 0 6px 14px rgba(14,116,144,.22);
124
  }}
125
- .suite-sub {{ color:#3b4656; font-weight:500; opacity:.92; }}
126
 
127
  /* GRID (3 → 2 → 1) */
128
  .grid {{
129
  display: grid;
130
- grid-template-columns: repeat(3, 300px);
131
  gap: 36px;
132
  justify-content: center;
133
  align-items: stretch;
134
  margin-top: 8px;
135
  }}
136
- @media (max-width: 1080px) {{
137
- .grid {{ grid-template-columns: repeat(2, 300px); gap: 28px; }}
138
  }}
139
- @media (max-width: 680px) {{
140
  .grid {{ grid-template-columns: 1fr; }}
141
  }}
142
 
143
- /* CARD */
144
  .card {{
145
  position: relative;
146
- width: 300px;
147
- background: #ffffff;
148
- border: 1px solid rgba(2,20,35,.06);
149
- border-radius:18px; padding:18px 16px 16px;
150
- box-shadow: 0 8px 28px rgba(2,20,35,.06);
151
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
152
- text-align:center; display:flex; flex-direction:column; gap:12px;
153
  align-items: center;
154
  }}
155
  .card:hover {{
156
  transform: translateY(-4px);
157
- box-shadow: 0 16px 44px rgba(2,20,35,.12);
158
  border-color: rgba(14,116,144,0.18);
159
  }}
160
 
161
- /* Corner suite chip (keeps branding without crowding) */
162
  .suite-chip {{
163
  position: absolute; top: 12px; right: 12px;
164
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand2) 100%);
165
- color:#fff; padding:5px 10px; border-radius:999px;
166
- font-weight:700; font-size:.80rem; letter-spacing:.2px;
167
  box-shadow: 0 6px 14px rgba(14,116,144,.22);
168
  }}
169
 
170
- /* Centered round icon */
171
  .icon-wrap {{
172
- width: 72px; height: 72px; border-radius: 9999px;
173
- background: #E6F4F7;
174
  display:grid; place-items:center;
175
- border: 1px solid rgba(14,116,144,0.20);
176
- box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 6px 16px rgba(2,20,35,.06);
177
  }}
178
  .icon-wrap img {{
179
- width: 62px; height: 62px; border-radius:9999px; display:block;
180
  }}
181
 
 
182
  .card h3 {{
183
- margin: 2px 0 0; font-size: 1.08rem; font-weight: 800; color:#0b1220;
 
184
  }}
185
  .card p {{
186
- color:#536071; min-height: 38px; margin: 2px 8px 0; font-size: .96rem;
187
  }}
188
 
189
- /* BUTTON */
190
  .btn {{
191
- display:inline-block; padding:10px 16px; border-radius:12px;
192
- border:1px solid rgba(14,116,144,0.25); text-decoration:none;
193
- background: linear-gradient(90deg, var(--brand) 0%, var(--brand2) 100%);
194
- color: white; font-weight: 600; letter-spacing:.2px;
195
- margin: 10px auto 0;
196
- box-shadow: 0 6px 18px rgba(20,184,166,.26);
197
  }}
198
  .btn:hover {{
199
- filter: brightness(0.98) saturate(1.05);
200
  transform: translateY(-1px);
201
- box-shadow: 0 12px 28px rgba(20,184,166,.34);
202
  }}
203
 
204
- .footer {{ text-align:center; color:#3f4a5a; font-size:0.98em; margin-top: 24px; }}
205
  .footer hr {{ margin: 12px 0; border-color: rgba(0,0,0,.08); }}
206
  </style>
207
  """, unsafe_allow_html=True)
208
 
209
- # ========= HERO =========
210
- hero_img = img_tag(HERO_LOGO, "ST_LOG SUITE", "")
211
- st.markdown(
212
- f"""
213
- <div class="hero">
214
- {hero_img}
215
- <h1>{escape(COMPANY_NAME)}</h1>
216
- <p>{escape(TAGLINE)}</p>
217
- </div>
218
- """,
219
- unsafe_allow_html=True,
220
- )
221
 
222
  # ========= SUITE BANNER =========
223
- st.markdown(
224
- f"""
225
- <div class="suite-banner">
226
- <span class="suite-pill">{escape(SUITE_NAME)}</span>
227
- <span class="suite-sub">Real-time well logging intelligence • 3 apps</span>
228
- </div>
229
- """,
230
- unsafe_allow_html=True,
231
- )
232
 
233
  # ========= CARDS =========
234
  def app_card(app: dict) -> str:
235
- icon_html = img_tag(app.get("icon"), "icon", style="width:62px;height:62px;border-radius:9999px;") \
236
- if app.get("icon") and (app["icon"]).exists() else ""
237
- target = "_self" # set to "_blank" if you want new tab
238
  return (
239
  "<div class='card'>"
240
  + f"<div class='suite-chip'>{escape(SUITE_NAME)}</div>"
241
  + f"<div class='icon-wrap'>{icon_html}</div>"
242
  + f"<h3>{escape(app['title'])}</h3>"
243
  + f"<p>{escape(app['blurb'])}</p>"
244
- + f"<a class='btn' href='{escape(app['url'])}' target='{target}' rel='noopener'>Open App</a>"
245
  + "</div>"
246
  )
247
 
 
8
  BASE_DIR = Path(__file__).parent
9
  ASSETS = BASE_DIR / "assets"
10
 
11
+ # ========= META =========
12
+ st.set_page_config(page_title="ST_LOG SUITE — Apps", page_icon="🧭", layout="wide")
13
 
14
  # ========= BRAND / DATA =========
15
+ SUITE_NAME = "ST_LOG SUITE"
16
+ ACCENT = "#0E7490" # teal start (kept subtly in chips)
17
+ ACCENT_END = "#14B8A6" # teal end
18
 
19
+ # Logos (put these PNGs in assets/)
 
 
 
20
  HERO_LOGO = ASSETS / "AI_Suite_Log_logo.png"
21
  ICON_GR = ASSETS / "GR_logo.png"
22
  ICON_TS = ASSETS / "Ts_logo.png"
 
61
  style_attr = f' style="{style}"' if style else ""
62
  return f'<img{cls_attr}{style_attr} src="{uri}" alt="{escape(alt)}" />'
63
 
64
+ # ========= BACKGROUND (clean, calm gradient) =========
 
 
 
 
65
  st.markdown(f"""
66
  <style>
67
  :root {{
68
  --brand: {ACCENT};
69
  --brand2: {ACCENT_END};
70
+ --btnDark1: #0B1220; /* dark slate for button */
71
+ --btnDark2: #334155; /* slate */
72
  }}
73
 
74
  html, body, [data-testid="stAppViewContainer"] {{ height: 100%; }}
 
76
  padding-top: 0 !important; padding-bottom: 0 !important;
77
  }}
78
 
 
79
  .block-container {{
80
  max-width: 1100px;
81
  min-height: 100vh;
82
  display: flex; flex-direction: column;
83
  gap: 16px;
84
+ padding: 72px 0 28px !important;
85
  background:
86
  radial-gradient(980px 460px at 50% -140px,
87
+ rgba(20,184,166,0.08) 0%,
88
+ rgba(14,116,144,0.05) 26%,
89
  rgba(255,255,255,0.98) 60%,
90
  rgba(255,255,255,1) 100%);
91
  }}
92
 
93
+ /* HERO (logo only — title/tagline removed) */
94
  .hero {{ text-align:center; margin: 0; }}
95
  .hero img {{
96
+ width: 560px; max-width: 92vw; height: auto;
97
+ display:block; margin: 0 auto 6px;
98
  filter: drop-shadow(0 6px 16px rgba(0,0,0,.10));
99
  }}
 
 
 
 
 
 
 
100
 
101
+ /* SUITE BANNER (tiny, elegant) */
102
  .suite-banner {{
103
+ display:flex; gap:10px; justify-content:center; align-items:center;
104
+ margin: 4px 0 10px;
105
  }}
106
  .suite-pill {{
107
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand2) 100%);
108
+ color:#fff; padding:6px 12px; border-radius:999px;
109
  font-weight:700; letter-spacing:.2px;
110
+ box-shadow: 0 6px 14px rgba(14,116,144,.20);
111
  }}
 
112
 
113
  /* GRID (3 → 2 → 1) */
114
  .grid {{
115
  display: grid;
116
+ grid-template-columns: repeat(3, 320px);
117
  gap: 36px;
118
  justify-content: center;
119
  align-items: stretch;
120
  margin-top: 8px;
121
  }}
122
+ @media (max-width: 1100px) {{
123
+ .grid {{ grid-template-columns: repeat(2, 320px); gap: 28px; }}
124
  }}
125
+ @media (max-width: 700px) {{
126
  .grid {{ grid-template-columns: 1fr; }}
127
  }}
128
 
129
+ /* CARD — premium look */
130
  .card {{
131
  position: relative;
132
+ width: 320px;
133
+ background: linear-gradient(180deg, #ffffff 0%, #FBFCFE 100%);
134
+ border: 1px solid rgba(12,18,32,.08);
135
+ border-radius:20px; padding:22px 18px 18px;
136
+ box-shadow: 0 10px 34px rgba(2,20,35,.08), 0 1px 0 rgba(255,255,255,0.9) inset;
137
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
138
+ text-align:center; display:flex; flex-direction:column; gap:14px;
139
  align-items: center;
140
  }}
141
  .card:hover {{
142
  transform: translateY(-4px);
143
+ box-shadow: 0 18px 52px rgba(2,20,35,.16);
144
  border-color: rgba(14,116,144,0.18);
145
  }}
146
 
147
+ /* Corner suite chip */
148
  .suite-chip {{
149
  position: absolute; top: 12px; right: 12px;
150
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand2) 100%);
151
+ color:#fff; padding:6px 10px; border-radius:999px;
152
+ font-weight:700; font-size:.82rem; letter-spacing:.2px;
153
  box-shadow: 0 6px 14px rgba(14,116,144,.22);
154
  }}
155
 
156
+ /* Larger round icon */
157
  .icon-wrap {{
158
+ width: 104px; height: 104px; border-radius: 9999px;
159
+ background: #F0F5F9;
160
  display:grid; place-items:center;
161
+ border: 1px solid rgba(12,18,32,0.10);
162
+ box-shadow: inset 0 1px 0 rgba(255,255,255,.95), 0 8px 20px rgba(2,20,35,.06);
163
  }}
164
  .icon-wrap img {{
165
+ width: 92px; height: 92px; border-radius:9999px; display:block;
166
  }}
167
 
168
+ /* Enlarged app title */
169
  .card h3 {{
170
+ margin: 2px 0 0; font-size: 1.26rem; font-weight: 900; color:#0b1220;
171
+ letter-spacing: .1px;
172
  }}
173
  .card p {{
174
+ color:#566275; min-height: 40px; margin: 0 10px; font-size: .98rem;
175
  }}
176
 
177
+ /* PREMIUM BUTTON (dark slate, not green) */
178
  .btn {{
179
+ display:inline-block; padding:12px 18px; border-radius:14px;
180
+ border: 1px solid rgba(15,23,42,.35); text-decoration:none;
181
+ background: linear-gradient(180deg, var(--btnDark1) 0%, var(--btnDark2) 100%);
182
+ color: white; font-weight: 700; letter-spacing:.25px;
183
+ margin: 6px auto 0;
184
+ box-shadow: 0 10px 26px rgba(15,23,42,.25), inset 0 1px 0 rgba(255,255,255,.08);
185
  }}
186
  .btn:hover {{
187
+ filter: brightness(1.02) saturate(1.02);
188
  transform: translateY(-1px);
189
+ box-shadow: 0 14px 34px rgba(15,23,42,.30);
190
  }}
191
 
192
+ .footer {{ text-align:center; color:#3f4a5a; font-size:0.96em; margin-top: 24px; }}
193
  .footer hr {{ margin: 12px 0; border-color: rgba(0,0,0,.08); }}
194
  </style>
195
  """, unsafe_allow_html=True)
196
 
197
+ # ========= HERO (logo only) =========
198
+ hero_html = img_tag(HERO_LOGO, "ST_LOG SUITE")
199
+ st.markdown(f"<div class='hero'>{hero_html}</div>", unsafe_allow_html=True)
 
 
 
 
 
 
 
 
 
200
 
201
  # ========= SUITE BANNER =========
202
+ st.markdown(f"<div class='suite-banner'><span class='suite-pill'>{escape(SUITE_NAME)}</span></div>", unsafe_allow_html=True)
 
 
 
 
 
 
 
 
203
 
204
  # ========= CARDS =========
205
  def app_card(app: dict) -> str:
206
+ icon_html = img_tag(app.get("icon"), "icon",
207
+ style="width:92px;height:92px;border-radius:9999px;") if app.get("icon") and app["icon"].exists() else ""
208
+ target = "_self" # change to "_blank" if you prefer new tab
209
  return (
210
  "<div class='card'>"
211
  + f"<div class='suite-chip'>{escape(SUITE_NAME)}</div>"
212
  + f"<div class='icon-wrap'>{icon_html}</div>"
213
  + f"<h3>{escape(app['title'])}</h3>"
214
  + f"<p>{escape(app['blurb'])}</p>"
215
+ + f"<a class='btn' href='{escape(app['url'])}' target='{target}' rel='noopener'>Run App</a>"
216
  + "</div>"
217
  )
218