Skip to content

Commit

Permalink
Pre-populate username (#185)
Browse files Browse the repository at this point in the history
* Pre-populate username

If a username is set, charm now pre-populates the input field with it
in the "set username" section. Resolves #16

* refactor: simplify username handling

---------

Co-authored-by: bashbunni <bunni@bashbunni.dev>
  • Loading branch information
jesselang and bashbunni committed Jun 28, 2023
1 parent 853bdfd commit 52294b4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ui/username/username.go
Expand Up @@ -94,11 +94,15 @@ func NewModel(cc *client.Client) Model {

im := input.New()
im.CursorStyle = st.Cursor
im.Placeholder = "divagurl2000"
im.Prompt = st.FocusedPrompt.String()
im.CharLimit = 50
im.Focus()

im.Placeholder = "divagurl2000"
if u, err := cc.Bio(); err == nil && u.Name != "" {
im.Placeholder = u.Name
}

return Model{
Done: false,
Quit: false,
Expand Down

0 comments on commit 52294b4

Please sign in to comment.