diff --git a/SurveyFrontend/src/api/SurveyApi.ts b/SurveyFrontend/src/api/SurveyApi.ts index 4c20c73..d182347 100644 --- a/SurveyFrontend/src/api/SurveyApi.ts +++ b/SurveyFrontend/src/api/SurveyApi.ts @@ -5,7 +5,6 @@ export interface ISurvey { title: string; description: string; createdBy: number; - createdAt: string; } export interface INewSurvey{ diff --git a/SurveyFrontend/src/components/MySurveyList/MySurveyList.tsx b/SurveyFrontend/src/components/MySurveyList/MySurveyList.tsx index 8083640..6fa3d1a 100644 --- a/SurveyFrontend/src/components/MySurveyList/MySurveyList.tsx +++ b/SurveyFrontend/src/components/MySurveyList/MySurveyList.tsx @@ -13,17 +13,6 @@ export const MySurveyList = () => { const navigate = useNavigate(); const [surveys, setSurveys] = useState([]); - const formatDate = (dateString: string) => { - const date = new Date(dateString); - const day = String(date.getDate()).padStart(2, '0'); - const month = String(date.getMonth() + 1).padStart(2, '0'); - const year = date.getFullYear(); - const hours = String(date.getHours()).padStart(2, '0'); - const minutes = String(date.getMinutes()).padStart(2, '0'); - - return `${day}/${month}/${year} ${hours}:${minutes}`; - }; - useEffect(() => { const fetchSurvey = async () => { try { @@ -74,7 +63,7 @@ export const MySurveyList = () => {

{survey.title}

{survey.description}

- Дата создания: {formatDate(survey.createdAt)} + Дата создания: {survey.createdBy}
{ const [descriptionSurvey, setDescriptionSurvey] = useState(''); - const [titleSurvey, setTitleSurvey] = useState(''); - const { surveyId } = useParams<{ surveyId: string }>(); - - useEffect(() => { - if (!surveyId) { - console.error('Survey ID is missing'); - return; - } - const id = parseInt(surveyId); - if (isNaN(id)) { - console.error('Invalid survey ID'); - return; - } - - const fetchData = async () => { - try { - const surveyData = await getSurveyById(id); - setTitleSurvey(surveyData.title); - setDescriptionSurvey(surveyData.description); - } catch (error) { - console.error('Ошибка:', error); - } - }; - - fetchData(); - - }, [surveyId]); + const [titleSurvey, setTitleSurvey] = useState('Название опроса'); return(
diff --git a/SurveyFrontend/src/components/SettingSurvey/SettingSurvey.module.css b/SurveyFrontend/src/components/SettingSurvey/SettingSurvey.module.css index fd5b485..055808d 100644 --- a/SurveyFrontend/src/components/SettingSurvey/SettingSurvey.module.css +++ b/SurveyFrontend/src/components/SettingSurvey/SettingSurvey.module.css @@ -2,7 +2,6 @@ .settingSurvey{ width: 85%; - height: 100vh; } .startEndTime{ diff --git a/SurveyFrontend/src/components/SettingSurvey/SettingSurvey.tsx b/SurveyFrontend/src/components/SettingSurvey/SettingSurvey.tsx index ec91bcb..a01c61c 100644 --- a/SurveyFrontend/src/components/SettingSurvey/SettingSurvey.tsx +++ b/SurveyFrontend/src/components/SettingSurvey/SettingSurvey.tsx @@ -1,41 +1,43 @@ -import React, {useEffect, useState} from 'react'; +import React, {useState} from 'react'; import SurveyInfo from "../SurveyInfo/SurveyInfo.tsx"; import styles from "./SettingSurvey.module.css"; import TimeEvent from "../TimeEvent/TimeEvent.tsx"; import SaveButton from "../SaveButton/SaveButton.tsx"; -import {useParams} from "react-router-dom"; -import {getSurveyById} from "../../api/SurveyApi.ts"; +// import {useParams} from "react-router-dom"; +// import {getSurveyById, ISurvey} from "../../api/SurveyApi.ts"; const SettingSurvey: React.FC = () => { const [descriptionSurvey, setDescriptionSurvey] = useState(''); + // const [survey, setSurvey] = useState(null); const [titleSurvey, setTitleSurvey] = useState(''); - const { surveyId } = useParams<{ surveyId: string }>(); + // const { surveyId } = useParams<{ surveyId: string }>(); - useEffect(() => { - if (!surveyId) { - console.error('Survey ID is missing'); - return; - } - const id = parseInt(surveyId); - if (isNaN(id)) { - console.error('Invalid survey ID'); - return; - } - - const fetchData = async () => { - try { - const surveyData = await getSurveyById(id); - setTitleSurvey(surveyData.title); - setDescriptionSurvey(surveyData.description); - } catch (error) { - console.error('Ошибка:', error); - } - }; - - fetchData(); - - }, [surveyId]); + // useEffect(() => { + // if (!surveyId) { + // console.error('Survey ID is missing'); + // return; + // } + // const id = parseInt(surveyId); + // if (isNaN(id)) { + // console.error('Invalid survey ID'); + // return; + // } + // + // const fetchData = async () => { + // try { + // const surveyData = await getSurveyById(id); + // setSurvey(surveyData); + // setTitleSurvey(surveyData.title); + // setDescriptionSurvey(surveyData.description); + // } catch (error) { + // console.error('Ошибка:', error); + // } + // }; + // + // fetchData(); + // + // }, [surveyId]); return (
diff --git a/SurveyFrontend/src/components/SurveyInfo/SurveyInfo.tsx b/SurveyFrontend/src/components/SurveyInfo/SurveyInfo.tsx index 11bfeb9..57e04c1 100644 --- a/SurveyFrontend/src/components/SurveyInfo/SurveyInfo.tsx +++ b/SurveyFrontend/src/components/SurveyInfo/SurveyInfo.tsx @@ -88,7 +88,7 @@ const SurveyInfo: React.FC = ({titleSurvey, setDescriptionSurve } const renderTitle = () => { - if ( isCompleteSurveyActive) { + if (isSurveyViewPage || isCompleteSurveyActive) { return (