Merge branch 'front' into front-greenhouse

This commit is contained in:
mfnefd 2024-12-23 20:50:29 +04:00
commit 1c5313a1d2
13 changed files with 2380 additions and 896 deletions

4
Dockerfile Normal file
View File

@ -0,0 +1,4 @@
FROM docker/whalesay:latest
LABEL Name=cucumber Version=0.0.1
RUN apt-get -y update && apt-get install -y fortunes
CMD ["sh", "-c", "/usr/games/fortune -a | cowsay"]

File diff suppressed because it is too large Load Diff

View File

@ -13,9 +13,12 @@
"antd": "^5.21.6",
"axios": "^1.7.7",
"react": "^18.3.1",
"react-avatar": "^5.0.3",
"react-dom": "^18.2.0",
"react-dropzone": "^14.3.5",
"react-router-dom": "^6.27.0",
"react-scripts": "^5.0.1",
"swagger-typescript-api": "^13.0.23",
"typescript": "^4.9.5",
"web-vitals": "^2.1.4"
},
@ -23,7 +26,8 @@
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"eject": "react-scripts eject",
"gen-api": "swagger-typescript-api -r -o ./src/core/api/ --modular -p "
},
"eslintConfig": {
"extends": [

View File

@ -4,7 +4,7 @@ import IFarm from '../models/IFarm';
import LoginRequest from '../Requests/LoginRequest';
import IRegisterRequest from '../Requests/RegisterRequest';
const API_BASE_URL = 'https://localhost:7113/api';
const API_BASE_URL = 'https://localhost:5124/api';
const getHeaders = (): { [key: string]: string } => {
return {

View File

@ -6,17 +6,19 @@ import {RegisterPage} from './pages/Register';
import {AppLayout} from './components/Layout';
import { ProfilePage } from './pages/Profile';
import { GreenHouseListPage } from './pages/GreenHouseListPage';
import { ReportPage } from './pages/ReportPage';
function App() {
return (
<div className="App">
<Routes>
<Route path="/" element={<AppLayout />}>
<Route index element={<Navigate to="/profile" />} />
<Route index element={<Navigate to="/report" />} />
<Route path="/login" element={<LoginPage />} />
<Route path="/register" element={<RegisterPage />} />
<Route path="/profile" element={<ProfilePage />} />
<Route path="/greenhouses" element={<GreenHouseListPage />} />
<Route path="/report" element={<ReportPage />} />
</Route>
</Routes>

View File

@ -1,7 +1,7 @@
import React from 'react';
import { Link } from 'react-router-dom';
import Title from 'antd/es/typography/Title';
import { LoginOutlined, ProfileOutlined } from '@ant-design/icons';
import { HomeOutlined, LoginOutlined, ProfileOutlined } from '@ant-design/icons';
export function Header () {
return (
@ -15,7 +15,10 @@ export function Header () {
<Link to="/login"><LoginOutlined style={{ fontSize: '24px' }} className="text-white"/></Link>
</li>
<li>
<Link to="/register"><ProfileOutlined style={{ fontSize: '24px', marginRight: '20px'}} className="text-white"/></Link>
<Link to="/profile"><ProfileOutlined style={{ fontSize: '24px', marginRight: '20px'}} className="text-white"/></Link>
</li>
<li>
<Link to="/greenhouses"><HomeOutlined style={{ fontSize: '24px', marginRight: '20px'}} className="text-white"/> </Link>
</li>
</ul>
</nav>

View File

@ -0,0 +1,297 @@
/* eslint-disable */
/* tslint:disable */
/*
* ---------------------------------------------------------------
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
* ## ##
* ## AUTHOR: acacode ##
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
* ---------------------------------------------------------------
*/
import {
Farm,
FarmRequest,
Greenhouse,
GreenhouseInfo,
GreenhouseRequest,
LoginRequest,
RegisterRequest,
ValveRequest,
} from "./data-contracts";
import { ContentType, HttpClient, RequestParams } from "./http-client";
export class Api<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
/**
* No description
*
* @tags Auth
* @name AuthRegisterCreate
* @request POST:/api/Auth/register
* @secure
* @response `200` `void` Success
*/
authRegisterCreate = (data: RegisterRequest, params: RequestParams = {}) =>
this.request<void, any>({
path: `/api/Auth/register`,
method: "POST",
body: data,
secure: true,
type: ContentType.Json,
...params,
});
/**
* No description
*
* @tags Auth
* @name AuthLoginCreate
* @request POST:/api/Auth/login
* @secure
* @response `200` `void` Success
*/
authLoginCreate = (data: LoginRequest, params: RequestParams = {}) =>
this.request<void, any>({
path: `/api/Auth/login`,
method: "POST",
body: data,
secure: true,
type: ContentType.Json,
...params,
});
/**
* No description
*
* @tags Auth
* @name AuthUserList
* @request GET:/api/Auth/user
* @secure
* @response `200` `void` Success
*/
authUserList = (params: RequestParams = {}) =>
this.request<void, any>({
path: `/api/Auth/user`,
method: "GET",
secure: true,
...params,
});
/**
* No description
*
* @tags Farm
* @name UserFarmDetail
* @request GET:/api/user/{userId}/farm
* @secure
* @response `200` `(Farm)[]` Success
*/
userFarmDetail = (userId: number, params: RequestParams = {}) =>
this.request<Farm[], any>({
path: `/api/user/${userId}/farm`,
method: "GET",
secure: true,
format: "json",
...params,
});
/**
* No description
*
* @tags Farm
* @name UserFarmCreate
* @request POST:/api/user/{userId}/farm
* @secure
* @response `200` `Farm` Success
*/
userFarmCreate = (userId: number, data: FarmRequest, params: RequestParams = {}) =>
this.request<Farm, any>({
path: `/api/user/${userId}/farm`,
method: "POST",
body: data,
secure: true,
type: ContentType.Json,
format: "json",
...params,
});
/**
* No description
*
* @tags Farm
* @name UserFarmDetail2
* @request GET:/api/user/{userId}/farm/{farmId}
* @originalName userFarmDetail
* @duplicate
* @secure
* @response `200` `Farm` Success
*/
userFarmDetail2 = (userId: number, farmId: number, params: RequestParams = {}) =>
this.request<Farm, any>({
path: `/api/user/${userId}/farm/${farmId}`,
method: "GET",
secure: true,
format: "json",
...params,
});
/**
* No description
*
* @tags Farm
* @name UserFarmUpdate
* @request PUT:/api/user/{userId}/farm/{farmId}
* @secure
* @response `200` `Farm` Success
*/
userFarmUpdate = (userId: number, farmId: number, data: FarmRequest, params: RequestParams = {}) =>
this.request<Farm, any>({
path: `/api/user/${userId}/farm/${farmId}`,
method: "PUT",
body: data,
secure: true,
type: ContentType.Json,
format: "json",
...params,
});
/**
* No description
*
* @tags Farm
* @name UserFarmDelete
* @request DELETE:/api/user/{userId}/farm/{farmId}
* @secure
* @response `200` `void` Success
*/
userFarmDelete = (userId: number, farmId: number, params: RequestParams = {}) =>
this.request<void, any>({
path: `/api/user/${userId}/farm/${farmId}`,
method: "DELETE",
secure: true,
...params,
});
/**
* No description
*
* @tags Greenhouse
* @name FarmGreenhouseDetail
* @request GET:/api/farm/{farmId}/greenhouse
* @secure
* @response `200` `(GreenhouseInfo)[]` Success
*/
farmGreenhouseDetail = (farmId: number, params: RequestParams = {}) =>
this.request<GreenhouseInfo[], any>({
path: `/api/farm/${farmId}/greenhouse`,
method: "GET",
secure: true,
format: "json",
...params,
});
/**
* No description
*
* @tags Greenhouse
* @name FarmGreenhouseCreate
* @request POST:/api/farm/{farmId}/greenhouse
* @secure
* @response `200` `Greenhouse` Success
*/
farmGreenhouseCreate = (farmId: number, data: GreenhouseRequest, params: RequestParams = {}) =>
this.request<Greenhouse, any>({
path: `/api/farm/${farmId}/greenhouse`,
method: "POST",
body: data,
secure: true,
type: ContentType.Json,
format: "json",
...params,
});
/**
* No description
*
* @tags Greenhouse
* @name FarmGreenhouseDetail2
* @request GET:/api/farm/{farmId}/greenhouse/{greenhouseId}
* @originalName farmGreenhouseDetail
* @duplicate
* @secure
* @response `200` `GreenhouseInfo` Success
*/
farmGreenhouseDetail2 = (farmId: number, greenhouseId: number, params: RequestParams = {}) =>
this.request<GreenhouseInfo, any>({
path: `/api/farm/${farmId}/greenhouse/${greenhouseId}`,
method: "GET",
secure: true,
format: "json",
...params,
});
/**
* No description
*
* @tags Greenhouse
* @name FarmGreenhouseDelete
* @request DELETE:/api/farm/{farmId}/greenhouse/{greenhouseId}
* @secure
* @response `200` `void` Success
*/
farmGreenhouseDelete = (farmId: number, greenhouseId: number, params: RequestParams = {}) =>
this.request<void, any>({
path: `/api/farm/${farmId}/greenhouse/${greenhouseId}`,
method: "DELETE",
secure: true,
...params,
});
/**
* No description
*
* @tags Greenhouse
* @name FarmGreenhouseSettingsDetail
* @request GET:/api/farm/{farmId}/greenhouse/{greenhouseId}/settings
* @secure
* @response `200` `Greenhouse` Success
*/
farmGreenhouseSettingsDetail = (farmId: number, greenhouseId: number, params: RequestParams = {}) =>
this.request<Greenhouse, any>({
path: `/api/farm/${farmId}/greenhouse/${greenhouseId}/settings`,
method: "GET",
secure: true,
format: "json",
...params,
});
/**
* No description
*
* @tags Greenhouse
* @name FarmGreenhouseSettingsUpdate
* @request PUT:/api/farm/{farmId}/greenhouse/{greenhouseId}/settings
* @secure
* @response `200` `Greenhouse` Success
*/
farmGreenhouseSettingsUpdate = (
farmId: number,
greenhouseId: number,
data: GreenhouseRequest,
params: RequestParams = {},
) =>
this.request<Greenhouse, any>({
path: `/api/farm/${farmId}/greenhouse/${greenhouseId}/settings`,
method: "PUT",
body: data,
secure: true,
type: ContentType.Json,
format: "json",
...params,
});
/**
* No description
*
* @tags Valve
* @name FarmGreenhouseWateringCreate
* @request POST:/api/farm/{farmId}/greenhouse/{ghId}/watering
* @secure
* @response `200` `void` Success
*/
farmGreenhouseWateringCreate = (farmId: number, ghId: number, data: ValveRequest, params: RequestParams = {}) =>
this.request<void, any>({
path: `/api/farm/${farmId}/greenhouse/${ghId}/watering`,
method: "POST",
body: data,
secure: true,
type: ContentType.Json,
...params,
});
}

View File

@ -0,0 +1,92 @@
/* eslint-disable */
/* tslint:disable */
/*
* ---------------------------------------------------------------
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
* ## ##
* ## AUTHOR: acacode ##
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
* ---------------------------------------------------------------
*/
export interface Farm {
/** @format int32 */
id?: number;
name?: string | null;
/** @format int32 */
userId?: number;
user?: User;
raspberryIP?: string | null;
}
export interface FarmRequest {
name?: string | null;
raspberryIP?: string | null;
}
export interface Greenhouse {
/** @format int32 */
id?: number;
/** @format int32 */
recomendedTemperature?: number;
wateringMode?: WateringMode;
heatingMode?: HeatingMode;
/** @format int32 */
farmId?: number;
farm?: Farm;
}
export interface GreenhouseInfo {
/** @format int32 */
id?: number;
/** @format int32 */
percentWater?: number;
/** @format int32 */
soilTemperature?: number;
pumpStatus?: boolean;
heatingStatus?: boolean;
autoWateringStatus?: boolean;
}
export interface GreenhouseRequest {
/** @format int32 */
recomendedTemperature?: number;
wateringMode?: WateringMode;
heatingMode?: HeatingMode;
}
/** @format int32 */
export enum HeatingMode {
Value0 = 0,
Value1 = 1,
}
export interface LoginRequest {
email?: string | null;
password?: string | null;
}
export interface RegisterRequest {
name?: string | null;
email?: string | null;
password?: string | null;
}
export interface User {
/** @format int32 */
id?: number;
name?: string | null;
email?: string | null;
password?: string | null;
farms?: Farm[] | null;
}
export interface ValveRequest {
action?: string | null;
}
/** @format int32 */
export enum WateringMode {
Value0 = 0,
Value1 = 1,
}

View File

@ -0,0 +1,220 @@
/* eslint-disable */
/* tslint:disable */
/*
* ---------------------------------------------------------------
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
* ## ##
* ## AUTHOR: acacode ##
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
* ---------------------------------------------------------------
*/
export type QueryParamsType = Record<string | number, any>;
export type ResponseFormat = keyof Omit<Body, "body" | "bodyUsed">;
export interface FullRequestParams extends Omit<RequestInit, "body"> {
/** set parameter to `true` for call `securityWorker` for this request */
secure?: boolean;
/** request path */
path: string;
/** content type of request body */
type?: ContentType;
/** query params */
query?: QueryParamsType;
/** format of response (i.e. response.json() -> format: "json") */
format?: ResponseFormat;
/** request body */
body?: unknown;
/** base url */
baseUrl?: string;
/** request cancellation token */
cancelToken?: CancelToken;
}
export type RequestParams = Omit<FullRequestParams, "body" | "method" | "query" | "path">;
export interface ApiConfig<SecurityDataType = unknown> {
baseUrl?: string;
baseApiParams?: Omit<RequestParams, "baseUrl" | "cancelToken" | "signal">;
securityWorker?: (securityData: SecurityDataType | null) => Promise<RequestParams | void> | RequestParams | void;
customFetch?: typeof fetch;
}
export interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
data: D;
error: E;
}
type CancelToken = Symbol | string | number;
export enum ContentType {
Json = "application/json",
FormData = "multipart/form-data",
UrlEncoded = "application/x-www-form-urlencoded",
Text = "text/plain",
}
export class HttpClient<SecurityDataType = unknown> {
public baseUrl: string = "http://172.18.167.3:5124";
private securityData: SecurityDataType | null = null;
private securityWorker?: ApiConfig<SecurityDataType>["securityWorker"];
private abortControllers = new Map<CancelToken, AbortController>();
private customFetch = (...fetchParams: Parameters<typeof fetch>) => fetch(...fetchParams);
private baseApiParams: RequestParams = {
credentials: "same-origin",
headers: {},
redirect: "follow",
referrerPolicy: "no-referrer",
};
constructor(apiConfig: ApiConfig<SecurityDataType> = {}) {
Object.assign(this, apiConfig);
}
public setSecurityData = (data: SecurityDataType | null) => {
this.securityData = data;
};
protected encodeQueryParam(key: string, value: any) {
const encodedKey = encodeURIComponent(key);
return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`;
}
protected addQueryParam(query: QueryParamsType, key: string) {
return this.encodeQueryParam(key, query[key]);
}
protected addArrayQueryParam(query: QueryParamsType, key: string) {
const value = query[key];
return value.map((v: any) => this.encodeQueryParam(key, v)).join("&");
}
protected toQueryString(rawQuery?: QueryParamsType): string {
const query = rawQuery || {};
const keys = Object.keys(query).filter((key) => "undefined" !== typeof query[key]);
return keys
.map((key) => (Array.isArray(query[key]) ? this.addArrayQueryParam(query, key) : this.addQueryParam(query, key)))
.join("&");
}
protected addQueryParams(rawQuery?: QueryParamsType): string {
const queryString = this.toQueryString(rawQuery);
return queryString ? `?${queryString}` : "";
}
private contentFormatters: Record<ContentType, (input: any) => any> = {
[ContentType.Json]: (input: any) =>
input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input,
[ContentType.Text]: (input: any) => (input !== null && typeof input !== "string" ? JSON.stringify(input) : input),
[ContentType.FormData]: (input: any) =>
Object.keys(input || {}).reduce((formData, key) => {
const property = input[key];
formData.append(
key,
property instanceof Blob
? property
: typeof property === "object" && property !== null
? JSON.stringify(property)
: `${property}`,
);
return formData;
}, new FormData()),
[ContentType.UrlEncoded]: (input: any) => this.toQueryString(input),
};
protected mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams {
return {
...this.baseApiParams,
...params1,
...(params2 || {}),
headers: {
...(this.baseApiParams.headers || {}),
...(params1.headers || {}),
...((params2 && params2.headers) || {}),
},
};
}
protected createAbortSignal = (cancelToken: CancelToken): AbortSignal | undefined => {
if (this.abortControllers.has(cancelToken)) {
const abortController = this.abortControllers.get(cancelToken);
if (abortController) {
return abortController.signal;
}
return void 0;
}
const abortController = new AbortController();
this.abortControllers.set(cancelToken, abortController);
return abortController.signal;
};
public abortRequest = (cancelToken: CancelToken) => {
const abortController = this.abortControllers.get(cancelToken);
if (abortController) {
abortController.abort();
this.abortControllers.delete(cancelToken);
}
};
public request = async <T = any, E = any>({
body,
secure,
path,
type,
query,
format,
baseUrl,
cancelToken,
...params
}: FullRequestParams): Promise<HttpResponse<T, E>> => {
const secureParams =
((typeof secure === "boolean" ? secure : this.baseApiParams.secure) &&
this.securityWorker &&
(await this.securityWorker(this.securityData))) ||
{};
const requestParams = this.mergeRequestParams(params, secureParams);
const queryString = query && this.toQueryString(query);
const payloadFormatter = this.contentFormatters[type || ContentType.Json];
const responseFormat = format || requestParams.format;
return this.customFetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, {
...requestParams,
headers: {
...(requestParams.headers || {}),
...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}),
},
signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null,
body: typeof body === "undefined" || body === null ? null : payloadFormatter(body),
}).then(async (response) => {
const r = response.clone() as HttpResponse<T, E>;
r.data = null as unknown as T;
r.error = null as unknown as E;
const data = !responseFormat
? r
: await response[responseFormat]()
.then((data) => {
if (r.ok) {
r.data = data;
} else {
r.error = data;
}
return r;
})
.catch((e) => {
r.error = e;
return r;
});
if (cancelToken) {
this.abortControllers.delete(cancelToken);
}
if (!response.ok) throw data;
return data;
});
};
}

View File

@ -56,8 +56,13 @@ export function GreenHouseListPage() {
},
{
title: 'Температура',
dataIndex: 'recommendedTemperature',
key: 'recommendedTemperature',
dataIndex: 'Temperature',
key: 'Temperature',
},
{
title: 'Процент влажности',
dataIndex: 'Humidity',
key: 'Humidity',
},
{
title: 'Режим полива',
@ -71,11 +76,25 @@ export function GreenHouseListPage() {
key: 'heatingMode',
render: (text: string) => text === 'Manual' ? 'Вручную' : 'Автоматически',
},
{
title: 'Статус вентиля',
dataIndex: 'ventilationStatus',
key: 'ventilationStatus',
render: (text: string) => text === 'Manual' ? 'Вручную' : 'Автоматически',
},
{
title: 'Статус нагревателя',
dataIndex: 'heatingStatus',
key: 'heatingStatus',
render: (text: string) => text === 'Manual' ? 'Вручную' : 'Автоматически',
},
{
title: 'Действия',
key: 'action',
render: (_: any, record: IGreenhouse) => (
<Space>
<Button>Начать полив</Button>
<Button>Начать нагрев</Button>
<Button onClick={() => handleDelete(record.id)}>Удалить</Button>
<Button onClick={() => handleModalOpen(record)}>Редактировать</Button>
</Space>
@ -106,7 +125,10 @@ export function GreenHouseListPage() {
<Form.Item name="name" label="Название" rules={[{ required: true }]}>
<Input />
</Form.Item>
<Form.Item name="recommendedTemperature" label="Температура">
<Form.Item name="Temperature" label="Температура">
<Input type="number" />
</Form.Item>
<Form.Item name="Humidity" label="Процент влажности">
<Input type="number" />
</Form.Item>
<Form.Item name="wateringMode" label="Режим полива">
@ -121,6 +143,18 @@ export function GreenHouseListPage() {
<Select.Option value="Auto">Автоматически</Select.Option>
</Select>
</Form.Item>
<Form.Item name="ventilationStatus" label="Статус вентиля">
<Select>
<Select.Option value="Manual">Вручную</Select.Option>
<Select.Option value="Auto">Автоматически</Select.Option>
</Select>
</Form.Item>
<Form.Item name="heatingStatus" label="Статус нагревателя">
<Select>
<Select.Option value="Manual">Вручную</Select.Option>
<Select.Option value="Auto">Автоматически</Select.Option>
</Select>
</Form.Item>
</Form>
</Modal>
</div>

View File

@ -1,15 +1,97 @@
import { Navigate } from "react-router-dom";
import { Link, Navigate } from "react-router-dom";
import { Form, Avatar, Button, Input, Typography } from "antd";
import { useId, useState } from "react";
import React from "react";
export function ProfilePage () {
const token = localStorage.getItem('token');
const [hidden, setHidden] = useState(true);
const [name, setName] = useState('Пользователь');
const [email, setEmail] = useState('user@gmail.com');
if (!token) {
return <Navigate to="/login" />;
const Title = () => <Typography.Title style={{ fontSize: '42px', fontWeight: 'bold', marginBottom: '40px', marginTop: '20px'}}>Ваш профиль</Typography.Title>;
const StyledText = ({ children }: { children: React.ReactNode }) => <Typography.Text strong style={{ fontSize: '24px', marginBottom: '20px' }}>{children}</Typography.Text>;
const StyledValue = ({ children }: { children: React.ReactNode }) => <Typography.Text style={{ fontSize: '24px', marginBottom: '20px' }}>{children}</Typography.Text>;
const User = {
id: 1,
name: name,
email: "user@gmail.com",
password: "12345",
}
function onFinish(name: string, email: string) {
setName(name);
setEmail(email);
}
function onLogout() {
localStorage.removeItem('token');
window.location.href = '/login';
}
return (
<div>
<h1 className="PCEtLSBpY29uNjY2LmNvbSAtIE1JTExJT05TIHZlY3RvciBJQ09OUyBGUkVFIC0tPjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIgdmlld0JveD0iMCAwIDUxMiA1MTIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDUxMiA1MTI7IiB4bWw6c3BhY2U9InByZXNlcnZlIj48Zz48Zz48cGF0aCBkPSJNMjU2LDBDMTE0Ljg0MiwwLDAsMTE0Ljg0MiwwLDI1NnMxMTQuODQyLDI1NiwyNTYsMjU2czI1Ni0xMTQuODQyLDI1Ni0yNTZTMzk3LjE1OCwwLDI1NiwweiBNMjU2LDQ2NS40NTUgYy0xMTUuNDkzLDAtMjA5LjQ1NS05My45NjEtMjA5LjQ1NS0yMDkuNDU1UzE0MC41MDcsNDYuNTQ1LDI1Niw0Ni41NDVTNDY1LjQ1NSwxNDAuNTA3LDQ2NS40NTUsMjU2UzM3MS40OTMsNDY1LjQ1NSwyNTYsNDY1LjQ1NXogIj48L3BhdGg+PC9nPjwvZz48Zz48Zz48cGF0aCBkPSJNMzE4LjA2MSwxMzkuNjM2Yy0xMi44NTMsMC0yMy4yNzMsMTAuNDItMjMuMjczLDIzLjI3M3YxODYuMTgyYzAsMTIuODUzLDEwLjQyLDIzLjI3MywyMy4yNzMsMjMuMjczIGMxMi44NTMsMCwyMy4yNzMtMTAuNDIsMjMuMjczLTIzLjI3M1YxNjIuOTA5QzM0MS4zMzMsMTUwLjA1NiwzMzAuOTEzLDEzOS42MzYsMzE4LjA2MSwxMzkuNjM2eiI+PC9wYXRoPjwvZz48L2c+PGc+PGc+PHBhdGggZD0iTTE5My45MzksMTM5LjYzNmMtMTIuODUzLDAtMjMuMjczLDEwLjQyLTIzLjI3MywyMy4yNzN2MTg2LjE4MmMwLDEyLjg1MywxMC40MiwyMy4yNzMsMjMuMjczLDIzLjI3MyBjMTIuODUzLDAsMjMuMjczLTEwLjQyLDIzLjI3My0yMy4yNzNWMTYyLjkwOUMyMTcuMjEyLDE1MC4wNTYsMjA2Ljc5MiwxMzkuNjM2LDE5My45MzksMTM5LjYzNnoiPjwvcGF0aD48L2c+PC9nPjwvc3ZnPg==">Profile</h1>
<div className="container mx-auto flex" style={{ flexDirection: 'column'}}>
<Title />
<div className="container mx-auto flex" style={{ maxWidth: '40%', marginTop: '100px', flexDirection: 'column'}}>
<div className="container mx-auto flex" style={{ flexDirection: 'column', justifyContent: 'left', alignItems: 'flex-start' }}>
<span style={{ marginLeft: '20px' }}>
<StyledText>Почта:</StyledText>
<StyledValue> {User.email}</StyledValue>
</span>
<span style={{ marginLeft: '20px' }}>
<StyledText>Имя пользователя:</StyledText>
<StyledValue> {User.name}</StyledValue>
</span>
<span style={{ marginLeft: '20px' }}>
<StyledText>Количество теплиц:</StyledText>
<StyledValue> 2</StyledValue>
<Link style={{ marginLeft: '10px', fontSize: '24px', textDecorationLine: 'underline', color: 'blue'}} to="/greenhouses">[Перейти]</Link>
</span>
</div>
<div className="container mx-auto flex" style={{ flexDirection: 'row', justifyContent: 'center', marginTop: '20px'}}>
<Button style={{ marginRight: '10px'}} onClick={() => setHidden(!hidden)}>{hidden ? 'Редактировать' : 'Закончить редактирование'} </Button>
<Button>Выйти</Button>
</div>
<Form style={{ marginTop: '20px', width: '70%' }} layout="vertical" hidden={hidden}>
<Form.Item style={{ width: '100%', justifySelf: 'end', textAlign: 'right' }} name="name" rules={[{ required: false }]}>
Новое имя пользователя: <Input style={{ width: '200px', marginLeft: '10px' }} placeholder={User.name}></Input>
</Form.Item>
<Form.Item style={{ width: '100%', justifySelf: 'end', textAlign: 'right' }} name="email" rules={[{ required: false }]}>
Новая почта: <Input style={{ width: '200px', marginLeft: '10px' }} placeholder={User.email}></Input>
</Form.Item>
<div style={{ textAlign: 'right' }}>
<Button htmlType="submit" onClick={() => onFinish(name, email)}>Сохранить изменения</Button>
</div>
</Form>
</div>
<div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '20px'}}>
<Button style={{ width: '160px', backgroundColor: 'red', color: 'white'}} onClick={onLogout}>Выйти из аккаунта</Button>
</div>
</div>
)
}
function async<T>(file: any, File: { new(fileBits: BlobPart[], fileName: string, options?: FilePropertyBag): File; prototype: File; }, url: any, string: any, arg4: any) {
throw new Error("Function not implemented.");
}

View File

@ -0,0 +1,25 @@
import Title from "antd/es/typography/Title";
export function ReportPage() {
return (
<div style={{ display: 'flex', flexDirection: 'column', marginTop: '200px', marginLeft: '550px' }}>
<Title style={{ marginBottom: '20px', fontSize: '42px', fontWeight: 'bold' }}>Отчеты по теплицам</Title>
<div style={{ marginTop: '20px', display: 'flex', flexDirection: 'row', justifyContent: 'space-between', width: '100%', maxWidth: '800px' }}>
<div style={{ flex: 1, marginRight: '20px' }}>
<h2>Температура</h2>
<img src="https://i.ibb.co/zhf8s0z/temperature-report.png" alt="temperature-report" />
</div>
<div style={{ flex: 1, marginLeft: '20px' }}>
<h2>Влажность</h2>
<img src="https://i.ibb.co/zhf8s0z/temperature-report.png" alt="humidity-report" />
</div>
<div style={{ flex: 1, marginLeft: '20px' }}>
<h2>Теплицы</h2>
<img src="https://i.ibb.co/zhf8s0z/temperature-report.png" alt="greenhouses-report" />
</div>
</div>
</div>
);
};
export default ReportPage;

View File

@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es5",
"target": "ES2022",
"lib": [
"dom",
"dom.iterable",