UCS2014 commited on
Commit
25e4f62
·
verified ·
1 Parent(s): 674b03f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -32
app.py CHANGED
@@ -7,11 +7,12 @@ import streamlit as st
7
  BASE_DIR = Path(__file__).parent # -> Landing_Page/
8
  ASSETS = BASE_DIR / "assets" # -> Landing_Page/assets/
9
 
10
- # ========= CONTROLS (tweak these) =========
11
- HERO_LOGO_SIZE = 160 # px (company logo size)
 
12
  CARD_THUMB_HEIGHT = 170 # px (image height inside each card)
13
  BUTTON_TEXT = "Click to Run APP"
14
- OPEN_IN_NEW_TAB = False # True = open links in a new tab
15
 
16
  # ========= BRAND / APPS =========
17
  COMPANY_NAME = "Smart Thinking"
@@ -35,7 +36,7 @@ LOGO_PATH = ASSETS / "logo.png"
35
  page_icon = str(LOGO_PATH) if LOGO_PATH.exists() else "🧭"
36
  st.set_page_config(page_title=f"{COMPANY_NAME} — Apps", page_icon=page_icon, layout="wide")
37
 
38
- # ========= CSS (one-screen desktop, original layout) =========
39
  st.markdown(
40
  f"""
41
  <style>
@@ -45,58 +46,56 @@ st.markdown(
45
  max-width: 1120px;
46
  min-height: 100vh;
47
  display: flex; flex-direction: column;
48
- justify-content: center; /* center vertically on desktop */
49
- padding-top: 14px !important;
50
  padding-bottom: 10px !important;
51
  }}
52
 
53
  /* HERO */
54
- .hero {{ text-align:center; margin: 10px 0 16px; }}
55
  .hero img {{
56
  width: {HERO_LOGO_SIZE}px; max-width: 95vw; height: auto;
57
- display:block; margin: 10px auto 6px; /* top margin avoids visual "trim" */
58
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.12));
59
  }}
60
  .hero h1 {{ font-size: 2.3rem; margin: .6rem 0 .2rem; }}
61
  .hero p {{ color: #5a5f6a; margin: 0 auto; max-width: 720px; }}
62
 
63
- /* CARDS GRID: keep 2 columns on desktop */
64
  .grid {{ display:grid; grid-template-columns: 1fr 1fr; gap: 18px; }}
65
  @media (max-width: 980px) {{
66
- /* On small screens we allow stacking (scroll may appear) */
67
  .grid {{ grid-template-columns: 1fr; }}
68
  .block-container {{ justify-content: flex-start; }}
69
  }}
70
 
71
  .card {{
72
- background: #fff; border-radius: 16px; padding: 16px;
73
- border: 1px solid rgba(0,0,0,.06);
74
- box-shadow: 0 4px 18px rgba(0,0,0,.05);
75
- transition: transform .12s ease, box-shadow .12s ease;
76
- text-align: center;
77
  }}
78
  .card:hover {{ transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0,0,0,.08); }}
79
 
80
  .thumb {{
81
  width: 100%;
82
  height: {CARD_THUMB_HEIGHT}px;
83
- border-radius: 14px;
84
- border: 1px solid rgba(0,0,0,.06);
85
- object-fit: contain; /* show full image (no crop) */
86
- background: #fff;
87
  }}
88
 
89
- .card h3 {{ margin: 12px 0 6px; }}
90
- .card p {{ color: #5a5f6a; min-height: 36px; margin-bottom: 10px; }}
91
 
92
  /* Light button with dark text */
93
  .btn {{
94
- display:inline-block; padding: 10px 14px; border-radius: 12px;
95
- border: 1px solid #e5e7eb; text-decoration:none;
96
- background: #f3f4f6; color: #111827; font-weight: 500;
97
  }}
98
  .btn:hover {{ background:#e5e7eb; }}
99
- .footer {{ text-align:center; color:#8a9099; font-size: 0.9rem; margin-top: 6px; }}
100
  </style>
101
  """,
102
  unsafe_allow_html=True,
@@ -114,10 +113,9 @@ def img_tag(path: Path, alt: str, cls: str) -> str:
114
  uri = data_uri(path)
115
  if uri:
116
  return f'<img class="{cls}" src="{uri}" alt="{escape(alt)}" />'
117
- # Friendly placeholder if missing
118
  return f'<div class="{cls}" style="display:flex;align-items:center;justify-content:center;color:#50545c;background:linear-gradient(180deg,#f6f7fb,#eceff4);">{escape(alt)}</div>'
119
 
120
- # ========= HERO (logo → name → tagline) =========
121
  st.markdown(
122
  '<div class="hero">'
123
  + (img_tag(LOGO_PATH, "logo", "") if LOGO_PATH.exists() else "")
@@ -127,7 +125,7 @@ st.markdown(
127
  unsafe_allow_html=True,
128
  )
129
 
130
- # ========= CARD HTML (compact strings to avoid markdown code-blocks) =========
131
  def app_card(app: dict) -> str:
132
  target = "_blank" if OPEN_IN_NEW_TAB else "_self"
133
  return (
@@ -139,10 +137,9 @@ def app_card(app: dict) -> str:
139
  + "</div>"
140
  )
141
 
142
- grid_html = "<div class='grid'>" + app_card(APP1) + app_card(APP2) + "</div>"
143
- st.markdown(grid_html, unsafe_allow_html=True)
144
 
145
- # ========= Footer (as requested) =========
146
  st.markdown("""
147
  <br><br><br>
148
  <hr>
@@ -150,4 +147,4 @@ st.markdown("""
150
  © 2025 Smart Thinking AI-Solutions Team. All rights reserved.<br>
151
  Contact: <a href="mailto:smartthinking@smartthinking.com.sa">smartthinking@smartthinking.com.sa</a>
152
  </div>
153
- """, unsafe_allow_html=True)
 
7
  BASE_DIR = Path(__file__).parent # -> Landing_Page/
8
  ASSETS = BASE_DIR / "assets" # -> Landing_Page/assets/
9
 
10
+ # ========= CONTROLS =========
11
+ HERO_LOGO_SIZE = 170 # px (top company logo size)
12
+ TOP_SPACER = 32 # px (extra top padding so logo never looks clipped)
13
  CARD_THUMB_HEIGHT = 170 # px (image height inside each card)
14
  BUTTON_TEXT = "Click to Run APP"
15
+ OPEN_IN_NEW_TAB = False # True = open app in new tab
16
 
17
  # ========= BRAND / APPS =========
18
  COMPANY_NAME = "Smart Thinking"
 
36
  page_icon = str(LOGO_PATH) if LOGO_PATH.exists() else "🧭"
37
  st.set_page_config(page_title=f"{COMPANY_NAME} — Apps", page_icon=page_icon, layout="wide")
38
 
39
+ # ========= CSS (one-screen desktop, logo not “trimmed”) =========
40
  st.markdown(
41
  f"""
42
  <style>
 
46
  max-width: 1120px;
47
  min-height: 100vh;
48
  display: flex; flex-direction: column;
49
+ justify-content: center; /* keep in-viewport on desktops */
50
+ padding-top: {TOP_SPACER}px !important; /* <-- gives the logo breathing room */
51
  padding-bottom: 10px !important;
52
  }}
53
 
54
  /* HERO */
55
+ .hero {{ text-align:center; margin: 4px 0 18px; }}
56
  .hero img {{
57
  width: {HERO_LOGO_SIZE}px; max-width: 95vw; height: auto;
58
+ display:block; margin: 8px auto 8px; /* no top clipping */
59
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.12));
60
  }}
