GSMEthesis commited on
Commit
b256f5c
·
verified ·
1 Parent(s): f59b1e8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +56 -56
app.py CHANGED
@@ -771,67 +771,65 @@ def create_likert_question(question, key, scale_type="5point"):
771
  """,
772
  unsafe_allow_html=True
773
  )
 
774
 
 
 
775
  st.markdown("""
776
  <style>
777
- /* پایه‌ای ترین تنظیمات جهت */
778
- * {
779
- direction: rtl !important;
780
- text-align: right !important;
781
- font-family: 'B Nazanin' !important;
782
- }
783
-
784
- /* تنظیمات کلی صفحه */
785
- .stApp {
786
- text-align: right !important;
787
- direction: rtl !important;
788
- }
789
-
790
- /* اصلاح دکمه‌ها */
791
- .stButton>button {
792
- margin-right: auto !important;
793
- margin-left: 0 !important;
794
- display: block !important;
795
- }
796
-
797
- /* اسلایدرها */
798
- div[data-testid="stSlider"] {
799
- direction: ltr !important; /* اسلایدرها باید LTR باشند */
800
- }
801
-
802
- /* لیبل‌ها */
803
- .stSlider>label, .stRadio>label, .stSelectbox>label {
804
- text-align: right !important;
805
- right: 0 !important;
806
- left: auto !important;
807
- }
808
-
809
- /* محتوای کشویی */
810
- .st-b7, .st-b8, .st-b9 {
811
- text-align: right !important;
812
- }
813
-
814
- /* جلوگیری از پرت شدن المان‌ها */
815
- div[data-testid="stVerticalBlock"] {
816
- padding-right: 1rem !important;
817
- padding-left: 1rem !important;
818
- }
819
-
820
- /* اسکرول افقی */
821
- html {
822
- overflow-x: hidden !important;
823
- }
824
- body {
825
- position: relative !important;
826
- right: 0 !important;
827
- transition: right 0.3s !important;
828
- }
829
  </style>
830
  """, unsafe_allow_html=True)
831
-
832
- return value
833
-
834
- # ========== توابع مدیریت داده‌ها ==========
835
  def get_credentials():
836
  """دریافت اعتبارنامه از Secrets"""
837
  try:
@@ -1425,6 +1423,8 @@ def thank_you_page():
1425
 
1426
  # ========== مدیریت وضعیت و صفحه‌بندی ==========
1427
  def main():
 
 
1428
  # تشخیص دستگاه
1429
  user_agent = st.query_params.get("user_agent", [""])[0]
1430
  st.session_state.is_desktop = "mobile" not in user_agent.lower()
 
771
  """,
772
  unsafe_allow_html=True
773
  )
774
+ return value
775
 
776
+ # ========== توابع مدیریت داده‌ها ==========
777
+ def apply_global_styles():
778
  st.markdown("""
779
  <style>
780
+ /* ===== بازنویسی کامل استایل‌های پیش‌فرض ===== */
781
+
782
+ /* پایه‌ترین سطوح */
783
+ html, body, #root, .stApp {
784
+ direction: rtl !important;
785
+ text-align: right !important;
786
+ font-family: 'B Nazanin' !important;
787
+ overflow-x: hidden !important;
788
+ }
789
+
790
+ /* دکمه‌ها - بالاترین سطح Specificity */
791
+ body .stButton>button,
792
+ body .stButton>button:hover,
793
+ body .stButton>button:focus {
794
+ margin-right: auto !important;
795
+ margin-left: 0 !important;
796
+ float: right !important;
797
+ transform: none !important;
798
+ }
799
+
800
+ /* اسلایدرها - بازنویسی کامل */
801
+ body div[data-testid="stSlider"] > div:first-child,
802
+ body div[data-testid="stSlider"] > div:first-child > div {
803
+ direction: ltr !important;
804
+ background:
805
+ repeating-linear-gradient(
806
+ to right,
807
+ #6a0dad, #6a0dad 3px,
808
+ transparent 3px, transparent calc(20% - 2px),
809
+ #6a0dad calc(20%), #6a0dad calc(20% + 2px),
810
+ transparent calc(20% + 2px), transparent calc(40% - 2px),
811
+ #6a0dad calc(40%), #6a0dad calc(40% + 2px),
812
+ transparent calc(40% + 2px), transparent calc(60% - 2px),
813
+ #6a0dad calc(60%), #6a0dad calc(60% + 2px),
814
+ transparent calc(60% + 2px), transparent calc(80% - 2px),
815
+ #6a0dad calc(80%), #6a0dad calc(80% + 2px)
816
+ ),
817
+ linear-gradient(to right, #E6E6FA, #6A0DAD) !important;
818
+ }
819
+
820
+ /* بازنویسی کامل بلوک‌ها */
821
+ body .stHorizontalBlock > div,
822
+ body .stVerticalBlock > div {
823
+ padding-right: 12px !important;
824
+ padding-left: 0 !important;
825
+ }
826
+
827
+ /* مخفی کردن اسکرول افقی */
828
+ body ::-webkit-scrollbar {
829
+ display: none !important;
830
+ }
 
831
  </style>
832
  """, unsafe_allow_html=True)
 
 
 
 
833
  def get_credentials():
834
  """دریافت اعتبارنامه از Secrets"""
835
  try:
 
1423
 
1424
  # ========== مدیریت وضعیت و صفحه‌بندی ==========
1425
  def main():
1426
+
1427
+ apply_global_styles()
1428
  # تشخیص دستگاه
1429
  user_agent = st.query_params.get("user_agent", [""])[0]
1430
  st.session_state.is_desktop = "mobile" not in user_agent.lower()