Documentation
¶
Overview ¶
Package views holds the templ components and pages.
Index ¶
- Constants
- func AdminRoom(row AdminRoomRow) templ.Component
- func AdminRoomPath(id uint64) string
- func AdminRoomsPage(d AdminRoomsData) templ.Component
- func AdminTabs(current string) templ.Component
- func AdminUsersPage(d AdminUsersData) templ.Component
- func AppearanceSection(d AppearanceData) templ.Component
- func Attachments(atts []app.AttachmentView) templ.Component
- func AuditEntityLabel(entity string) string
- func AuditFilters(d AuditData) templ.Component
- func AuditPage(d AuditData) templ.Component
- func AuditPanel(d AuditData) templ.Component
- func Avatar(id uint64, displayName, url string) templ.Component
- func AvatarColourIndex(id uint64) int
- func AvatarSized(id uint64, displayName, url, size string) templ.Component
- func BoardAddColumn(d BoardData) templ.Component
- func BoardColumns(d BoardData) templ.Component
- func BoardColumnsPath(roomID uint64) string
- func BoardEditor(d BoardData) templ.Component
- func BoardHeader(d BoardData) templ.Component
- func BoardMessage(message string) templ.Component
- func BoardNote(d BoardData) templ.Component
- func BoardPage(d BoardData) templ.Component
- func BoardPath(roomID uint64) string
- func BoardStreamPath(roomID uint64, version string) string
- func BoardVersion(b app.BoardView) string
- func CallAnsweredPath(conversationID uint64, video bool) string
- func CallArea(d CallData) templ.Component
- func CallButtons(d CallData) templ.Component
- func CallEntry(d MessageData) templ.Component
- func CallKindText(video bool) string
- func CallPath(conversationID uint64, action string) string
- func CallRingingDialog(inv CallInviteData) templ.Component
- func CallRingingSlot(inv *CallInviteData) templ.Component
- func CallSocketURL(conversationID uint64) string
- func CommentPath(rootID, id uint64) string
- func CommentsSection(d PostPageData) templ.Component
- func ConversationActions(d PlacePrefsData, call CallData) templ.Component
- func ConversationBeforePath(convID, before uint64) string
- func ConversationHeader(d ConversationData) templ.Component
- func ConversationList(items []app.ConversationSummary, viewerID uint64) templ.Component
- func ConversationMembers(d MembersPanelData) templ.Component
- func ConversationMessagePath(convID, msgID uint64) string
- func ConversationOlderPath(convID, before uint64) string
- func ConversationPage(d ConversationData) templ.Component
- func ConversationPath(id uint64) string
- func ConversationPrefsPath(convID uint64) string
- func ConversationReplyPath(convID, msgID uint64) string
- func ConversationStreamPath(convID, newest, before uint64) string
- func CountLabel(n int) string
- func ErrorPage(status int, message string) templ.Component
- func Favicon(unread int) templ.Component
- func FaviconPath(unread int) string
- func Feed(d FeedData) templ.Component
- func FeedMore(d FeedData) templ.Component
- func FeedNewLine() templ.Component
- func FeedPath(roomID, before uint64) string
- func FeedPosts(d FeedData) templ.Component
- func FilePath(a app.AttachmentView) string
- func FormPost(path string) string
- func FormPostConfirm(path, message string) string
- func GroupMentionConfirm(d GroupMentionConfirmData) templ.Component
- func GroupMentionConfirmID(id string) string
- func GroupMentionSendPath(action string) string
- func Header(d SidebarData) templ.Component
- func Home(sb SidebarData) templ.Component
- func IconAttach() templ.Component
- func IconBell() templ.Component
- func IconBoard() templ.Component
- func IconCalendar() templ.Component
- func IconCheck() templ.Component
- func IconClose() templ.Component
- func IconFeed() templ.Component
- func IconFile() templ.Component
- func IconHangUp() templ.Component
- func IconHeart() templ.Component
- func IconLock() templ.Component
- func IconLogout() templ.Component
- func IconMenu() templ.Component
- func IconMessage() templ.Component
- func IconMic() templ.Component
- func IconMicOff() templ.Component
- func IconMonitor() templ.Component
- func IconMoon() templ.Component
- func IconMore() templ.Component
- func IconMuted() templ.Component
- func IconPaw() templ.Component
- func IconPhone() templ.Component
- func IconPlus() templ.Component
- func IconScreen() templ.Component
- func IconSearch() templ.Component
- func IconSettings() templ.Component
- func IconSliders() templ.Component
- func IconSun() templ.Component
- func IconTag() templ.Component
- func IconTask() templ.Component
- func IconTaskDone() templ.Component
- func IconVideo() templ.Component
- func IconVideoOff() templ.Component
- func Initials(displayName string) string
- func InviteSection(d InviteData) templ.Component
- func Layout(title string, unread int, sb *SidebarData) templ.Component
- func LoginCodeForm(d LoginCodeData) templ.Component
- func LoginCodePage(d LoginCodeData) templ.Component
- func LoginForm(d LoginData) templ.Component
- func LoginPage(d LoginData) templ.Component
- func Logo() templ.Component
- func LogoMark() templ.Component
- func MembersPanel(d RoomData) templ.Component
- func MessageActionPath(msgID uint64, action string) string
- func MessageAttachments(atts []app.AttachmentView) templ.Component
- func MessageComposer(d ComposerData) templ.Component
- func MessageComposerForm(d ComposerData) templ.Component
- func MessageContent(d MessageData) templ.Component
- func MessageContentID(id uint64) string
- func MessageCount(n int) templ.Component
- func MessageEdit(d MessageEditData) templ.Component
- func MessageElementID(id uint64) string
- func MessageFilePath(a app.AttachmentView) string
- func MessageItem(d MessageData) templ.Component
- func MessageItemEditing(d MessageEditData) templ.Component
- func MessageItems(items []MessageData) templ.Component
- func MessageQuote(q app.MessageQuote) templ.Component
- func MessageReactionPicker(d MessageReactionsData) templ.Component
- func MessageReactions(d MessageReactionsData) templ.Component
- func MessageReplySlot(q *app.MessageQuote, convID uint64) templ.Component
- func MessageSearchBox(query string) templ.Component
- func MessageSearchPath(q string, before uint64) string
- func MessageSearchResults(d MessageSearchData) templ.Component
- func MessageSeen(id uint64, seen bool) templ.Component
- func MessagesOlder(convID uint64, hasOlder bool, before uint64) templ.Component
- func MessagesPage(d ConversationsData) templ.Component
- func NewConversationForm(d NewConversationData) templ.Component
- func NewSinceID(posts []app.Post, seen, viewerID uint64) uint64
- func NoticePath(n app.Notice) string
- func NoticePlaceKey(n app.Notice) string
- func NotificationCount(n int) templ.Component
- func NotificationElementID(id uint64) string
- func NotificationItem(n app.Notification) templ.Component
- func NotificationOthers(n app.Notification) string
- func NotificationPath(n app.Notification) string
- func NotificationSentence(n app.Notification) string
- func NotificationsMessage(message string) templ.Component
- func NotificationsOlderPath(before uint64) string
- func NotificationsPage(d NotificationsData) templ.Component
- func NotificationsStreamPath(seen uint64, live bool) string
- func NotifyEvent(n app.Notice) templ.Component
- func NotifyPlace(place string) templ.Component
- func NotifyPrefsSection(d NotifyPrefsData) templ.Component
- func OlderPostsPath(roomID, before uint64) string
- func OnlineDot(online bool) templ.Component
- func PageBaseTitle(title string) string
- func PageHeader(d SidebarData) templ.Component
- func PageSidebar(d SidebarData) templ.Component
- func PageTitle(unread int, base string) templ.Component
- func PasswordSection(d PasswordData) templ.Component
- func PlaceKey(ref app.PlaceRef) string
- func PlacePrefsButton(d PlacePrefsData) templ.Component
- func PlacePrefsDialog(d PlacePrefsData) templ.Component
- func PlacePrefsForm(d PlacePrefsData) templ.Component
- func PlacePrefsSummary(p app.PlacePrefs) string
- func PostCard(d PostCardData) templ.Component
- func PostCommentsPath(id uint64) string
- func PostContent(d PostCardData) templ.Component
- func PostEdit(d PostEditData) templ.Component
- func PostEditor(d PostEditorData) templ.Component
- func PostMenu(d PostCardData) templ.Component
- func PostPage(d PostPageData) templ.Component
- func PostPath(id uint64) string
- func PostPreview(d PostPreviewData) templ.Component
- func PostStreamPath(rootID, newest uint64) string
- func PostTasks(roomID uint64, tasks []app.TaskCard) templ.Component
- func ProfileSection(d ProfileData) templ.Component
- func ReactionPicker(d ReactionsData) templ.Component
- func Reactions(d ReactionsData) templ.Component
- func ReplySlot(parentID uint64, editor *PostEditorData) templ.Component
- func ResetForm(d ResetData) templ.Component
- func ResetPage(d ResetData) templ.Component
- func RoomComposer(d RoomData) templ.Component
- func RoomEditForm(d RoomData) templ.Component
- func RoomHeader(d RoomData) templ.Component
- func RoomMemberCount(d RoomData) templ.Component
- func RoomNav(roomID uint64, current RoomNavCurrent) templ.Component
- func RoomNewForm(d RoomNewData) templ.Component
- func RoomNewPage(d RoomNewData) templ.Component
- func RoomPage(d RoomData) templ.Component
- func RoomPath(id uint64) string
- func RoomPrefsPath(roomID uint64) string
- func RoomStreamPath(roomID, newest, before, newSince uint64) string
- func RoomsBrowsePage(d RoomsBrowseData) templ.Component
- func RoomsPanel(d RoomsBrowseData) templ.Component
- func SSHKeyRemovePath(id uint64) string
- func SearchBar() templ.Component
- func SearchBox(query string) templ.Component
- func SearchPage(d SearchData) templ.Component
- func SearchPanel(d SearchData) templ.Component
- func SearchPath(q string, page int) string
- func SeenMessageID(viewerID uint64, h app.ConversationHeader, messages []app.Message) uint64
- func SessionEndPath(id uint64) string
- func SessionsSection(sessions []app.SessionInfo) templ.Component
- func SettingsPage(d SettingsData) templ.Component
- func Sidebar(d SidebarData) templ.Component
- func SidebarRoom(room app.Room, current uint64) templ.Component
- func SignInSection(d SignInData) templ.Component
- func SignUpForm(d SignUpData) templ.Component
- func SignUpPage(d SignUpData) templ.Component
- func SizeText(n int64) string
- func SplitTitle(title string) (label, base string)
- func StaticURL(ctx context.Context, path string) string
- func TabTitle(unread int, base string) string
- func TagSearchPath(tag string) string
- func TagSuggestions(editorID string, tags []string) templ.Component
- func TaskBoardPath(roomID, taskID uint64) string
- func TaskRow(editorID string, index int, row TaskRowData, options []AssigneeOption) templ.Component
- func TaskRowsSelector(editorID string) string
- func ThemeColor() templ.Component
- func ThemeMenu(theme app.Theme) templ.Component
- func Thread(d PostPageData) templ.Component
- func UserMenu(d SidebarData) templ.Component
- func UsersPanel(d AdminUsersData) templ.Component
- func WithRoomRead(room app.Room) app.Room
- func WithStaticVersion(ctx context.Context, version string) context.Context
- func WithTheme(ctx context.Context, theme string) context.Context
- type AdminRoomRow
- type AdminRoomsData
- type AdminUsersData
- type AppearanceData
- type AssigneeOption
- type AuditData
- type AuditDetail
- type AuditFilterForm
- type AuditRow
- type BoardData
- type BoardEditorData
- type CallData
- type CallInviteData
- type CallPanelData
- type ComposerData
- type ConversationData
- type ConversationsData
- type FeedData
- type FormErrors
- type GroupMentionConfirmData
- type InviteData
- type LoginCodeData
- type LoginData
- type MembersPanelData
- type MessageData
- type MessageEditData
- type MessageReactionsData
- type MessageSearchData
- type NewConversationData
- type NotificationsData
- type NotifyPrefsData
- type PasswordData
- type PlaceListItem
- type PlacePrefsData
- type PostCardData
- type PostEditData
- type PostEditorData
- type PostPageData
- type PostPreviewData
- type ProfileData
- type ReactionsData
- type ResetData
- type ResetLinkData
- type RoomData
- type RoomEditData
- type RoomNavCurrent
- type RoomNewData
- type RoomsBrowseData
- type SSHKeyAddData
- type SearchChip
- type SearchData
- type SettingsData
- type SidebarData
- type SignInData
- type SignUpData
- type TaskRowData
Constants ¶
const ( // SettingsNotificationsPath saves the global notification preferences. SettingsNotificationsPath = SettingsPath + "/notifications" // PlacePrefsQuery is the query that opens the "Notification preferences" // dialog when a room or a conversation page loads: the links of the // settings page use it. PlacePrefsQuery = "prefs=1" )
The paths of the notification preferences (SPEC §7.15).
const ( PlacePrefsDialogID = "place-prefs-dialog" PlacePrefsFormID = "place-prefs-form" )
PlacePrefsDialogID is the id of the dialog "Notification preferences" of a room page and of a conversation page, and PlacePrefsFormID the id of its form, which the server patches.
const ( // SettingsPath is the settings page of the logged-in user (SPEC §7.14). SettingsPath = "/me/settings" // SessionsPath is the old page of the sessions, which redirects to the // Sessions section of the settings page. SessionsPath = "/me/sessions" // SettingsSessionsPath is the Sessions section of the settings page. SettingsSessionsPath = SettingsPath + "#sessions" // SettingsProfilePath saves the display name. SettingsProfilePath = SettingsPath + "/profile" // SettingsAvatarPath uploads the avatar. SettingsAvatarPath = SettingsPath + "/avatar" // SettingsAvatarRemovePath removes the avatar. SettingsAvatarRemovePath = SettingsPath + "/avatar/remove" // SettingsPasswordPath changes the password. SettingsPasswordPath = SettingsPath + "/password" // SettingsAppearancePath saves the theme. SettingsAppearancePath = SettingsPath + "/appearance" )
The paths of the settings page and of what it sends.
const ( // SettingsSSHKeysPath adds an SSH key. SettingsSSHKeysPath = SettingsPath + "/ssh-keys" // SettingsSignInPath is the Sign-in section of the settings page. SettingsSignInPath = SettingsPath + "#signin" )
The paths of the Sign-in section of the settings page.
const ( // ThemeColorLight is the ground of the light palette. ThemeColorLight = "#fbf6ee" // ThemeColorDark is the ground of the dark palette. ThemeColorDark = "#1a1512" )
The two colours of the theme-color elements: the ground of the light and of the dark palette (--c-ground in app.css; a test keeps them equal), which the browser draws behind its own bars on a phone.
const ( // FaviconPlainPath is the favicon of a page with nothing waiting. FaviconPlainPath = "/static/favicon.svg" // FaviconDotPath is the favicon of a page with something waiting. FaviconDotPath = "/static/favicon-dot.svg" )
The two favicons: the plain one, and the one with a dot, which says that something is waiting (SPEC §7.17). The stream swaps one for the other by patching the link element of the page; no script draws anything.
const CallAnswerQuery = "call"
CallAnswerQuery is the query a page of a conversation gets after its user answered a call: "call=video" or "call=audio". The page then opens the call, sending video or not as the value says (the choice is not stored by the server).
const (
// FromPost says the post is shown on its own page.
FromPost = "post"
)
The values of the form field "from" of the actions on a post: where the post is shown, so that the answer fits the page.
const FromRoomPrefix = "room-"
FromRoomPrefix starts the value of the form field "from" of a "Message" button in the member list of a room: FromRoomPrefix + the room's ID. It says where the message of a failure is shown.
const LoginCodePath = "/login/code"
LoginCodePath is the page and the form of the second step of the login.
const LoginCodeRestartPath = "/login/code/restart"
LoginCodeRestartPath is the "Start again" link of the second step.
const MaxVisualDepth = 6
MaxVisualDepth is the deepest level a comment is indented to. A comment deeper than that stays at this level and says whom it replies to (SPEC §7.3).
const MeStreamPath = "/me/stream"
MeStreamPath is the path of the stream of the pages that have no stream of their own: it keeps the counts and the room list of the sidebar live (SPEC D31).
const MessagesPath = "/messages"
MessagesPath is the path of the page that lists the conversations of the user; a POST to it starts a conversation.
const MessagesStreamPath = MeStreamPath + "?messages=1"
MessagesStreamPath is the path of the stream of the Messages page: the stream of the pages that have none (MeStreamPath), told to keep the list of conversations live too.
const NotificationsPath = "/notifications"
NotificationsPath is the path of the notifications page.
const NotificationsReadPath = "/notifications/read"
NotificationsReadPath is the path that marks all notifications as read.
const SettingsAppearanceMenuPath = SettingsAppearancePath + "?from=menu"
SettingsAppearanceMenuPath is the route that saves the theme, as the form of the user menu posts to it: the query from=menu makes the answer patch the menu and not the Appearance section, which is not on most pages.
const SettingsSSHCodePath = SettingsPath + "/ssh-code"
SettingsSSHCodePath turns the SSH code at login on or off.
Variables ¶
This section is empty.
Functions ¶
func AdminRoom ¶
func AdminRoom(row AdminRoomRow) templ.Component
AdminRoom is the row of one room: its name, visibility, member count, creator and creation date, and the forms that rename it, delete it and show its members. The id of the row is room-<id>, so that other pages link to it. The server sends it alone as a Datastar patch after an action.
func AdminRoomPath ¶
AdminRoomPath returns the path of the row of a room on the admin rooms page, /admin/rooms/<id>. Its actions are AdminRoomPath + "/rename", "/delete", "/members" and "/members/<user>/remove".
func AdminRoomsPage ¶
func AdminRoomsPage(d AdminRoomsData) templ.Component
AdminRoomsPage is the page of every room, with the forms that rename and delete a room and the list of its members. Only admins get it.
func AdminTabs ¶
AdminTabs is the segmented bar under the title that the admin pages share: Users, Rooms and Audit log. current is the tab of the page that is shown: "users", "rooms" or "audit".
func AdminUsersPage ¶
func AdminUsersPage(d AdminUsersData) templ.Component
AdminUsersPage is the page of the users and of the invitation form. Only admins get it.
func AppearanceSection ¶ added in v1.2.0
func AppearanceSection(d AppearanceData) templ.Component
AppearanceSection is the Appearance section: the theme. The server sends it alone as a Datastar patch after a submit.
func Attachments ¶
func Attachments(atts []app.AttachmentView) templ.Component
Attachments shows the files of a post or comment under its body: the images inline, scaled to the width of the column (the width and height attributes hold the size of the file, so that the page does not jump when it loads), each a link to the full file; then the other files as a list of links with their sizes.
func AuditEntityLabel ¶ added in v1.2.0
AuditEntityLabel is the text of an entity type in the filter of the audit log: the events about accounts are "Accounts", every other type is shown as it is stored.
func AuditFilters ¶
AuditFilters is the form of the filters. It is a plain GET form, so the result can be shared by its URL; with Datastar it fetches the events and patches the table in place.
func AuditPage ¶
AuditPage is the page of the audit log: the filter form and the events. Only admins get it.
func AuditPanel ¶
AuditPanel is the message about the filters, the table of events and the links to the newer and older page. The server sends it alone as a Datastar patch when the filters or the page change.
func Avatar ¶ added in v1.2.0
Avatar draws the small avatar of a user next to their name: their picture when url is not empty, else their initials on a colour picked from their ID. The name is next to it in the page, so the picture has no text of its own.
func AvatarColourIndex ¶ added in v1.2.0
AvatarColourIndex is the number of the colour, 0 to 7, of the initials of the user with the ID: the same user always gets the same colour.
func AvatarSized ¶ added in v1.2.0
AvatarSized is Avatar in one of the sizes "sm" (24 px), "md" (36 px), "xl" (42 px, the author of a post) and "lg" (96 px).
func BoardAddColumn ¶
BoardAddColumn is the form that adds a column at the right end of the board, for a member; empty for anyone else. It is not part of the columns, so that a live update does not clear the name that is being typed. A live update replaces it when the person joins or leaves the room.
func BoardColumns ¶
BoardColumns are the columns of the board side by side, with their cards. The server sends it alone as a Datastar patch after every action on the board and, to every open board page, when the board changes. It holds no form that the person fills in over time (the card form has its own panel and the form that adds a column sits next to it), so that a live update never takes a typed text away.
func BoardColumnsPath ¶
BoardColumnsPath returns the path that adds a column to the board of a room and, with GET, shows the columns alone (what the board asks for when a drag ends without a drop).
func BoardEditor ¶
BoardEditor is the panel of the board where the form of a card opens, empty until then. It is outside the columns, so that a live update of the columns never closes the form or clears what is typed in it. The server sends it alone as a Datastar patch to open the form and to show its problems.
func BoardHeader ¶
BoardHeader is the header of the board page: the name of the room, its visibility and the navigation back to the posts. A live update replaces it when the room is renamed.
func BoardMessage ¶
BoardMessage is the problem of the last action on the board, at the top of it. The server sends it alone as a Datastar patch when an action fails.
func BoardNote ¶
BoardNote tells a person who has not joined the room that the board is theirs to read only. It is empty for a member. A live update replaces it when the person joins or leaves.
func BoardPage ¶
BoardPage is the page of the board of a room, in the layout with the sidebar: the header with the way back to the posts, the note for a person who has not joined, the form of the card being edited, the columns with their cards, the form that adds a column, and the script of the drag and drop. The hidden form and link next to the columns are what that script uses to talk to the server through Datastar.
func BoardPath ¶
BoardPath returns the path of the board of a room, /rooms/<id>/board. Its actions are BoardPath + "/columns" and "/tasks/<id>"; its stream is BoardPath + "/stream".
func BoardStreamPath ¶
BoardStreamPath returns the path of the live stream of the board. version is the BoardVersion of the board the page showed; the stream sends the columns at once when the board changed since.
func BoardVersion ¶
BoardVersion is a short text that changes when anything the board shows changes: the columns and the cards with their places, titles, assignees and due dates, and whether the viewer may change the board. The page tells it to its stream, which finds out what happened while the page was loading.
func CallAnsweredPath ¶ added in v1.2.0
CallAnsweredPath returns the page a user is sent to when they answer a call: the conversation, which opens the call with what they chose to send.
func CallArea ¶ added in v1.2.0
CallArea is the place of the call on the page of a direct conversation: empty while there is no call, "Calling Bob…" with Cancel while the user's call rings, and the call view while it is active. The stream patches it when the call starts, is answered and ends; the script call.js watches it, takes part in the call from the tab that started or answered it and keeps what it changed in the view (the marks, the buttons, the duration) when the server patches the area again.
func CallButtons ¶ added in v1.2.0
CallButtons are the buttons that start a call in the header actions of a direct conversation: Video call and Audio call. They give way to the state of the call while one rings or is active, and are not there at all when calls are off or the conversation is a group. The element is always there for a direct conversation, empty while a call is in progress, so that the stream can patch it. Each button is a form that works without JavaScript.
func CallEntry ¶ added in v1.2.0
func CallEntry(d MessageData) templ.Component
CallEntry is the entry that a finished call leaves in a direct conversation (SPEC §7.18): one quiet line in the middle of the list, with the icon of a video or an audio call, the text the user reads ("Video call · 12 min", "Declined video call", "Missed video call") and the time. The call the user missed is in the colour of a warning. It has nothing to reply to, edit or react to.
func CallKindText ¶ added in v1.2.0
CallKindText is "Video call" or "Audio call".
func CallPath ¶ added in v1.2.0
CallPath returns the path of the call of a direct conversation, or of one of its actions: CallPath(id, "") is the path that starts a call, and the actions are "answer", "decline", "cancel" and "hangup" (SPEC §7.18).
func CallRingingDialog ¶ added in v1.2.0
func CallRingingDialog(inv CallInviteData) templ.Component
CallRingingDialog is the dialog of a call that rings for the user: the avatar and name of the caller, whether it is a video or an audio call, and Answer with video, Answer with audio and Decline. Answering is a plain form post that takes the page to the conversation, which opens the call (the browser then asks for the camera and the microphone there); Decline is a Datastar form that removes the dialog. The data attributes are what notify.js reads: data-ring is present when the ringtone plays (SPEC §7.15), data-browser when the browser notification is wanted, data-notice is its text and data-url the page it opens.
func CallRingingSlot ¶ added in v1.2.0
func CallRingingSlot(inv *CallInviteData) templ.Component
CallRingingSlot is the slot of the ringing dialog, in the shell of every page of a logged-in user (id "call-ringing"). It is empty while nothing rings for the user, and holds the dialog while a call does. The user's stream patches it when a call starts to ring and when it stops (SPEC §7.18); a page made while a call rings has the dialog in it already. The script notify.js opens the dialog, plays the ringtone and shows the browser notification.
func CallSocketURL ¶ added in v1.2.0
CallSocketURL returns the path of the signalling socket of the call of a conversation, /calls/<id>/ws.
func CommentPath ¶
CommentPath returns the path that shows a comment in its thread, on the page of the top-level post: /posts/<root>#post-<id>.
func CommentsSection ¶
func CommentsSection(d PostPageData) templ.Component
CommentsSection is the comments of the thread, or the note that there are none. A live update replaces it alone when the first comment arrives.
func ConversationActions ¶ added in v1.2.0
func ConversationActions(d PlacePrefsData, call CallData) templ.Component
ConversationActions is the row of actions at the right of the header of a conversation: the call buttons of a direct conversation (SPEC §7.18) and the "more" menu with the notification preferences. It is not part of the header, which the server patches when the group changes, so that a patch never takes the menu or the buttons away.
func ConversationBeforePath ¶
ConversationBeforePath returns the path of the page of the conversation that shows the messages older than before, for a browser without JavaScript.
func ConversationHeader ¶
func ConversationHeader(d ConversationData) templ.Component
ConversationHeader is the header of a conversation: its title, who is in it and the message of the last action on the conversation. The server sends it alone as a Datastar patch when the conversation is renamed or its members change.
func ConversationList ¶
func ConversationList(items []app.ConversationSummary, viewerID uint64) templ.Component
ConversationList is the conversations of the user, most recent first: the title, who wrote the last message and the start of it, when, and the unread mark. The server sends it alone as a Datastar patch when a conversation changes.
func ConversationMembers ¶
func ConversationMembers(d MembersPanelData) templ.Component
ConversationMembers is the panel of a group: its members, the form that adds people by username, the rename form and the Leave button. The server sends it alone as a Datastar patch after an action on the group and when the group changes.
func ConversationMessagePath ¶ added in v1.2.0
ConversationMessagePath returns the path of the page of the conversation that shows the message msgID and scrolls to it: the newest messages when it is among them, else the page that ends with it.
func ConversationOlderPath ¶
ConversationOlderPath returns the path that loads the messages older than before, as a Datastar patch.
func ConversationPage ¶
func ConversationPage(d ConversationData) templ.Component
ConversationPage is the page of a conversation: its header, the messages oldest first with the newest at the bottom, the composer and, for a group, the members panel.
func ConversationPath ¶
ConversationPath returns the path of the page of a conversation, /messages/<id>. Its actions are ConversationPath + "/members", "/rename" and "/leave"; "/stream" is its live stream and "/older" loads older messages.
func ConversationPrefsPath ¶ added in v1.2.0
ConversationPrefsPath is where the dialog of a conversation posts to.
func ConversationReplyPath ¶
ConversationReplyPath returns the path of the page of the conversation with the composer set to reply to the message, for a browser without JavaScript.
func ConversationStreamPath ¶
ConversationStreamPath returns the path of the live stream of the conversation. newest is the ID of the newest message the page showed (0 for none); before is the before of the page (0 for the newest messages), whose messages a stream does not keep up to date.
func CountLabel ¶ added in v1.2.0
CountLabel is the label of a count of unread things as the title shows it: empty for none, the number, or "99+".
func ErrorPage ¶
ErrorPage is the page shown for an HTTP error (404, 500 and the like): the status code and a short message, in a card under the logo. The message is plain text, never the text of an error.
func Favicon ¶ added in v1.2.0
Favicon is the link element of the favicon: the plain one, or the one with a dot while unread is above 0. It has an id so that the stream can patch it when the count changes.
func FaviconPath ¶ added in v1.2.0
FaviconPath is the favicon for a page that has unread things waiting.
func Feed ¶
Feed is the feed of a room: the posts of the page, the empty message (shown by the stylesheet only while there is no post), and the end of the feed.
func FeedMore ¶
FeedMore is the end of the feed. When older posts exist it is the sentinel: when it scrolls into view, Datastar loads the next page (the server answers with the posts to append and a new sentinel); without JavaScript the link "Older posts" opens the older page. With no older posts it is empty.
func FeedNewLine ¶ added in v1.2.0
FeedNewLine is the line "New since your last visit" (SPEC §7.17). The feed is newest first, so the line sits below the oldest post the person has not seen: what is above it is new.
func FeedPath ¶
FeedPath returns the path that loads the posts older than before, in the feed of the room, as a Datastar patch.
func FilePath ¶
func FilePath(a app.AttachmentView) string
FilePath returns the path that downloads an attachment, /files/<id>/<name>. The name only gives the download a good name; the ID decides.
func FormPost ¶
FormPost returns the Datastar action that sends the form it is on to path with a POST, as an ordinary form (not as signals). Put it on the form as data-on:submit. The path is escaped, so that it can sit inside the quotes of the expression.
func FormPostConfirm ¶
FormPostConfirm is FormPost behind a confirm dialog: the form is sent only when the person agrees. The message is escaped like the path.
func GroupMentionConfirm ¶ added in v1.2.0
func GroupMentionConfirm(d GroupMentionConfirmData) templ.Component
GroupMentionConfirm is the question that stands above the buttons of an editor or of the composer when the body holds a group mention that would notify more than 5 people (SPEC §7.15): "This will notify 14 people. Send anyway?", with Send, which sends the form again with the flag confirm_group_mention=1 (the Send button of the page works through Datastar, and without JavaScript the button posts to the same address), and Cancel, which closes the question. With a Count of 0 it is an empty place that the server patches the question into.
func GroupMentionConfirmID ¶ added in v1.2.0
GroupMentionConfirmID is the id of the place of the question of the editor or composer id.
func GroupMentionSendPath ¶ added in v1.2.0
GroupMentionSendPath is the address the form with the action posts to when the person confirmed the group mention.
func Header ¶ added in v1.2.0
func Header(d SidebarData) templ.Component
Header is the content of the header of the pages of a logged-in user: the menu button that opens the drawer of rooms on a phone (hidden above 40 rem; its dot, and the word "unread" in its name, show while a room has unread posts or mentions, by CSS from the list of rooms itself, so that the patch of a single room keeps them right), the logo (a link to the home page), the search box (left out when HideSearch is set), the bell with the unread notifications, Messages with the conversations that have unread messages (both links, with the counts that the streams patch by their ids) and the user menu.
func Home ¶
func Home(sb SidebarData) templ.Component
Home is the home page of a logged-in user: it greets the user by display name.
func IconAttach ¶ added in v1.2.0
IconAttach is a paperclip: attach a file.
func IconBoard ¶ added in v1.2.0
IconBoard is three columns of different heights: the board of a room.
func IconCalendar ¶ added in v1.2.0
IconCalendar is a calendar page: a due date.
func IconHangUp ¶ added in v1.2.0
IconHangUp is a handset turned down: hang up and decline.
func IconLogout ¶ added in v1.2.0
IconLogout is an arrow leaving a frame: log out.
func IconMessage ¶ added in v1.2.0
IconMessage is a speech bubble: private messages.
func IconMicOff ¶ added in v1.2.0
IconMicOff is a microphone crossed out: the microphone that is off.
func IconMonitor ¶ added in v1.2.0
IconMonitor is a screen: the theme of the system.
func IconScreen ¶ added in v1.2.0
IconScreen is a monitor with an arrow: share the screen.
func IconSearch ¶ added in v1.2.0
IconSearch is a magnifying glass.
func IconSettings ¶ added in v1.2.0
IconSettings is two sliders: settings.
func IconSliders ¶ added in v1.2.0
IconSliders is two sliders: the choice of the devices.
func IconTaskDone ¶ added in v1.2.0
IconTaskDone is a box with a check mark: a task that is done.
func IconVideoOff ¶ added in v1.2.0
IconVideoOff is a camera crossed out: the camera that is off.
func Initials ¶ added in v1.2.0
Initials returns the letters shown for a user without an avatar: the first letter of the first word of the display name and of the last one, in upper case; the first letter alone for a name of one word; "?" for a name with no letters.
func InviteSection ¶
func InviteSection(d InviteData) templ.Component
InviteSection is the form that makes an invitation and the box that shows its link. The server sends it alone as a Datastar patch with the link or the problems.
func Layout ¶
func Layout(title string, unread int, sb *SidebarData) templ.Component
Layout is the HTML page every page is rendered in: the head with the title (which starts with "(n) " while unread is above 0, the number of unread notifications and conversations of the person, SPEC §7.17) and the favicon (with a dot while unread is above 0), the stylesheets (app.css, and code.css for the code blocks), the Datastar client and code.js (the toolbar of the code blocks) and the shell of the page (SPEC D57). With sb, the page of a logged-in person, the shell is the header (the logo, the search box, the bell, Messages and the user menu), the aside of the sidebar with the rooms and the main element for the children. Without it, the pages of people who are not logged in and the error pages, the shell is a main element with the logo above the card of the children. The html element carries data-theme when the context has a theme (WithTheme).
func LoginCodeForm ¶ added in v1.2.0
func LoginCodeForm(d LoginCodeData) templ.Component
LoginCodeForm is the form of the SSH code. The server sends it alone as a Datastar patch to show a wrong code; it replaces the element with the same id.
func LoginCodePage ¶ added in v1.2.0
func LoginCodePage(d LoginCodeData) templ.Component
LoginCodePage is the page of the second form of the login, which asks for the SSH code after the right password.
func LoginForm ¶
LoginForm is the login form. The server sends it alone as a Datastar patch to show the problems of a failed login; it replaces the element with the same id.
func Logo ¶ added in v1.2.0
Logo is the logo of Clowder: the cat head and the word "clowder" in the heading font, one link to the home page. The word is text, so the link has its name.
func LogoMark ¶ added in v1.2.0
LogoMark is the cat head of Clowder, the mark of the logo and of the favicon: a head with two ears, two eyes and a nose. It is decorative (aria-hidden). app.css colours the head with the accent and the eyes and the nose with --logo-eye, the colour of the ground it sits on.
func MembersPanel ¶
MembersPanel is the members of a room, each with a "Message" button (except the viewer) that starts a direct conversation, with the "Add member" form, for a member, and the Remove buttons, for an admin. The server sends it alone as a Datastar patch after an action on the members.
func MessageActionPath ¶
MessageActionPath returns the path of an action on a message, /messages/m/<id>/<action> with the action "edit" (the form, and the POST that saves it), "view", "delete", "react" or "reply".
func MessageAttachments ¶
func MessageAttachments(atts []app.AttachmentView) templ.Component
MessageAttachments shows the files of a message under its text: the images inline, scaled to the width of the column, each a link to the full file; then the other files as a list of links with their sizes.
func MessageComposer ¶
func MessageComposer(d ComposerData) templ.Component
MessageComposer is the place where a member writes a message: the form, or for a direct conversation with a disabled user the note that nothing can be sent.
func MessageComposerForm ¶
func MessageComposerForm(d ComposerData) templ.Component
MessageComposerForm is the form of the composer: the quote of the message being replied to, the text (Enter sends, Shift+Enter makes a new line), the files and the Send button. The server sends it alone as a Datastar patch to show the problems of a failed submit, and, replacing the old one, a fresh, empty one after a message was sent.
func MessageContent ¶
func MessageContent(d MessageData) templ.Component
MessageContent is a message without its list item: the author and time, "edited", the quote of the message it replies to, the text, the files, the reactions and the Reply, Edit and Delete buttons for the person who may. A deleted message is the placeholder "message deleted". The entry of a call is one quiet line (CallEntry). A live update of a message replaces only this part.
func MessageContentID ¶
MessageContentID is the id of the element that holds the content of a message (see MessageContent).
func MessageCount ¶
MessageCount is the badge with the number of conversations that have unread messages, on the Messages link of the header. The element is always there, so that a patch finds it; it is empty, and not shown, when the count is 0.
func MessageEdit ¶
func MessageEdit(d MessageEditData) templ.Component
MessageEdit is the content of a message replaced by its editor: the text in a field with Save and Cancel. A failed save shows its problem in it.
func MessageElementID ¶
MessageElementID is the id of the element of a message in the list.
func MessageFilePath ¶
func MessageFilePath(a app.AttachmentView) string
MessageFilePath returns the path that downloads an attachment of a message, /messages/files/<id>/<name>. The name only gives the download a good name; the ID decides.
func MessageItem ¶
func MessageItem(d MessageData) templ.Component
MessageItem is a message in the list: its content and, in a direct conversation, the place for "Seen" under an own message.
func MessageItemEditing ¶
func MessageItemEditing(d MessageEditData) templ.Component
MessageItemEditing is a message of the list replaced by its editor, for the page of a browser without JavaScript.
func MessageItems ¶
func MessageItems(items []MessageData) templ.Component
MessageItems is messages one after the other, as the list shows them.
func MessageQuote ¶
func MessageQuote(q app.MessageQuote) templ.Component
MessageQuote is the message that a message replies to, above its text: the author and the start of the text, or "message deleted".
func MessageReactionPicker ¶
func MessageReactionPicker(d MessageReactionsData) templ.Component
MessageReactionPicker is the add button of the reaction bar of a message and the picker it opens, as ReactionPicker is that of a post. Live changes of the reactions leave it alone.
func MessageReactions ¶
func MessageReactions(d MessageReactionsData) templ.Component
MessageReactions are the chips of a message, as Reactions are those of a post. The server sends it alone as a Datastar patch after a reaction and, to every open page, when the reactions of a message change; the picker next to it is not part of it.
func MessageReplySlot ¶
func MessageReplySlot(q *app.MessageQuote, convID uint64) templ.Component
MessageReplySlot is the place in the composer where the message being replied to shows as a quote with a cancel button, and holds the field "reply_to" that sends its ID. It is empty for a message that replies to nothing. The server sends it alone as a Datastar patch when the person asks to reply.
func MessageSearchBox ¶ added in v1.2.0
MessageSearchBox is the search box of the Messages page: a plain GET form, so that a search is a link (SPEC §7.11, D56).
func MessageSearchPath ¶ added in v1.2.0
MessageSearchPath returns the path of the Messages page with a search: the text of the box and, for an older page of results, the before that asks for it. An empty query gives MessagesPath.
func MessageSearchResults ¶ added in v1.2.0
func MessageSearchResults(d MessageSearchData) templ.Component
MessageSearchResults is the results of a search of the messages in place of the list of conversations: the problem with the query, or the messages found with a link to each in its conversation, "No messages match." for none, the link that clears the search and the link to the older results.
func MessageSeen ¶
MessageSeen is the place under an own message of a direct conversation where "Seen" shows, empty unless the other member read up to the message.
func MessagesOlder ¶
MessagesOlder is the top of the list of messages. When older messages exist it is the sentinel: when it scrolls into view, Datastar loads the next, older page (the server answers with the messages to put on top and a new sentinel); without JavaScript the link "Older messages" opens the older page. With no older messages it is empty.
func MessagesPage ¶
func MessagesPage(d ConversationsData) templ.Component
MessagesPage is the page of the conversations of the user, most recent first, with the form that starts one. Its stream keeps the list live.
func NewConversationForm ¶
func NewConversationForm(d NewConversationData) templ.Component
NewConversationForm is the form that starts a conversation: the usernames of the people, separated by spaces or commas (one makes a direct conversation, several a group), and the optional name of a group. The server sends it alone as a Datastar patch to show the problems of a failed submit.
func NewSinceID ¶ added in v1.2.0
NewSinceID is the ID of the post after which the feed draws the line "New since your last visit" (SPEC §7.17): the oldest top-level post of the page that the viewer has not seen. posts are the posts of the first page, newest first; seen is the viewer's mark before it moved; a post is unseen when its ID is above the mark, it is not deleted and someone else wrote it, which is what the sidebar counts. It is 0 when no post of the page is unseen. When every post of the page is unseen it is the last post of the page.
func NoticePath ¶ added in v1.2.0
NoticePath returns where a notice leads when it is clicked: the post or comment of a new post, a mention, a reply or an assignment, in its thread; the room of an addition; the conversation of a message.
func NoticePlaceKey ¶ added in v1.2.0
NoticePlaceKey is the PlaceKey of the place of a notice.
func NotificationCount ¶
NotificationCount is the badge with the number of unread notifications, on the bell of the header. The element is always there, so that a patch finds it; it is empty, and not shown, when the count is 0.
func NotificationElementID ¶
NotificationElementID is the id of the element of a notification.
func NotificationItem ¶
func NotificationItem(n app.Notification) templ.Component
NotificationItem is one notification: who did what in which room, when, a link to it and, if it was unread, the unread mark. The mark goes when the signal readUpTo reaches the ID of the notification.
func NotificationOthers ¶ added in v1.2.0
func NotificationOthers(n app.Notification) string
NotificationOthers is what follows the name of the actor of a reply that took in more people: " and 2 others", empty for none.
func NotificationPath ¶
func NotificationPath(n app.Notification) string
NotificationPath returns where a notification leads: the post or comment of a mention, a reply or an assignment, in its thread; the room of a room addition.
func NotificationSentence ¶
func NotificationSentence(n app.Notification) string
NotificationSentence is what the actor did, up to the room: "mentioned you in", "replied in", `assigned you "<task>" in` or "added you to". A reply says "replied in" whether it answers the user or comes from a followed thread (SPEC §7.15).
func NotificationsMessage ¶
NotificationsMessage is the place of the message about the last action of the page, such as a failed "Mark all as read"; empty it shows nothing.
func NotificationsOlderPath ¶
NotificationsOlderPath returns the path of the notifications older than the notification before.
func NotificationsPage ¶
func NotificationsPage(d NotificationsData) templ.Component
NotificationsPage is the page of the notifications of the user, newest first. The unread marks are those of the notifications that were unread when the page opened; "Mark all as read" clears them through the signal readUpTo.
func NotificationsStreamPath ¶
NotificationsStreamPath returns the path of the stream of the notifications page: MeStreamPath, with the ID of the newest notification the page shows when the page shows the newest ones, so that the stream puts newer ones on top. A page of older notifications keeps no list live, and takes seen 0 with live false.
func NotifyEvent ¶ added in v1.2.0
NotifyEvent is the element that tells the page script (notify.js) to ring for an event of the user's stream: who did what and where, never the body. The server appends it to #notify-events; the script reads it, decides with the other tabs which one rings, and removes it (SPEC §7.15). The decision whether the event rings is the server's: the element exists only for an event that rings, and carries the sound and whether a browser notification is wanted. The text is in data-notice and not data-text: Datastar runs every data-text attribute it meets as an expression, which stops it from setting up the other elements of the same patch.
func NotifyPlace ¶ added in v1.2.0
NotifyPlace marks the place the page shows (the room, or the conversation), so that the page script stays silent for events of the place the person is looking at. place is a PlaceKey.
func NotifyPrefsSection ¶ added in v1.2.0
func NotifyPrefsSection(d NotifyPrefsData) templ.Component
NotifyPrefsSection is the Notifications section of the settings: what notifies the user (all, mentions, nothing), the sound with its choice and a Play button each, the browser notifications, the replies, and the list of the rooms and conversations that have preferences of their own. The server sends it alone as a Datastar patch after a submit.
func OlderPostsPath ¶
OlderPostsPath returns the path of the page of the room that shows the posts older than before, for a browser without JavaScript.
func OnlineDot ¶ added in v1.2.0
OnlineDot is the small dot next to a member who is online (SPEC §7.15); it draws nothing for one who is not. It is drawn when the page loads and not updated live.
func PageBaseTitle ¶ added in v1.2.0
PageBaseTitle is the title of a page without the count: the name of the page and the name of the site.
func PageHeader ¶ added in v1.2.0
func PageHeader(d SidebarData) templ.Component
PageHeader is the header element of the pages of a logged-in user, with its content (Header). The streams patch it together with PageSidebar, by their ids.
func PageSidebar ¶ added in v1.2.0
func PageSidebar(d SidebarData) templ.Component
PageSidebar is the aside element of the pages of a logged-in user, with the rooms (Sidebar). It is a popover (SPEC D58): above 40 rem app.css draws it as the column beside the page, at 40 rem and below as a drawer from the left that the menu button of the header (Header) opens, with the close button in front of the rooms (hidden in the column). The close button has autofocus, which is what makes the browser move the focus into the drawer when it opens.
func PageTitle ¶ added in v1.2.0
PageTitle is the title element of a page: "(n) " when unread is above 0, then base, the name of the page with the name of the site. It has an id so that the stream can patch it when the count changes.
func PasswordSection ¶ added in v1.2.0
func PasswordSection(d PasswordData) templ.Component
PasswordSection is the Password section: the current password and the new one twice. The server sends it alone as a Datastar patch after a submit.
func PlaceKey ¶ added in v1.2.0
PlaceKey returns the key of a place that the page script compares with the place of an event: "room:3" or "conversation:5".
func PlacePrefsButton ¶ added in v1.2.0
func PlacePrefsButton(d PlacePrefsData) templ.Component
PlacePrefsButton is the button that opens the dialog; the header of a room and of a conversation have one.
func PlacePrefsDialog ¶ added in v1.2.0
func PlacePrefsDialog(d PlacePrefsData) templ.Component
PlacePrefsDialog is the dialog "Notification preferences" of a room page and of a conversation page. It is drawn for a person who has preferences in the place (Action is not empty); a button in the header of the page opens it.
func PlacePrefsForm ¶ added in v1.2.0
func PlacePrefsForm(d PlacePrefsData) templ.Component
PlacePrefsForm is the form of the dialog. The server sends it alone as a Datastar patch after a submit, so that the dialog stays open.
func PlacePrefsSummary ¶ added in v1.2.0
func PlacePrefsSummary(p app.PlacePrefs) string
PlacePrefsSummary says in a few words what the preferences of a place are, for the list of the settings: "Muted", "Notify: mentions, sound off".
func PostCard ¶
func PostCard(d PostCardData) templ.Component
PostCard is a post or a comment: author, time, "edited", the body, the tags as links to their search, the comment count of a post that links to its thread, and Reply, Edit and Delete for the person who may. A comment is indented to its depth (at most MaxVisualDepth) and, below that depth, says whom it replies to. A post or comment that was deleted but stays because it has replies is the placeholder "This post was deleted." or "This comment was deleted." The server sends it alone as a Datastar patch after an edit, a cancel or a failed action.
func PostCommentsPath ¶
PostCommentsPath returns the path of the comments of a post, the page of the post at its thread: /posts/<id>#comments.
func PostContent ¶
func PostContent(d PostCardData) templ.Component
PostContent is the card of a post or comment without its article and its reply slot: the message above it, the author and time, the body, the attachments, the tags and the footer with the buttons. A live update of a post or comment replaces only this part, so that a reply editor open in the slot below it, or the editor that replaced the article, is left alone.
func PostEdit ¶
func PostEdit(d PostEditData) templ.Component
PostEdit is a post or comment replaced by its editor, for the edit in place.
func PostEditor ¶
func PostEditor(d PostEditorData) templ.Component
PostEditor is the composer of a post: a card with the body, then one row of controls (the Text / Markdown switch, the tags field with its suggestions, the attach button, Add task, Preview and the submit button), the tasks being added, the preview and the problems. The server sends it alone as a Datastar patch to show the problems of a failed submit; what the person typed is kept. The comments and the edit in place reuse it.
func PostMenu ¶ added in v1.2.0
func PostMenu(d PostCardData) templ.Component
PostMenu is the "more" menu of a post or comment: a details element without script, opened by the three dots, with Follow or Unfollow (posts), Edit and Delete for the person who may. It is left out when none of them is offered. The details element keeps its open state when a stream patches the card (data-preserve-attr) and closes when the person clicks outside it.
func PostPage ¶
func PostPage(d PostPageData) templ.Component
PostPage is the page of a post, in the layout with the sidebar: the room it was written in, the post and its thread of comments. The page of a comment is the page of its post with that comment in focus.
func PostPath ¶
PostPath returns the path of the page of a post, /posts/<id>. Its actions are PostPath + "/edit", "/view" and "/delete".
func PostPreview ¶
func PostPreview(d PostPreviewData) templ.Component
PostPreview is the preview box of an editor. The server sends it alone as a Datastar patch when the person asks for a preview.
func PostStreamPath ¶
PostStreamPath returns the path of the live stream of the thread of the top-level post rootID. newest is the ID of the newest item the page showed (PostPageData.NewestID).
func PostTasks ¶
PostTasks is the list of the tasks of a post or comment under its body: the title, the column as a badge (the last column styled as done), the names of the assignees, the due date (red when overdue) and a link to the card on the board of the room.
func ProfileSection ¶ added in v1.2.0
func ProfileSection(d ProfileData) templ.Component
ProfileSection is the Profile section: the avatar, with the form that uploads one and the button that removes it, and the display name. The server sends it alone as a Datastar patch after a submit.
func ReactionPicker ¶
func ReactionPicker(d ReactionsData) templ.Component
ReactionPicker is the add button of the reaction bar of a member and the picker it opens: the common emoji and a field for any other emoji. It is empty for anyone who has not joined the room. The server sends it alone as a Datastar patch after the person's own reaction (which closes it) or a mistake in the field (which opens it); live changes of the reactions leave it alone.
func Reactions ¶
func Reactions(d ReactionsData) templ.Component
Reactions are the chips of a post or comment: one for each emoji with its count, highlighted when the person reacted, with the names of the people as its title; clicking a chip adds or removes the person's reaction. Anyone who has not joined the room sees the chips and cannot click them. The server sends it alone as a Datastar patch after a reaction and, to every open page, when the reactions of a post change; the picker next to it is not part of it, so that a live change does not close it or clear what the person typed.
func ReplySlot ¶
func ReplySlot(parentID uint64, editor *PostEditorData) templ.Component
ReplySlot is the place under a post or comment where the reply editor opens, empty until then. The server sends it alone as a Datastar patch to open the editor.
func ResetForm ¶ added in v1.2.0
ResetForm is the form of a reset link. The server sends it alone as a Datastar patch to show the problems of a failed submit.
func ResetPage ¶ added in v1.2.0
ResetPage is the page of the form that sets a new password with a reset link.
func RoomComposer ¶
RoomComposer is the place where a member writes a new post: the editor, or for anyone else the note to join the room. A live update replaces it when the viewer joins or leaves the room.
func RoomEditForm ¶
RoomEditForm is the rename form of a room, in a details element that opens after a failed submit. The server sends it alone as a Datastar patch to show the problems.
func RoomHeader ¶
RoomHeader is the header of a room: its name, visibility, the links to its posts and its board, its description and member count, the join, leave and delete buttons, the message of the last action and the rename form. The server sends it alone as a Datastar patch when an action on the room fails.
func RoomMemberCount ¶
RoomMemberCount is the number of members in the header of a room. A live update replaces it alone when someone joins or leaves.
func RoomNav ¶
func RoomNav(roomID uint64, current RoomNavCurrent) templ.Component
RoomNav is the navigation between the pages of a room: its posts and its board. The page that is shown is marked as current.
func RoomNewForm ¶
func RoomNewForm(d RoomNewData) templ.Component
RoomNewForm is the form that makes a room. The server sends it alone as a Datastar patch to show the problems of a failed submit.
func RoomNewPage ¶
func RoomNewPage(d RoomNewData) templ.Component
RoomNewPage is the page of the form that makes a room.
func RoomPage ¶
RoomPage is the page of a room: the header, the editor of a new post (for a member; others are told to join), the feed and the members panel.
func RoomPath ¶
RoomPath returns the path of the page of a room, /rooms/<id>. Its actions are RoomPath + "/join", "/leave", "/rename", "/delete" and "/members".
func RoomPrefsPath ¶ added in v1.2.0
RoomPrefsPath is where the dialog of a room posts to.
func RoomStreamPath ¶
RoomStreamPath returns the path of the live stream of the room. newest is the ID of the newest post the page showed, 0 for none; before is the beforeID of the page of the feed (0 for the newest posts), which a stream does not keep up to date; newSince is the post after which the page draws the line "New since your last visit" (0 for none), which the stream draws again when it sends the feed.
func RoomsBrowsePage ¶
func RoomsBrowsePage(d RoomsBrowseData) templ.Component
RoomsBrowsePage is the page that lists the visible rooms with a Join button for each room the person has not joined.
func RoomsPanel ¶
func RoomsPanel(d RoomsBrowseData) templ.Component
RoomsPanel is the list of the visible rooms with the message of the last action above it. The server sends it alone as a Datastar patch when a join fails.
func SSHKeyRemovePath ¶ added in v1.2.0
SSHKeyRemovePath is the path that removes the SSH key with the id.
func SearchBar ¶
SearchBar is the small search box of the sidebar, on every page but the search page. It is a plain GET form.
func SearchBox ¶
SearchBox is the search box of the search page. It is a plain GET form, so the result can be shared by its URL; with Datastar the results are fetched and patched in place after a short pause in the typing.
func SearchPage ¶
func SearchPage(d SearchData) templ.Component
SearchPage is the page of the search: the box, the help, the filters as chips and the results.
func SearchPanel ¶
func SearchPanel(d SearchData) templ.Component
SearchPanel is the message about the query, the help, the filters as chips, the results and the links to the newer and older page. The server sends it alone as a Datastar patch when the query or the page changes.
func SearchPath ¶
SearchPath returns the path of the search for the text of the box, with the page number: /search?q=design&page=2. The page 1 and lower is not written, and an empty query gives /search.
func SeenMessageID ¶
SeenMessageID returns the ID of the message that "Seen" shows under in a direct conversation: the newest message of the viewer, not deleted, among messages that the other member has read. It is 0 for a group, when the other member has read none of them, and when none is the viewer's.
func SessionEndPath ¶ added in v1.1.0
SessionEndPath is the path that ends the session with the id.
func SessionsSection ¶ added in v1.2.0
func SessionsSection(sessions []app.SessionInfo) templ.Component
SessionsSection is the Sessions section: every browser and every app that is logged in, with when it was made and last used, the one that shows the page marked, and a button to end each of them. Ending the session of the page logs it out.
func SettingsPage ¶ added in v1.2.0
func SettingsPage(d SettingsData) templ.Component
SettingsPage is the settings page of the user: the sections Profile, Password, Appearance, Notifications, Sign-in and Sessions, each of which saves on its own.
func Sidebar ¶
func Sidebar(d SidebarData) templ.Component
Sidebar is the sidebar of the pages of a logged-in user: the rooms of the user with the counts of 20.2, and the links to browse and to make rooms. Everything else the old sidebar held is in the header (Header).
func SidebarRoom ¶ added in v1.2.0
SidebarRoom is the list item of one room in the sidebar: the link with the name, then what is waiting in it (SPEC §7.17). A room with unread posts is bold and shows their number ("99+" above 99); a room set to count only mentions is not bold and shows only the badge of the mentions; a muted room is dimmed and shows only the badge of the mentions. A mention badge appears whenever the room has unread mentions. The item has an id so that the stream can patch it alone when the counts of the room change.
func SignInSection ¶ added in v1.2.0
func SignInSection(d SignInData) templ.Component
SignInSection is the Sign-in section: the SSH keys with Remove, the form that adds one, and what the user needs to fetch a code (the command and the fingerprint of the host key) or the note that the server is off. The server sends it alone as a Datastar patch after a submit.
func SignUpForm ¶
func SignUpForm(d SignUpData) templ.Component
SignUpForm is the sign-up form. The server sends it alone as a Datastar patch to show the problems of a failed submit.
func SignUpPage ¶
func SignUpPage(d SignUpData) templ.Component
SignUpPage is the page of the sign-up form of an invitation.
func SizeText ¶
SizeText writes a size in bytes for people: "512 B", "12 KB", "3.4 MB". The units are powers of 1024; a value of 10 or more has no decimals, a smaller one has one unless it is whole.
func SplitTitle ¶ added in v1.2.0
SplitTitle splits the title of a page into the label of its count of unread things ("3" or "99+"; empty when the title has none) and the rest, which is the name of the page with the name of the site. It is how a stream learns what the page shows from the title the page tells it.
func StaticURL ¶ added in v1.2.0
StaticURL is the address of a static file for the page rendered in ctx: path (such as "/static/app.css") with "?v=" and the version of the static files when ctx has one (WithStaticVersion), and path alone otherwise (a component rendered in a context that was not made by the server).
func TabTitle ¶ added in v1.2.0
TabTitle is the title of a page: "(n) " when n is above 0, then base. base is the name of the page with the suffix of the site, as PageTitle takes it.
func TagSearchPath ¶
TagSearchPath returns the path of the search for a tag, /search?q=%23tag.
func TagSuggestions ¶
TagSuggestions is the list of suggested tags under the tags field of an editor. The server sends it alone as a Datastar patch while the person types; a suggestion completes the tag being typed.
func TaskBoardPath ¶
TaskBoardPath returns the path of a task on the board of its room, which the board page opens at its card: /rooms/<room>/board#task-<id>.
func TaskRow ¶
func TaskRow(editorID string, index int, row TaskRowData, options []AssigneeOption) templ.Component
TaskRow is one task row of the editor: the title, the people it is assigned to (a multiple choice of the options), the due date, the hidden ID of the task (0 for a new one) and the Remove button. The fields are named tasks[<index>][id], [title], [assignees] and [due]. The server sends a row alone as a Datastar patch when the Add task button asks for one.
func TaskRowsSelector ¶
TaskRowsSelector is the selector of the list of task rows of the editor.
func ThemeColor ¶ added in v1.2.0
ThemeColor writes the theme-color elements of the head: one with the colour of the theme the person chose (Light or Dark), or, for System, one for each palette, chosen by prefers-color-scheme. The theme form patches nothing here; it replaces the elements through script (the answer of the theme form).
func ThemeMenu ¶ added in v1.2.0
ThemeMenu is the small form of the user menu that picks the theme: System, Light or Dark, three buttons that post to the Appearance route of the settings (the query from=menu tells it to answer for the menu). The current choice has aria-pressed="true". The server sends it alone as a Datastar patch after the choice, which also sets data-theme on the page.
func Thread ¶
func Thread(d PostPageData) templ.Component
Thread is the post of the page and its comments, one after the other in reading order, each indented to its depth. The server sends it alone as a Datastar patch when a comment is written or deleted: the new thread replaces the old one.
func UserMenu ¶ added in v1.2.0
func UserMenu(d SidebarData) templ.Component
UserMenu is the menu of the user, a details element without script: the avatar opens a panel with the name, Settings, the theme (ThemeMenu), Sessions, Admin (for admins only) and the logout form. The details element keeps its open state when a stream patches the header (data-preserve-attr).
func UsersPanel ¶
func UsersPanel(d AdminUsersData) templ.Component
UsersPanel is the table of users with the message of the last action above it. The server sends it alone as a Datastar patch after an action on a user.
func WithRoomRead ¶ added in v1.2.0
WithRoomRead returns the room with its unread counts set to 0; see SidebarData.WithRoomRead.
func WithStaticVersion ¶ added in v1.2.0
WithStaticVersion returns ctx with the version of the embedded static files (the hash the server puts in /sw.js too). StaticURL then adds it to the address of every static file a page names, so that a page of a new release asks for new addresses: a browser or the service worker that kept the old files under the old addresses cannot answer them (SPEC D58).
Types ¶
type AdminRoomRow ¶
type AdminRoomRow struct {
// Room is the room.
Room app.Room
// Creator is the display name of the user who made the room; empty when
// that user is not known.
Creator string
// MembersOpen is true when the members list is open; Members are then the
// members of the room.
MembersOpen bool
Members []app.Member
// Message is the problem of the last action on the room (rename, delete),
// shown in the row; empty shows none.
Message string
// MembersMessage is the problem of the last action on the members, shown
// above the list; empty shows none.
MembersMessage string
// Edit is the state of the rename form. Open is true after a failed
// submit.
Edit RoomEditData
}
AdminRoomRow is one room on the admin rooms page with the state of its forms.
type AdminRoomsData ¶
type AdminRoomsData struct {
// Sidebar is the sidebar of the page.
Sidebar SidebarData
// Rooms are all the rooms, ordered by name.
Rooms []AdminRoomRow
}
AdminRoomsData is what the admin rooms page shows.
type AdminUsersData ¶
type AdminUsersData struct {
// Viewer is the admin who looks at the page.
Viewer app.User
// Sidebar is the sidebar of the page.
Sidebar SidebarData
// Users are all the users.
Users []app.User
// Message is the problem of the last action on a user, shown above the
// table; empty shows none.
Message string
// Invite is the state of the invitation form and of its link.
Invite InviteData
// Reset is the reset link that was just made, shown once above the
// table; its Link is empty when none was.
Reset ResetLinkData
// SSHServerOff is true when this Clowder runs no SSH server and some user
// has the SSH code on: the page warns that those users log in with their
// password only (SPEC §7.16).
SSHServerOff bool
}
AdminUsersData is what the admin users page shows.
type AppearanceData ¶ added in v1.2.0
type AppearanceData struct {
// Theme is the theme in use, which the radio button checks.
Theme app.Theme
// Errors are the problems of the last submit.
Errors FormErrors
// Saved is true right after a submit that worked.
Saved bool
}
AppearanceData is what the Appearance section shows.
type AssigneeOption ¶
type AssigneeOption struct {
// ID is the ID of the user, the value of the option.
ID uint64
// Label is the text of the option.
Label string
}
AssigneeOption is a person the assignee picker of a task row offers.
func AssigneeOptions ¶
func AssigneeOptions(members []app.Member) []AssigneeOption
AssigneeOptions makes the options of the assignee picker from the members of a room, in their order.
type AuditData ¶
type AuditData struct {
// Sidebar is the sidebar of the page.
Sidebar SidebarData
// Filter is the state of the filter form.
Filter AuditFilterForm
// Rooms are all the rooms, for the room filter.
Rooms []app.Room
// MissingRoom is true when the room of the filter is not in Rooms (it was
// deleted); the room filter then offers it by its ID.
MissingRoom bool
// Users are all the users, for the actor filter.
Users []app.User
// Entities and Actions are the values of the entity type and action
// filters.
Entities []string
Actions []string
// Rows are the events of the page, newest first.
Rows []AuditRow
// Page is the number of the page, starting at 1.
Page int
// HasNext is true when an older page exists.
HasNext bool
}
AuditData is what the audit log page shows.
type AuditDetail ¶
type AuditDetail struct {
// Key is the name of the field.
Key string
// Old and New are the values before and after the change. They are empty
// for a row with a Text.
Old string
New string
// Text is the whole content of a row that has no old and new value, such as
// "body changed (42 characters)" or the user of a member event. When it is
// not empty the row spans the Old and New columns.
Text string
}
AuditDetail is one row of the details table of an audit event: a field and its old and new value, or a single text that spans both columns.
func AuditDetails ¶
func AuditDetails(details map[string]any) []AuditDetail
AuditDetails makes the rows of the details table from the decoded Details of an event (SPEC §7.10), sorted by key. A field of the form {"old": ..., "new": ...} is a row with the two values. The body shape of a post or comment, {"bodyChanged": true, "length": n}, is the one row "body changed (n characters)": the text of a body is never in the details. Any other value is a row with a text.
type AuditFilterForm ¶
type AuditFilterForm struct {
// Room is the ID of the room to keep; 0 keeps every room.
Room uint64
// Actor is the ID of the user to keep; 0 keeps every user.
Actor uint64
// Entity is the entity type to keep; empty keeps every type.
Entity string
// Action is the action to keep; empty keeps every action.
Action string
// From and To are the first and the last day to keep, as 2006-01-02; empty
// leaves that end open.
From string
To string
// Message is the problem with the filters, such as a date that is not a
// date; empty shows none.
Message string
}
AuditFilterForm is the state of the filter form of the audit log: the values of the query parameters of the page. The zero value filters nothing.
func (AuditFilterForm) AuditPath ¶
func (f AuditFilterForm) AuditPath(page int) string
AuditPath returns the path of the audit log page with the filters and the page number, such as /admin/audit?actor=3&page=2.
func (AuditFilterForm) Query ¶
func (f AuditFilterForm) Query(page int) string
Query returns the query string of the filters (without the "?") for the page of the log, with empty filters left out. Page 1 and lower is not written.
type AuditRow ¶
type AuditRow struct {
// Event is the event.
Event app.AuditView
// RoomName is the name of the room of the event: the current name while
// the room exists, else the name it had in the event; empty when the event
// does not tell.
RoomName string
// RoomExists is true when the room still exists, so that the row links to
// it.
RoomExists bool
}
AuditRow is one event of the audit log with what the page shows around it.
type BoardData ¶
type BoardData struct {
// Sidebar is the sidebar of the page.
Sidebar SidebarData
// Board is the board as the viewer sees it: its room, the columns with the
// cards, and whether the viewer may change it.
Board app.BoardView
// Message is the problem of the last action on the board, shown above the
// columns; empty shows none.
Message string
// Editor is the form of the card being edited; nil when none is open.
Editor *BoardEditorData
}
BoardData is what the page of the board of a room shows.
type BoardEditorData ¶
type BoardEditorData struct {
// Task is the card being edited, as the board shows it.
Task app.TaskCard
// Title is the text in the title field.
Title string
// Assignees are the IDs of the people selected in the picker.
Assignees []uint64
// Due is the due date as the date field holds it ("2006-01-02"), or empty.
Due string
// ClearDue is true when the box that removes the due date is ticked.
ClearDue bool
// Options are the people the picker offers: the members of the room and
// the former members who are assigned to the card.
Options []AssigneeOption
// Errors are the problems of the last submit; the fields are named title,
// assignees and dueDate.
Errors FormErrors
}
BoardEditorData is the form that edits one card. It lives in its own panel outside the columns, so that a live update of the columns never closes it or clears what is typed in it.
func NewBoardEditorData ¶
func NewBoardEditorData(task app.TaskCard, members []app.Member) BoardEditorData
NewBoardEditorData makes the editor of a card, filled with what the card has now. members are the members of the room; people assigned to the card who are no longer members stay in the picker, marked as having left, so that a save keeps them (SPEC §7.6).
type CallData ¶ added in v1.2.0
type CallData struct {
// ConversationID is the conversation.
ConversationID uint64
// Enabled is true for a direct conversation of a server whose calls are
// on; only then the page has the buttons and the call area.
Enabled bool
// Open is the call that rings or is active; nil for none. The buttons give
// way to it.
Open *CallPanelData
}
CallData is what the page of a direct conversation shows of its calls: the buttons that start one, and the call that is in progress.
type CallInviteData ¶ added in v1.2.0
type CallInviteData struct {
// CallID and ConversationID are the call and its direct conversation.
CallID uint64
ConversationID uint64
// Caller is the person who calls.
Caller app.UserRef
// Video is true when the caller started the call with video.
Video bool
// Ring is true when the ringtone plays (SPEC §7.15); Browser is true when
// the browser notification is wanted.
Ring bool
Browser bool
// Text is the text of the browser notification.
Text string
}
CallInviteData is what the ringing dialog shows: the call that rings for the user, and how it rings.
func CallInviteOf ¶ added in v1.2.0
func CallInviteOf(inv app.CallInvitation) *CallInviteData
CallInviteOf makes the data of the dialog out of an invitation.
type CallPanelData ¶ added in v1.2.0
type CallPanelData struct {
// CallID is the call.
CallID uint64
// Video is true when the caller started the call with video.
Video bool
// Active is true once the callee answered; false while it rings.
Active bool
// Incoming is true when the user of the page is the callee.
Incoming bool
// Other is the other person of the call.
Other app.UserRef
// Elapsed is how long the call has been active, as the server read it.
Elapsed time.Duration
// Answer is what the user chose to send when they answered ("video" or
// "audio"), from the query of the page; empty when they did not answer in
// this page load. It makes the tab the one that takes part in the call.
Answer string
}
CallPanelData is the call in progress, as the user of the page sees it.
type ComposerData ¶
type ComposerData struct {
// ConversationID is the conversation the composer writes in.
ConversationID uint64
// CanSend is false when the other user of a direct conversation is
// disabled: the composer is replaced by a note.
CanSend bool
// Body is the text in the field, kept after a failed submit.
Body string
// Reply is the message the new one replies to; nil for none.
Reply *app.MessageQuote
// Errors are the problems of the last submit; the fields are named body,
// attachments and replyTo.
Errors FormErrors
// ConfirmCount, when it is not 0, is the number of people a group mention
// of the body would notify, and the composer asks "This will notify N
// people. Send anyway?" (SPEC §7.15).
ConfirmCount int
}
ComposerData is what the composer of a conversation shows.
type ConversationData ¶
type ConversationData struct {
// Sidebar is the sidebar of the page.
Sidebar SidebarData
// ViewerID is the ID of the person who looks at the page.
ViewerID uint64
// Header is the conversation.
Header app.ConversationHeader
// Messages are the messages of the page, oldest first.
Messages []MessageData
// HasOlder is true when older messages exist; NextBefore is the before
// that asks for them.
HasOlder bool
NextBefore uint64
// Before is the before that asked for this page; 0 for the newest
// messages.
Before uint64
// Composer is the composer.
Composer ComposerData
// Members is the members panel of a group.
Members MembersPanelData
// Edit is the editor of the message being edited; nil for none.
Edit *MessageEditData
// Notice is the problem of the last action on the conversation, shown in
// the header; empty shows none.
Notice string
// Prefs is the dialog of the notification preferences of the viewer in
// the conversation.
Prefs PlacePrefsData
// Focus is the message the page was opened for (a search result links to
// it); 0 for none. The page scrolls to it and marks it.
Focus uint64
// Call is the calls of the conversation: the buttons and the call in
// progress (SPEC §7.18). The zero value is a conversation without calls.
Call CallData
}
ConversationData is what the page of a conversation shows.
func (ConversationData) NewestID ¶
func (d ConversationData) NewestID() uint64
NewestID is the ID of the newest message of the page, 0 for none. The stream of the page is told it, to find out what was sent while the page was loading.
type ConversationsData ¶
type ConversationsData struct {
// Sidebar is the sidebar of the page.
Sidebar SidebarData
// ViewerID is the ID of the person who looks at the page.
ViewerID uint64
// Items are the conversations, the most recent first.
Items []app.ConversationSummary
// New is the state of the form that starts a conversation.
New NewConversationData
// Search is the search of the page, if any (SPEC §7.11, D56).
Search MessageSearchData
}
ConversationsData is what the Messages page shows.
type FeedData ¶
type FeedData struct {
// RoomID is the ID of the room.
RoomID uint64
// Page holds the posts, newest first, and where the next page starts.
Page app.FeedPage
// Before is the beforeID that asked for this page; 0 for the first page.
Before uint64
// NewSince is the ID of the post after which the line "New since your last
// visit" is drawn (see NewSinceID); 0 for no line. Only the first page of
// the feed has one.
NewSince uint64
}
FeedData is a page of the feed of a room.
type FormErrors ¶
type FormErrors struct {
// Form is a problem of the whole form, shown above its fields.
Form string
// Fields maps the name of an input to the message shown next to it.
Fields map[string]string
}
FormErrors are the problems to show in a form after a failed submit. The zero value shows none.
type GroupMentionConfirmData ¶ added in v1.2.0
type GroupMentionConfirmData struct {
// ID is the ID of the editor or composer the question belongs to.
ID string
// Count is the number of people the mention would notify; 0 shows nothing.
Count int
// SendPath is where Send posts to: the action of the form with the query
// confirm_group_mention=1.
SendPath string
}
GroupMentionConfirmData is what the question of a group mention shows.
func ComposerConfirm ¶ added in v1.2.0
func ComposerConfirm(conversationID uint64, n int) GroupMentionConfirmData
ComposerConfirm is the data of the question of the composer of the conversation: n people would be notified.
func (GroupMentionConfirmData) Question ¶ added in v1.2.0
func (d GroupMentionConfirmData) Question() string
Question is the text of the question: "This will notify 14 people. Send anyway?".
type InviteData ¶
type InviteData struct {
// Role is the role chosen in the form: "member" or "admin".
Role string
// Link is the full invitation link, <base URL>/invite/<token>; empty until
// an invitation is made. It is shown once.
Link string
// ExpiresAt is when the invitation stops working.
ExpiresAt time.Time
// Errors are the problems of the last submit.
Errors FormErrors
}
InviteData is what the invitation form shows.
type LoginCodeData ¶ added in v1.2.0
type LoginCodeData struct {
// Command is the ssh command that fetches a code for the user of the
// pending login, such as "ssh -p 2222 alice@chat.example.org"; empty when
// this Clowder shows none.
Command string
// Errors are the problems of the last submit, under the field "code".
Errors FormErrors
}
LoginCodeData is what the second form of the login shows: the code of the SSH server (SPEC §7.16).
type LoginData ¶
type LoginData struct {
// Username is the username typed in the last submit. The password is
// never put back.
Username string
// Next is the local path to go to after the login, already checked; empty
// means the home page.
Next string
// Errors are the problems of the last submit.
Errors FormErrors
}
LoginData is what the login page and its form show.
type MembersPanelData ¶
type MembersPanelData struct {
// Header is the conversation.
Header app.ConversationHeader
// ViewerID is the ID of the person who looks at the page.
ViewerID uint64
// Online is the set of the members who are online when the page loads
// (SPEC §7.15); the dots are not live.
Online map[uint64]bool
// AddUsers is the text in the field of the people to add.
AddUsers string
// RenameTo is the text in the name field when RenameOpen is set; the
// current name otherwise.
RenameTo string
// RenameOpen says that RenameTo is what the person typed.
RenameOpen bool
// AddErrors and RenameErrors are the problems of the last add and rename.
AddErrors, RenameErrors FormErrors
// Message is the problem of the last action on the panel (leave); empty
// shows none.
Message string
}
MembersPanelData is what the members panel of a group shows.
type MessageData ¶
type MessageData struct {
// Message is the message.
Message app.Message
// HTML is the rendered body, which comes from internal/markdown; empty for
// a message without text.
HTML template.HTML
// Own is true when the viewer wrote the message.
Own bool
// Direct is true in a direct conversation, where an own message has the
// place for "Seen".
Direct bool
// Seen is true for the message "Seen" shows under.
Seen bool
// CanReply shows the Reply link: the viewer may send messages here.
CanReply bool
// Notice is the problem of the last action on the message (it may not be
// edited or deleted), shown above it; empty shows none.
Notice string
}
MessageData is what one message shows.
type MessageEditData ¶
type MessageEditData struct {
// Message is the message being edited.
Message MessageData
// Body is the text in the field.
Body string
// Errors are the problems of the last submit; the field is named body.
Errors FormErrors
}
MessageEditData is a message replaced by its editor.
type MessageReactionsData ¶
type MessageReactionsData struct {
// Message is the message: its reactions, and whether the person may react.
Message app.Message
// Notice is the problem of the last reaction, shown above the bar; empty
// shows none.
Notice string
// Problem is the message of the emoji field of the last reaction that was
// not an emoji; the picker is open and shows it.
Problem string
// Typed is what the person typed in the emoji field, kept with Problem.
Typed string
}
MessageReactionsData is what the reaction bar of a message shows.
type MessageSearchData ¶ added in v1.2.0
type MessageSearchData struct {
// Active is true when the page shows a search: the text of the box is not
// empty. The results then replace the list of conversations.
Active bool
// Query is the text of the search box, as typed.
Query string
// Message is the problem with the query, such as a filter that does not
// work in messages; empty shows none.
Message string
// Results are the results of the page, newest first.
Results []app.MessageSearchResult
// HasMore is true when older results follow; NextBefore is the before that
// asks for them.
HasMore bool
NextBefore uint64
}
MessageSearchData is the search of the Messages page. The zero value is no search.
type NewConversationData ¶
type NewConversationData struct {
// Users and Name are the values of the last submit.
Users string
Name string
// Errors are the problems of the last submit; the fields are named users
// and name.
Errors FormErrors
}
NewConversationData is the form that starts a conversation.
type NotificationsData ¶
type NotificationsData struct {
// Sidebar is the sidebar of the page.
Sidebar SidebarData
// Items are the notifications of the page, newest first. Their Read is
// what it was when the page was opened.
Items []app.Notification
// Before is the before of the page: 0 for the newest notifications.
Before uint64
// HasNext is true when older notifications exist; NextBefore is the
// before that asks for them.
HasNext bool
NextBefore uint64
// Message is a problem to show, such as a failed "Mark all as read".
Message string
}
NotificationsData is what the notifications page shows.
func (NotificationsData) NewestID ¶
func (d NotificationsData) NewestID() uint64
NewestID is the ID of the newest notification of the page, 0 for none.
type NotifyPrefsData ¶ added in v1.2.0
type NotifyPrefsData struct {
// Settings are the settings the form shows.
Settings app.Settings
// Places are the rooms and conversations that have preferences of their
// own, each with the link to its dialog.
Places []PlaceListItem
// Errors are the problems of the last submit.
Errors FormErrors
// Saved is true right after a submit that worked.
Saved bool
// KeywordsTyped is what the person typed in the keywords field when the
// submit failed, to put it back; nil when the field shows the saved list.
KeywordsTyped *string
}
NotifyPrefsData is what the Notifications section of the settings shows.
func (NotifyPrefsData) KeywordsText ¶ added in v1.2.0
func (d NotifyPrefsData) KeywordsText() string
KeywordsText is the text of the keywords field: what was typed, or the saved keywords separated by commas.
type PasswordData ¶ added in v1.2.0
type PasswordData struct {
// Errors are the problems of the last submit.
Errors FormErrors
// Saved is true right after a submit that worked.
Saved bool
}
PasswordData is what the Password section shows. No password is ever put back into the form.
type PlaceListItem ¶ added in v1.2.0
type PlaceListItem struct {
// Name is the name of the room, or the title of the conversation.
Name string
// Room is true for a room.
Room bool
// Path is the page of the place with the dialog open.
Path string
// Summary says in a few words what the preferences are.
Summary string
}
PlaceListItem is a room or a conversation that has preferences of its own, as the Notifications section lists it.
type PlacePrefsData ¶ added in v1.2.0
type PlacePrefsData struct {
// Prefs are the preferences the form shows.
Prefs app.PlacePrefs
// Title is the name of the place.
Title string
// Action is where the form posts to; empty for a viewer who has no
// preferences here (the dialog is then not drawn).
Action string
// Errors are the problems of the last submit.
Errors FormErrors
// Saved is true right after a submit that worked.
Saved bool
}
PlacePrefsData is what the dialog "Notification preferences" shows.
type PostCardData ¶
type PostCardData struct {
// Post is the post or comment.
Post app.Post
// From says where the post is shown (FromPost or empty): the delete form
// takes the person to the room when the post page itself is gone.
From string
// Message is the problem of the last action on the post (edit, delete),
// shown above it; empty shows none.
Message string
// Depth is how deep a comment is in its thread (1 for a reply to the post);
// 0 for a post.
Depth int
// ParentAuthor is the author of the item a comment replies to; the zero
// value when that is deleted. It is shown for a comment deeper than
// MaxVisualDepth.
ParentAuthor app.UserRef
// Focus marks the comment that the page was opened for: highlighted and
// scrolled into view.
Focus bool
// CanReply shows the Reply button (and holds the reply slot): the post is
// shown on its own page to a member of its room.
CanReply bool
// Reply is the editor open in the reply slot under the item; nil for an
// empty slot.
Reply *PostEditorData
}
PostCardData is what one post or comment shows.
type PostEditData ¶
type PostEditData struct {
// Post is the post being edited.
Post app.Post
// Editor is the editor, filled for this post.
Editor PostEditorData
// Depth is how deep the post is, when it is a comment (see PostCardData).
Depth int
}
PostEditData is the post replaced by its editor.
type PostEditorData ¶
type PostEditorData struct {
// ID tells the editors of a page apart: "new" for the new post, "edit-12"
// for the edit of the post 12. The ids of its elements end with it.
ID string
// Action is the path the form posts to.
Action string
// Format is the value of the Text / Markdown switch: "markdown" or "text".
Format string
// Body is the text in the body field.
Body string
// Tags is the text in the tags field: tags separated by spaces or commas.
Tags string
// Errors are the problems of the last submit; the fields are named body,
// format and tags.
Errors FormErrors
// SubmitLabel is the text of the submit button.
SubmitLabel string
// CancelPath is the path that restores what the editor replaced, which
// Datastar fetches; empty for an editor that replaces nothing (it has no
// Cancel link).
CancelPath string
// CancelHref is where the Cancel link goes without JavaScript.
CancelHref string
// CancelClose makes the Cancel link close the reply slot the editor is in,
// in the browser, without asking the server (CancelHref is its target
// without JavaScript).
CancelClose bool
// From says where the post is shown (FromPost), for an edit in place.
From string
// Attachments are the files the post has now, listed with a Remove box
// each; nil for an editor that writes a new post.
Attachments []app.AttachmentView
// Removing holds the IDs of the attachments whose Remove box is ticked,
// kept from a submit that failed.
Removing map[uint64]bool
// RoomID is the ID of the room the post is written in; the Add task button
// asks the server for a row with the members of that room.
RoomID uint64
// Tasks are the task rows of the editor: the tasks of the post when it is
// edited, or the rows typed in a submit that failed. The errors of the
// rows are the message of the field "tasks".
Tasks []TaskRowData
// Assignable are the people the assignee pickers offer: the members of the
// room and, when a post is edited, the former members who are assigned to
// one of its tasks (see WithMembers).
Assignable []AssigneeOption
// ConfirmCount, when it is not 0, is the number of people a group mention
// of the body would notify, and the editor asks "This will notify N
// people. Send anyway?" (SPEC §7.15).
ConfirmCount int
// contains filtered or unexported fields
}
PostEditorData is what the post editor shows. The room page uses it for the new post, the post page for the edit in place and for the replies; the attachments and tasks of M6 and M9 add their fields here.
func EditPostEditorData ¶
func EditPostEditorData(p app.Post, from string) PostEditorData
EditPostEditorData is the editor that edits the post, filled with its body, format and tags. from says where the post is shown (FromPost or empty).
func NewPostEditorData ¶
func NewPostEditorData(roomID uint64) PostEditorData
NewPostEditorData is the empty editor that writes a post in the room.
func ReplyEditorData ¶
func ReplyEditorData(parentID uint64) PostEditorData
ReplyEditorData is the empty editor that writes a comment under the post or comment parentID. It opens in the reply slot under that item.
func (PostEditorData) WithMembers ¶
func (d PostEditorData) WithMembers(roomID uint64, members []app.Member) PostEditorData
WithMembers returns the editor for the room, with the members of the room offered in the assignee pickers. People assigned to the tasks of the post who are no longer members stay in the pickers, marked as having left, so that an edit can keep them (SPEC §7.6).
type PostPageData ¶
type PostPageData struct {
// Sidebar is the sidebar of the page; the room of the post is highlighted.
Sidebar SidebarData
// Post is the top-level post of the thread.
Post app.Post
// Comments are the comments of the thread, depth first.
Comments []app.Comment
// Focus is the ID of the comment the page was opened for; 0 for the post.
Focus uint64
// CanReply is true for a member of the room: the items have Reply buttons.
// Anyone else is told to join the room.
CanReply bool
// ActiveID is the ID of the post or comment that Message, Editing and
// Replying are about; 0 is the top-level post.
ActiveID uint64
// Message is the problem of the last action on the active item, shown above
// it.
Message string
// Editing is true when the active item is replaced by its editor.
Editing bool
// Replying is true when the active item has the editor in Editor open in
// its reply slot.
Replying bool
// Editor is the editor, used when Editing or Replying is true.
Editor PostEditorData
}
PostPageData is what the page of a post shows.
func (PostPageData) CommentCard ¶
func (d PostPageData) CommentCard(c app.Comment) PostCardData
CommentCard is the card of a comment of the thread.
func (PostPageData) NewestID ¶
func (d PostPageData) NewestID() uint64
NewestID is the largest ID among the top-level post and the comments of the thread: the newest item the page shows. The stream of the page is told it, to find out what was written while the page was loading.
func (PostPageData) RootCard ¶
func (d PostPageData) RootCard() PostCardData
RootCard is the card of the top-level post of the page.
type PostPreviewData ¶
type PostPreviewData struct {
// EditorID is the ID of the editor the box belongs to.
EditorID string
// HTML is the rendered body, which comes from internal/markdown; empty for
// an empty body.
HTML template.HTML
// Message is the problem that stopped the preview (a body that is too
// long); empty shows none.
Message string
// Hidden is true for the box before the first preview.
Hidden bool
}
PostPreviewData is what the preview box of an editor shows.
type ProfileData ¶ added in v1.2.0
type ProfileData struct {
// User is the logged-in user, with their avatar.
User app.User
// DisplayName is the value of the display name input: the user's name, or
// what they typed in a submit that failed.
DisplayName string
// Errors are the problems of the last submit; the avatar's are under the
// field "avatar", the name's under "displayName".
Errors FormErrors
// Saved is true right after a submit that worked.
Saved bool
}
ProfileData is what the Profile section shows.
type ReactionsData ¶
type ReactionsData struct {
// Post is the post or comment: its reactions, and whether the person may
// react.
Post app.Post
// From says where the post is shown (FromPost or empty), so that a plain
// form post is sent back to the right page.
From string
// Message is the problem of the last reaction, shown above the bar (the
// person may not react); empty shows none.
Message string
// Problem is the message of the emoji field of the last reaction that was
// not an emoji; the picker is open and shows it (see ReactionPicker).
Problem string
// Typed is what the person typed in the emoji field, kept with Problem.
Typed string
}
ReactionsData is what the reaction bar of a post or comment shows.
type ResetData ¶ added in v1.2.0
type ResetData struct {
// Token is the token of the link, from the address.
Token string
// Errors are the problems of the last submit. The passwords are never
// put back.
Errors FormErrors
}
ResetData is what the page of a password reset link and its form show.
type ResetLinkData ¶ added in v1.2.0
type ResetLinkData struct {
// Username is the username of the user the link is for.
Username string
// Link is the full link, <base URL>/reset/<token>; empty when none was
// made. It is shown once.
Link string
// ExpiresAt is when the link stops working.
ExpiresAt time.Time
}
ResetLinkData is the password reset link that an admin just made.
type RoomData ¶
type RoomData struct {
// Sidebar is the sidebar of the page.
Sidebar SidebarData
// Viewer is the person who looks at the page.
Viewer app.User
// Room is the room.
Room app.Room
// Members are the members of the room.
Members []app.Member
// Online is the set of the members who are online when the page loads
// (SPEC §7.15); the dots are not live.
Online map[uint64]bool
// Candidates are the users the viewer can add; empty for a viewer who is
// not a member.
Candidates []app.User
// Message is the problem of the last action on the room (join, leave,
// delete), shown in the header; empty shows none.
Message string
// MembersMessage is the problem of the last action on the members, shown in
// the members panel; empty shows none.
MembersMessage string
// Edit is the state of the rename form.
Edit RoomEditData
// Editor is the editor of a new post, shown to a member.
Editor PostEditorData
// Feed is the page of the feed that the page shows.
Feed FeedData
// Prefs is the dialog of the notification preferences of the viewer in
// the room; it has no Action, and is not drawn, for a viewer who is not
// a member.
Prefs PlacePrefsData
}
RoomData is what the page of a room shows.
type RoomEditData ¶
type RoomEditData struct {
// Name and Description are the values in the form. Empty Name means the
// current values of the room.
Name string
Description string
// Open is true when the form is shown open (after a failed submit).
Open bool
// Errors are the problems of the last submit.
Errors FormErrors
}
RoomEditData is the state of the rename form.
type RoomNavCurrent ¶
type RoomNavCurrent string
RoomNavCurrent says which page of a room the navigation marks as current.
const ( NavPosts RoomNavCurrent = "posts" NavBoard RoomNavCurrent = "board" )
The pages of a room that the navigation links.
type RoomNewData ¶
type RoomNewData struct {
// Sidebar is the sidebar of the page.
Sidebar SidebarData
// Admin is true when the person is an admin and so chooses the
// visibility; members always make private rooms.
Admin bool
// Name, Description and Visibility are the values of the last submit.
Name string
Description string
Visibility string
// Errors are the problems of the last submit.
Errors FormErrors
}
RoomNewData is what the page of the new room form shows.
type RoomsBrowseData ¶
type RoomsBrowseData struct {
// Sidebar is the sidebar of the page.
Sidebar SidebarData
// Rooms are the visible rooms.
Rooms []app.Room
// Message is the problem of the last action, shown above the list; empty
// shows none.
Message string
}
RoomsBrowseData is what the page of the visible rooms shows.
type SSHKeyAddData ¶ added in v1.2.0
type SSHKeyAddData struct {
// Name is the name typed in the form, kept after a failed submit.
Name string
// PublicKey is the key typed in the form, kept after a failed submit.
PublicKey string
// Errors are the problems of the last submit. Passwords are never put
// back.
Errors FormErrors
}
SSHKeyAddData is the Add form of the Sign-in section.
type SearchChip ¶
type SearchChip struct {
// Label is the filter as it is written in a query, such as "#design" or
// "room:general".
Label string
// Path is the path of the search without this filter: the other words and
// filters of the query, on the first page.
Path string
}
SearchChip is a filter of the query, shown as a chip with a link that removes it.
func SearchChips ¶
func SearchChips(q app.Query) []SearchChip
SearchChips returns the chips of the filters of a parsed query, in the order #tags, room, from, after, before, is:post, is:comment. The path of each chip is the search for the query without that filter.
type SearchData ¶
type SearchData struct {
// Sidebar is the sidebar of the page.
Sidebar SidebarData
// Query is the text of the search box, as typed.
Query string
// Message is the problem with the query, such as a date that is not a
// date; empty shows none.
Message string
// Searched is true when the query was searched: it is not empty and has
// no problem. Without it the page shows no results and no "Nothing
// found.".
Searched bool
// Chips are the filters of the query.
Chips []SearchChip
// Results are the results of the page.
Results []app.SearchResult
// Page is the number of the page, starting at 1.
Page int
// HasNext is true when more results follow this page.
HasNext bool
}
SearchData is what the search page shows. The zero value is the page of an empty query.
type SettingsData ¶ added in v1.2.0
type SettingsData struct {
// Sidebar is the sidebar of the page.
Sidebar SidebarData
// Profile, Password, Appearance and Notifications are their sections.
Profile ProfileData
Password PasswordData
Appearance AppearanceData
Notifications NotifyPrefsData
// SignIn is the Sign-in section: the SSH keys and the SSH server.
SignIn SignInData
// Sessions are the live sessions of the user, the newest first.
Sessions []app.SessionInfo
}
SettingsData is what the settings page shows.
type SidebarData ¶
type SidebarData struct {
// User is the logged-in user.
User app.User
// Rooms are the rooms the user is a member of, in the order to show.
Rooms []app.Room
// CurrentRoomID is the ID of the room whose page is shown, which the
// sidebar highlights; 0 on every other page.
CurrentRoomID uint64
// Unread is the number of unread notifications of the user, shown on the
// bell; the badge is left out when it is 0.
Unread int
// UnreadMessages is the number of conversations of the user with unread
// messages, shown on the Messages link of the header; the badge is left out
// when it is 0.
UnreadMessages int
// HideSearch leaves out the search box of the header. The search page
// sets it: it has a box of its own.
HideSearch bool
// Theme is the theme of the user, which the theme form of the user menu
// marks; empty means System.
Theme app.Theme
// Ringing is the call that rings for the user, which the ringing dialog
// of the page shows (SPEC §7.18); nil while none does.
Ringing *CallInviteData
}
SidebarData is what the shell of a logged-in page shows: the header and the sidebar of rooms.
func (SidebarData) UnreadTotal ¶ added in v1.2.0
func (d SidebarData) UnreadTotal() int
UnreadTotal is the number in the title of the tab: the unread notifications plus the conversations with unread messages that are not muted, the same numbers as the bell and the Messages link (SPEC §7.17).
func (SidebarData) WithRoomRead ¶ added in v1.2.0
func (d SidebarData) WithRoomRead(roomID uint64) SidebarData
WithRoomRead returns the data with the unread counts of the room roomID set to 0: the page of the room's feed (or its board) has just marked the room as read, and the room being looked at shows nothing waiting. The rooms are copied; the receiver is not changed.
type SignInData ¶ added in v1.2.0
type SignInData struct {
// Keys are the SSH keys of the user, oldest first.
Keys []app.SSHKey
// Server is what the section shows of the SSH server.
Server app.SSHServer
// Add holds the Add form: the values kept from a submit that failed and
// its problems under the fields "name", "publicKey" and
// "currentPassword".
Add SSHKeyAddData
// RemoveKeyID is the key whose Remove form has the problems in
// RemoveErrors; 0 for none.
RemoveKeyID uint64
// RemoveErrors are the problems of the last Remove, under the field
// "currentPassword".
RemoveErrors FormErrors
// CodeRequired is true when the user turned on "Ask for an SSH code when
// I log in".
CodeRequired bool
// Code holds the problems of the last submit of the switch, under the
// fields "form" and "currentPassword".
Code FormErrors
// Saved is true right after a key was added or removed, or the switch was
// used.
Saved bool
}
SignInData is what the Sign-in section shows (SPEC §7.16).
type SignUpData ¶
type SignUpData struct {
// Token is the token of the invitation, from the link.
Token string
// Username and DisplayName are the values typed in the last submit. The
// password is never put back.
Username string
DisplayName string
// Errors are the problems of the last submit.
Errors FormErrors
}
SignUpData is what the sign-up page and its form show.
type TaskRowData ¶
type TaskRowData struct {
// ID is the ID of the task for a row that edits one; 0 for a new task.
ID uint64
// Title is the text in the title field.
Title string
// Assignees are the IDs of the people selected in the picker.
Assignees []uint64
// Due is the due date as the date field holds it ("2006-01-02"), or empty.
Due string
}
TaskRowData is one task row of the editor.
Source Files
¶
- admin_audit_templ.go
- admin_rooms_templ.go
- admin_templ.go
- audit.go
- auth_templ.go
- avatar_templ.go
- board.go
- board_templ.go
- calls.go
- calls_templ.go
- doc.go
- error_templ.go
- forms.go
- generate.go
- home_templ.go
- icons_templ.go
- layout_templ.go
- logo_templ.go
- mentions.go
- mentions_templ.go
- messages.go
- messages_templ.go
- notifications.go
- notifications_templ.go
- notify.go
- notify_templ.go
- posts.go
- posts_templ.go
- rooms_templ.go
- search.go
- search_templ.go
- settings_templ.go
- sidebar_templ.go
- signin_templ.go
- static.go
- theme.go
- unread.go