61
  .hero h1 {{ font-size: 2.3rem; margin: .6rem 0 .2rem; }}
62
  .hero p {{ color: #5a5f6a; margin: 0 auto; max-width: 720px; }}
63
 
64
+ /* Two-card grid on desktop, stack on small screens */
65
  .grid {{ display:grid; grid-template-columns: 1fr 1fr; gap: 18px; }}
66
  @media (max-width: 980px) {{
 
67
  .grid {{ grid-template-columns: 1fr; }}
68
  .block-container {{ justify-content: flex-start; }}
69
  }}
70
 
71
  .card {{
72
+ background:#fff; border-radius:16px; padding:16px;
73
+ border:1px solid rgba(0,0,0,.06);
74
+ box-shadow:0 4px 18px rgba(0,0,0,.05);
75
+ transition:transform .12s ease, box-shadow .12s ease;
76
+ text-align:center;
77
  }}
78
  .card:hover {{ transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0,0,0,.08); }}
79
 
80
  .thumb {{
81
  width: 100%;
82
  height: {CARD_THUMB_HEIGHT}px;
83
+ border-radius:14px;
84
+ border:1px solid rgba(0,0,0,.06);
85
+ object-fit: contain; /* show full logo/image, no cropping */
86
+ background:#fff;
87
  }}
88
 
89
+ .card h3 {{ margin:12px 0 6px; }}
90
+ .card p {{ color:#5a5f6a; min-height:36px; margin-bottom:10px; }}
91
 
92
  /* Light button with dark text */
93
  .btn {{
94
+ display:inline-block; padding:10px 14px; border-radius:12px;
95
+ border:1px solid #e5e7eb; text-decoration:none;
96
+ background:#f3f4f6; color:#111827; font-weight:500;
97
  }}
98
  .btn:hover {{ background:#e5e7eb; }}
 
99
  </style>
100
  """,
101
  unsafe_allow_html=True,
 
113
  uri = data_uri(path)
114
  if uri:
115
  return f'<img class="{cls}" src="{uri}" alt="{escape(alt)}" />'
 
116
  return f'<div class="{cls}" style="display:flex;align-items:center;justify-content:center;color:#50545c;background:linear-gradient(180deg,#f6f7fb,#eceff4);">{escape(alt)}</div>'
117
 
118
+ # ========= HERO =========
119
  st.markdown(
120
  '<div class="hero">'
121
  + (img_tag(LOGO_PATH, "logo", "") if LOGO_PATH.exists() else "")
 
125
  unsafe_allow_html=True,
126
  )
127
 
128
+ # ========= CARDS =========
129
  def app_card(app: dict) -> str:
130
  target = "_blank" if OPEN_IN_NEW_TAB else "_self"
131
  return (
 
137
  + "</div>"
138
  )
139
 
140
+ st.markdown("<div class='grid'>" + app_card(APP1) + app_card(APP2) + "</div>", unsafe_allow_html=True)
 
141
 
142
+ # ========= FOOTER =========
143
  st.markdown("""
144
  <br><br><br>
145
  <hr>
 
147
  © 2025 Smart Thinking AI-Solutions Team. All rights reserved.<br>
148
  Contact: <a href="mailto:smartthinking@smartthinking.com.sa">smartthinking@smartthinking.com.sa</a>
149
  </div>
150
+ """, unsafe_allow_html=True)