@@ -4,6 +4,7 @@ import (
44 "fmt"
55 "slices"
66 "strconv"
7+ "strings"
78 "time"
89
910 "xonecas.io/site/internal/project"
@@ -21,19 +22,19 @@ type WallYear struct {
2122 Cells []Cell
2223 }
2324
24-// Pinned is a project card on the home page, with its months of the latest year.
25-type Pinned struct {
25+// Recent is a project card on the home page, with its months of the latest year.
26+type Recent struct {
2627 Row ProjectRow
2728 P project.Project
2829 Strip []Cell
2930 }
3031
31-// HomeData is the home page: totals, the wall of every month, and the busiest projects of the latest year.
32+// HomeData is the home page: totals, the wall of every month, and the projects with the latest commits.
3233 type HomeData struct {
3334 Commits, Projects, Languages int
34- Busiest, Quietest, Year string
35+ Busiest, Quietest string
3536 Wall []WallYear
36- Pinned []Pinned
37+ Recent []Recent
3738 Tags []string
3839 }
3940
@@ -70,7 +71,7 @@ func homeData(shown []project.Project, rows []ProjectRow) HomeData {
7071 }
7172 first, last = min(first, p.First[:4]), max(last, p.Last[:4])
7273 }
73- d.Languages, d.Year = len(langs), last
74+ d.Languages = len(langs)
7475 busiest, quiet, quietN := "", "", -1
7576 for y := mustAtoi(first); y <= mustAtoi(last); y++ {
7677 year := strconv.Itoa(y)
@@ -92,16 +93,10 @@ func homeData(shown []project.Project, rows []ProjectRow) HomeData {
9293 d.Quietest = fmt.Sprintf("%s · %d", quiet, quietN)
9394
9495 for i, p := range shown {
95- d.Pinned = append(d.Pinned, Pinned{rows[i], p, months(last, p.Months)})
96+ d.Recent = append(d.Recent, Recent{rows[i], p, months(last, p.Months)})
9697 }
97- inYear := func(p Pinned) (n int) {
98- for _, c := range p.Strip {
99- n += c.Count
100- }
101- return n
102- }
103- slices.SortStableFunc(d.Pinned, func(a, b Pinned) int { return inYear(b) - inYear(a) })
104- d.Pinned = d.Pinned[:min(6, len(d.Pinned))]
98+ slices.SortStableFunc(d.Recent, func(a, b Recent) int { return strings.Compare(b.P.Last, a.P.Last) })
99+ d.Recent = d.Recent[:min(12, len(d.Recent))]
105100 return d
106101 }
107102