PageSourceSearch

https://www.temperatur.nu/assets/PrecipitationCard-BwQjveKn.js

js temperatur.nu collected 2026-10-04 00:30:52 UTC 2,633 bytes, 56 lines download raw bytes

1import{R,r as c,Y as w,j as i,q as s}from"./index-BbkocQAL.js";import{u as E}from"./dashboardRefresh-kLHHuvqm.js";import{c as _}from"./dashboardDataCache-Dfz4Spti.js";import{u as C}from"./useResolvedCoords-zNlV1d7v.js";const S=s.div`
2  height: 100%;
3  display: flex;
4  flex-direction: column;
5  padding: 8px 10px 6px;
6`,m=s.div`
7  display: flex;
8  justify-content: center;
9  align-items: center;
10  height: 100%;
11  font-family: 'Roboto', sans-serif;
12  font-size: 13px;
13  opacity: 0.5;
14`,z=s.div`
15  flex: 1;
16  min-height: 0;
17  display: flex;
18  align-items: flex-end;
19  gap: 2px;
20  padding-bottom: 18px;
21  position: relative;
22`,A=s.div`
23  flex: 1;
24  display: flex;
25  flex-direction: column;
26  align-items: center;
27  justify-content: flex-end;
28  height: 100%;
29  position: relative;
30`,B=s.div`
31  width: 70%;
32  min-width: 4px;
33  max-width: 28px;
34  border-radius: 3px 3px 0 0;
35  background: ${({$value:n})=>n>2?"#2471a3":n>.5?"#5dade2":"#aed6f1"};
36  transition: height 0.3s;
37`,M=s.div`
38  position: absolute;
39  bottom: -16px;
40  font-size: 9px;
41  font-family: 'Roboto', sans-serif;
42  opacity: 0.5;
43  white-space: nowrap;
44`,P=s.div`
45  font-size: 9px;
46  font-family: 'Roboto', sans-serif;
47  opacity: 0.6;
48  margin-bottom: 2px;
49`,T=s.div`
50  font-family: 'Roboto', sans-serif;
51  font-size: 12px;
52  opacity: 0.6;
53  text-align: center;
54  padding-top: 4px;
55  flex-shrink: 0;
56`,F=({card:n,width:L,height:k})=>{const u=E(),l=C(n),[a,h]=c.useState(null),[g,f]=c.useState(!1);c.useEffect(()=>{if(!l)return;const t=new AbortController;return(async()=>{var e,r;try{const o=await _(w,{lat:l.lat,lon:l.lon},{timeout:8e3,signal:t.signal});(r=(e=o.data)==null?void 0:e.properties)!=null&&r.timeseries&&(h(o.data.properties.timeseries),f(!1))}catch{t.signal.aborted||f(!0)}})(),()=>t.abort()},[l,u]);const d=c.useMemo(()=>{var e,r,o;if(!a)return[];const t=[];for(let p=0;p<Math.min(a.length,12);p++){const x=a[p],j=new Date(x.time),b=((o=(r=(e=x.data)==null?void 0:e.next_1_hours)==null?void 0:r.details)==null?void 0:o.precipitation_amount)??0;t.push({hour:j.getHours(),value:b})}return t},[a]);if(g)return i.jsx(m,{children:"Kunde inte hämta nederbördsdata"});if(!a)return i.jsx(m,{children:"Laddar..."});const y=Math.max(...d.map(t=>t.value),1),v=d.reduce((t,e)=>t+e.value,0);return i.jsxs(S,{children:[i.jsx(z,{children:d.map((t,e)=>i.jsxs(A,{children:[t.value>0&&i.jsx(P,{children:t.value.toFixed(1)}),i.jsx(B,{$value:t.value,style:{height:t.value>0?`${Math.max(t.value/y*100,8)}%`:"0%"}}),i.jsx(M,{children:String(t.hour).padStart(2,"0")})]},e))}),i.jsxs(T,{children:["Totalt ",v.toFixed(1)," mm närmaste 12h"]})]})},V=R.memo(F);export{V as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.