Files
nib-v1/internal/display/glyph.go
T
lerko 2b177eeae9 feat(cards): add 'note' card type for readable markdown content
New card type renders body as styled markdown with no copy/fill/run
affordance. Glyph: ¶, color: --note.

Migration uses transaction to safely rebuild table constraint.
Checks both 'note' presence and modified_at column to catch
partial migration state.
2026-05-17 12:49:43 -04:00

39 lines
707 B
Go

package display
import "github.com/lerko/nib/internal/db"
var glyphMap = map[db.Glyph]string{
db.GlyphNote: "—",
db.GlyphTodo: "○",
db.GlyphEvent: "◇",
db.GlyphReminder: "△",
}
var cardGlyphMap = map[db.CardType]string{
db.CardSnippet: "◆",
db.CardTemplate: "◈",
db.CardChecklist: "☐",
db.CardDecision: "⚖",
db.CardLink: "↗",
db.CardNote: "¶",
}
func DisplayGlyph(glyph db.Glyph, cardType *db.CardType) string {
if cardType != nil {
if g, ok := cardGlyphMap[*cardType]; ok {
return g
}
}
if g, ok := glyphMap[glyph]; ok {
return g
}
return "—"
}
func FormatID(id string) string {
if len(id) > 12 {
return id[:12]
}
return id
}