MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / renderContent

Method renderContent

internal/tui/auth_tab.go:167–252  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

165}
166
167func (m authTabModel) renderContent() string {
168 var sb strings.Builder
169
170 sb.WriteString(titleStyle.Render(T("auth_title")))
171 sb.WriteString("\n")
172 sb.WriteString(helpStyle.Render(T("auth_help1")))
173 sb.WriteString("\n")
174 sb.WriteString(helpStyle.Render(T("auth_help2")))
175 sb.WriteString("\n")
176 sb.WriteString(strings.Repeat("─", m.width))
177 sb.WriteString("\n")
178
179 if m.err != nil {
180 sb.WriteString(errorStyle.Render("⚠ Error: " + m.err.Error()))
181 sb.WriteString("\n")
182 return sb.String()
183 }
184
185 if len(m.files) == 0 {
186 sb.WriteString(subtitleStyle.Render(T("no_auth_files")))
187 sb.WriteString("\n")
188 return sb.String()
189 }
190
191 for i, f := range m.files {
192 name := getString(f, "name")
193 channel := getString(f, "channel")
194 email := getString(f, "email")
195 disabled := getBool(f, "disabled")
196
197 statusIcon := successStyle.Render("●")
198 statusText := T("status_active")
199 if disabled {
200 statusIcon = lipgloss.NewStyle().Foreground(colorMuted).Render("○")
201 statusText = T("status_disabled")
202 }
203
204 cursor := " "
205 rowStyle := lipgloss.NewStyle()
206 if i == m.cursor {
207 cursor = "▸ "
208 rowStyle = lipgloss.NewStyle().Bold(true)
209 }
210
211 displayName := name
212 if len(displayName) > 24 {
213 displayName = displayName[:21] + "..."
214 }
215 displayEmail := email
216 if len(displayEmail) > 28 {
217 displayEmail = displayEmail[:25] + "..."
218 }
219
220 row := fmt.Sprintf("%s%s %-24s %-12s %-28s %s",
221 cursor, statusIcon, displayName, channel, displayEmail, statusText)
222 sb.WriteString(rowStyle.Render(row))
223 sb.WriteString("\n")
224

Callers 6

UpdateMethod · 0.95
startEditMethod · 0.95
SetSizeMethod · 0.95
handleEditInputMethod · 0.95
handleConfirmInputMethod · 0.95
handleNormalInputMethod · 0.95

Calls 8

renderDetailMethod · 0.95
TFunction · 0.85
getStringFunction · 0.85
getBoolFunction · 0.85
WriteStringMethod · 0.80
ErrorMethod · 0.45
StringMethod · 0.45
ViewMethod · 0.45

Tested by

no test coverage detected