Ignore:
Timestamp:
01/24/24 17:42:28 (5 months ago)
Author:
darsov2 <62809499+darsov2@…>
Branches:
master
Children:
0f5aa27
Parents:
5528b99
Message:

prefinal fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • frontend/src/Pages/TransportEditPage.js

    r5528b99 r07f4e8b  
    1 import React, { useState } from "react";
    2 import { Container, Col, Row, Image } from "react-bootstrap";
     1import React, {useState} from "react";
     2import {Container, Col, Row, Image} from "react-bootstrap";
    33import Navigation from "../Components/Layout/Navbar/Navigation";
    44import ResourcesTab from "../Components/Resources/ResourcesTab";
     
    77import TransportEditTab from "../Components/TransportEdit/TransportEditTab";
    88import useGet from "../Components/Hooks/useGet";
    9 import { useParams } from "react-router-dom";
     9import {Navigate, useParams} from "react-router-dom";
     10import {useAuth} from "../Components/Context/AuthContext";
    1011
    1112const TransportEditPage = () => {
    12   const params = useParams();
    13   console.log("transportot ima id " + params.transportId);
    14   const link = "/transport/" + params.transportId;
    15   const [changed, setChanged] = useState(0);
    16   const { data, setData, isLoading, getData } = useGet(link, changed);
    1713
    18   !isLoading && console.log(data)
     14    const params = useParams();
    1915
    20   return (
    21     <>
    22       <Navigation />
    23       {!isLoading && (
    24         <Container>
    25           <Row className="mb-5">
    26             <h2 style={{ color: "#159895", textAlign: "left" }}>Мои ресурси</h2>
    27           </Row>
    28           <Row className="mb-5">
    29             <Col>
    30               <Row className="d-flex mb-3">
    31                 <Col
    32                   className="d-flex justify-content-center"
    33                   style={{ maxWidth: "30%" }}
    34                 >
    35                   <Image
    36                     src="https://t3.ftcdn.net/jpg/05/16/27/58/360_F_516275801_f3Fsp17x6HQK0xQgDQEELoTuERO4SsWV.jpg"
    37                     style={{
    38                       height: "5em",
    39                       borderRadius: "50%",
    40                       maxWidth: "100%",
    41                     }}
    42                     className="m-auto"
    43                   ></Image>
    44                 </Col>
    45                 <Col className="d-flex justify-content-center">
    46                   <Container className="pt-2" style={{ textAlign: "left" }}>
    47                     <h4>{data.transportName}</h4>
    48                     <h5>{data.carBrand + " " + data.carType}</h5>
    49                   </Container>
    50                 </Col>
    51               </Row>
    52             </Col>
    53           </Row>
    54           <Row>
    55             {data && <TransportEditTab displayRoute={data} refresh={setChanged}/>}
    56           </Row>
    57         </Container>
    58       )}
    59     </>
    60   );
     16    const link = "/transport/" + params.transportId;
     17
     18    const {data, setData, isLoading, getData, setChanged} = useGet(link);
     19
     20    !isLoading && console.log(data)
     21
     22    return (
     23        <>
     24            <Navigation/>
     25            {!isLoading && (
     26                <Container>
     27                    <Row className="mb-5">
     28                        <h2 style={{color: "#159895", textAlign: "left"}}>Мои ресурси</h2>
     29                    </Row>
     30                    <Row className="mb-5">
     31                        <Col>
     32                            <Row className="d-flex mb-3">
     33                                <Col
     34                                    className="d-flex justify-content-center"
     35                                    style={{maxWidth: "30%"}}
     36                                >
     37                                    <Image
     38                                        src="https://t3.ftcdn.net/jpg/05/16/27/58/360_F_516275801_f3Fsp17x6HQK0xQgDQEELoTuERO4SsWV.jpg"
     39                                        style={{
     40                                            height: "5em",
     41                                            borderRadius: "50%",
     42                                            maxWidth: "100%",
     43                                        }}
     44                                        className="m-auto"
     45                                    ></Image>
     46                                </Col>
     47                                <Col className="d-flex justify-content-center">
     48                                    <Container className="pt-2" style={{textAlign: "left"}}>
     49                                        <h4>{data.transportName}</h4>
     50                                        <h5>{data.carBrand + " " + data.carType}</h5>
     51                                    </Container>
     52                                </Col>
     53                            </Row>
     54                        </Col>
     55                    </Row>
     56                    <Row>
     57                        {data && <TransportEditTab displayRoute={data} refresh={setChanged}/>}
     58                    </Row>
     59                </Container>
     60            )}
     61        </>
     62    );
    6163};
    6264
Note: See TracChangeset for help on using the changeset viewer.