add:remove server config func

This commit is contained in:
2026-04-06 03:36:51 +09:00
parent 83aab9d943
commit 9e9134f659
6 changed files with 113 additions and 1 deletions

View File

@@ -38,6 +38,8 @@ func (m TUIInterface) subtitle() string {
return "Send File"
case pageCleanAll:
return "Clean All"
case pageRemoveServer:
return "Remove Server"
default:
return "Secure file transfer"
}
@@ -71,6 +73,8 @@ func (m TUIInterface) View() tea.View {
body = m.viewSend()
case pageCleanAll:
body = m.viewCleanAll()
case pageRemoveServer:
body = m.viewRemoveServer()
default:
body = m.viewMenu()
}
@@ -114,6 +118,12 @@ func (m TUIInterface) View() tea.View {
footerHint("enter", "confirm") +
footerSep() +
footerHint("esc", "back")
case pageRemoveServer:
footerStr = footerHint("↑↓", "navigate") +
footerSep() +
footerHint("enter", "remove") +
footerSep() +
footerHint("esc", "back")
case pageCleanAll:
footerStr = footerHint("enter", "confirm") +
footerSep() +
@@ -262,6 +272,17 @@ func (m TUIInterface) viewSend() string {
return lipgloss.JoinVertical(lipgloss.Left, crumb, queryLine, list)
}
func (m TUIInterface) viewRemoveServer() string {
if len(m.ServerNames) == 0 {
return styles.StatusWarnStyle.Render("⚠ No servers configured.")
}
var rows []string
for i, name := range m.ServerNames {
rows = append(rows, styles.ServerRowStyle(i == m.Selected, name))
}
return lipgloss.JoinVertical(lipgloss.Left, rows...)
}
func (m TUIInterface) viewCleanAll() string {
fileCount := len(m.StorageFiles)
warning := styles.CleanWarningStyle.Render(