DeepLearning101 commited on
Commit
7bb2e5d
·
verified ·
1 Parent(s): e794799

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -14
app.py CHANGED
@@ -21,7 +21,7 @@ theme = gr.themes.Soft(
21
 
22
  # --- 2. CSS ---
23
  custom_css = """
24
- /* 隱藏 Gradio 原生 footer */
25
  footer {display: none !important;}
26
 
27
  /* 強制讓所有容器允許內容溢出 */
@@ -37,33 +37,44 @@ footer {display: none !important;}
37
  box-shadow: 0 5px 15px rgba(0,0,0,0.5);
38
  }
39
 
40
- /* 選單內的選項 */
41
  .item, .options .item {
42
  color: #E0E0E0 !important;
43
  padding: 8px 12px !important;
44
  }
45
 
46
- /* 滑鼠滑過選項 */
47
  .item:hover, .item.selected, .options .item:hover {
48
  background-color: #d4af37 !important;
49
  color: black !important;
50
  }
51
 
52
- /* 輸入框聚焦時的金色光暈 */
53
  input:focus, .dropdown-trigger:focus-within {
54
  border-color: #d4af37 !important;
55
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.4) !important;
56
  }
57
 
58
- /* 標題樣式 */
59
  h3 {
60
  border-bottom: 1px solid #444;
61
  padding-bottom: 5px;
62
  margin-bottom: 10px;
63
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  """
65
 
66
- # --- 核心邏輯 ---
67
  def get_date_options():
68
  options = []
69
  today = datetime.now()
@@ -102,7 +113,7 @@ def handle_booking(name, tel, date_str, time, pax):
102
  return "⚠️ 請完整填寫所有欄位"
103
 
104
  return f"""
105
- <div style='text-align: center; color: #fff; padding: 20px; border: 1px solid #d4af37; border-radius: 8px; background: #222;'>
106
  <h2 style='color: #d4af37; margin: 0;'>Request Received</h2>
107
  <p style='margin: 10px 0;'>🥂 預約申請已提交</p>
108
  <p style='font-size: 0.9em; color: #aaa;'>系統將發送確認信至您的信箱。</p>
@@ -123,7 +134,7 @@ with gr.Blocks(theme=theme, css=custom_css, title="Booking") as demo:
123
  status_box = gr.Markdown("請先選擇日期...", visible=True)
124
  time_slot = gr.Dropdown(choices=[], label="可用時段 Available Time", interactive=True)
125
 
126
- gr.HTML("<div style='height: 20px'></div>")
127
 
128
  gr.Markdown("### 👤 聯絡人資料 Contact")
129
  with gr.Group():
@@ -131,15 +142,19 @@ with gr.Blocks(theme=theme, css=custom_css, title="Booking") as demo:
131
  cust_name = gr.Textbox(label="訂位姓名 Name", placeholder="ex. 王小明")
132
  cust_tel = gr.Textbox(label="手機號碼 Phone", placeholder="ex. 0912-xxx-xxx")
133
 
134
- gr.HTML("<div style='height: 20px'></div>")
 
135
  submit_btn = gr.Button("確認預約 Request Booking", size="lg", variant="primary")
136
- output_msg = gr.HTML(label="系統訊息")
137
 
138
- # --- 新增的頁尾宣告區 ---
 
 
 
139
  gr.HTML("""
140
- <div style="text-align: center; margin-top: 50px; padding-top: 20px; border-top: 1px solid #333; color: #666; font-size: 0.8rem; line-height: 1.6;">
141
- <p>© 2026 CIE CIE TAIPEI. All Rights Reserved.</p>
142
- <p style="margin-top: 5px; color: #888;">內容涉及酒類產品訊息,請勿轉發分享給未達法定購買年齡者;未滿十八歲請勿飲酒。<br>喝酒不開車,開車不喝酒。</p>
 
143
  </div>
144
  """)
145
 
 
21
 
22
  # --- 2. CSS ---
23
  custom_css = """
24
+ /* 隱藏 footer */
25
  footer {display: none !important;}
26
 
27
  /* 強制讓所有容器允許內容溢出 */
 
37
  box-shadow: 0 5px 15px rgba(0,0,0,0.5);
38
  }
39
 
 
40
  .item, .options .item {
41
  color: #E0E0E0 !important;
42
  padding: 8px 12px !important;
43
  }
44
 
 
45
  .item:hover, .item.selected, .options .item:hover {
46
  background-color: #d4af37 !important;
47
  color: black !important;
48
  }
49
 
 
50
  input:focus, .dropdown-trigger:focus-within {
51
  border-color: #d4af37 !important;
52
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.4) !important;
53
  }
54
 
 
55
  h3 {
56
  border-bottom: 1px solid #444;
57
  padding-bottom: 5px;
58
  margin-bottom: 10px;
59
  }
60
+
61
+ /* 🌟 新增:針對警語頁尾的優化樣式 */
62
+ .legal-footer {
63
+ text-align: center;
64
+ margin-top: 15px; /* 縮小上方間距 */
65
+ padding-top: 15px;
66
+ border-top: 1px solid #333;
67
+ color: #666;
68
+ font-size: 0.75rem; /* 字體稍微縮小更像註解 */
69
+ line-height: 1.5;
70
+ font-family: sans-serif;
71
+ }
72
+ .legal-footer strong {
73
+ color: #888;
74
+ }
75
  """
76
 
77
+ # --- 核心邏輯 (保持不變) ---
78
  def get_date_options():
79
  options = []
80
  today = datetime.now()
 
113
  return "⚠️ 請完整填寫所有欄位"
114
 
115
  return f"""
116
+ <div style='text-align: center; color: #fff; padding: 20px; border: 1px solid #d4af37; border-radius: 8px; background: #222; margin-bottom: 10px;'>
117
  <h2 style='color: #d4af37; margin: 0;'>Request Received</h2>
118
  <p style='margin: 10px 0;'>🥂 預約申請已提交</p>
119
  <p style='font-size: 0.9em; color: #aaa;'>系統將發送確認信至您的信箱。</p>
 
134
  status_box = gr.Markdown("請先選擇日期...", visible=True)
135
  time_slot = gr.Dropdown(choices=[], label="可用時段 Available Time", interactive=True)
136
 
137
+ gr.HTML("<div style='height: 10px'></div>")
138
 
139
  gr.Markdown("### 👤 聯絡人資料 Contact")
140
  with gr.Group():
 
142
  cust_name = gr.Textbox(label="訂位姓名 Name", placeholder="ex. 王小明")
143
  cust_tel = gr.Textbox(label="手機號碼 Phone", placeholder="ex. 0912-xxx-xxx")
144
 
145
+ gr.HTML("<div style='height: 15px'></div>")
146
+
147
  submit_btn = gr.Button("確認預約 Request Booking", size="lg", variant="primary")
 
148
 
149
+ # 🌟 修改點 1:移除 label,這樣平常就不會出現一個空框框
150
+ output_msg = gr.HTML()
151
+
152
+ # 🌟 修改點 2:使用更緊湊的 HTML 結構與 CSS class
153
  gr.HTML("""
154
+ <div class="legal-footer">
155
+ <p style="margin-bottom: 5px;">© 2026 CIE CIE TAIPEI. All Rights Reserved.</p>
156
+ <p>內容涉及酒類產品訊息,請勿轉發分享給未達法定購買年齡者;未滿十八歲請勿飲酒。<br>
157
+ <strong>喝酒不開車,開車不喝酒。</strong></p>
158
  </div>
159
  """)
160