Commit dd9e24fa by asranov0003

fix: translate text select device

parent 3a26228b
...@@ -94,6 +94,7 @@ const Header: React.FC = () => { ...@@ -94,6 +94,7 @@ const Header: React.FC = () => {
disabled={!devices.length} disabled={!devices.length}
style={{ width: "220px" }} style={{ width: "220px" }}
className="header__device-select" className="header__device-select"
placeholder={t("common.selectDevice")}
/> />
</div> </div>
</div> </div>
......
...@@ -9,6 +9,7 @@ import { ...@@ -9,6 +9,7 @@ import {
import CDeviceSelect from "../../components/CDeviceSelect"; import CDeviceSelect from "../../components/CDeviceSelect";
import { setSelectedDevice } from "../../stores/slices/deviceSlice"; import { setSelectedDevice } from "../../stores/slices/deviceSlice";
import { BiArrowBack } from "react-icons/bi"; import { BiArrowBack } from "react-icons/bi";
import { useTranslation } from "react-i18next";
interface SectionHeaderProps { interface SectionHeaderProps {
to?: string; to?: string;
...@@ -20,6 +21,7 @@ const SectionHeader: React.FC<SectionHeaderProps> = ({ to }) => { ...@@ -20,6 +21,7 @@ const SectionHeader: React.FC<SectionHeaderProps> = ({ to }) => {
); );
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const navigate = useNavigate(); const navigate = useNavigate();
const { t } = useTranslation();
const handleNavigate = (e: React.MouseEvent) => { const handleNavigate = (e: React.MouseEvent) => {
if (!to) { if (!to) {
...@@ -35,7 +37,7 @@ const SectionHeader: React.FC<SectionHeaderProps> = ({ to }) => { ...@@ -35,7 +37,7 @@ const SectionHeader: React.FC<SectionHeaderProps> = ({ to }) => {
onClick={handleNavigate} onClick={handleNavigate}
className="sectionheader__link" className="sectionheader__link"
> >
<BiArrowBack className="sectionheader__link__icon"/> <BiArrowBack className="sectionheader__link__icon" />
</Link> </Link>
<CDeviceSelect <CDeviceSelect
...@@ -45,6 +47,7 @@ const SectionHeader: React.FC<SectionHeaderProps> = ({ to }) => { ...@@ -45,6 +47,7 @@ const SectionHeader: React.FC<SectionHeaderProps> = ({ to }) => {
disabled={!devices.length} disabled={!devices.length}
style={{ width: "220px" }} style={{ width: "220px" }}
className="header__device-select" className="header__device-select"
placeholder={t("common.selectDevice")}
/> />
</div> </div>
); );
......
...@@ -12,7 +12,8 @@ ...@@ -12,7 +12,8 @@
"to": "To", "to": "To",
"confirm": "Confirm", "confirm": "Confirm",
"password": "Password", "password": "Password",
"passwordPlaceholder": "Enter your password" "passwordPlaceholder": "Enter your password",
"selectDevice": "Select Device"
}, },
"auth": { "auth": {
"entrance": "Sign In", "entrance": "Sign In",
......
...@@ -12,7 +12,8 @@ ...@@ -12,7 +12,8 @@
"to": "До", "to": "До",
"confirm": "Подтвердить", "confirm": "Подтвердить",
"password": "Пароль", "password": "Пароль",
"passwordPlaceholder": "Введите ваш пароль" "passwordPlaceholder": "Введите ваш пароль",
"selectDevice": "Выбрать устройство"
}, },
"auth": { "auth": {
"entrance": "Вход", "entrance": "Вход",
......
...@@ -17,7 +17,7 @@ interface IDeviceState { ...@@ -17,7 +17,7 @@ interface IDeviceState {
selectedDevice: IDevice | null; selectedDevice: IDevice | null;
loadingDevices: boolean; loadingDevices: boolean;
errorDevices: string; errorDevices: string;
isFetched: boolean isFetched: boolean;
} }
const initialState: IDeviceState = { const initialState: IDeviceState = {
...@@ -26,7 +26,7 @@ const initialState: IDeviceState = { ...@@ -26,7 +26,7 @@ const initialState: IDeviceState = {
selectedDevice: null, selectedDevice: null,
loadingDevices: false, loadingDevices: false,
errorDevices: "", errorDevices: "",
isFetched: false isFetched: false,
}; };
export const fetchDevices = createAsyncThunk( export const fetchDevices = createAsyncThunk(
...@@ -83,18 +83,18 @@ const deviceSlice = createSlice({ ...@@ -83,18 +83,18 @@ const deviceSlice = createSlice({
builder builder
.addCase(fetchDevices.pending, (state) => { .addCase(fetchDevices.pending, (state) => {
state.loadingDevices = true; state.loadingDevices = true;
state.isFetched = false; state.isFetched = false;
}) })
.addCase(fetchDevices.fulfilled, (state, action) => { .addCase(fetchDevices.fulfilled, (state, action) => {
state.loadingDevices = false; state.loadingDevices = false;
state.devices = action.payload; state.devices = action.payload;
state.selectedDevice = action.payload[0] ?? null; state.selectedDevice = action.payload[0] ?? null;
state.isFetched = true; state.isFetched = true;
}) })
.addCase(fetchDevices.rejected, (state, action) => { .addCase(fetchDevices.rejected, (state, action) => {
state.loadingDevices = false; state.loadingDevices = false;
state.errorDevices = action.payload as string; state.errorDevices = action.payload as string;
state.isFetched = false; state.isFetched = false;
}) })
.addCase(fetchDeviceData.fulfilled, (state, action) => { .addCase(fetchDeviceData.fulfilled, (state, action) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment