|
1 | 1 | import '../styles/Home.css';
|
2 |
| -import { useState, useEffect } from 'react'; |
3 | 2 | import { Button } from 'antd';
|
4 | 3 | import { Link } from "react-router-dom";
|
5 | 4 | import { DISCORD_LINK, DEV_DOCS, CLOUD_LINK } from '../common/constants';
|
6 | 5 | import ChatBubbles from '../components/ChatBubbles';
|
7 | 6 | import IconDisplay from '../components/IconsDisplay';
|
8 | 7 |
|
9 | 8 | export function Home() {
|
10 |
| - const [currentConversationIndex, setCurrentConversationIndex] = useState(0); |
11 |
| - |
12 |
| - useEffect(() => { |
13 |
| - const intervalId = setInterval(() => { |
14 |
| - setCurrentConversationIndex((currentConversationIndex + 1) % conversationSamples.length); |
15 |
| - }, 15000); // Change conversation every 5 seconds |
16 |
| - |
17 |
| - // Clear interval on component unmount |
18 |
| - return () => clearInterval(intervalId); |
19 |
| - }, [currentConversationIndex]); |
20 | 9 |
|
21 | 10 | function copyToClipboardAction() {
|
22 | 11 | const codeSnippetElements = document.getElementsByClassName('self-host-code');
|
@@ -75,6 +64,10 @@ export function Home() {
|
75 | 64 | ]
|
76 | 65 | ]
|
77 | 66 |
|
| 67 | + function getRandomConvo() { |
| 68 | + return conversationSamples[Math.floor(Math.random() * conversationSamples.length)]; |
| 69 | + } |
| 70 | + |
78 | 71 | return (
|
79 | 72 | <section className='core-page'>
|
80 | 73 | <div className='hero-container'>
|
@@ -103,7 +96,7 @@ export function Home() {
|
103 | 96 | </div>
|
104 | 97 | <div className='hero-container-right'>
|
105 | 98 | <div className='product-description-bubbles'>
|
106 |
| - <ChatBubbles conversation={conversationSamples[currentConversationIndex]} /> |
| 99 | + <ChatBubbles conversation={getRandomConvo()} /> |
107 | 100 | </div>
|
108 | 101 | </div>
|
109 | 102 | </div>
|
|
0 commit comments