add lint js

This commit is contained in:
Romulus21
2024-03-06 09:42:12 +01:00
parent 2de7c78344
commit 115d597a09
26 changed files with 479 additions and 163 deletions

View File

@@ -9,7 +9,6 @@ const Weather = () => {
const [currentWeather, setCurrentWeather] = useState<WeatherValue|null>(null)
const [fetchTime, setFetchTime] = useState(0)
const [count, setCount] = useState(0)
const [weatherDays, setWeatherDays] = useState<[string, WeatherValue[]][]|null>(null)
const {loading, setLoading, errorLabel, errorCatch, cleanErrors, axiosGet} = useAxiosTools()
@@ -31,9 +30,9 @@ const Weather = () => {
const res = await axiosGet(`/api/weather`)
const currentWeather = res.data.list[0]
let weatherDays: [string, WeatherValue[]][] = []
const weatherDays: [string, WeatherValue[]][] = []
let objectEntries = {index: -1, date: ''}
res.data.list.forEach((item: WeatherValue, index: number) => {
res.data.list.forEach((item: WeatherValue) => {
const date = item.dt_txt.split(' ')[0]
if (date === (new Date).toSQLDate()) {
@@ -70,7 +69,7 @@ const Weather = () => {
{errorLabel()}
<Card className="flex justify-between">
<div className="flex flex-col m-2 justify-between">
<div className="m-2 flex flex-col justify-between">
<span className="text-6xl">{currentWeather?.main.temp.toFixed()} °C</span>
<span className="text-secondary dark:text-secondary-ligth">{currentWeather?.weather[0].description}</span>
</div>
@@ -81,9 +80,9 @@ const Weather = () => {
{currentWeather && <Img src={`images/icons/${currentWeather?.weather[0].icon}.svg`}
alt={currentWeather?.weather[0].main} width="120px" />}
</div>
<div className="flex gap-1 flex-col">
<span className="text-4xl pt-5">{currentWeather?.main.temp_max.toFixed()} <span className="text-2xl">°C</span></span>
<span className="text-secondary text-2xl mt-2 dark:text-secondary-ligth">{currentWeather?.main.temp_min.toFixed()} °C</span>
<div className="flex flex-col gap-1">
<span className="pt-5 text-4xl">{currentWeather?.main.temp_max.toFixed()} <span className="text-2xl">°C</span></span>
<span className="mt-2 text-2xl text-secondary dark:text-secondary-ligth">{currentWeather?.main.temp_min.toFixed()} °C</span>
</div>
</div>
</Card>
@@ -108,7 +107,7 @@ const WeatherCard: FC<{date: string, values: WeatherValue[]}> = ({date, values=
icon: '',
description: '',
}
const result: {[k: string]: number} = {}
const result: Record<string, number> = {}
values.forEach(value => {
if (value.main.temp_min < weatherState.min) {
weatherState.min = value.main.temp_min
@@ -144,17 +143,17 @@ const WeatherCard: FC<{date: string, values: WeatherValue[]}> = ({date, values=
}, [])
return <div className="flex gap-5">
<div className="flex flex-col gap-2 flex-1 h-full">
<span className="font-bold text-lg" title={(new Date(date)).toLocaleDateString()}>{(new Date(date)).getWeekDay()}</span>
<div className="flex h-full flex-1 flex-col gap-2">
<span className="text-lg font-bold" title={(new Date(date)).toLocaleDateString()}>{(new Date(date)).getWeekDay()}</span>
<span className="text-secondary dark:text-secondary-ligth">{weatherState?.description}</span>
</div>
<div className="flex items-center -mt-1.5">
<div className="-mt-1.5 flex items-center">
<Img src={`images/icons/${weatherState?.icon}.svg`}
alt={weatherState?.main + ' ' + weatherState?.icon}
width="80px" />
</div>
<div className="flex gap-1 flex-col">
<div className="flex flex-col gap-1">
<span className="text-lg">{weatherState?.max.toFixed()} °C</span>
<span className="text-secondary dark:text-secondary-ligth">{weatherState?.min.toFixed()} °C</span>
</div>