@@ -39,17 +39,14 @@ def setup_system():
3939if 'sound_unlocked' not in st .session_state : st .session_state .sound_unlocked = False
4040if 'selected_alarm_tone' not in st .session_state : st .session_state .selected_alarm_tone = "Double Beep"
4141
42- # Global Persistence for Text Inputs (Prevents clearing when switching tabs)
4342if 'study_text_input' not in st .session_state : st .session_state .study_text_input = ""
4443if 'grammar_text_input' not in st .session_state : st .session_state .grammar_text_input = ""
4544if 'plag_text_input' not in st .session_state : st .session_state .plag_text_input = ""
4645
47- # Settings Persistance
4846if 'set_color' not in st .session_state : st .session_state .set_color = "#3b82f6"
4947if 'set_bg' not in st .session_state : st .session_state .set_bg = "#1e293b"
5048if 'set_font' not in st .session_state : st .session_state .set_font = 1.10
5149
52- # NotebookLM Style States
5350if 'quiz_step' not in st .session_state : st .session_state .quiz_step = 0
5451if 'quiz_score' not in st .session_state : st .session_state .quiz_score = 0
5552if 'fc_step' not in st .session_state : st .session_state .fc_step = 0
@@ -135,23 +132,44 @@ def trigger_master_reset():
135132 st .image ("z.png" , width = 80 )
136133 st .title ("VERSO PRO" )
137134
138- # Word Counter Logic for the Sidebar Button
139- def get_current_word_count ():
140- # Scans all active text inputs for a total count
141- text = f"{ st .session_state .study_text_input } { st .session_state .grammar_text_input } { st .session_state .plag_text_input } "
142- return len (text .split ())
143-
135+ # Navigation list exactly matching your requirements
144136 nav_options = ["🏠 Home" , "📒 Study Assistant" , "✍️ Grammar Checker" , "🛡️ Plagiarism Checker" , "⏱️ Time Tracker" ]
145137
146- # Navigation Radio
147- choice = st .radio ("Navigation" , nav_options + ["⚙️ Settings" ])
138+ # Custom CSS to make the Word Counter Button look like a Nav Item
139+ st .markdown ("""
140+ <style>
141+ div.stButton > button:first-child {
142+ border: none;
143+ background-color: transparent;
144+ color: #FFFFFF;
145+ text-align: left;
146+ padding: 0px;
147+ font-size: 16px;
148+ display: flex;
149+ align-items: center;
150+ }
151+ div.stButton > button:first-child:hover {
152+ color: #3b82f6;
153+ background-color: transparent;
154+ }
155+ </style>
156+ """ , unsafe_allow_html = True )
157+
158+ # Initial Radio for primary navigation
159+ if 'main_nav' not in st .session_state : st .session_state .main_nav = "🏠 Home"
160+
161+ choice = st .radio ("Menu" , nav_options , label_visibility = "collapsed" )
162+
163+ # WORD COUNTER POSITIONED UNDER TIMER AND ABOVE SETTINGS
164+ if st .button ("📝 Word Counter" ):
165+ all_text = f"{ st .session_state .study_text_input } { st .session_state .grammar_text_input } { st .session_state .plag_text_input } "
166+ count = len (re .findall (r'\w+' , all_text ))
167+ st .toast (f"Total Session Count: { count } words" )
168+ st .sidebar .info (f"Words detected: { count } " )
148169
149- st .write ("---" )
150- # WORD COUNT BUTTON - POSITIONED UNDER TIMER AND ABOVE SETTINGS
151- if st .button ("📝 WORD COUNTER" , use_container_width = True ):
152- count = get_current_word_count ()
153- st .toast (f"Total Words Across App: { count } " )
154- st .sidebar .info (f"Current Session: { count } words" )
170+ # Settings separated as requested
171+ if st .radio ("System" , ["⚙️ Settings" ], label_visibility = "collapsed" , index = None ):
172+ choice = "⚙️ Settings"
155173
156174# --- MODULE: GRAMMAR CHECKER ---
157175if choice == "✍️ Grammar Checker" :
@@ -339,7 +357,7 @@ def get_current_word_count():
339357 st .markdown ('<h1 style="font-size: 3rem;">Verso Control Center</h1>' , unsafe_allow_html = True )
340358 if st .button ("🚨 MASTER RESET" , type = "primary" ): trigger_master_reset ()
341359
342- st .write ("" ) # Spacer
360+ st .write ("" )
343361 v_id = st .session_state .reset_counter
344362
345363 col1 , col2 , col3 = st .columns (3 )
0 commit comments