s_app

package
v0.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRoute

func NewRoute(dp RouteDataProvider) web.Route

NewRoute returns the page for this folder.

Types

type DP

type DP struct {
	// contains filtered or unexported fields
}

DP provides the mail of the app the URL names.

func NewDP

func NewDP(d *deps.Deps) *DP

NewDP returns the page's data provider.

func (*DP) Data

func (p *DP) Data(ctx context.Context, r *web.Request, _ web.ResponseWriter, data *RouteData) error

Data lists the mail of the app; an app the workspace does not have is not found.

func (*DP) Guard

func (p *DP) Guard(ctx context.Context, r *web.Request) error

Guard answers 404 for a name that is not an app of the workspace, before the form or the live connection reaches the backend.

func (*DP) InitReceive

InitReceive leaves the form empty.

func (*DP) ProcessReceive

func (p *DP) ProcessReceive(ctx context.Context, r *web.Request, _ web.ResponseWriter, f *FormReceiveValues) error

ProcessReceive puts the message into the app's inbox and shows the mail again; it shows why when the workspace refuses the message.

func (*DP) Subscribe

func (p *DP) Subscribe(ctx context.Context, r *web.Request, state *ReactiveState) error

Subscribe lists the mail again at every change of the workspace.

type FormReceiveValues

type FormReceiveValues struct {
	form.BaseFormValues
	From    form.Input[string]
	Subject form.Input[string]
	Text    form.Textarea
}

FormReceiveValues holds the fields of the form receive.

type Message

type Message struct {
	ID      string
	Folder  string
	Stamp   string // the time as RFC 3339
	Time    string
	From    string
	To      string
	Subject string
}

Message sums up one message as the page shows it.

type ReactiveState

type ReactiveState struct {
	// contains filtered or unexported fields
}

ReactiveState sends new values of the page's live variables to one open page. Its Set methods may be called from any goroutine.

func (*ReactiveState) SetMail

func (rs *ReactiveState) SetMail(v []Message)

SetMail stores v as mail and sends the parts of the page that show it.

type RouteData

type RouteData struct {
	App  string
	Mail []Message
}

RouteData holds the variables the template declares with <ssr:var>.

type RouteDataProvider

type RouteDataProvider interface {
	Guard(ctx context.Context, r *web.Request) error
	Data(ctx context.Context, r *web.Request, w web.ResponseWriter, data *RouteData) error
	InitReceive(ctx context.Context, r *web.Request, w web.ResponseWriter, data *FormReceiveValues) error
	ProcessReceive(ctx context.Context, r *web.Request, w web.ResponseWriter, data *FormReceiveValues) error
	// Subscribe runs while the page is open and must return when ctx is done.
	Subscribe(ctx context.Context, r *web.Request, state *ReactiveState) error
}

RouteDataProvider is what this page's DP implements.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL