Spaces:
Sleeping
Sleeping
""" | |
مكون ترويسة الصفحة | |
""" | |
import streamlit as st | |
from datetime import datetime | |
import config | |
def render_header(): | |
""" | |
عرض ترويسة الصفحة | |
""" | |
# إنشاء مكون الترويسة باستخدام HTML | |
header_html = """ | |
<div class="header-container"> | |
<div class="header-title"> | |
<h1>نظام تحليل العقود والمناقصات</h1> | |
<p>الحلول الشاملة للتسعير والتحليل بالذكاء الاصطناعي</p> | |
</div> | |
<div class="header-info"> | |
<div class="date-box"> | |
<div class="date-day">{day}</div> | |
<div class="date-info"> | |
<div class="date-month">{month}</div> | |
<div class="date-year">{year}</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
""" | |
# الحصول على معلومات التاريخ الحالي | |
today = datetime.now() | |
day = today.day | |
month_names = [ | |
"يناير", "فبراير", "مارس", "إبريل", "مايو", "يونيو", | |
"يوليو", "أغسطس", "سبتمبر", "أكتوبر", "نوفمبر", "ديسمبر" | |
] | |
month = month_names[today.month - 1] | |
year = today.year | |
# استبدال القيم في قالب HTML | |
header_html = header_html.format(day=day, month=month, year=year) | |
# عرض الترويسة | |
st.markdown(header_html, unsafe_allow_html=True) | |
# إضافة شريط التنقل الرئيسي | |
if 'is_authenticated' in st.session_state and st.session_state.is_authenticated: | |
render_navigation_menu() | |
# إضافة خط فاصل | |
st.markdown("<hr>", unsafe_allow_html=True) | |
def render_navigation_menu(): | |
""" | |
عرض قائمة التنقل الرئيسية | |
""" | |
# إنشاء قائمة التنقل المختصرة | |
menu_items = [ | |
{"icon": "🏠", "label": "الرئيسية", "url": "/?page=home"}, | |
{"icon": "📊", "label": "لوحة المعلومات", "url": "/?page=dashboard"}, | |
{"icon": "⚙️", "label": "الإعدادات", "url": "/?page=settings"}, | |
{"icon": "❓", "label": "المساعدة", "url": "/?page=help"} | |
] | |
# إنشاء قائمة HTML | |
menu_html = """ | |
<div class="nav-menu"> | |
<ul> | |
""" | |
for item in menu_items: | |
menu_html += f""" | |
<li> | |
<a href="{item['url']}"> | |
<span class="nav-icon">{item['icon']}</span> | |
<span class="nav-label">{item['label']}</span> | |
</a> | |
</li> | |
""" | |
menu_html += """ | |
</ul> | |
</div> | |
""" | |
# عرض قائمة التنقل | |
st.markdown(menu_html, unsafe_allow_html=True) |