Skip to content

ui.generic #

enum ChannelType #

enum ChannelType {
	console
	telegram
}

struct UserInterface #

struct UserInterface {
pub mut:
	channel UIChannel
	user_id string
}

fn (UserInterface) ask_dropdown #

fn (mut c UserInterface) ask_dropdown(args DropDownArgs) !string

return the dropdown as an int description string items []string warning string clear bool = true

fn (UserInterface) ask_dropdown_int #

fn (mut c UserInterface) ask_dropdown_int(args DropDownArgs) !int

will return the string as given as response description string items []string warning string clear bool = true

fn (UserInterface) ask_dropdown_multiple #

fn (mut c UserInterface) ask_dropdown_multiple(args DropDownArgs) ![]string

result can be multiple, aloso can select all description string items []string warning string clear bool = true

fn (UserInterface) ask_question #

fn (mut c UserInterface) ask_question(args QuestionArgs) !string

args:

  • description string
  • question string
  • warning: string (if it goes wrong, which message to use)
  • reset bool = true
  • regex: to check what result need to be part of
  • minlen: min nr of chars

fn (UserInterface) ask_yesno #

fn (mut c UserInterface) ask_yesno(args uimodel.YesNoArgs) !bool

yes is true, no is false args:- description string

  • question string
  • warning string
  • clear bool = true

fn (UserInterface) edit #

fn (mut c UserInterface) edit(args uimodel.EditArgs) !string

open editor which can be used to edit content (not every UI has all capability, in case of console open vscode if installed) . .

args:
     content 	string //in specified format
  cat ...
enum InfoCat {
    content 	string //in specified format
    cat EditorCat
}

returns the editted content, idea is that formatting is used in editor

fn (UserInterface) info #

fn (mut c UserInterface) info(args uimodel.InfoArgs) !

send info to the main pannel . (not every UI has all capability e.g. html)

args:
    content 	string //in specified format
    clear       bool //means screen is reset for content above
    lf_before int 	 //line feed before content
    lf_after int
    cat InfoCat
 components []ComponentCat
enum InfoCat {
    txt
    html
    markdown
}
MORE THAN ONE COMPONENT CAN BE ADDED TO INFO
enum ComponentCat {
    bootstrap
    htmx
    bulma
}

supports images, and other html elements suggest to support htmx and limited js (how can we limit this)

fn (UserInterface) log #

fn (mut c UserInterface) log(args uimodel.LogArgs) !

log content to the log panel (not every UI has this capability)

args:
    content 	string
    clear       bool //means screen is reset for content above
    lf_before int 	 //line feed before content
    lf_after int
 cat LogCat
defines colors as used in the representation layer
enum LogCat {
    info
    log
    warning
    header
    debug
    error
}

fn (UserInterface) pay #

fn (mut c UserInterface) pay(args uimodel.PayArgs) !

...

args:
TODO
}