forked from tangled.org/core
Monorepo for Tangled — https://tangled.org
1package models 2 3import ( 4 "time" 5 6 "github.com/bluesky-social/indigo/atproto/syntax" 7) 8 9type ReactionKind string 10 11const ( 12 Like ReactionKind = "👍" 13 Unlike ReactionKind = "👎" 14 Laugh ReactionKind = "😆" 15 Celebration ReactionKind = "🎉" 16 Confused ReactionKind = "🫤" 17 Heart ReactionKind = "❤️" 18 Rocket ReactionKind = "🚀" 19 Eyes ReactionKind = "👀" 20) 21 22func (rk ReactionKind) String() string { 23 return string(rk) 24} 25 26var OrderedReactionKinds = []ReactionKind{ 27 Like, 28 Unlike, 29 Laugh, 30 Celebration, 31 Confused, 32 Heart, 33 Rocket, 34 Eyes, 35} 36 37func ParseReactionKind(raw string) (ReactionKind, bool) { 38 k, ok := (map[string]ReactionKind{ 39 "👍": Like, 40 "👎": Unlike, 41 "😆": Laugh, 42 "🎉": Celebration, 43 "🫤": Confused, 44 "❤️": Heart, 45 "🚀": Rocket, 46 "👀": Eyes, 47 })[raw] 48 return k, ok 49} 50 51type Reaction struct { 52 ReactedByDid string 53 ThreadAt syntax.ATURI 54 Created time.Time 55 Rkey string 56 Kind ReactionKind 57} 58 59type ReactionDisplayData struct { 60 Count int 61 Users []string 62}