mirror of
https://codeberg.org/readeck/readeck.git
synced 2026-05-19 11:00:36 +00:00
8328f0df6d
- moved the shared auth layout to components (used by signin, oauth and oidc) - moved the post login redirects to internal/server - load OIDC configuration during app initialization - added provisioning tests
50 lines
1.4 KiB
Go
50 lines
1.4 KiB
Go
// SPDX-FileCopyrightText: © 2026 Olivier Meunier <olivier@neokraft.net>
|
|
//
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
package components
|
|
|
|
import "github.com/a-h/templ"
|
|
|
|
// BasePage renders an empty page with default and required head elements.
|
|
func BasePage(title string) templ.Component {
|
|
return defaultLayout.BasePage(title)
|
|
}
|
|
|
|
// SideMenuLayout renders a page with a side menu.
|
|
func SideMenuLayout(title string, sidemenu templ.Component) templ.Component {
|
|
return defaultLayout.SideMenuLayout(title, sidemenu, defaultLayout.SideMenuWrapper())
|
|
}
|
|
|
|
// SideMenuStdLayout renders a page with a side menu.
|
|
// The content has a standard maximum width.
|
|
func SideMenuStdLayout(title string, sidemenu templ.Component) templ.Component {
|
|
return defaultLayout.SideMenuLayout(title, sidemenu, defaultLayout.SideMenuStdWrapper())
|
|
}
|
|
|
|
// Layout is our base layout for every Readeck page.
|
|
type Layout struct {
|
|
Head templ.Component
|
|
}
|
|
|
|
// defaultLayout is an instance of [Layout] that we reuse
|
|
// about everywhere.
|
|
var defaultLayout = NewLayout()
|
|
|
|
// NewLayout returns a new [Layout].
|
|
func NewLayout() (l *Layout) {
|
|
return &Layout{
|
|
Head: templ.NopComponent,
|
|
}
|
|
}
|
|
|
|
// AuthLayout is the layout used on all the authentication pages.
|
|
func AuthLayout(title string) templ.Component {
|
|
return defaultLayout.AuthBase(title)
|
|
}
|
|
|
|
// AuthError is the component for the authentication error pages.
|
|
func AuthError(status int) templ.Component {
|
|
return defaultLayout.AuthError(status)
|
|
}
|