77 lines
2.4 KiB
Go
77 lines
2.4 KiB
Go
package steps
|
|
|
|
import (
|
|
"miasma-installer/tui/styles"
|
|
"strings"
|
|
|
|
tea "github.com/charmbracelet/bubbletea"
|
|
)
|
|
|
|
type WelcomeModel struct {
|
|
Finished bool
|
|
}
|
|
|
|
func NewWelcomeModel() WelcomeModel {
|
|
return WelcomeModel{Finished: false}
|
|
}
|
|
|
|
func (m WelcomeModel) Init() tea.Cmd {
|
|
return nil
|
|
}
|
|
|
|
func (m WelcomeModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|
if m.Finished {
|
|
return m, nil
|
|
}
|
|
|
|
switch msg := msg.(type) {
|
|
case tea.KeyMsg:
|
|
switch msg.String() {
|
|
case "enter":
|
|
m.Finished = true
|
|
}
|
|
}
|
|
return m, nil
|
|
}
|
|
|
|
func (m WelcomeModel) View() string {
|
|
logo := `
|
|
███╗ ███╗██╗ █████╗ ███████╗███╗ ███╗ █████╗
|
|
████╗ ████║██║██╔══██╗██╔════╝████╗ ████║██╔══██╗
|
|
██╔████╔██║██║███████║███████╗██╔████╔██║███████║
|
|
██║╚██╔╝██║██║██╔══██║╚════██║██║╚██╔╝██║██╔══██║
|
|
██║ ╚═╝ ██║██║██║ ██║███████║██║ ╚═╝ ██║██║ ██║
|
|
╚═╝ ╚═╝╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝
|
|
`
|
|
|
|
var content strings.Builder
|
|
|
|
content.WriteString(styles.LogoStyle.Render(logo))
|
|
content.WriteString("\n\n")
|
|
content.WriteString(styles.TitleStyle.Render("Welcome to Miasma OS Installer"))
|
|
content.WriteString("\n")
|
|
content.WriteString(styles.SubtitleStyle.Render("An opinionated Arch Linux installation"))
|
|
content.WriteString("\n\n")
|
|
|
|
features := []string{
|
|
"🔒 LUKS2 encryption by default",
|
|
"🗂️ Btrfs filesystem with snapshots",
|
|
"🛡️ Hardened Linux kernel",
|
|
"🚀 Cosmic Desktop environment",
|
|
"⚡ UEFI boot with systemd-boot",
|
|
}
|
|
|
|
featureBox := styles.InfoBoxStyle.Render(strings.Join(features, "\n"))
|
|
content.WriteString(featureBox)
|
|
content.WriteString("\n\n")
|
|
|
|
warning := styles.WarningBoxStyle.Render("⚠️ WARNING: This will erase all data on the selected disk!")
|
|
content.WriteString(warning)
|
|
content.WriteString("\n\n")
|
|
|
|
help := styles.RenderHelp("Enter", "Continue", "Ctrl+C", "Exit")
|
|
content.WriteString(help)
|
|
|
|
return styles.AppStyle.Render(content.String())
|
|
}
|