Starting work on the authDialog needed for Elevate

This commit is contained in:
HikariKnight 2023-04-10 16:28:12 +02:00
parent 798427280b
commit 7eb7e2fa1c
3 changed files with 85 additions and 24 deletions

View file

@ -12,6 +12,7 @@ import (
func (m model) View() string {
if m.width != 0 {
title := ""
view := "Empty View :("
switch m.focused {
case INTRO:
title = dialogStyle.Render(
@ -31,11 +32,16 @@ func (m model) View() string {
"becomes unbootable, as you will be asked to verify the files generated",
),
)
view = listStyle.Render(m.lists[m.focused].View())
case GPUS:
title = titleStyle.MarginLeft(2).Render(
"Select a GPU to check the IOMMU groups of",
)
view = listStyle.Render(m.lists[m.focused].View())
case GPU_GROUP:
title = titleStyle.Render(
fmt.Sprint(
@ -44,11 +50,15 @@ func (m model) View() string {
),
)
view = listStyle.Render(m.lists[m.focused].View())
case USB:
title = titleStyle.Render(
"[OPTIONAL]: Select a USB Controller to check the IOMMU groups of",
)
view = listStyle.Render(m.lists[m.focused].View())
case USB_GROUP:
title = titleStyle.Render(
fmt.Sprint(
@ -57,6 +67,8 @@ func (m model) View() string {
),
)
view = listStyle.Render(m.lists[m.focused].View())
case VBIOS:
// Get the program directory
exe, _ := os.Executable()
@ -89,6 +101,8 @@ func (m model) View() string {
title = fmt.Sprintf(text, m.vbios_path, scriptdir)
view = listStyle.Render(m.lists[m.focused].View())
case VIDEO:
title = dialogStyle.Render(
fmt.Sprint(
@ -99,13 +113,15 @@ func (m model) View() string {
),
)
view = listStyle.Render(m.lists[m.focused].View())
case DONE:
title = dialogStyle.Render(
fmt.Sprint(
"The configuration files have been generated and are\n",
"located inside the \"config\" folder\n",
"\n",
"* The \"cmdline\" file contains kernel arguments that your bootloader needs\n",
"* The \"kernel_args\" file contains kernel arguments that your bootloader needs\n",
"* The \"quickemu\" folder contains files that might be\n useable for quickemu in the future\n",
"* The files inside the \"etc\" folder must be copied to your system.\n",
" NOTE: Verify that these files are correctly formated/edited!\n",
@ -114,9 +130,11 @@ func (m model) View() string {
"run it to copy the files to your system and make a backup of your old files.",
),
)
view = m.authDialog.View()
}
//return listStyle.SetString(fmt.Sprintf("%s\n\n", title)).Render(m.lists[m.focused].View())
return lipgloss.JoinVertical(lipgloss.Left, fmt.Sprintf("%s\n%s\n", title, listStyle.Render(m.lists[m.focused].View())))
return lipgloss.JoinVertical(lipgloss.Left, fmt.Sprintf("%s\n%s\n", title, view))
} else {
return "Loading..."
}