dmitri.shuralyov.com/app/changes/...

component: Improve style of MergedEvent, DeletedEvent.

This helps readability, and doesn't make the page appear too wide on
narrow mobile displays.

Helps https://dmitri.shuralyov.com/app/changes/...$issues/1.
dmitshur committed 6 years ago commit 4277748913c2949855566d7d36f838ac4e7cceab
Collapse all
cmd/changesdev/main.go
@@ -35,16 +35,18 @@ import (
	"dmitri.shuralyov.com/app/changes"
	"dmitri.shuralyov.com/service/change"
	"dmitri.shuralyov.com/service/change/fs"
	"dmitri.shuralyov.com/service/change/gerritapi"
	"dmitri.shuralyov.com/service/change/githubapi"
	"dmitri.shuralyov.com/service/change/maintner"
	"github.com/andygrunwald/go-gerrit"
	"github.com/google/go-github/github"
	"github.com/gregjones/httpcache"
	"github.com/shurcooL/githubql"
	"github.com/shurcooL/httpgzip"
	"github.com/shurcooL/reactions/emojis"
	"golang.org/x/build/maintner/godata"
	"golang.org/x/oauth2"
)

var httpFlag = flag.String("http", ":8080", "Listen for HTTP connections on this address.")

@@ -85,23 +87,24 @@ func main() {
		}

		service = gerritapi.NewService(gerrit)

	case 2:
		/*corpus, err := godata.Get(context.Background())
		corpus, err := godata.Get(context.Background())
		if err != nil {
			log.Fatalln(err)
		}

		service = maintner.NewService(corpus)*/
		service = maintner.NewService(corpus)

	case 3:
		service = &fs.Service{}
	}

	changesOpt := changes.Options{
		HeadPre: `<style type="text/css">
		HeadPre: `<meta name="viewport" content="width=device-width">
<style type="text/css">
	body {
		margin: 20px;
		font-family: Go;
		font-size: 14px;
		line-height: initial;
@@ -135,11 +138,14 @@ func main() {
		}
		//req = req.WithContext(context.WithValue(req.Context(), changes.RepoSpecContextKey, "github.com/google/go-github"))
		//req = req.WithContext(context.WithValue(req.Context(), changes.RepoSpecContextKey, "github.com/dustin/go-humanize"))
		//req = req.WithContext(context.WithValue(req.Context(), changes.RepoSpecContextKey, "github.com/neugram/ng"))
		//req = req.WithContext(context.WithValue(req.Context(), changes.RepoSpecContextKey, "github.com/golang/scratch"))
		req = req.WithContext(context.WithValue(req.Context(), changes.RepoSpecContextKey, "github.com/bradleyfalzon/ghinstallation"))
		//req = req.WithContext(context.WithValue(req.Context(), changes.RepoSpecContextKey, "github.com/bradleyfalzon/ghinstallation"))
		//req = req.WithContext(context.WithValue(req.Context(), changes.RepoSpecContextKey, "github.com/golang/gddo"))
		//req = req.WithContext(context.WithValue(req.Context(), changes.RepoSpecContextKey, "github.com/avelino/awesome-go"))
		req = req.WithContext(context.WithValue(req.Context(), changes.RepoSpecContextKey, "github.com/travis-ci/travis-build"))
		//req = req.WithContext(context.WithValue(req.Context(), changes.RepoSpecContextKey, "go.googlesource.com/go"))
		//req = req.WithContext(context.WithValue(req.Context(), changes.RepoSpecContextKey, "go.googlesource.com/tools"))
		//req = req.WithContext(context.WithValue(req.Context(), changes.RepoSpecContextKey, "go.googlesource.com/build"))
		//req = req.WithContext(context.WithValue(req.Context(), changes.RepoSpecContextKey, "upspin.googlesource.com/upspin"))
		//req = req.WithContext(context.WithValue(req.Context(), changes.RepoSpecContextKey, "dmitri.shuralyov.com/font/woff2"))
component/component.go
@@ -3,10 +3,11 @@ package component

import (
	"fmt"
	"time"

	"dmitri.shuralyov.com/html/belt"
	"dmitri.shuralyov.com/service/change"
	"github.com/dustin/go-humanize"
	"github.com/shurcooL/htmlg"
	issuescomponent "github.com/shurcooL/issuesapp/component"
	"github.com/shurcooL/octiconssvg"
@@ -128,20 +129,23 @@ func (e Event) text() []*html.Node {
		ns = append(ns, User{p.RequestedReviewer}.Render()...)
		return ns
	case change.MergedEvent:
		var ns []*html.Node
		ns = append(ns, htmlg.Text("merged commit "))
		ns = append(ns, htmlg.Strong(p.CommitID)) // TODO: Code{}, use CommitHTMLURL.
		ns = append(ns, belt.CommitID{
			SHA:     p.CommitID,
			HTMLURL: p.CommitHTMLURL,
		}.Render()...)
		ns = append(ns, htmlg.Text(" into "))
		ns = append(ns, htmlg.Strong(p.RefName)) // TODO: Code{}.
		ns = append(ns, belt.Reference{Name: p.RefName}.Render()...)
		return ns
	case change.DeletedEvent:
		switch p.Type {
		case "branch":
			var ns []*html.Node
			ns = append(ns, htmlg.Text("deleted the "))
			ns = append(ns, htmlg.Strong(p.Name)) // TODO: Code{}.
			ns = append(ns, belt.Reference{Name: p.Name}.Render()...)
			ns = append(ns, htmlg.Text(" branch"))
			return ns
		case "comment":
			return []*html.Node{htmlg.Text("deleted a comment")}
		default: