22import pandas as pd
33
44# 5) BACKGROUND COLOR - Tag: BACKGROUND_STYLE
5- # This injects custom CSS to change the main app background to light grey
5+ # Fixed the parameter here to 'unsafe_allow_html=True'
66st .markdown (
77 """
88 <style>
1111 }
1212 </style>
1313 """ ,
14- unsafe_content_as_allowed = True
14+ unsafe_allow_html = True
1515)
1616
1717# 4) HEADER TEXT - Tag: HEADER_SECTION
18- # Edit the strings below to customize your page introduction
18+ # Edit the text between the quotes to change your page header
1919st .title ("Document Management Library" )
2020st .markdown ("""
21- Welcome to the Digital Library. Here you can browse all stored files,
22- view them directly in Google Sheets, or download them to your local device.
21+ ### Resource Archive
22+ Use this page to access our shared slide decks and documents.
23+ You can preview files in the browser or download them directly.
2324""" )
2425# --- END HEADER SECTION ---
2526
26- # 1) SWAP TABS - "Library" is now the first index (Default)
27+ # 1) SWAP TABS - "Library" is now first (Default)
2728tab1 , tab2 = st .tabs (["📚 View Library" , "📤 Upload New File" ])
2829
2930with tab1 :
30- # Sample Data - Replace this with your actual Google Sheet / Dataframe logic
31+ # This is placeholder data - replace 'df' with your actual Google Sheets dataframe
3132 data = {
32- "File Name" : ["Project_Alpha_Specs.pdf" , "Budget_2024.xlsx" , "Team_Contact_List.csv" ],
33- "Description" : [
34- "Full technical specifications for the Alpha project initiative including timeline." ,
35- "Complete budget breakdown for the upcoming fiscal year 2024." ,
36- "Internal contact directory for all department heads and primary stakeholders."
37- ],
38- "View Link" : ["https://docs.google.com/spreadsheets/d/1" , "https://docs.google.com/spreadsheets/d/2" , "https://docs.google.com/spreadsheets/d/3" ],
39- "Download Link" : ["https://example.com/download1" , "https://example.com/download2" , "https://example.com/download3" ]
33+ "File Name" : ["Sample_Presentation.pptx" , "Data_Analysis_v2.xlsx" ],
34+ "Description" : ["A short description of the file." , "A much longer description that will wrap within the cell to keep the table narrow." ],
35+ "View Link" : ["https://docs.google.com/spreadsheets/d/1" , "https://docs.google.com/spreadsheets/d/2" ],
36+ "Download Link" : ["https://example.com/file1" , "https://example.com/file2" ]
4037 }
4138 df = pd .DataFrame (data )
4239
4340 # 2) NARROWER TABLE & WORD WRAP
4441 # 3) TWO LINK COLUMNS
45- # We use st.column_config to turn URLs into clickable buttons/links
4642 st .dataframe (
4743 df ,
4844 column_config = {
4945 "File Name" : st .column_config .TextColumn ("File Name" , width = "medium" ),
5046 "Description" : st .column_config .TextColumn ("Description" , width = "large" ),
51- "View Link" : st .column_config .LinkColumn ("View File" , display_text = "Open in Sheets " ),
52- "Download Link" : st .column_config .LinkColumn ("Download" , display_text = "Direct Download" )
47+ "View Link" : st .column_config .LinkColumn ("View File" , display_text = "👁️ View " ),
48+ "Download Link" : st .column_config .LinkColumn ("Download" , display_text = "📥 Download" )
5349 },
5450 hide_index = True ,
55- use_container_width = True # This ensures it fits the "narrower" container feel
51+ use_container_width = True
5652 )
5753
5854with tab2 :
5955 st .header ("Upload Section" )
60- st .file_uploader ( "Select a file to upload to the library " )
56+ st .write ( "Upload functionality goes here. " )
0 commit comments