Add about page

This commit is contained in:
r 2019-12-21 05:48:48 +00:00
parent 889f8da496
commit 2648484a1d
8 changed files with 75 additions and 0 deletions

View file

@ -33,6 +33,7 @@ type Service interface {
ServeThreadPage(ctx context.Context, client io.Writer, c *mastodon.Client, id string, reply bool) (err error)
ServeNotificationPage(ctx context.Context, client io.Writer, c *mastodon.Client, maxID string, minID string) (err error)
ServeUserPage(ctx context.Context, client io.Writer, c *mastodon.Client, id string, maxID string, minID string) (err error)
ServeAboutPage(ctx context.Context, client io.Writer, c *mastodon.Client) (err error)
Like(ctx context.Context, client io.Writer, c *mastodon.Client, id string) (err error)
UnLike(ctx context.Context, client io.Writer, c *mastodon.Client, id string) (err error)
Retweet(ctx context.Context, client io.Writer, c *mastodon.Client, id string) (err error)
@ -411,6 +412,21 @@ func (svc *service) ServeUserPage(ctx context.Context, client io.Writer, c *mast
return
}
func (svc *service) ServeAboutPage(ctx context.Context, client io.Writer, c *mastodon.Client) (err error) {
navbarData, err := svc.getNavbarTemplateData(ctx, client, c)
if err != nil {
return
}
data := renderer.NewAboutPageTemplateData(navbarData)
err = svc.renderer.RenderAboutPage(ctx, client, data)
if err != nil {
return
}
return
}
func (svc *service) getNavbarTemplateData(ctx context.Context, client io.Writer, c *mastodon.Client) (data *renderer.NavbarTemplateData, err error) {
notifications, err := c.GetNotifications(ctx, nil)
if err != nil {