-

-
-
${name}
-
${user.email || ''}
+
+ if (profilePopover) {
+ profilePopover.innerHTML = `
+
+

+
+
${name}
+
${user.email || ''}
+
-
-
-
-
- `;
+
+
+
+ `;
+ }
}
- profileBtn.addEventListener('click', (e) => {
- if (!localStorage.getItem('studyplan_user')) {
- document.getElementById('auth-modal').style.display = 'flex';
- return;
- }
- profilePopover.style.display = profilePopover.style.display === 'block' ? 'none' : 'block';
- const expanded = profilePopover.style.display === 'block';
- profileBtn.setAttribute('aria-expanded', expanded ? 'true' : 'false');
- });
+ if (profileBtn) {
+ profileBtn.addEventListener('click', (e) => {
+ if (!localStorage.getItem('studyplan_user')) {
+ document.getElementById('auth-modal').style.display = 'flex';
+ return;
+ }
+ if (profilePopover) {
+ profilePopover.style.display = profilePopover.style.display === 'block' ? 'none' : 'block';
+ const expanded = profilePopover.style.display === 'block';
+ profileBtn.setAttribute('aria-expanded', expanded ? 'true' : 'false');
+ }
+ });
+ }
// Close popover when clicking outside
document.addEventListener('click', (e) => {
+ if (!profilePopover || !profileBtn) return;
if (!profilePopover.contains(e.target) && e.target !== profileBtn) {
profilePopover.style.display = 'none';
profileBtn.setAttribute('aria-expanded','false');
@@ -579,7 +590,9 @@
=12"
- },
- "funding": {
- "url": "https://github.com/sponsors/jonschlinkert"
- }
- },
"node_modules/prebuild-install": {
"version": "7.1.3",
"resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.3.tgz",