Skip to content

Commit f5c184a

Browse files
committed
Add power
1 parent 118f27f commit f5c184a

2 files changed

Lines changed: 49 additions & 30 deletions

File tree

surfline/urls.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ async def fetch_waves(self):
192192
"primary_swell_size": swells[0]["height"],
193193
"primary_swell_period": swells[0]["period"],
194194
"primary_swell_direction": swells[0]["direction"],
195+
"power": d["power"],
195196
}
196197
)
197198
return res

templates/surfline.html

Lines changed: 48 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -31,38 +31,56 @@
3131
<div>
3232
<table>
3333
{% for wind, wave in wind_and_waves %}
34-
<tr>
35-
{% if wind.break %}
34+
{% if wind.break %}
35+
<tr>
3636
<td colspan="7">{{ wind.date | date:"l, M j" }}</td>
37-
{% else %}
38-
<td style="padding: 0px 0px;
39-
width: 12px;
40-
transform: rotate(-90deg);
41-
font-size: 10px">{{ wind.date | date:"H:i" }}</td>
42-
<td style="padding: 10px 8px;
43-
font-size: 12px;
44-
text-align: center;
45-
background-color: #58B0E1;
46-
color: white">{{ wave.min|floatformat:"1" }}-{{ wave.max| floatformat:"1" }}m</td>
47-
<td style="padding: 10px 8px; line-height: 12px;">
48-
<strong>{{ wave.primary_swell_size | floatformat:"1" }}</strong>m
49-
</td>
50-
<td style="padding: 10px 8px; font-size: 12px;">
51-
<strong>{{ wave.primary_swell_period }}</strong>s
37+
</tr>
38+
<tr>
39+
<td></td>
40+
<td style="text-align: center;">Swell(m)</td>
41+
<td style="text-align: center;">Primary Swell</td>
42+
<td style="text-align: center;" colspan="2">Wind</td>
43+
</tr>
44+
{% else %}
45+
<tr>
46+
<td style="padding: 0px 0px; width: 12px; font-size: 10px">{{ wind.date | date:"G:i" }}</td>
47+
<td style="">
48+
<div style="text-align: center;">{{ wave.min|floatformat:"1" }}-{{ wave.max| floatformat:"1" }}m</div>
5249
</td>
53-
<td style="padding: 10px 8px; text-align: center; line-height: 18px;">
54-
<div style="transform: rotate(calc({{ wave.primary_swell_direction | floatformat:"0" }}deg - 270deg))"></div>
55-
<span style="font-size:10px;">{{ wave.primary_swell_direction | floatformat:"0" }}°</span>
50+
<td style="padding: 10px 8px;
51+
line-height: 36px;
52+
display: flex;
53+
justify-content: space-evenly">
54+
<div>
55+
<strong class="margin: 0px 10px">{{ wave.primary_swell_size | floatformat:"1" }}</strong><span style="font-size:12px">m</span>
56+
</div>
57+
<div>
58+
<strong>{{ wave.primary_swell_period }}</strong><span style="font-size: 12px;">s</span>
59+
</div>
60+
<div>
61+
<strong>{{ wave.power|floatformat:"0" }}</strong><span style="font-size: 12px;">kJ</span>
62+
</div>
63+
<div style="text-align: center; line-height: 18px; display: inline-block;">
64+
<div style="transform: rotate(calc({{ wave.primary_swell_direction | floatformat:"0" }}deg - 270deg))"></div>
65+
<span style="font-size:10px;">{{ wave.primary_swell_direction | floatformat:"0" }}°</span>
66+
</div>
5667
</td>
5768
<td style="padding: 10px 8px;">
58-
<div style="float: left; font-size: 12px; font-weight: bold;">{{ wind.speed|floatformat:"0" }}</div>
59-
<div style="padding: 0px 0px 0px 4px;
60-
float: left;
61-
font-size:8px;
62-
line-height: 8px">
63-
{{ wind.gust|floatformat:"0" }}
64-
<br>
65-
kph
69+
<div style="display: flex; justify-content: flex-end;">
70+
<div style="float: left;
71+
font-size: 16px;
72+
font-weight: bold;
73+
display: inline-block">{{ wind.speed|floatformat:"0" }}</div>
74+
<div style="padding: 0px 0px 0px 4px;
75+
float: left;
76+
font-size:8px;
77+
line-height: 8px;
78+
text-align: right;
79+
display: inline-block">
80+
{{ wind.gust|floatformat:"0" }}
81+
<br>
82+
kph
83+
</div>
6684
</div>
6785
</td>
6886
<td style="padding: 10px 8px;
@@ -74,8 +92,8 @@
7492
<span style="font-size: 10px">{{ wind.direction_type | title }}</span>
7593
</td>
7694
<!-- D8833B -->
77-
{% endif %}
78-
</tr>
95+
</tr>
96+
{% endif %}
7997
{% endfor %}
8098
</table>
8199
</div>

0 commit comments

Comments
 (0)