Spaces:
Sleeping
Sleeping
Update app.py
Browse files4 unmodified lines56788910119 unmodified lines21222324242526272 unmodified lines30313233333435363738399 unmodified lines49505151525354555657585960596162631 unmodified line6566676768697071717273747576777879807381828376848586878889909192939495964 unmodified linesimport osimport json
# 1. إعداد الواجهة (نفس إعداداتك الأصلية)# 1. إعداد الواجهة ومنع التجمد (نفس كودك الأصلي تماماً)st.set_page_config(page_title="تطبيق فرصة عمل", layout="centered")
st.markdown("""9 unmodified lines </style> """, unsafe_allow_html=True)
# 2. تهيئة Firebase (نفس طريقتك بالـ Secret)# 2. تهيئة Firebase باستخدام الـ Secret (نفس كودك الأصلي تماماً)if not firebase_admin._apps: try: firebase_json = os.environ.get("FIREBASE")2 unmodified lines cred = credentials.Certificate(cred_dict) firebase_admin.initialize_app(cred) else: st.error("⚠️ لم أجد الـ Secret المسمى FIREBASE!") st.error("⚠️ لم أجد الـ Secret المسمى FIREBASE في الإعدادات!") st.stop() except Exception as e: st.error(f"❌ خطأ في قراءة الـ Secret: {e}") st.stop()
db = firestore.client()9 unmodified lines else: show_app_content()
# --- صفحة الدخول (بدون Tabs كما طلبت) ---# --- صفحة الدخول (بدون Tabs وبدون تغيير الكود) ---def show_auth_page(): st.markdown("<h1 style='text-align: center;'>فرصة عمل</h1>", unsafe_allow_html=True) # هذه هي الحقول الأصلية التي كانت داخل tab1 email = st.text_input("البريد الإلكتروني / الرقم", key="l_mail") password = st.text_input("كلمة المرور", type="password", key="l_pass") if st.button("تسجيل الدخول"): # التحقق من Firebase users = db.collection("users").where("email", "==", email).where("password", "==", password).stream() if any(users): st.session_state.logged_in = True1 unmodified line st.rerun() else: st.error("بيانات غير صحيحة") if st.button("ليس لديك حساب؟ إنشاء حساب"): if email and password: db.collection("users").add({"email": email, "password": password, "date": datetime.now()}) st.success("تم إنشاء الحساب بنجاح! يمكنك الدخول الآن.") st.success("تم! الآن اضغط على تسجيل الدخول.")
st.markdown(""" <div class='form-link'> <p>أو يمكنك ملء الاستمارة مباشرة من هنا:</p> <a href="https://docs.google.com/forms/d/e/1FAIpQLSe8diAuMlAHSuYQWsXvFov7EGygF8ZLf_Ojf3prF0sZvrFG0A/viewform?usp=publish-editor" target="_blank">فتح استمارة التقديم</a> </div> """, unsafe_allow_html=True)
# --- واجهة التطبيق (نفس محتواك الأصلي للوظائف) ---# --- واجهة التطبيق (نفس كودك الأصلي تماماً) ---def show_app_content(): st.markdown(f"<p style='text-align: left;'>👤 {st.session_state.user_email}</p>", unsafe_allow_html=True) st.markdown("<h1 style='text-align: center; color: #2E86C1;'>الفرص المتاحة</h1>", unsafe_allow_html=True) st.markdown("<h1 style='text-align: center; color: #2E86C1;'>تطبيق فرصة عمل</h1>", unsafe_allow_html=True)
with st.expander("📸 إكمال الملف الشخصي"): img = st.file_uploader("ارفع صورتك", type=["jpg", "png"]) if img: st.image(img, width=120) name = st.text_input("الاسم الكامل") if st.button("حفظ المعلومات"): st.success("تم الحفظ!")
st.markdown("---")
st.header("🔍 ابحث عن وظيفة") with st.form("search"):app.py+26-9