Skip to content

Commit

Permalink
Merge pull request #11 from MohamTahaB/Fix/initiate-view
Browse files Browse the repository at this point in the history
Fix/initiate-view
  • Loading branch information
MohamTahaB authored Mar 14, 2024
2 parents 953fd6d + ebe6980 commit 634fdd9
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion jotter/model/view.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
package model

import (
"fmt"
"strings"
)

func (m Model) View() string {
var b strings.Builder
var msg string

// Render the appropriate section according to the state of the model.
switch m.State {
case ReadFileList:
// Render the list of files.
msg = m.List.View()
case ReadFile:
// Render the file viewport.
msg = m.ViewPort.View()
case WriteFile:
// Render the form.
msg = m.Form.View()
}

fmt.Fprintf(&b, "%s \n", msg)

return ""
}
}

0 comments on commit 634fdd9

Please sign in to comment.