SHELLAPANDIANGANHUNGING commited on
Commit
966d943
·
verified ·
1 Parent(s): abf229a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +64 -28
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import streamlit as st
2
  import pandas as pd
3
  import plotly.express as px
@@ -24,8 +25,6 @@ st.markdown("""<style>
24
  margin-bottom: 25px;
25
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
26
  border: 1px solid #e0e0e0;
27
- position: relative; /* Penting untuk positioning logo */
28
- box-sizing: border-box; /* Agar padding tidak menambah lebar total */
29
  }
30
  h1, h2, h3, h4, h5, .stMarkdown h1, .stMarkdown h2, .stMarkdown h3 {
31
  text-align: center;
@@ -284,32 +283,69 @@ else:
284
  st.sidebar.markdown('</div>', unsafe_allow_html=True)
285
 
286
 
287
- # =================== HEADER DENGAN LOGO DI POJOK KANAN ATAS DALAM BOX ===================
288
- # Gunakan HTML dan CSS untuk menyusun header dengan logo mengambang di kanan atas
289
- header_html = f"""
290
- <div class="main-header">
291
- <!-- Logo mengambang (absolute) di pojok kanan atas -->
292
- <img src="pln.png" style="position: absolute; top: 10px; right: 10px; width: 80px; height: auto; object-fit: contain;" alt="PLN Logo">
293
-
294
- <!-- Konten teks header -->
295
- <h1>PLN Audit Insight & Intelligence Dashboard</h1>
296
- <p style="text-align:center; color:#546e7a; font-size:1.1em; margin-top:8px;">
297
- Operational Risk Intelligence for Audit & Compliance
298
- </p>
299
- </div>
300
- """
301
-
302
- st.markdown(header_html, unsafe_allow_html=True)
303
-
304
- # Pastikan file pln.png ada di direktori yang sama dengan app.py
305
- if not os.path.exists("pln.png"):
306
- st.warning("⚠️ File logo `pln.png` tidak ditemukan di direktori aplikasi. Harap letakkan file tersebut di sini.")
307
-
308
- # (Lanjutkan dengan bagian dashboard lainnya di sini...)
309
- # Contoh ringan:
310
- st.write(f"### Data Overview (Filtered)")
311
- st.write(f"Showing {len(df_filtered)} records based on selected filters.")
312
- st.dataframe(df_filtered[['kode_temuan', 'temuan_kategori', 'nama_perusahaan', 'temuan_nama_distrik', 'created_at']].head())
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
313
 
314
  # =================== 1. Pie Charts: Temuan/Person by Company (PG & UM) - PERBAIKAN ===================
315
  st.markdown("<h3 class='section-title'>OBJECTIVE 1 - Company Reporting Activity: Who Reports the Most?</h3>", unsafe_allow_html=True)
 
1
+
2
  import streamlit as st
3
  import pandas as pd
4
  import plotly.express as px
 
25
  margin-bottom: 25px;
26
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
27
  border: 1px solid #e0e0e0;
 
 
28
  }
29
  h1, h2, h3, h4, h5, .stMarkdown h1, .stMarkdown h2, .stMarkdown h3 {
30
  text-align: center;
 
283
  st.sidebar.markdown('</div>', unsafe_allow_html=True)
284
 
285
 
286
+ # =================== HEADER ===================
287
+
288
+ # CSS untuk membuat box logo di kanan atas
289
+ st.markdown("""
290
+ <style>
291
+ .header-container {
292
+ display: flex;
293
+ justify-content: space-between;
294
+ align-items: center;
295
+ padding: 12px 20px;
296
+ border-radius: 10px;
297
+ background-color: #ffffff;
298
+ border: 1px solid #e0e0e0;
299
+ }
300
+
301
+ .header-title {
302
+ flex-grow: 1;
303
+ text-align: center;
304
+ }
305
+
306
+ .logo-box {
307
+ border: 1px solid #e0e0e0;
308
+ padding: 6px;
309
+ border-radius: 10px;
310
+ background-color: #f8f9fa;
311
+ display: flex;
312
+ align-items: center;
313
+ }
314
+ </style>
315
+ """, unsafe_allow_html=True)
316
+
317
+
318
+ # ======== HEADER LAYOUT ========
319
+ logo_path = "pln.png"
320
+
321
+ st.markdown('<div class="header-container">', unsafe_allow_html=True)
322
+
323
+ # ---- TITLE (CENTER) ----
324
+ st.markdown("""
325
+ <div class="header-title">
326
+ <h1 style="margin-bottom:4px;">PLN Audit Insight & Intelligence Dashboard</h1>
327
+ <p style="color:#546e7a; font-size:1.05em; margin-top:0px;">
328
+ Operational Risk Intelligence for Audit & Compliance
329
+ </p>
330
+ </div>
331
+ """, unsafe_allow_html=True)
332
+
333
+ # ---- LOGO (RIGHT BOX) ----
334
+ if os.path.exists(logo_path):
335
+ st.markdown(f"""
336
+ <div class="logo-box">
337
+ <img src="data:image/png;base64,{open(logo_path, "rb").read().hex()}"
338
+ width="70">
339
+ </div>
340
+ """, unsafe_allow_html=True)
341
+ else:
342
+ st.markdown("""
343
+ <div class="logo-box">
344
+ <p style="color:red; font-size:0.9em;">Logo missing</p>
345
+ </div>
346
+ """, unsafe_allow_html=True)
347
+
348
+ st.markdown('</div>', unsafe_allow_html=True)
349
 
350
  # =================== 1. Pie Charts: Temuan/Person by Company (PG & UM) - PERBAIKAN ===================
351
  st.markdown("<h3 class='section-title'>OBJECTIVE 1 - Company Reporting Activity: Who Reports the Most?</h3>", unsafe_allow_html=True)