From ceed38f600a9ebf6e11d6cb42a4ec1b9a098f8db Mon Sep 17 00:00:00 2001 From: shivam <141029609+js-1608@users.noreply.github.com> Date: Fri, 21 Mar 2025 01:12:20 +0530 Subject: [PATCH] updated frontend user pannel --- src/App.js | 5 +- src/pages/Faq.js | 74 ++++++++++++++++++++++ src/pages/Footer.js | 41 +++++++++++++ src/pages/GameList.js | 133 +++++++++++++--------------------------- src/pages/Header.js | 44 +++++++++++++ src/pages/Home2.js | 53 ++-------------- src/pages/Home3.js | 2 + src/pages/TeamResult.js | 8 +-- 8 files changed, 215 insertions(+), 145 deletions(-) create mode 100644 src/pages/Faq.js create mode 100644 src/pages/Footer.js create mode 100644 src/pages/Header.js diff --git a/src/App.js b/src/App.js index ebb0575..cbd7a1f 100644 --- a/src/App.js +++ b/src/App.js @@ -6,6 +6,7 @@ import Home from './pages/Home'; import TeamResults from './pages/TeamResult'; import Home2 from './pages/Home2'; import GameList from './pages/GameList'; +import Faq from './pages/Faq'; // Auth Context const AuthContext = React.createContext(); @@ -1059,8 +1060,10 @@ const App = () => { } /> } /> - } /> + } /> } /> + } /> + diff --git a/src/pages/Faq.js b/src/pages/Faq.js new file mode 100644 index 0000000..7ca2ae3 --- /dev/null +++ b/src/pages/Faq.js @@ -0,0 +1,74 @@ +import React from 'react'; +import { useState } from 'react'; +import Header from './Header'; + + const Faq = () => { + const [openIndex, setOpenIndex] = useState(null); + + const toggleFAQ = (index) => { + setOpenIndex(openIndex === index ? null : index); + }; + + const faqs = [ + { question: "HOW TO PLAY", answer: "Details about how to play." }, + { question: "WHERE TO PLAY", answer: "Information on where to play." }, + { question: "WINNING NUMBERS EMAIL", answer: "Sign up for emails." }, + ]; + + return ( + <> +
+
+ {/* FAQ Section */} +
+ {faqs.map((faq, index) => ( +
+ + {openIndex === index && ( +
+ {faq.answer} +
+ )} +
+ ))} +
+ + {/* Footer Section */} +
+
+

+ MATKA SATTA +

+

+ The Multi-State Lottery Association makes every effort to ensure the + accuracy of winning numbers and other information. Official winning + numbers are those selected in the respective drawings and recorded + under the observation of an independent accounting firm. +

+

+ In the event of a discrepancy, the official drawing results shall + prevail. All winning tickets must be redeemed in the + state/jurisdiction in which they are sold. +

+

+ Media Center + Legal + Privacy + español +

+
+
+
+ + + ); + } + + export default Faq; + \ No newline at end of file diff --git a/src/pages/Footer.js b/src/pages/Footer.js new file mode 100644 index 0000000..659eac4 --- /dev/null +++ b/src/pages/Footer.js @@ -0,0 +1,41 @@ +import React from 'react'; +import Faq from './Faq'; +const Footer = () => { + + return ( + <> +
+ {/* FAQ Section */} + + + {/* Footer Section */} +
+
+

+ MATKA SATTA +

+

+ The Multi-State Lottery Association makes every effort to ensure the + accuracy of winning numbers and other information. Official winning + numbers are those selected in the respective drawings and recorded + under the observation of an independent accounting firm. +

+

+ In the event of a discrepancy, the official drawing results shall + prevail. All winning tickets must be redeemed in the + state/jurisdiction in which they are sold. +

+

+ Media Center + Legal + Privacy + español +

+
+
+
+ + ); +} + +export default Footer; diff --git a/src/pages/GameList.js b/src/pages/GameList.js index 9a46dd2..6499a65 100644 --- a/src/pages/GameList.js +++ b/src/pages/GameList.js @@ -3,6 +3,8 @@ import { BarChart2, Calendar, RefreshCw, Clock, ChevronLeft, ChevronRight } from import axios from 'axios'; import TodaysMatch from './TodaysMatch'; import Today from './Today'; +import Header from './Header'; +import Footer from './Footer'; const GameList = () => { const [teams, setTeams] = useState([]); @@ -141,33 +143,41 @@ const GameList = () => { }, []); // Show chart for selected team - const handleViewChart = async (team) => { - try { - setLoading(true); - // Get monthly results for the selected team - const currentDate = new Date(); - const month = currentDate.getMonth() + 1; - const year = currentDate.getFullYear(); - - const response = await axios.post(`${API_URL}/results/monthly`, { - team: team.name, - month: `${year}-${month.toString().padStart(2, '0')}` - }); - - setSelectedTeam({ - ...team, - chartData: response.data - }); - - setShowChartView(true); - setShowCalendar(false); - setLoading(false); - } catch (err) { - console.error("Error fetching chart data:", err); - setError("Failed to load chart data. Please try again later."); - setLoading(false); - } - }; +const handleViewChart = async (team) => { + try { + setLoading(true); + // Get monthly results for the selected team + const currentDate = new Date(); + const month = currentDate.getMonth() + 1; + const year = currentDate.getFullYear(); + + const monthStr = `${year}-${month.toString().padStart(2, '0')}`; + + console.log("Fetching chart data for:", team.name, "Month:", monthStr); + + const response = await axios.post(`${API_URL}/results/monthly`, { + team: team.name, + month: monthStr + }); + + console.log("API Response:", response.data); + + // Keep the original data structure + setSelectedTeam({ + ...team, + chartData: response.data + }); + + setShowChartView(true); + setShowCalendar(false); + setLoading(false); + } catch (err) { + console.error("Error fetching chart data:", err); + setError("Failed to load chart data: " + (err.response?.data?.message || err.message)); + setLoading(false); + setShowChartView(false); + } +}; // Load calendar data const loadCalendarData = async (year, month) => { @@ -288,21 +298,9 @@ const GameList = () => { }); }; - - const [openIndex, setOpenIndex] = useState(null); - - const toggleFAQ = (index) => { - setOpenIndex(openIndex === index ? null : index); - }; - - const faqs = [ - { question: "HOW TO PLAY", answer: "Details about how to play." }, - { question: "WHERE TO PLAY", answer: "Information on where to play." }, - { question: "WINNING NUMBERS EMAIL", answer: "Sign up for emails." }, - ]; - return (
+
@@ -322,14 +320,14 @@ const GameList = () => {
Latest Results
- + */}