MCPcopy Create free account
hub / github.com/error311/FileRise / openUserPanel

Function openUserPanel

public/js/userPanel.js:70–578  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

68}
69
70export async function openUserPanel() {
71 // 1) load data
72 const { username = 'User', profile_picture = '', totp_enabled = false } = await fetchCurrentUser();
73 const raw = profile_picture;
74 const picUrl = normalizePicUrl(raw) || withBase('/assets/default-avatar.png');
75 const hoverDelayMs = persistHoverPreviewDelayMs(readHoverPreviewDelayMs());
76
77 // 2) dark‐mode helpers
78 const isDark = document.body.classList.contains('dark-mode');
79 const overlayBg = isDark ? 'rgba(0,0,0,0.7)' : 'rgba(0,0,0,0.3)';
80 const contentStyle = `
81 background: ${isDark ? '#2c2c2c' : '#fff'};
82 color: ${isDark ? '#e0e0e0' : '#000'};
83 padding: 20px;
84 max-width: 600px; width:90%;
85 overflow-y: auto; height: 655px; max-height: 655px;
86 display: flex; flex-direction: column; gap: 16px;
87 margin: 0;
88 scrollbar-gutter: stable both-edges;
89 border: ${isDark ? '1px solid #444' : '1px solid #ccc'};
90 box-sizing: border-box;
91 scrollbar-width: none;
92 -ms-overflow-style: none;
93 `;
94
95 // 3) create or reuse modal
96 let modal = document.getElementById('userPanelModal');
97 if (!modal) {
98 // overlay
99 modal = document.createElement('div');
100 modal.id = 'userPanelModal';
101 Object.assign(modal.style, {
102 position: 'fixed',
103 top: '0',
104 left: '0',
105 right: '0',
106 bottom: '0',
107 background: overlayBg,
108 display: 'flex',
109 alignItems: 'center',
110 justifyContent: 'center',
111 padding: '16px',
112 boxSizing: 'border-box',
113 overflow: 'hidden',
114 zIndex: '1000',
115 });
116
117 // content container
118 const content = document.createElement('div');
119 content.className = 'modal-content';
120 content.style.cssText = contentStyle;
121
122 // close button
123 const closeBtn = document.createElement('span');
124 closeBtn.id = 'closeUserPanel';
125 closeBtn.className = 'editor-close-btn';
126 closeBtn.textContent = '×';
127 closeBtn.addEventListener('click', () => modal.style.display = 'none');

Callers 1

updateAuthenticatedUIFunction · 0.85

Calls 13

fetchCurrentUserFunction · 0.85
normalizePicUrlFunction · 0.85
withBaseFunction · 0.85
readHoverPreviewDelayMsFunction · 0.85
tFunction · 0.85
openTOTPModalFunction · 0.85
setLocaleFunction · 0.85
applyTranslationsFunction · 0.85
applyHoverDelayFunction · 0.85
updateAuthenticatedUIFunction · 0.85

Tested by

no test coverage detected