Empty sections will be hidden from guests. Fixed temperature value rounding. Added welcome message

This commit is contained in:
Paweł Malak
2021-11-22 12:29:47 +01:00
parent 882f011d07
commit d110d9b732
11 changed files with 80 additions and 71 deletions

View File

@@ -1,4 +1,4 @@
import { FormEvent, Fragment, useEffect, useState } from 'react';
import { FormEvent, Fragment, useEffect, useState, useRef } from 'react';
// Redux
import { useSelector, useDispatch } from 'react-redux';
@@ -23,6 +23,12 @@ export const AuthForm = (): JSX.Element => {
duration: '14d',
});
const passwordInputRef = useRef<HTMLInputElement>(null);
useEffect(() => {
passwordInputRef.current?.focus();
}, []);
useEffect(() => {
if (token) {
const decoded = decodeToken(token);
@@ -52,6 +58,7 @@ export const AuthForm = (): JSX.Element => {
name="password"
placeholder="••••••"
autoComplete="current-password"
ref={passwordInputRef}
value={formData.password}
onChange={(e) =>
setFormData({ ...formData, password: e.target.value })