@vixoniccom/aqi 0.0.1-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierrc +8 -0
- package/CHANGELOG.md +14 -0
- package/LICENSE.md +15 -0
- package/README.md +29 -0
- package/build/index.html +11 -0
- package/build/main.js +1 -0
- package/build.zip +0 -0
- package/configuration/appeareanceGroup/AppeareanceInputs.ts +75 -0
- package/configuration/appeareanceGroup/index.ts +8 -0
- package/configuration/index.ts +8 -0
- package/configuration.json +123 -0
- package/icon.png +0 -0
- package/package.json +35 -0
- package/src/App.tsx +114 -0
- package/src/components/Card.tsx +43 -0
- package/src/components/FontLoader.tsx +41 -0
- package/src/components/FormattedText.tsx +81 -0
- package/src/index.html +11 -0
- package/src/main.ts +27 -0
- package/src/parameters.d.ts +9 -0
- package/src/test/downloads/123.ttf +0 -0
- package/src/test/downloads/7953953c-7029-4730-ae4d-cff4abd5288f.ttf +0 -0
- package/src/test/downloads/Earthquakes.png +0 -0
- package/src/test/downloads/c705a739-312e-4334-9231-e73a05e9d382.ttf +0 -0
- package/src/test/downloads/futura-font.ttf +0 -0
- package/src/test/parameters.json +34 -0
- package/src/types.d.ts +80 -0
- package/src/utils.ts +31 -0
- package/tsconfig.json +37 -0
package/src/types.d.ts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
export interface AirQuality {
|
|
2
|
+
status: 'ok' | 'error' | number
|
|
3
|
+
data: Data
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface StorageData {
|
|
7
|
+
item: AirQuality
|
|
8
|
+
date: Date
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface Data {
|
|
12
|
+
aqi: number
|
|
13
|
+
idx: number
|
|
14
|
+
attributions: Attribution[]
|
|
15
|
+
city: City
|
|
16
|
+
dominentpol: string
|
|
17
|
+
iaqi: Iaqi
|
|
18
|
+
time: Time
|
|
19
|
+
forecast: Forecast
|
|
20
|
+
debug: Debug
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface Attribution {
|
|
24
|
+
url: string
|
|
25
|
+
name: string
|
|
26
|
+
logo?: string
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface City {
|
|
30
|
+
geo: number[]
|
|
31
|
+
name: string
|
|
32
|
+
url: string
|
|
33
|
+
location: string
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface Debug {
|
|
37
|
+
sync: Date
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface Forecast {
|
|
41
|
+
daily: Daily
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface Daily {
|
|
45
|
+
o3: O3[]
|
|
46
|
+
pm10: O3[]
|
|
47
|
+
pm25: O3[]
|
|
48
|
+
uvi: O3[]
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface O3 {
|
|
52
|
+
avg: number
|
|
53
|
+
day: Date
|
|
54
|
+
max: number
|
|
55
|
+
min: number
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface Iaqi {
|
|
59
|
+
co: Co
|
|
60
|
+
dew: Co
|
|
61
|
+
h: Co
|
|
62
|
+
no2: Co
|
|
63
|
+
o3: Co
|
|
64
|
+
p: Co
|
|
65
|
+
pm10: Co
|
|
66
|
+
pm25: Co
|
|
67
|
+
t: Co
|
|
68
|
+
w: Co
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface Co {
|
|
72
|
+
v: number
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface Time {
|
|
76
|
+
s: Date
|
|
77
|
+
tz: string
|
|
78
|
+
v: number
|
|
79
|
+
iso: Date
|
|
80
|
+
}
|
package/src/utils.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const API_RESPONSE_STATUS = {
|
|
2
|
+
OK: "ok",
|
|
3
|
+
ERROR: "error"
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
const assingAirQuality = (magnitude: number): { color: string, quality: string } => {
|
|
7
|
+
let color
|
|
8
|
+
let quality
|
|
9
|
+
if (0 <= magnitude && magnitude <= 50) {
|
|
10
|
+
color = '#009966'
|
|
11
|
+
quality = "Buena"
|
|
12
|
+
} else if (51 <= magnitude && magnitude <= 100) {
|
|
13
|
+
color = '#FFDE33'
|
|
14
|
+
quality = "Moderada"
|
|
15
|
+
} else if (101 <= magnitude && magnitude <= 150) {
|
|
16
|
+
color = '#FF9933'
|
|
17
|
+
quality = "Dañina a grupos sensibles"
|
|
18
|
+
} else if (151 <= magnitude && magnitude <= 200) {
|
|
19
|
+
color = '#CC0033'
|
|
20
|
+
quality = "Dañina a la salud"
|
|
21
|
+
} else if (201 <= magnitude && magnitude <= 300) {
|
|
22
|
+
color = '#660099'
|
|
23
|
+
quality = "Muy dañina a la salud"
|
|
24
|
+
} else {
|
|
25
|
+
color = '#7E0023'
|
|
26
|
+
quality = "Arriesgado"
|
|
27
|
+
}
|
|
28
|
+
return { color, quality }
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { API_RESPONSE_STATUS, assingAirQuality }
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2015",
|
|
4
|
+
"module": "es2015",
|
|
5
|
+
"moduleResolution": "node",
|
|
6
|
+
"jsx": "preserve",
|
|
7
|
+
"allowJs": true,
|
|
8
|
+
"checkJs": true,
|
|
9
|
+
"allowSyntheticDefaultImports": true,
|
|
10
|
+
"emitDecoratorMetadata": true,
|
|
11
|
+
"experimentalDecorators": true,
|
|
12
|
+
"downlevelIteration": true,
|
|
13
|
+
"strict": true,
|
|
14
|
+
"forceConsistentCasingInFileNames": true,
|
|
15
|
+
"noFallthroughCasesInSwitch": true,
|
|
16
|
+
"noImplicitReturns": true,
|
|
17
|
+
"noImplicitAny": true,
|
|
18
|
+
"noImplicitThis": true,
|
|
19
|
+
"noUnusedLocals": true,
|
|
20
|
+
"noUnusedParameters": true,
|
|
21
|
+
"sourceMap": true,
|
|
22
|
+
"types": [
|
|
23
|
+
"node"
|
|
24
|
+
],
|
|
25
|
+
"typeRoots": [
|
|
26
|
+
"./node_modules/@types",
|
|
27
|
+
"./src",
|
|
28
|
+
"./src/global.d.ts"
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
"include": [
|
|
32
|
+
"./src/**/*"
|
|
33
|
+
],
|
|
34
|
+
"exclude": [
|
|
35
|
+
"./node_modules/**/*"
|
|
36
|
+
]
|
|
37
|
+
}
|