Skip to content

Commit 65301b9

Browse files
committed
chore(demo): demo encadré avec une question fixe
1 parent 1ce1ebb commit 65301b9

File tree

3 files changed

+31
-14
lines changed

3 files changed

+31
-14
lines changed

frontend/src/components/tchat/ChatInput.tsx

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useState, useRef, useEffect } from "react";
22
import Icon from "@icon";
33
import styles from "./ChatInput.module.css";
4-
import { Spin } from "antd";
4+
import { Button, Modal, Spin } from "antd";
55
import { LoadingOutlined } from "@ant-design/icons";
66

77
interface ChatInputProps {
@@ -12,6 +12,7 @@ interface ChatInputProps {
1212
const ChatInput: React.FC<ChatInputProps> = ({ onSendMessage, isLoading }) => {
1313
const [message, setMessage] = useState("");
1414
const textareaRef = useRef<HTMLTextAreaElement>(null);
15+
const [isModalVisible, setIsModalVisible] = useState(false);
1516

1617
const adjustTextareaHeight = () => {
1718
if (textareaRef.current) {
@@ -28,11 +29,12 @@ const ChatInput: React.FC<ChatInputProps> = ({ onSendMessage, isLoading }) => {
2829
}, [message]);
2930

3031
const handleSend = () => {
31-
onSendMessage(message);
32-
setMessage("");
33-
if (textareaRef.current) {
34-
textareaRef.current.style.height = "auto";
35-
}
32+
// onSendMessage(message);
33+
// setMessage("");
34+
// if (textareaRef.current) {
35+
// textareaRef.current.style.height = "auto";
36+
// }
37+
setIsModalVisible(true)
3638
};
3739

3840
const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
@@ -57,6 +59,7 @@ const ChatInput: React.FC<ChatInputProps> = ({ onSendMessage, isLoading }) => {
5759
<button
5860
className={styles.sendButton}
5961
disabled={!message.trim() || isLoading}
62+
// disabled
6063
onClick={handleSend}
6164
>
6265
{isLoading ? (
@@ -75,6 +78,25 @@ const ChatInput: React.FC<ChatInputProps> = ({ onSendMessage, isLoading }) => {
7578
/>
7679
)}
7780
</button>
81+
<Modal
82+
title="Fonctionnalité désactivée"
83+
visible={isModalVisible}
84+
onOk={() => setIsModalVisible(false)}
85+
onCancel={() => setIsModalVisible(false)}
86+
footer={[
87+
<Button
88+
key="ok"
89+
type="primary"
90+
onClick={() => setIsModalVisible(false)}
91+
>
92+
OK
93+
</Button>,
94+
]}
95+
>
96+
<p>
97+
Cette fonctionnalité est désactivée pour des fins de démonstration.
98+
</p>
99+
</Modal>
78100
</div>
79101
);
80102
};

frontend/src/views/chat/ChatContainer.module.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
border-radius: 12px;
2727
color: #f5f5f5;
2828
font-size: 16px;
29-
padding: 28px 28px;
29+
padding: 12px;
30+
height: auto;
3031
transition:
3132
background-color 0.3s ease,
3233
border-color 0.3s ease;

frontend/src/views/chat/ChatContainer.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,11 @@ import { v4 as uuidv4 } from "uuid";
99
import ApiFct from "@services/apiService";
1010
import { APP_ROUTES } from "@config/appRoutes";
1111
import { useMap } from "@contexts/MapContext";
12-
import L, { Point } from "leaflet";
1312
import addCustomPolygonToMap from "@utils/customPolygon";
1413
import { addMarkers } from "@utils/plugins";
1514

1615
const suggestions = [
17-
"Quelles sont les causes du changement climatique ?",
18-
"Comment se forment les ouragans ?",
19-
"Quels sont les impacts du réchauffement climatique ?",
20-
"Comment prévenir les catastrophes naturelles ?",
16+
"Quels risques d'inondation à Nice et quels dégâts potentiels sur les infrastructures publiques ?",
2117
];
2218

2319
const fktext = `Pour Nice, les données historiques indiquent que le risque d’inondation est élevé, avec une moyenne de 2 à 3 inondations majeures par décennie. En croisant ces informations avec la Base Permanente des Équipements et l’estimation financière des infrastructures publiques, il est estimé que les dégâts potentiels pourraient atteindre jusqu’à 15 millions d’euros en cas d’inondation majeure.
@@ -38,7 +34,6 @@ const ChatContainer: React.FC = () => {
3834
const [messages, setMessages] = useState<Message[]>([]);
3935
const [isTyping, setIsTyping] = useState(false);
4036
const { map } = useMap();
41-
``;
4237

4338
useEffect(() => {
4439
if (chatId) {
@@ -69,7 +64,6 @@ const ChatContainer: React.FC = () => {
6964
updatedAt: number;
7065
} | null = null;
7166

72-
console.log("p1", chatId);
7367
if (!chatId) return;
7468
while (attempts > 0) {
7569
const chat = await ApiFct.getMessages(chatId);

0 commit comments

Comments
 (0)