mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
refactor: redesign login page
refactor: redesign signup page refactor: redesign summary page
This commit is contained in:
@ -55,8 +55,6 @@ type SummaryViewModel struct {
|
||||
User *User
|
||||
AvatarURL string
|
||||
LanguageColors map[string]string
|
||||
EditorColors map[string]string
|
||||
OSColors map[string]string
|
||||
Error string
|
||||
Success string
|
||||
ApiKey string
|
||||
@ -225,6 +223,27 @@ func (s *Summary) TotalTimeByFilters(filters *Filters) time.Duration {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (s *Summary) MaxBy(entityType uint8) *SummaryItem {
|
||||
var max *SummaryItem
|
||||
mappedItems := s.MappedItems()
|
||||
if items := mappedItems[entityType]; len(*items) > 0 {
|
||||
for _, item := range *items {
|
||||
if max == nil || item.Total > max.Total {
|
||||
max = item
|
||||
}
|
||||
}
|
||||
}
|
||||
return max
|
||||
}
|
||||
|
||||
func (s *Summary) MaxByToString(entityType uint8) string {
|
||||
max := s.MaxBy(entityType)
|
||||
if max == nil {
|
||||
return "-"
|
||||
}
|
||||
return max.Key
|
||||
}
|
||||
|
||||
func (s *Summary) WithResolvedAliases(resolve AliasResolver) *Summary {
|
||||
processAliases := func(origin []*SummaryItem) []*SummaryItem {
|
||||
target := make([]*SummaryItem, 0)
|
||||
|
Reference in New Issue
Block a user