1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-04 15:04:42 +00:00

refactor: remove Christmas seasonal feature

This commit is contained in:
Tw93
2026-01-02 19:26:22 +08:00
parent 115e2d3ef1
commit 6c8c87bef6
3 changed files with 17 additions and 128 deletions

View File

@@ -5,7 +5,6 @@ import (
"sort"
"strconv"
"strings"
"time"
"github.com/charmbracelet/lipgloss"
)
@@ -17,7 +16,7 @@ var (
dangerStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#FF5F5F")).Bold(true)
okStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#A5D6A7"))
lineStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#404040"))
hatStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#FF4D4D"))
primaryStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#BD93F9"))
)
@@ -33,14 +32,6 @@ const (
iconProcs = "❊"
)
// isChristmasSeason reports Dec 10-31.
func isChristmasSeason() bool {
now := time.Now()
month := now.Month()
day := now.Day()
return month == time.December && day >= 10 && day <= 31
}
// Mole body frames.
var moleBody = [][]string{
{
@@ -69,55 +60,10 @@ var moleBody = [][]string{
},
}
// Mole body frames with Christmas hat.
var moleBodyWithHat = [][]string{
{
` *`,
` /o\`,
` {/\_/\}`,
` ___/ o o \`,
` /___ =-= /`,
` \____)-m-m)`,
},
{
` *`,
` /o\`,
` {/\_/\}`,
` ___/ o o \`,
` /___ =-= /`,
` \____)mm__)`,
},
{
` *`,
` /o\`,
` {/\_/\}`,
` ___/ · · \`,
` /___ =-= /`,
` \___)-m__m)`,
},
{
` *`,
` /o\`,
` {/\_/\}`,
` ___/ o o \`,
` /___ =-= /`,
` \____)-mm-)`,
},
}
// getMoleFrame renders the animated mole.
func getMoleFrame(animFrame int, termWidth int) string {
var body []string
var bodyIdx int
isChristmas := isChristmasSeason()
if isChristmas {
bodyIdx = animFrame % len(moleBodyWithHat)
body = moleBodyWithHat[bodyIdx]
} else {
bodyIdx = animFrame % len(moleBody)
body = moleBody[bodyIdx]
}
bodyIdx := animFrame % len(moleBody)
body := moleBody[bodyIdx]
moleWidth := 15
maxPos := termWidth - moleWidth
@@ -137,18 +83,8 @@ func getMoleFrame(animFrame int, termWidth int) string {
padding := strings.Repeat(" ", pos)
var lines []string
if isChristmas {
for i, line := range body {
if i < 3 {
lines = append(lines, padding+hatStyle.Render(line))
} else {
lines = append(lines, padding+line)
}
}
} else {
for _, line := range body {
lines = append(lines, padding+line)
}
for _, line := range body {
lines = append(lines, padding+line)
}
return strings.Join(lines, "\n")