Skip to content

Commit

Permalink
Fix UI and icon display (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed May 5, 2020
1 parent b7c9069 commit 4c3f8a0
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 30 deletions.
5 changes: 3 additions & 2 deletions assets/ico/site.webmanifest
@@ -1,14 +1,15 @@
{
"start_url": "../#",
"name": "EV Charge Controller",
"short_name": "EV Charge Controller",
"icons": [
{
"src": "ico/android-chrome-192x192.png",
"src": "android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "ico/android-chrome-512x512.png",
"src": "android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
Expand Down
12 changes: 6 additions & 6 deletions assets/index.html
Expand Up @@ -40,7 +40,7 @@

<div id="app">
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="https://github.com/andig/evcc"><i class="text-primary far fa-leaf mr-2"></i>evcc</a>
<a class="navbar-brand" href="https://github.com/andig/evcc"><i class="text-primary fas fa-leaf mr-2"></i>evcc</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup"
aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
Expand All @@ -62,7 +62,7 @@
<div id="error">
<div class="toast" data-delay="2000" style="position: absolute; top: 4rem; right: 0.5rem;">
<div class="toast-header">
<strong class="mr-auto"><i class="text-danger far fa-exclamation-triangle"></i> Error</strong>
<strong class="mr-auto"><i class="text-danger fas fa-exclamation-triangle"></i> Error</strong>
<small v-if="error.status">HTTP {{error.status}}</small>
<button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
<span aria-hidden="true">&times;</span>
Expand Down Expand Up @@ -154,7 +154,7 @@ <h4 class="my-0 font-weight-normal">Wallbox</h4>
<h2 class="card-title pricing-card-title">
{{fmt(state.chargePower)}} <small class="text-muted">{{fmtUnit(state.chargePower)}}W</small>
</h2>
<p>Ladeleistung <i class="text-primary far fa-leaf" v-if="state.chargePower"></i></p>
<p>Ladeleistung <i class="text-primary fas fa-leaf" v-if="state.chargePower"></i></p>
</div>
</div>
</div>
Expand All @@ -170,10 +170,10 @@ <h4 class="my-0 font-weight-normal">Netz</h4>
<h2 class="card-title pricing-card-title">{{fmt(state.gridPower)}} <small
class="text-muted">{{fmtUnit(state.gridPower)}}W</small></h2>
<p v-if="state.gridPower > 0">
Bezug <i class="text-primary far fa-arrow-down"></i>
Bezug <i class="text-primary fas fa-arrow-down"></i>
</p>
<p v-else>
Einspeisung <i class="text-primary far fa-arrow-up"></i>
Einspeisung <i class="text-primary fas fa-arrow-up"></i>
</p>
</div>
</div>
Expand All @@ -190,7 +190,7 @@ <h4 class="my-0 font-weight-normal">PV</h4>
<h2 class="card-title pricing-card-title">
{{fmt(state.pvPower)}} <small class="text-muted">{{fmtUnit(state.pvPower)}}W</small>
</h2>
<p>Erzeugung <i class="text-primary far fas fa-sun" v-if="false"></i></p>
<p>Erzeugung <i class="text-primary fas fas fa-sun" v-if="false"></i></p>
</div>
</div>
</div>
Expand Down
38 changes: 19 additions & 19 deletions server/assets.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions server/socket.go
Expand Up @@ -85,12 +85,13 @@ func NewSocketHub() *SocketHub {
func (h *SocketHub) encode(v core.Param) ([]byte, error) {
var s string
switch val := v.Val.(type) {
case string:
case time.Duration:
// must be before stringer to convert to seconds instead of string
s = fmt.Sprintf("{\"%s\": %d}", v.Key, int64(val.Seconds()))
case fmt.Stringer, string:
s = fmt.Sprintf("{\"%s\": \"%s\"}", v.Key, val)
case float64:
s = fmt.Sprintf("{\"%s\": %.3f}", v.Key, val)
case time.Duration:
s = fmt.Sprintf("{\"%s\": %d}", v.Key, int64(val.Seconds()))
default:
s = fmt.Sprintf("{\"%s\": %v}", v.Key, val)
}
Expand Down

0 comments on commit 4c3f8a0

Please sign in to comment.