2b177eeae9
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.
39 lines
707 B
Go
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
|
|
}
|