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

Update for octicon package rename.

Follows https://github.com/shurcooL/octicon/commit/c42b0e3b24d96976ecac81ef691662777b39ef64.
dmitshur committed 5 years ago commit 0a106ad413e3d333da336ce3a90970dc87151beb
Collapse all
component/changes.go
@@ -4,11 +4,11 @@ import (
	"fmt"

	"dmitri.shuralyov.com/service/change"
	"github.com/shurcooL/htmlg"
	issuescomponent "github.com/shurcooL/issuesapp/component"
	"github.com/shurcooL/octiconssvg"
	"github.com/shurcooL/octicon"
	"golang.org/x/net/html"
	"golang.org/x/net/html/atom"
)

// Changes is a component that displays a page of changes,
@@ -133,11 +133,11 @@ func (i ChangeEntry) Render() []*html.Node {
		Attr: []html.Attribute{
			{Key: atom.Title.String(), Val: fmt.Sprintf("%d replies", i.Change.Replies)},
			{Key: atom.Class.String(), Val: spanClass},
		},
	}
	span.AppendChild(octiconssvg.Comment())
	span.AppendChild(octicon.Comment())
	span.AppendChild(htmlg.Text(fmt.Sprintf(" %d", i.Change.Replies)))
	div.AppendChild(span)

	listEntryDiv := htmlg.DivClass("list-entry-body multilist-entry", div)
	if i.Unread {
component/component.go
@@ -9,11 +9,11 @@ import (
	"dmitri.shuralyov.com/service/change"
	"dmitri.shuralyov.com/state"
	"github.com/dustin/go-humanize"
	"github.com/shurcooL/htmlg"
	issuescomponent "github.com/shurcooL/issuesapp/component"
	"github.com/shurcooL/octiconssvg"
	"github.com/shurcooL/octicon"
	"github.com/shurcooL/users"
	"golang.org/x/net/html"
	"golang.org/x/net/html/atom"
)

@@ -52,44 +52,44 @@ func (e Event) icon() *html.Node {
		color           = "#767676"
		backgroundColor = "#f3f3f3"
	)
	switch p := e.Event.Payload.(type) {
	case change.ClosedEvent:
		icon = octiconssvg.CircleSlash()
		icon = octicon.CircleSlash()
		color, backgroundColor = "#fff", "#bd2c00"
	case change.ReopenedEvent:
		icon = octiconssvg.PrimitiveDot()
		icon = octicon.PrimitiveDot()
		color, backgroundColor = "#fff", "#6cc644"
	case change.RenamedEvent:
		icon = octiconssvg.Pencil()
		icon = octicon.Pencil()
	case change.LabeledEvent, change.UnlabeledEvent:
		icon = octiconssvg.Tag()
		icon = octicon.Tag()
	case change.ReviewRequestedEvent:
		icon = octiconssvg.Eye()
		icon = octicon.Eye()
	case change.ReviewRequestRemovedEvent:
		icon = octiconssvg.X()
		icon = octicon.X()
	case change.MergedEvent:
		icon = octiconssvg.GitMerge()
		icon = octicon.GitMerge()
		color, backgroundColor = "#fff", "#6f42c1"
	case change.DeletedEvent:
		switch p.Type {
		case "branch":
			icon = octiconssvg.GitBranch()
			icon = octicon.GitBranch()
			color, backgroundColor = "#fff", "#767676"
		case "comment":
			icon = octiconssvg.X()
			icon = octicon.X()
		default:
			panic("unreachable")
		}
	case change.ApprovedEvent:
		icon = octiconssvg.Check()
		icon = octicon.Check()
		color, backgroundColor = "#fff", "#6cc644"
	case change.ChangesRequestedEvent:
		icon = octiconssvg.X()
		icon = octicon.X()
		color, backgroundColor = "#fff", "#bd2c00"
	default:
		icon = octiconssvg.PrimitiveDot()
		icon = octicon.PrimitiveDot()
	}
	return &html.Node{
		Type: html.ElementNode, Data: atom.Span.String(),
		Attr: []html.Attribute{
			{Key: atom.Class.String(), Val: "event-icon"},
@@ -214,19 +214,19 @@ func (cb ChangeBadge) Render() []*html.Node {
		text  string
		color string
	)
	switch cb.State {
	case change.OpenState:
		icon = octiconssvg.GitPullRequest()
		icon = octicon.GitPullRequest()
		text = "Open"
		color = "#6cc644"
	case change.ClosedState:
		icon = octiconssvg.GitPullRequest()
		icon = octicon.GitPullRequest()
		text = "Closed"
		color = "#bd2c00"
	case change.MergedState:
		icon = octiconssvg.GitMerge()
		icon = octicon.GitMerge()
		text = "Merged"
		color = "#6f42c1"
	default:
		return []*html.Node{htmlg.Text(string(cb.State))}
	}
@@ -266,17 +266,17 @@ func (ii ChangeIcon) Render() []*html.Node {
		icon  *html.Node
		color string
	)
	switch ii.State {
	case change.OpenState:
		icon = octiconssvg.GitPullRequest()
		icon = octicon.GitPullRequest()
		color = "#6cc644"
	case change.ClosedState:
		icon = octiconssvg.GitPullRequest()
		icon = octicon.GitPullRequest()
		color = "#bd2c00"
	case change.MergedState:
		icon = octiconssvg.GitMerge()
		icon = octicon.GitMerge()
		color = "#6f42c1"
	}
	span := &html.Node{
		Type: html.ElementNode, Data: atom.Span.String(),
		Attr: []html.Attribute{{
component/tabs.go
@@ -3,11 +3,11 @@ package component
import (
	"fmt"
	"net/url"

	"github.com/shurcooL/htmlg"
	"github.com/shurcooL/octiconssvg"
	"github.com/shurcooL/octicon"
	"golang.org/x/net/html"
	"golang.org/x/net/html/atom"
)

// ChangesNav is a navigation component for displaying a header for a list of changes.
@@ -93,11 +93,11 @@ func (t OpenChangesTab) Render() []*html.Node {
	icon := &html.Node{
		Type: html.ElementNode, Data: atom.Span.String(),
		Attr: []html.Attribute{
			{Key: atom.Style.String(), Val: "margin-right: 4px;"},
		},
		FirstChild: octiconssvg.GitPullRequest(),
		FirstChild: octicon.GitPullRequest(),
	}
	text := htmlg.Text(fmt.Sprintf("%d Open", t.Count))
	return []*html.Node{icon, text}
}

@@ -113,10 +113,10 @@ func (t ClosedChangesTab) Render() []*html.Node {
	icon := &html.Node{
		Type: html.ElementNode, Data: atom.Span.String(),
		Attr: []html.Attribute{
			{Key: atom.Style.String(), Val: "margin-right: 4px;"},
		},
		FirstChild: octiconssvg.Check(),
		FirstChild: octicon.Check(),
	}
	text := htmlg.Text(fmt.Sprintf("%d Closed", t.Count))
	return []*html.Node{icon, text}
}
main.go
@@ -26,11 +26,11 @@ import (
	"github.com/shurcooL/htmlg"
	"github.com/shurcooL/httperror"
	"github.com/shurcooL/httpfs/html/vfstemplate"
	"github.com/shurcooL/httpgzip"
	"github.com/shurcooL/notifications"
	"github.com/shurcooL/octiconssvg"
	"github.com/shurcooL/octicon"
	"github.com/shurcooL/reactions"
	reactionscomponent "github.com/shurcooL/reactions/component"
	"github.com/shurcooL/users"
	"golang.org/x/net/html"
	"sourcegraph.com/sourcegraph/go-diff/diff"
@@ -557,27 +557,27 @@ type state struct {
	Timeline []timelineItem
}

// Tabnav renders the tabnav.
func (s state) Tabnav(selected string) template.HTML {
	var files htmlg.Component = iconText{Icon: octiconssvg.Diff, Text: "Files"}
	var files htmlg.Component = iconText{Icon: octicon.Diff, Text: "Files"}
	if s.Change.ChangedFiles != 0 {
		files = contentCounter{Content: files, Count: s.Change.ChangedFiles}
	}
	return template.HTML(htmlg.RenderComponentsString(tabnav{
		Tabs: []tab{
			{
				Content: contentCounter{
					Content: iconText{Icon: octiconssvg.CommentDiscussion, Text: "Discussion"},
					Content: iconText{Icon: octicon.CommentDiscussion, Text: "Discussion"},
					Count:   s.Change.Replies,
				},
				URL:      fmt.Sprintf("%s/%d", s.BaseURI, s.ChangeID),
				Selected: selected == "Discussion",
			},
			{
				Content: contentCounter{
					Content: iconText{Icon: octiconssvg.GitCommit, Text: "Commits"},
					Content: iconText{Icon: octicon.GitCommit, Text: "Commits"},
					Count:   s.Change.Commits,
				},
				URL:      fmt.Sprintf("%s/%d/commits", s.BaseURI, s.ChangeID),
				Selected: selected == "Commits",
			},
@@ -622,11 +622,11 @@ func loadTemplates(state common.State, bodyPre string) (*template.Template, erro
			}
		},
		"state": func() common.State { return state },

		"octicon": func(name string) (template.HTML, error) {
			icon := octiconssvg.Icon(name)
			icon := octicon.Icon(name)
			if icon == nil {
				return "", fmt.Errorf("%q is not a valid Octicon symbol name", name)
			}
			var buf bytes.Buffer
			err := html.Render(&buf, icon)