This commit is contained in:
Robert Janetzko 2022-04-29 09:31:05 +00:00
parent 572d676fb3
commit 9c2a1c3b97
13 changed files with 129 additions and 11 deletions

View File

@ -63,14 +63,14 @@ func (c *Context) hfListRelated(ids []int, to int) string {
func (c *Context) artifact(id int) string {
if x, ok := c.World.Artifacts[id]; ok {
return fmt.Sprintf(`<a class="artifact" href="/artifact/%d">%s</a>`, x.Id(), util.Title(x.Name()))
return fmt.Sprintf(`<a class="artifact" href="/artifact/%d"><i class="%s fa-xs"></i>&nbsp;%s</a>`, x.Id(), x.Icon(), util.Title(x.Name()))
}
return "UNKNOWN ARTIFACT"
}
func (c *Context) entity(id int) string {
if x, ok := c.World.Entities[id]; ok {
return fmt.Sprintf(`<a class="entity" href="/entity/%d">%s</a>`, x.Id(), util.Title(x.Name()))
return fmt.Sprintf(`<a class="entity" href="/entity/%d"><i class="%s fa-xs"></i>&nbsp;%s</a>`, x.Id(), x.Icon(), util.Title(x.Name()))
}
return "UNKNOWN ENTITY"
}
@ -104,7 +104,7 @@ func (c *Context) siteStructure(siteId, structureId int, prefix string) string {
func (c *Context) site(id int, prefix string) string {
if x, ok := c.World.Sites[id]; ok {
return fmt.Sprintf(`%s <a class="site" href="/site/%d">%s</a>`, prefix, x.Id(), util.Title(x.Name()))
return fmt.Sprintf(`%s <a class="site" href="/site/%d"><i class="%s fa-xs"></i>&nbsp;%s</a>`, prefix, x.Id(), x.Icon(), util.Title(x.Name()))
}
return "UNKNOWN SITE"
}
@ -180,28 +180,28 @@ func (c *Context) fullIdentity(id int) string {
func (c *Context) danceForm(id int) string {
if x, ok := c.World.DanceForms[id]; ok {
return fmt.Sprintf(`<a class="artform" href="/danceForm/%d">%s</a>`, id, util.Title(x.Name()))
return fmt.Sprintf(`<a class="artform" href="/danceForm/%d"><i class="fa-solid fa-shoe-prints fa-xs"></i>&nbsp;%s</a>`, id, util.Title(x.Name()))
}
return "UNKNOWN DANCE FORM"
}
func (c *Context) musicalForm(id int) string {
if x, ok := c.World.MusicalForms[id]; ok {
return fmt.Sprintf(`<a class="artform" href="/musicalForm/%d">%s</a>`, id, util.Title(x.Name()))
return fmt.Sprintf(`<a class="artform" href="/musicalForm/%d"><i class="fa-solid fa-music fa-xs"></i>&nbsp;%s</a>`, id, util.Title(x.Name()))
}
return "UNKNOWN MUSICAL FORM"
}
func (c *Context) poeticForm(id int) string {
if x, ok := c.World.PoeticForms[id]; ok {
return fmt.Sprintf(`<a class="artform" href="/poeticForm/%d">%s</a>`, id, util.Title(x.Name()))
return fmt.Sprintf(`<a class="artform" href="/poeticForm/%d"><i class="fa-solid fa-comment-dots fa-xs"></i>&nbsp;%s</a>`, id, util.Title(x.Name()))
}
return "UNKNOWN POETIC FORM"
}
func (c *Context) worldConstruction(id int) string {
if x, ok := c.World.WorldConstructions[id]; ok {
return fmt.Sprintf(`<a class="artform" href="/wc/%d">%s</a>`, id, util.Title(x.Name()))
return fmt.Sprintf(`<a class="worldconstruction" href="/wc/%d"><i class="%s fa-xs"></i>&nbsp;%s</a>`, id, x.Icon(), util.Title(x.Name()))
}
return "UNKNOWN WORLD CONSTRUCTION"
}

View File

@ -49,7 +49,18 @@ func (w *DfWorld) EventsMatching(f func(HistoricalEventDetails) bool) []*Histori
}
func (e *Artifact) Type() string {
return e.ItemType
switch e.ItemSubtype {
case "scroll":
return "scroll"
}
switch e.ItemType {
case "weapon", "tool", "book", "slab":
return e.ItemType
case "armor", "shoe", "gloves", "helm", "pants":
return "armor"
default:
return "item"
}
}
func (e *Entity) Type() string {

98
backend/model/icons.go Normal file
View File

@ -0,0 +1,98 @@
package model
func (x *Entity) Icon() string {
switch x.Type_ {
case EntityType_Civilization:
return "fa-solid fa-star"
case EntityType_Guild:
return "fa-solid fa-wrench"
case EntityType_Merchantcompany:
return "fa-solid fa-coins"
case EntityType_Migratinggroup:
return "fa-solid fa-person-hiking"
case EntityType_Militaryunit:
return "fa-solid fa-chess-knight"
case EntityType_Nomadicgroup:
return "fa-solid fa-tent"
case EntityType_Outcast:
return "fa-solid fa-campground"
case EntityType_Performancetroupe:
return "fa-solid fa-guitar"
case EntityType_Religion:
return "fa-solid fa-building-columns"
case EntityType_Sitegovernment:
return "fa-solid fa-scale-balanced"
}
return "fa-solid fa-star"
}
func (x *Site) Icon() string {
switch x.Type_ {
case SiteType_Camp:
return "fa-solid fa-campground"
case SiteType_Castle, SiteType_DarkFortress, SiteType_Fort, SiteType_Fortress:
return "fa-brands fa-fort-awesome"
case SiteType_Cave:
return "fa-solid fa-mound"
case SiteType_DarkPits:
return "fa-solid fa-square"
case SiteType_ForestRetreat:
return "fa-solid fa-tree-city"
case SiteType_Hamlet, SiteType_Hillocks:
return "fa-solid fa-home"
case SiteType_ImportantLocation:
return "fa-solid fa-monument"
case SiteType_Labyrinth:
return "fa-solid fa-border-all"
case SiteType_Lair:
return "fa-solid fa-paw"
case SiteType_Monastery:
return "fa-solid fa-building-columns"
case SiteType_MountainHalls:
return "fa-solid fa-mountain-city"
case SiteType_Shrine:
return "fa-solid fa-landmark-dome"
case SiteType_Tomb:
return "fa-solid fa-circle-stop"
case SiteType_Town:
return "fa-solid fa-city"
case SiteType_Tower:
return "fa-solid fa-chess-rook"
case SiteType_Vault:
return "fa-solid fa-vault"
}
return ""
}
func (x *WorldConstruction) Icon() string {
switch x.Type_ {
case WorldConstructionType_Bridge:
return "fa-solid fa-bridge"
case WorldConstructionType_Road:
return "fa-solid fa-road"
case WorldConstructionType_Tunnel:
return "fa-solid fa-archway"
}
return ""
}
func (e *Artifact) Icon() string {
switch e.ItemSubtype {
case "scroll":
return "fa-solid fa-scroll"
}
switch e.ItemType {
case "weapon":
return "fa-solid fa-baseball-bat-ball"
case "tool":
return "fa-solid fa-wrench"
case "book":
return "fa-solid fa-book"
case "slab":
return "fa-solid fa-square"
case "armor", "shoe", "gloves", "helm", "pants", "shield":
return "fa-solid fa-shield"
default:
return "fa-solid fa-circle"
}
}

View File

@ -262,7 +262,9 @@ func grouped[T namedTyped](input map[int]T) map[string][]T {
for _, v := range input {
k := v.Type()
output[k] = append(output[k], v)
if v.Name() != "" {
output[k] = append(output[k], v)
}
}
for _, v := range output {

6
backend/static/css/all.min.css vendored Normal file

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -19,12 +19,12 @@
<table>
<tr>
<th width="100%">Name</th>
<th>Size</th>
<th>Type</th>
</tr>
{{- range $v }}{{- if not (eq .Name "") }}
<tr>
<td>{{ artifact .Id }}</td>
<td></td>
<td>{{ if eq $t "item"}}{{.ItemType}}{{else}}{{.ItemSubtype}}{{end}}</td>
</tr>
{{- end}}{{- end}}
</table>

View File

@ -8,6 +8,7 @@
<title>{{block "title" .}}{{end}}</title>
<link href="/css/bootstrap.min.css" rel="stylesheet">
<link href="/css/bootstrap-icons.css" rel="stylesheet">
<link href="/css/all.min.css" rel="stylesheet">
<link href="/css/legends.css" rel="stylesheet">
<script src="/js/jquery-3.6.0.min.js"></script>
<script src="/js/bootstrap.min.js"></script>