diff --git a/public/index.html b/public/index.html index 5231058..04ec9e2 100644 --- a/public/index.html +++ b/public/index.html @@ -25,7 +25,7 @@ Learn how to configure a non-root public URL by running `npm run build`. --> React App - + + + + + @@ -48,7 +62,7 @@ To begin the development, run `npm start` or `yarn start`. To create a production bundle, use `npm run build` or `yarn build`. --> - + diff --git a/src/App.css b/src/App.css index aa6fa22..76274c2 100644 --- a/src/App.css +++ b/src/App.css @@ -244,4 +244,61 @@ .team-table, .results-table { font-size: 14px; } - } \ No newline at end of file + } + + + + + /* 1. Remove background, borders from the outer Google gadget */ +.goog-te-gadget { + font-family: 'Poppins', sans-serif !important; + font-size: 14px !important; + color: white !important; +} + +/* 2. Customize the translate dropdown box */ +.goog-te-gadget-simple { + background-color: #1f2937 !important; /* dark background */ + border: 1px solid #4b5563 !important; /* gray border */ + padding: 8px 12px !important; + border-radius: 8px !important; + cursor: pointer !important; + display: inline-flex !important; + align-items: center !important; +} + +/* 3. Customize the select language text inside */ +.goog-te-gadget-simple span { + font-size: 14px !important; + color: white !important; + margin-right: 5px !important; +} + +/* 4. Customize hover effect */ +.goog-te-gadget-simple:hover { + background-color: #374151 !important; /* slightly lighter on hover */ +} + +/* 5. Hide the default Google icon if you want */ +.goog-te-gadget-icon { + display: none !important; +} + +/* 6. Adjust the down arrow color */ +.goog-te-gadget-simple span[aria-hidden="true"] { + color: #d1d5db !important; /* light gray arrow */ + margin-left: 4px !important; +} + +/* 7. Prevent weird border inside dropdown */ +.skiptranslate { + padding: 0 !important; + margin: 0 !important; + border: none !important; + background: none !important; +} + +/* 8. Remove unwanted clear dots or extra images */ +.goog-te-gadget img { + display: none !important; +} diff --git a/src/App.js b/src/App.js index c04cdfb..899be94 100644 --- a/src/App.js +++ b/src/App.js @@ -1,1082 +1,34 @@ -import React, { useState, useEffect } from 'react'; -import { BrowserRouter as Router, Route, Routes, Navigate, Link } from 'react-router-dom'; +import React from 'react'; +import { BrowserRouter as Router, Route, Routes } from 'react-router-dom'; import './App.css'; -import { useParams, useNavigate, useLocation } from 'react-router-dom'; -import Home from './pages/Home'; + +// Import user-facing pages import TeamResults from './pages/TeamResult'; import Home2 from './pages/Home2'; import GameList from './pages/GameList'; -import Faq from './pages/Faq'; -import MatkaResultsDashboard from './pages/Today'; -import Homenew from './User/Home'; -// Auth Context -const AuthContext = React.createContext(); +import Translate from './Translate'; +import FaqPage from './pages/FaqPage'; -const AuthProvider = ({ children }) => { - const [token, setToken] = useState(localStorage.getItem('token')); - - const login = (newToken) => { - localStorage.setItem('token', newToken); - setToken(newToken); - }; - - const logout = () => { - localStorage.removeItem('token'); - setToken(null); - }; - - return ( - - {children} - - ); -}; - -// API Service -const API_URL = 'http://localhost:5500'; - -const apiService = { - login: async (accessKey, password) => { - const response = await fetch(`${API_URL}/admin/login`, { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ accessKey, password }) - }); - - if (!response.ok) { - throw new Error('Login failed'); - } - - return response.json(); - }, - - getTeams: async (token) => { - const response = await fetch(`${API_URL}/api/teams`, { - headers: token ? { 'Authorization': `Bearer ${token}` } : {} - }); - - if (!response.ok) { - throw new Error('Failed to fetch teams'); - } - - return response.json(); - }, - - createTeam: async (teamData, token) => { - const response = await fetch(`${API_URL}/admin/teams`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'Authorization': `Bearer ${token}` - }, - body: JSON.stringify(teamData) - }); - - if (!response.ok) { - throw new Error('Failed to create team'); - } - - return response.json(); - }, - - updateTeam: async (id, teamData, token) => { - const response = await fetch(`${API_URL}/admin/teams/${id}`, { - method: 'PUT', - headers: { - 'Content-Type': 'application/json', - 'Authorization': `Bearer ${token}` - }, - body: JSON.stringify(teamData) - }); - - if (!response.ok) { - throw new Error('Failed to update team'); - } - - return response.json(); - }, - - deleteTeam: async (id, token) => { - const response = await fetch(`${API_URL}/admin/teams/${id}`, { - method: 'DELETE', - headers: { 'Authorization': `Bearer ${token}` } - }); - - if (!response.ok) { - throw new Error('Failed to delete team'); - } - - return response.json(); - }, - - publishResult: async (resultData, token) => { - console.log("Publishing result with data:", resultData); - console.log("Using token:", token); - - const response = await fetch(`${API_URL}/admin/results`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'Authorization': `Bearer ${token}` - }, - body: JSON.stringify(resultData) - }); - // In your publishResult function - - - if (!response.ok) { - const errorData = await response.json().catch(() => ({})); - console.error("Server responded with error:", response.status, errorData); - console.log("Sending exact payload:", JSON.stringify(resultData)); - throw new Error(`Failed to publish result: ${response.status}`); - } else { - console.log("Response is ok") - } - - return response.json(); - }, - - updateResult: async (id, resultData, token) => { - console.log(`Updating result ${id} with data:`, resultData); - - try { - const response = await fetch(`${API_URL}/admin/results/${id}`, { - method: 'PUT', - headers: { - 'Content-Type': 'application/json', - 'Authorization': `Bearer ${token}` - }, - body: JSON.stringify(resultData) - }); - - if (!response.ok) { - // Try to get error details if available - const errorText = await response.text(); - console.error("Server error response:", errorText); - throw new Error(`Server responded with status: ${response.status}`); - } - - return await response.json(); - } catch (error) { - console.error("Error in updateResult:", error); - throw error; - } - }, - - deleteResult: async (id, token) => { - console.log(`Deleting result ${id}`); - - try { - const response = await fetch(`${API_URL}/admin/results/${id}`, { - method: 'DELETE', - headers: { 'Authorization': `Bearer ${token}` } - }); - - if (!response.ok) { - // Try to get error details if available - const errorText = await response.text(); - console.error("Server error response:", errorText); - throw new Error(`Server responded with status: ${response.status}`); - } - - return await response.json(); - } catch (error) { - console.error("Error in deleteResult:", error); - throw error; - } - }, - - getDailyResults: async (date, token) => { - const response = await fetch(`${API_URL}/api/results/daily?date=${date}`, { - headers: token ? { 'Authorization': `Bearer ${token}` } : {} - }); - - if (!response.ok) { - throw new Error('Failed to fetch daily results'); - } - - return response.json(); - }, - - getMonthlyResults: async (team, month) => { - const response = await fetch(`${API_URL}/api/results/monthly`, { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ team, month }) - }); - - if (!response.ok) { - throw new Error('Failed to fetch monthly results'); - } - - return response.json(); - }, - - getTodayResults: async () => { - const response = await fetch(`${API_URL}/api/today`); - - if (!response.ok) { - throw new Error('Failed to fetch today\'s results'); - } - - return response.json(); - }, - - // Scheduled games API endpoints - getScheduledGames: async (date, token) => { - const response = await fetch(`${API_URL}/api/schedule?date=${date}`, { - headers: token ? { 'Authorization': `Bearer ${token}` } : {} - }); - - if (!response.ok) { - throw new Error('Failed to fetch scheduled games'); - } - - return response.json(); - }, - - createScheduledGame: async (gameData, token) => { - const response = await fetch(`${API_URL}/admin/schedule`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'Authorization': `Bearer ${token}` - }, - body: JSON.stringify(gameData) - }); - - if (!response.ok) { - throw new Error('Failed to create scheduled game'); - } - - return response.json(); - }, - - updateScheduledGame: async (id, gameData, token) => { - const response = await fetch(`${API_URL}/admin/schedule/${id}`, { - method: 'PUT', - headers: { - 'Content-Type': 'application/json', - 'Authorization': `Bearer ${token}` - }, - body: JSON.stringify(gameData) - }); - - if (!response.ok) { - throw new Error('Failed to update scheduled game'); - } - - return response.json(); - }, - - deleteScheduledGame: async (id, token) => { - const response = await fetch(`${API_URL}/admin/schedule/${id}`, { - method: 'DELETE', - headers: { 'Authorization': `Bearer ${token}` } - }); - - if (!response.ok) { - throw new Error('Failed to delete scheduled game'); - } - - return response.json(); - } -}; - -// Components -const Login = () => { - const [accessKey, setAccessKey] = useState(''); - const [password, setPassword] = useState(''); - const [error, setError] = useState(''); - const { login } = React.useContext(AuthContext); - const navigate = useNavigate(); - - const handleSubmit = async (e) => { - e.preventDefault(); - try { - const data = await apiService.login(accessKey, password); - console.log("Login successful, token:", data.token); - login(data.token); - navigate('/teams'); - } catch (err) { - console.error("Login failed:", err); - setError('Invalid credentials'); - } - }; - - return ( -
-

Admin Login

- {error &&
{error}
} -
-
- - setAccessKey(e.target.value)} - required - /> -
-
- - setPassword(e.target.value)} - required - /> -
- -
-
- ); -}; - -const TeamList = () => { - const [teams, setTeams] = useState([]); - const [loading, setLoading] = useState(true); - const [error, setError] = useState(''); - const { token } = React.useContext(AuthContext); - - useEffect(() => { - const fetchTeams = async () => { - try { - const data = await apiService.getTeams(token); - setTeams(data); - alert(teams) - setLoading(false); - } catch (err) { - setError('Failed to fetch teams'); - setLoading(false); - } - }; - - fetchTeams(); - }, [token]); - - const handleDelete = async (id) => { - if (window.confirm('Are you sure you want to delete this team?')) { - try { - await apiService.deleteTeam(id, token); - setTeams(teams.filter(team => team.id !== id)); - } catch (err) { - setError('Failed to delete team'); - } - } - }; - - if (loading) return
Loading...
; - if (error) return
{error}
; - - return ( -
-

Team Management

- Add New Team - - - - - - - - - - {teams.map(team => ( - - - - - - ))} - -
IDNameActions
{team.id}{team.name} - Edit - -
-
- ); -}; - -const TeamForm = ({ isEdit = false }) => { - const [name, setName] = useState(''); - const [submitting, setSubmitting] = useState(false); - const [error, setError] = useState(''); - const { token } = React.useContext(AuthContext); - const { id } = useParams(); - const navigate = useNavigate(); - - useEffect(() => { - if (isEdit && id) { - const fetchTeam = async () => { - try { - const teams = await apiService.getTeams(token); - const team = teams.find(t => t.id === parseInt(id)); - if (team) { - // Use the exact name as stored in the database - setName(team.name); - } - } catch (err) { - setError('Failed to fetch team details'); - } - }; - - fetchTeam(); - } - }, [isEdit, id, token]); - - const handleSubmit = async (e) => { - e.preventDefault(); - setSubmitting(true); - - try { - // Send the name exactly as entered by the user without any transformation - if (isEdit) { - await apiService.updateTeam(id, { name }, token); - } else { - await apiService.createTeam({ name }, token); - } - navigate('/teams'); - } catch (err) { - setError(isEdit ? 'Failed to update team' : 'Failed to create team'); - setSubmitting(false); - } - }; - - return ( -
-

{isEdit ? 'Edit Team' : 'Add New Team'}

- {error &&
{error}
} -
-
- - setName(e.target.value)} - required - placeholder="Enter team name exactly as desired" - /> - Name will be saved exactly as entered -
- - Cancel -
-
- ); -}; - -const ResultCalendar = () => { - const [date, setDate] = useState(new Date().toISOString().split('T')[0]); - const [results, setResults] = useState([]); - const [teams, setTeams] = useState([]); - const [loading, setLoading] = useState(true); - const [error, setError] = useState(''); - const { token } = React.useContext(AuthContext); - - const fetchData = async () => { - setLoading(true); - try { - const [teamsData, resultsData] = await Promise.all([ - apiService.getTeams(token), - apiService.getDailyResults(date, token) - ]); - setTeams(teamsData); - setResults(resultsData); - setError(''); - setLoading(false); - } catch (err) { - console.error("Error fetching data:", err); - setError('Failed to fetch data'); - setLoading(false); - } - }; - - useEffect(() => { - fetchData(); - }, [date, token]); - - const handleDateChange = (e) => { - setDate(e.target.value); - }; - - const handleDeleteResult = async (id) => { - // First, ensure the ID is valid - if (!id) { - console.error("Invalid result ID:", id); - setError("Cannot delete result: Invalid ID"); - return; - } - - console.log("Attempting to delete result with ID:", id); - - if (window.confirm('Are you sure you want to delete this result?')) { - try { - await apiService.deleteResult(id, token); - // Refresh the results after deletion - fetchData(); - } catch (err) { - console.error("Error deleting result:", err); - setError(`Failed to delete result: ${err.message}`); - } - } - }; - - if (loading) return
Loading...
; - - return ( -
-

Results Calendar

-
- - -
- -
-

Results for {date}

- Add New Result - - {error &&
{error}
} - - {results.length === 0 ? ( -

No results for this date.

- ) : ( - - - - - - - - - - - {results.map(result => ( - - - - - - - ))} - -
TeamResultResult TimeActions
{result.team}{result.visible_result || result.result}{new Date(result.result_time).toISOString().split('T').join(" ").replace("Z", "").slice(0, -4)} - Edit - -
- )} -
-
- ); -}; - -// result form to update result -const ResultForm = ({ isEdit = false }) => { - const [formData, setFormData] = useState({ - team: '', - result: '', - date: new Date().toISOString().split('T')[0], - result_time: '12:00:00' // Default now includes seconds - }); - const [teams, setTeams] = useState([]); - const [submitting, setSubmitting] = useState(false); - const [error, setError] = useState(''); - const { token } = React.useContext(AuthContext); - const { id } = useParams(); - const navigate = useNavigate(); - const location = useLocation(); - - useEffect(() => { - const fetchData = async () => { - try { - const teamsData = await apiService.getTeams(token); - setTeams(teamsData); - - // Set date from query params if available - const params = new URLSearchParams(location.search); - const dateParam = params.get('date'); - if (dateParam) { - setFormData(prev => ({ ...prev, date: dateParam })); - } - - // If editing, fetch the result details - if (isEdit && id) { - const results = await apiService.getDailyResults(dateParam || formData.date, token); - const result = results.find(r => r.id === parseInt(id)); - if (result) { - // Extract time from result_time and ensure it has seconds - const resultTime = result.result_time.split(' ')[1]; - const formattedTime = resultTime.includes('.') - ? resultTime.split('.')[0] - : resultTime.length === 5 ? `${resultTime}:00` : resultTime; - - setFormData({ - team: result.team, // Use the exact team name as stored - result: result.visible_result, - date: result.result_time.split(' ')[0], - result_time: formattedTime - }); - } - } - } catch (err) { - setError('Failed to fetch data'); - } - }; - - fetchData(); - }, [isEdit, id, token, location.search, formData.date]); - - const handleChange = (e) => { - const { name, value } = e.target; - setFormData(prev => ({ ...prev, [name]: value })); - }; - - const handleSubmit = async (e) => { - e.preventDefault(); - setSubmitting(true); - - try { - const payload = { - team: formData.team, // Use the exact team name as selected - result: formData.result, - result_time: `${formData.date} ${formData.result_time}` - }; - - if (isEdit) { - await apiService.updateResult(id, payload, token); - } else { - await apiService.publishResult(payload, token); - } - navigate(`/admin/results?date=${formData.date}`); - } catch (err) { - console.error("Error submitting form:", err); - setError(isEdit ? 'Failed to update result' : 'Failed to publish result'); - setSubmitting(false); - } - }; - - return ( -
-

{isEdit ? 'Edit Result' : 'Add New Result'}

- {error &&
{error}
} -
-
- - -
-
- - -
-
- - -
-
- - -
- - Cancel -
-
- ); -}; -// Scheduled Games Components -const ScheduleCalendar = () => { - const [date, setDate] = useState(new Date().toISOString().split('T')[0]); - const [scheduledGames, setScheduledGames] = useState([]); - const [loading, setLoading] = useState(true); - const [error, setError] = useState(''); - const { token } = React.useContext(AuthContext); - - useEffect(() => { - const fetchScheduledGames = async () => { - try { - const data = await apiService.getScheduledGames(date, token); - setScheduledGames(data); - setLoading(false); - } catch (err) { - setError('Failed to fetch scheduled games'); - setLoading(false); - } - }; - - fetchScheduledGames(); - }, [date, token]); - - const handleDateChange = (e) => { - setDate(e.target.value); - }; - - const handleDeleteScheduledGame = async (id) => { - if (window.confirm('Are you sure you want to delete this scheduled game?')) { - try { - await apiService.deleteScheduledGame(id, token); - setScheduledGames(scheduledGames.filter(game => game.id !== id)); - } catch (err) { - setError('Failed to delete scheduled game'); - } - } - }; - - if (loading) return
Loading...
; - if (error) return
{error}
; - - return ( -
-

Scheduled Games

-
- - -
- -
-

Games scheduled for {date}

- Schedule New Game - - {scheduledGames.length === 0 ? ( -

No games scheduled for this date.

- ) : ( - - - - - - - - - - - - {scheduledGames.map(game => ( - - - - - - - - ))} - -
Home TeamAway TeamTimeStatusActions
{game.home_team_name}{game.away_team_name}{game.game_time}{game.status} - Edit - -
- )} -
-
- ); -}; - -// ScheduleForm component with seconds support -const ScheduleForm = ({ isEdit = false }) => { - const [formData, setFormData] = useState({ - home_team: '', - away_team: '', - game_date: new Date().toISOString().split('T')[0], - game_time: '12:00:00', // Default now includes seconds - status: 'SCHEDULED' - }); - const [teams, setTeams] = useState([]); - const [submitting, setSubmitting] = useState(false); - const [error, setError] = useState(''); - const { token } = React.useContext(AuthContext); - const { id } = useParams(); - const navigate = useNavigate(); - const location = useLocation(); - - useEffect(() => { - const fetchData = async () => { - try { - const teamsData = await apiService.getTeams(token); - setTeams(teamsData); - - // Set date from query params if available - const params = new URLSearchParams(location.search); - const dateParam = params.get('date'); - if (dateParam) { - setFormData(prev => ({ ...prev, game_date: dateParam })); - } - - // If editing, fetch the scheduled game details - if (isEdit && id) { - const games = await apiService.getScheduledGames(dateParam || formData.game_date, token); - const game = games.find(g => g.id === parseInt(id)); - if (game) { - // Ensure game_time includes seconds - const gameTime = game.game_time; - const formattedTime = gameTime.length === 5 ? `${gameTime}:00` : gameTime; - - setFormData({ - home_team: game.home_team_id.toString(), - away_team: game.away_team_id.toString(), - game_date: game.game_date, - game_time: formattedTime, - status: game.status - }); - } - } - } catch (err) { - setError('Failed to fetch data'); - } - }; - - fetchData(); - }, [isEdit, id, token, location.search, formData.game_date]); - - const handleChange = (e) => { - const { name, value } = e.target; - setFormData(prev => ({ ...prev, [name]: value })); - }; - - const handleSubmit = async (e) => { - e.preventDefault(); - setSubmitting(true); - - try { - const payload = { - ...formData, - // Ensure the API receives the complete time with seconds - game_time: formData.game_time.length === 5 ? `${formData.game_time}:00` : formData.game_time - }; - - if (isEdit) { - await apiService.updateScheduledGame(id, payload, token); - } else { - await apiService.createScheduledGame(payload, token); - } - navigate(`/admin/schedule?date=${formData.game_date}`); - } catch (err) { - setError(isEdit ? 'Failed to update scheduled game' : 'Failed to create scheduled game'); - setSubmitting(false); - } - }; - - return ( -
-

{isEdit ? 'Edit Scheduled Game' : 'Schedule New Game'}

- {error &&
{error}
} -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
- - Cancel -
-
- ); -}; - -const Dashboard = () => { - const { logout } = React.useContext(AuthContext); - - return ( -
-
-

Admin Dashboard

- -
- - - -
- - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - -
-
- ); -}; - - -// Protected Route -const ProtectedRoute = ({ children }) => { - const { isAuthenticated } = React.useContext(AuthContext); - - if (!isAuthenticated) { - return ; - } - - return children; -}; - -// App const App = () => { - - return ( - - - - } /> - - - - } - /> - } /> - }/> + + + + } /> + {/* } /> */} + {/* } /> */} + } /> + {/* } /> */} - } /> - } /> - } /> - } /> - - - + } /> + } /> + {/* } /> */} + {/* } /> */} + - ); }; -export default App; \ No newline at end of file +export default App; diff --git a/src/Translate.js b/src/Translate.js index 966e2ce..261cbb2 100644 --- a/src/Translate.js +++ b/src/Translate.js @@ -1,67 +1,16 @@ -import { useState } from "react"; -import { Menu, X, Globe } from "lucide-react"; -import { Link } from "react-router-dom"; +import { useState, useEffect } from "react"; export default function Translate() { - const [isOpen, setIsOpen] = useState(false); - const [currentLanguage, setCurrentLanguage] = useState("English"); - - // Function to handle language change - const changeLanguage = (language) => { - setCurrentLanguage(language); - - // This would integrate with Google Translate API - // For actual implementation, you would need to use the Google Translate Element - if (language === "English") { - // Set to English - if (window.googleTranslateElementInit) { - const selectElement = document.querySelector('.goog-te-combo'); - if (selectElement) { - selectElement.value = 'en'; - selectElement.dispatchEvent(new Event('change')); - } - } - } else if (language === "Hindi") { - // Set to Hindi - if (window.googleTranslateElementInit) { - const selectElement = document.querySelector('.goog-te-combo'); - if (selectElement) { - selectElement.value = 'hi'; - selectElement.dispatchEvent(new Event('change')); - } - } - } - }; - return ( - <> - {/* Translation Bar */} -
-
-
- - Translate: -
-
- - - {/* Hidden div for Google Translate Element */} -
-
-
-
+
+ {/* Left Side - Text */} + + Translate: + - {/* Header */} - + {/* Right Side - Google Translate Original Widget */} +
+
); -} \ No newline at end of file +} + diff --git a/src/User/Faq.js b/src/User/Faq.js deleted file mode 100644 index 92eb139..0000000 --- a/src/User/Faq.js +++ /dev/null @@ -1,47 +0,0 @@ -import React from 'react'; -import { useState } from 'react'; - - 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} -
- )} -
- ))} -
- -
- - - ); - } - - export default Faq; - \ No newline at end of file diff --git a/src/User/Footer.js b/src/User/Footer.js deleted file mode 100644 index 8021f1c..0000000 --- a/src/User/Footer.js +++ /dev/null @@ -1,46 +0,0 @@ -import React from 'react'; -import Faq from './Faq'; -const Footer = () => { - - return ( - <> -
- {/* FAQ Section */} - - - {/* Footer Section */} -
-
-

- MATKA SATTA -

-

- Advertisement -

-

- At *Matka Satta Daily.com*, we provide accurate results, expert tips, and daily charts for all major Matka games. Whether you're looking for Desawar Matka results at 5:00 AM or Gali Matka results at 11:30 PM, we’ve got you covered. Stay ahead of the game with our live updates and expert strategies. - -

-

- 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/User/Header.js b/src/User/Header.js deleted file mode 100644 index b77261a..0000000 --- a/src/User/Header.js +++ /dev/null @@ -1,49 +0,0 @@ -import { useState } from "react"; -import { Menu, X } from "lucide-react"; -import { Link } from "react-router-dom"; - -export default function Header() { - const [isOpen, setIsOpen] = useState(false); - - return ( - <> - {/* Header */} -
-
-
- {/* Logo */} - - Advertisement - - - {/* Desktop Menu */} - - - {/* Mobile Menu Button */} - -
- - {/* Mobile Menu */} - {isOpen && ( - - )} -
-
- - ); -} \ No newline at end of file diff --git a/src/User/Herosection.js b/src/User/Herosection.js deleted file mode 100644 index 53f7e16..0000000 --- a/src/User/Herosection.js +++ /dev/null @@ -1,293 +0,0 @@ -import React, { useState, useEffect } from 'react'; -import { RefreshCw, Clock, ChevronRight, ChevronLeft } from 'lucide-react'; -import axios from 'axios'; -import TeamTime from './TeamTime'; - -const HeroSection = () => { - const [todaysMatches, setTodaysMatches] = useState([]); - const [loading, setLoading] = useState(true); - const [error, setError] = useState(null); - const [currentDate, setCurrentDate] = useState(''); - const [activeTeamIndex, setActiveTeamIndex] = useState(0); - - // API URL - const API_URL = 'http://localhost:5500/api'; - - // Format time - const formatTime = (timeString) => { - try { - const date = new Date(timeString); - return date.toLocaleTimeString("en-US", { hour: '2-digit', minute: '2-digit', hour12: true }); - } catch (e) { - return "XX:XX"; - } - }; - - // Fetch today's matches - useEffect(() => { - const fetchTodaysMatches = async () => { - try { - setLoading(true); - - // Get today's date for display - const today = new Date(); - setCurrentDate(today.toLocaleDateString('en-US', { - weekday: 'short', - month: 'long', - day: 'numeric', - year: 'numeric' - })); - - // Get today's results - const todayResultsResponse = await axios.get(`${API_URL}/today`); - const todayResults = todayResultsResponse.data; - - // Group by team - const teamResults = {}; - - todayResults.forEach(result => { - if (!teamResults[result.team]) { - teamResults[result.team] = []; - } - teamResults[result.team].push({ - result: result.visible_result, - time: formatTime(result.result_time), - upcoming: new Date(result.result_time) > new Date() - }); - }); - - // Convert to array for display - const groupedResults = Object.entries(teamResults).map(([team, results]) => ({ - team, - results: results.sort((a, b) => a.upcoming - b.upcoming) - })); - - setTodaysMatches(groupedResults); - setLoading(false); - } catch (err) { - console.error("Error fetching today's matches:", err); - setError("Failed to load today's match data. Please try again later."); - setLoading(false); - } - }; - - fetchTodaysMatches(); - }, []); - - // Navigation handlers - const handleNext = () => { - if (todaysMatches.length > 0) { - setActiveTeamIndex((prevIndex) => - prevIndex === todaysMatches.length - 1 ? 0 : prevIndex + 1 - ); - } - }; - - const handlePrev = () => { - if (todaysMatches.length > 0) { - setActiveTeamIndex((prevIndex) => - prevIndex === 0 ? todaysMatches.length - 1 : prevIndex - 1 - ); - } - }; - - // Refresh data - const handleRefresh = () => { - setLoading(true); - setError(null); - - const fetchData = async () => { - try { - const todayResultsResponse = await axios.get(`${API_URL}/today`); - const todayResults = todayResultsResponse.data; - - const teamResults = {}; - - todayResults.forEach(result => { - if (!teamResults[result.team]) { - teamResults[result.team] = []; - } - teamResults[result.team].push({ - result: result.visible_result, - time: formatTime(result.result_time), - upcoming: new Date(result.result_time) > new Date() - }); - }); - - const groupedResults = Object.entries(teamResults).map(([team, results]) => ({ - team, - results: results.sort((a, b) => a.upcoming - b.upcoming) - })); - - setTodaysMatches(groupedResults); - setLoading(false); - } catch (err) { - setError("Failed to refresh match data. Please try again later."); - setLoading(false); - } - }; - - fetchData(); - }; - - // Render boxes similar to lottery design - return ( -
- {/* Today's Matches Box */} -
-
-

Winning Numbers

-
-
-

{currentDate}

- - {loading ? ( -
- -
- ) : error ? ( -
-

{error}

-
- ) : todaysMatches.length > 0 ? ( -
- {/* Navigation buttons */} - - - - - {/* Current team results */} -
-
- {todaysMatches[activeTeamIndex]?.team || "No Team"} -
- -
- {todaysMatches[activeTeamIndex]?.results.map((result, idx) => ( -
-
- - {result.time} -
-
- {result.upcoming ? "Upcoming" : result.result} -
-
- ))} -
-
- - {/* Team indicators */} -
- {todaysMatches.map((_, idx) => ( -
- ))} -
-
- ) : ( -
- No match results available for today. -
- )} - - - - {/*
- - -
*/} -
-
- - {/* Next Drawing Box */} -
-
-

Next Drawing

-
-
-

Sat, Mar 22, 2025

- -
-
-
67
-
-
-
58
-
-
-
11
-
-
- -
-
HOURS
-
MINUTES
-
SECONDS
-
- -
- ESTIMATED JACKPOT -
- -
- $444 Million -
- -
-
- - {/* Winners Box */} -
-
-

Today's Timing

-
-
- {/*

{currentDate}

*/} - - {/*
-
Team Alpha
-
JACKPOT WINNERS
-
None
-
- -
-
Team Beta
-
$2 MILLION WINNERS
-
CO, TX
-
- -
-
MATCH 5
-
$1 MILLION WINNERS
-
None
-
*/} - -
-
-
- ); -}; - -export default HeroSection; \ No newline at end of file diff --git a/src/User/Home.js b/src/User/Home.js deleted file mode 100644 index b299252..0000000 --- a/src/User/Home.js +++ /dev/null @@ -1,207 +0,0 @@ -import React, { useState, useEffect } from 'react'; -import { BarChart2, Calendar, RefreshCw, Clock, ChevronLeft, ChevronRight } from 'lucide-react'; -import axios from 'axios'; -import Footer from './Footer'; -import Header from './Header'; -import Translate from './Translate'; -import HeroSection from './Herosection'; - -const Home = () => { - - const [teams, setTeams] = useState([]); - const [dates, setDates] = useState([]); - const [selectedTeam, setSelectedTeam] = useState(null); - const [showChartView, setShowChartView] = useState(false); - const [showCalendar, setShowCalendar] = useState(false); - const [currentTime, setCurrentTime] = useState(""); - const [loading, setLoading] = useState(true); - const [error, setError] = useState(null); - const [calendarData, setCalendarData] = useState([]); - const [currentMonth, setCurrentMonth] = useState(new Date()); - const [upcomingMatches, setUpcomingMatches] = useState([]); - - - // API URL - const API_URL = 'http://localhost:5500/api'; - - // Format time - const formatTime = (timeString) => { - try { - const date = new Date(timeString); - return date.toLocaleTimeString("en-US", { hour: '2-digit', minute: '2-digit', hour12: true }); - } catch (e) { - return "XX:XX"; - } - }; - - // Check if a match is upcoming - const isUpcoming = (resultTime) => { - try { - const now = new Date(); - const matchTime = new Date(resultTime); - return matchTime > now; - } catch (e) { - return false; - } - }; - - // Fetch teams data - useEffect(() => { - const fetchData = async () => { - try { - setLoading(true); - - // Get all teams - const teamsResponse = await axios.get(`${API_URL}/teams`); - - // Get today's date and format it - const today = new Date(); - const todayFormatted = today.toISOString().split('T')[0]; - - // Get yesterday's date and format it - const yesterday = new Date(); - yesterday.setDate(yesterday.getDate() - 1); - const yesterdayFormatted = yesterday.toISOString().split('T')[0]; - - // Set dates for display - setDates([yesterdayFormatted, todayFormatted]); - - // Get today's results - const todayResultsResponse = await axios.get(`${API_URL}/results/daily?date=${todayFormatted}`); - const todayResults = todayResultsResponse.data; - - // Get yesterday's results - const yesterdayResultsResponse = await axios.get(`${API_URL}/results/daily?date=${yesterdayFormatted}`); - const yesterdayResults = yesterdayResultsResponse.data; - - // Process upcoming matches - const upcoming = todayResults.filter(result => isUpcoming(result.result_time)); - setUpcomingMatches(upcoming); - - // Combine team data with results - const teamsWithResults = teamsResponse.data.map(team => { - // Get all results for this team - const yesterdayTeamResults = yesterdayResults.filter(r => r.team === team.name); - const todayTeamResults = todayResults.filter(r => r.team === team.name); - - // Create result arrays for both days - const yesterdayResultsArr = yesterdayTeamResults.map(r => ({ - result: r.visible_result, - time: formatTime(r.result_time) - })); - - const todayResultsArr = todayTeamResults - .filter(r => !isUpcoming(r.result_time)) - .map(r => ({ - result: r.visible_result, - time: formatTime(r.result_time) - })); - - // Extract latest scheduled time - let latestTime = "XX:XX"; - const latestTodayResult = todayTeamResults - .sort((a, b) => new Date(b.result_time) - new Date(a.result_time)) - .find(r => r.result_time); - - if (latestTodayResult) { - latestTime = formatTime(latestTodayResult.result_time); - } - - return { - id: team.id, - name: team.name, - time: latestTime, - results: { - [yesterdayFormatted]: yesterdayResultsArr, - [todayFormatted]: todayResultsArr - } - }; - }); - - setTeams(teamsWithResults); - setLoading(false); - } catch (err) { - console.error("Error fetching data:", err); - setError("Failed to load team data. Please try again later."); - setLoading(false); - } - }; - - fetchData(); - - // Update current time every minute - const interval = setInterval(() => { - const now = new Date(); - const formattedTime = now.toLocaleString("en-IN", { timeZone: "Asia/Kolkata" }); - setCurrentTime(formattedTime); - }, 60000); - - // Set initial time - const now = new Date(); - const formattedTime = now.toLocaleString("en-IN", { timeZone: "Asia/Kolkata" }); - setCurrentTime(formattedTime); - - return () => clearInterval(interval); - }, []); - - - return ( -
- -
-
- {/* Header */} - {/*

- Advertisement -

*/} - - {/* Advertisement Banner */} - {/*
- Advertisement -
*/} - {/* Disclaimer */} -

- Welcome to *Matka Satta Daily.com, your ultimate destination for accurate and timely Matka Satta results. We provide live updates, expert tips, and daily charts for all major Matka games, including **Desawar, **Delhi Bazar, **Shri Ganesh, **Faridabad, **Ghaziabad, and **Gali Matka*. Whether you're looking for results, guessing strategies, or historical data, we’ve got you covered. -

- - {/* Informational Text */} -

- Matka Satta Daily Results 2025: Desawar, Delhi Bazar, Shri Ganesh, Faridabad, Ghaziabad, and Gali Matka Live Updates -

- - - - {/* Warning Message */} -

- Please note, do not give any money to anyone in the name of leaked game, neither before nor after - Thank you -

- - {/* Contact Link */} -

- Click to contact us ➡ Click Here -

- - {/* Timestamp */} -

- Updated: {currentTime} IST. -

-
-
- - -
- -
-
- ); -}; - -export default Home; \ No newline at end of file diff --git a/src/User/TeamTime.js b/src/User/TeamTime.js deleted file mode 100644 index 480df75..0000000 --- a/src/User/TeamTime.js +++ /dev/null @@ -1,36 +0,0 @@ -import { useState } from "react"; - -const TeamTime = () => { - const [teams, setTeams] = useState([ - { name: "GALI MATKA", time: "6:00 PM" }, - { name: "GHAZIABAD MATKA", time: "4:00 PM" }, - { name: "FARIDABAD MATKA", time: "12:30 PM" }, - { name: "SHRI GANESH MATKA", time: "11:00 AM" }, - { name: "DELHI BAZAR MATKA", time: "9:30 AM" }, - { name: "DESAWAR MATKA", time: "5:00 AM" }, - ]); - - return ( -
- {/*

Team Match Schedule

*/} - - - - - - - - - {teams.map((team, index) => ( - - - - - ))} - -
Team NameTiming
{team.name}{team.time}
-
- ); -}; - -export default TeamTime; diff --git a/src/User/Translate.js b/src/User/Translate.js deleted file mode 100644 index 31f1562..0000000 --- a/src/User/Translate.js +++ /dev/null @@ -1,64 +0,0 @@ -import { useState } from "react"; -import { Globe } from "lucide-react"; - -export default function Translate() { - - const [currentLanguage, setCurrentLanguage] = useState("English"); - - // Function to handle language change - const changeLanguage = (language) => { - setCurrentLanguage(language); - - // This would integrate with Google Translate API - // For actual implementation, you would need to use the Google Translate Element - if (language === "English") { - // Set to English - if (window.googleTranslateElementInit) { - const selectElement = document.querySelector('.goog-te-combo'); - if (selectElement) { - selectElement.value = 'en'; - selectElement.dispatchEvent(new Event('change')); - } - } - } else if (language === "Hindi") { - // Set to Hindi - if (window.googleTranslateElementInit) { - const selectElement = document.querySelector('.goog-te-combo'); - if (selectElement) { - selectElement.value = 'hi'; - selectElement.dispatchEvent(new Event('change')); - } - } - } - }; - - return ( - <> - {/* Translation Bar */} -
-
-
- - Translate: -
-
- - - {/* Hidden div for Google Translate Element */} -
-
-
-
- - ); -} \ No newline at end of file diff --git a/src/pages/Admin.js b/src/pages/Admin.js deleted file mode 100644 index a7467d5..0000000 --- a/src/pages/Admin.js +++ /dev/null @@ -1,586 +0,0 @@ -import React, { useState, useEffect } from 'react'; -import { PlusCircle, Trash2, Edit, BarChart2, LogIn, Calendar as CalendarIcon } from 'lucide-react'; - -const Admin = () => { - // Authentication state - const [isAuthenticated, setIsAuthenticated] = useState(false); - const [authError, setAuthError] = useState(''); - const [loginData, setLoginData] = useState({ username: '', password: '' }); - - // Static credentials - in a real app, these would be stored securely - const validCredentials = { - username: 'admin', - password: 'satta123' - }; - - const [teams, setTeams] = useState([ - { id: 1, name: 'BIKANER SUPER', time: '02:20 AM', results: { '2025-03-11': '04', '2025-03-12': '61' } }, - { id: 2, name: 'DESAWAR', time: '05:00 AM', results: { '2025-03-11': '79', '2025-03-12': '55' } }, - { id: 3, name: 'FARIDABAD', time: '06:00 PM', results: { '2025-03-11': '78', '2025-03-12': '98' } }, - { id: 4, name: 'GHAZIABAD', time: '09:30 PM', results: { '2025-03-11': '19', '2025-03-12': '23' } }, - { id: 5, name: 'GALI', time: '11:30 PM', results: { '2025-03-11': '72', '2025-03-12': 'XX' } }, - ]); - - const [selectedTeam, setSelectedTeam] = useState(null); - const [showAddForm, setShowAddForm] = useState(false); - const [showEditForm, setShowEditForm] = useState(false); - const [showChartView, setShowChartView] = useState(false); - const [showCalendar, setShowCalendar] = useState(false); - const [formData, setFormData] = useState({ name: '', time: '', result: '' }); - const [dates, setDates] = useState(['2025-03-11', '2025-03-12']); - const [currentDate, setCurrentDate] = useState('2025-03-12'); - - // Calendar state - const [calendarYear, setCalendarYear] = useState(new Date().getFullYear()); - const [calendarMonth, setCalendarMonth] = useState(new Date().getMonth()); - - // Handle login input changes - const handleLoginInputChange = (e) => { - const { name, value } = e.target; - setLoginData({ ...loginData, [name]: value }); - setAuthError(''); - }; - - // Handle login submission - const handleLogin = (e) => { - e.preventDefault(); - if (loginData.username === validCredentials.username && - loginData.password === validCredentials.password) { - setIsAuthenticated(true); - setAuthError(''); - } else { - setAuthError('Invalid username or password'); - } - }; - - // Handle logout - const handleLogout = () => { - setIsAuthenticated(false); - setLoginData({ username: '', password: '' }); - }; - - // Handle input changes for team forms - const handleInputChange = (e) => { - const { name, value } = e.target; - setFormData({ ...formData, [name]: value }); - }; - - // Add new team - const handleAddTeam = () => { - const newTeam = { - id: teams.length + 1, - name: formData.name, - time: formData.time, - results: { - [dates[0]]: '', - [dates[1]]: '' - } - }; - setTeams([...teams, newTeam]); - setFormData({ name: '', time: '', result: '' }); - setShowAddForm(false); - }; - - // Delete team - const handleDeleteTeam = (id) => { - setTeams(teams.filter(team => team.id !== id)); - }; - - // Select team for editing - const handleSelectTeam = (team) => { - setSelectedTeam(team); - setFormData({ - name: team.name, - time: team.time, - result: team.results[currentDate] || '' - }); - setShowEditForm(true); - setShowChartView(false); - }; - - // Update team - const handleUpdateTeam = () => { - const updatedTeams = teams.map(team => { - if (team.id === selectedTeam.id) { - const updatedResults = { ...team.results }; - updatedResults[currentDate] = formData.result; - - return { - ...team, - name: formData.name, - time: formData.time, - results: updatedResults - }; - } - return team; - }); - - setTeams(updatedTeams); - setShowEditForm(false); - setSelectedTeam(null); - setFormData({ name: '', time: '', result: '' }); - }; - - // Show chart for selected team - const handleViewChart = (team) => { - setSelectedTeam(team); - setShowChartView(true); - setShowEditForm(false); - }; - - // Generate mock chart data for the selected team - const generateChartData = () => { - if (!selectedTeam) return []; - - // Generate some random data for demonstration - const mockData = []; - const currentDate = new Date(); - - for (let i = 0; i < 30; i++) { - const date = new Date(currentDate); - date.setDate(date.getDate() - i); - const dateStr = date.toISOString().split('T')[0]; - - mockData.unshift({ - date: dateStr, - result: Math.floor(Math.random() * 100).toString().padStart(2, '0') - }); - } - - return mockData; - }; - - // Calendar helpers - const getDaysInMonth = (year, month) => { - return new Date(year, month + 1, 0).getDate(); - }; - - const getFirstDayOfMonth = (year, month) => { - return new Date(year, month, 1).getDay(); - }; - - const handlePrevMonth = () => { - if (calendarMonth === 0) { - setCalendarMonth(11); - setCalendarYear(calendarYear - 1); - } else { - setCalendarMonth(calendarMonth - 1); - } - }; - - const handleNextMonth = () => { - if (calendarMonth === 11) { - setCalendarMonth(0); - setCalendarYear(calendarYear + 1); - } else { - setCalendarMonth(calendarMonth + 1); - } - }; - - const handleDateSelect = (day) => { - const selectedDate = new Date(calendarYear, calendarMonth, day); - const formattedDate = selectedDate.toISOString().split('T')[0]; - - // Check if the date is in the dates array - if (!dates.includes(formattedDate)) { - // Add the date to the dates array - const newDates = [...dates, formattedDate].sort(); - setDates(newDates); - - // Update teams with the new date - const updatedTeams = teams.map(team => { - const updatedResults = { ...team.results }; - if (!updatedResults[formattedDate]) { - updatedResults[formattedDate] = ''; - } - return { ...team, results: updatedResults }; - }); - - setTeams(updatedTeams); - } - - setCurrentDate(formattedDate); - setShowCalendar(false); - }; - - // Calendar component - const CalendarComponent = () => { - const monthNames = ["January", "February", "March", "April", "May", "June", - "July", "August", "September", "October", "November", "December" - ]; - - const daysInMonth = getDaysInMonth(calendarYear, calendarMonth); - const firstDay = getFirstDayOfMonth(calendarYear, calendarMonth); - - const renderCalendarDays = () => { - const days = []; - - // Add empty cells for days before the first day of the month - for (let i = 0; i < firstDay; i++) { - days.push(
); - } - - // Add cells for each day of the month - for (let day = 1; day <= daysInMonth; day++) { - const date = new Date(calendarYear, calendarMonth, day).toISOString().split('T')[0]; - const isSelected = dates.includes(date); - const isCurrentDate = date === currentDate; - - days.push( -
handleDateSelect(day)} - > - {day} -
- ); - } - - return days; - }; - - return ( -
-
- -
- {monthNames[calendarMonth]} {calendarYear} -
- -
-
- {['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'].map(day => ( -
- {day} -
- ))} -
-
- {renderCalendarDays()} -
-
- ); - }; - - // Login Screen Component - const LoginScreen = () => { - return ( -
-
-
- Bikaner Super Satta Admin Login -
-
- {authError && ( -
- {authError} -
- )} -
- - -
-
- - -
-
- -
-
-
-
- ); - }; - - // Render login screen if not authenticated - if (!isAuthenticated) { - return ; - } - - // Render admin panel if authenticated - return ( -
-
-
- Bikaner Super Satta Result Admin Panel - -
- - {/* Controls */} -
- - -
-
- - -
- {showCalendar && } -
-
- - {/* Add Form */} - {showAddForm && ( -
-

Add New Team

-
-
- - -
-
- - -
-
-
- - -
-
- )} - - {/* Edit Form */} - {showEditForm && selectedTeam && ( -
-

Edit Team: {selectedTeam.name}

-
-
- - -
-
- - -
-
- - -
-
-
- - -
-
- )} - - {/* Chart View */} - {showChartView && selectedTeam && ( -
-

Monthly Chart: {selectedTeam.name}

-
- - - - - - - - - {generateChartData().map((item, index) => ( - - - - - ))} - -
DateResult
{new Date(item.date).toLocaleDateString()}{item.result}
-
-
- -
-
- )} - - {/* Teams Table */} -
- - - - - - - - - - - {teams.map(team => ( - - - - - - - ))} - -
Games List - {new Date(dates[0]).toLocaleDateString()}
- {new Date(dates[0]).toLocaleDateString("en-US", {weekday: 'short'})} -
- {new Date(dates[1]).toLocaleDateString()}
- {new Date(dates[1]).toLocaleDateString("en-US", {weekday: 'short'})} -
Actions
-
{team.name}
-
at {team.time}
-
{team.results[dates[0]] || 'XX'}{team.results[dates[1]] || 'XX'} -
- - - -
-
-
-
-
- ); -}; - -export default Admin; \ No newline at end of file diff --git a/src/pages/AdminPannel.js b/src/pages/AdminPannel.js deleted file mode 100644 index 36fbef5..0000000 --- a/src/pages/AdminPannel.js +++ /dev/null @@ -1,591 +0,0 @@ -import React, { useState, useEffect } from 'react'; -import { BrowserRouter as Router, Route, Routes, Navigate, Link } from 'react-router-dom'; -import './App.css'; -import { useParams,useNavigate,useLocation } from 'react-router-dom'; -import Home from './pages/Home'; -import TeamResults from './pages/TeamResult'; -// Auth Context -const AuthContext = React.createContext(); - -const AuthProvider = ({ children }) => { - const [token, setToken] = useState(localStorage.getItem('token')); - - const login = (newToken) => { - localStorage.setItem('token', newToken); - setToken(newToken); - }; - - const logout = () => { - localStorage.removeItem('token'); - setToken(null); - }; - - return ( - - {children} - - ); -}; - -// API Service -const API_URL = 'http://localhost:5500'; - -const apiService = { - login: async (accessKey, password) => { - const response = await fetch(`${API_URL}/admin/login`, { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ accessKey, password }) - }); - console.log(accessKey); - - - if (!response.ok) { - throw new Error('Login failed'); - } - - return response.json(); - }, - - getTeams: async (token) => { - const response = await fetch(`${API_URL}/api/teams`, { - headers: { 'Authorization': `Bearer ${token}` } - }); - - if (!response.ok) { - throw new Error('Failed to fetch teams'); - } - - return response.json(); - }, - - createTeam: async (teamData, token) => { - const response = await fetch(`${API_URL}/api/teams`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'Authorization': `Bearer ${token}` - }, - body: JSON.stringify(teamData) - }); - - if (!response.ok) { - throw new Error('Failed to create team'); - } - - return response.json(); - }, - - updateTeam: async (id, teamData, token) => { - const response = await fetch(`${API_URL}/api/teams/${id}`, { - method: 'PUT', - headers: { - 'Content-Type': 'application/json', - 'Authorization': `Bearer ${token}` - }, - body: JSON.stringify(teamData) - }); - - if (!response.ok) { - throw new Error('Failed to update team'); - } - - return response.json(); - }, - - deleteTeam: async (id, token) => { - const response = await fetch(`${API_URL}/api/teams/${id}`, { - method: 'DELETE', - headers: { 'Authorization': `Bearer ${token}` } - }); - - if (!response.ok) { - throw new Error('Failed to delete team'); - } - - return response.json(); - }, - - publishResult: async (resultData, token) => { - const response = await fetch(`${API_URL}/admin/results`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'Authorization': `Bearer ${token}` - }, - body: JSON.stringify(resultData) - }); - - if (!response.ok) { - throw new Error('Failed to publish result'); - } - - return response.json(); - }, - - getDailyResults: async (date, token) => { - const response = await fetch(`${API_URL}/api/results/daily?date=${date}`, { - headers: { 'Authorization': `Bearer ${token}` } - }); - - if (!response.ok) { - throw new Error('Failed to fetch daily results'); - } - - return response.json(); - } -}; - -// Components -const Login = () => { - const [accessKey, setAccessKey] = useState(''); - const [password, setPassword] = useState(''); - const [error, setError] = useState(''); - const { login } = React.useContext(AuthContext); - - const handleSubmit = async (e) => { - e.preventDefault(); - try { - const data = await apiService.login(accessKey, password); - login(data.token); - // redirection - - } catch (err) { - setError('Invalid credentials'); - } - }; - - return ( -
-

Admin Login

- {error &&
{error}
} -
-
- - setAccessKey(e.target.value)} - required - /> -
-
- - setPassword(e.target.value)} - required - /> -
- -
-
- ); -}; - -const TeamList = () => { - const [teams, setTeams] = useState([]); - const [loading, setLoading] = useState(true); - const [error, setError] = useState(''); - const { token } = React.useContext(AuthContext); - - useEffect(() => { - const fetchTeams = async () => { - try { - const data = await apiService.getTeams(token); - setTeams(data); - setLoading(false); - } catch (err) { - setError('Failed to fetch teams'); - setLoading(false); - } - }; - - fetchTeams(); - }, [token]); - - const handleDelete = async (id) => { - if (window.confirm('Are you sure you want to delete this team?')) { - try { - await apiService.deleteTeam(id, token); - setTeams(teams.filter(team => team.id !== id)); - } catch (err) { - setError('Failed to delete team'); - } - } - }; - - if (loading) return
Loading...
; - if (error) return
{error}
; - - return ( -
-

Team Management

- Add New Team - - - - - - - - - - {teams.map(team => ( - - - - - - ))} - -
IDNameActions
{team.id}{team.name} - Edit - -
-
- ); -}; - -const TeamForm = ({ isEdit = false }) => { - const [name, setName] = useState(''); - const [submitting, setSubmitting] = useState(false); - const [error, setError] = useState(''); - const { token } = React.useContext(AuthContext); - const { id } = useParams(); - const navigate = useNavigate(); - - useEffect(() => { - if (isEdit && id) { - const fetchTeam = async () => { - try { - const teams = await apiService.getTeams(token); - const team = teams.find(t => t.id === parseInt(id)); - if (team) { - setName(team.name); - } - } catch (err) { - setError('Failed to fetch team details'); - } - }; - - fetchTeam(); - } - }, [isEdit, id, token]); - - const handleSubmit = async (e) => { - e.preventDefault(); - setSubmitting(true); - - try { - if (isEdit) { - await apiService.updateTeam(id, { name }, token); - } else { - await apiService.createTeam({ name }, token); - } - navigate('/teams'); - } catch (err) { - setError(isEdit ? 'Failed to update team' : 'Failed to create team'); - setSubmitting(false); - } - }; - - return ( -
-

{isEdit ? 'Edit Team' : 'Add New Team'}

- {error &&
{error}
} -
-
- - setName(e.target.value)} - required - /> -
- - Cancel -
-
- ); -}; - -const ResultCalendar = () => { - const [date, setDate] = useState(new Date().toISOString().split('T')[0]); - const [results, setResults] = useState([]); - const [teams, setTeams] = useState([]); - const [loading, setLoading] = useState(true); - const [error, setError] = useState(''); - const { token } = React.useContext(AuthContext); - - useEffect(() => { - const fetchData = async () => { - try { - const [teamsData, resultsData] = await Promise.all([ - apiService.getTeams(token), - apiService.getDailyResults(date, token) - ]); - setTeams(teamsData); - setResults(resultsData); - setLoading(false); - } catch (err) { - setError('Failed to fetch data'); - setLoading(false); - } - }; - - fetchData(); - }, [date, token]); - - const handleDateChange = (e) => { - setDate(e.target.value); - }; - - if (loading) return
Loading...
; - if (error) return
{error}
; - - return ( -
-

Results Calendar

-
- - -
- -
-

Results for {date}

- Add New Result - - {results.length === 0 ? ( -

No results for this date.

- ) : ( - - - - - - - - - - {results.map(result => ( - - - - - - ))} - -
TeamResultActions
{result.team}{result.visible_result} - Edit -
- )} -
-
- ); -}; - -const ResultForm = ({ isEdit = false }) => { - const [formData, setFormData] = useState({ - team: '', - result: '', - date: new Date().toISOString().split('T')[0] - }); - const [teams, setTeams] = useState([]); - const [submitting, setSubmitting] = useState(false); - const [error, setError] = useState(''); - const { token } = React.useContext(AuthContext); - const { id } = useParams(); - const navigate = useNavigate(); - const location = useLocation(); - - useEffect(() => { - const fetchTeams = async () => { - try { - const teamsData = await apiService.getTeams(token); - setTeams(teamsData); - - // Set date from query params if available - const params = new URLSearchParams(location.search); - const dateParam = params.get('date'); - if (dateParam) { - setFormData(prev => ({ ...prev, date: dateParam })); - } - - // If editing, fetch the result details - if (isEdit && id) { - // This is a simplified approach. In a real app, you'd have an API endpoint to fetch a specific result - const results = await apiService.getDailyResults(dateParam, token); - const result = results.find(r => r.id === parseInt(id)); - console.log(result.team); - if (result) { - console.log(result) - setFormData({ - team: result.team, - result: result.visible_result, - date: result.date - }); - } - } - } catch (err) { - setError('Failed to fetch data'); - } - }; - - fetchTeams(); - }, [isEdit, id, token, location.search]); - - const handleChange = (e) => { - const { name, value } = e.target; - setFormData(prev => ({ ...prev, [name]: value })); - }; - - const handleSubmit = async (e) => { - e.preventDefault(); - setSubmitting(true); - - try { - await apiService.publishResult(formData, token); - navigate(`/results?date=${formData.date}`); - } catch (err) { - setError('Failed to publish result'); - setSubmitting(false); - } - }; - - return ( -
-

{isEdit ? 'Edit Result' : 'Add New Result'}

- {error &&
{error}
} -
-
- - -
-
- - -
-
- - -
- - Cancel -
-
- ); -}; - -const Dashboard = () => { - const { logout } = React.useContext(AuthContext); - - return ( -
-
-

Admin Dashboard

- -
- - - -
- - } /> - } /> - } /> - } /> - } /> - } /> - } /> - -
-
- ); -}; - -// Protected Route -const ProtectedRoute = ({ children }) => { - const { isAuthenticated } = React.useContext(AuthContext); - - if (!isAuthenticated) { - return ; - } - - return children; -}; - -// App -const App = () => { - return ( - - - - } /> - - - - } - /> - } /> - } /> - - - - - ); -}; - -export default App; \ No newline at end of file diff --git a/src/pages/Faq.js b/src/pages/Faq.js index 0bc647d..09a9dcd 100644 --- a/src/pages/Faq.js +++ b/src/pages/Faq.js @@ -9,14 +9,52 @@ import { useState } from 'react'; }; 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." }, + { + question: "What is matkasatta.com?", + answer: "matkasatta.com is an online platform where users can access information about satta games, strategies, and updates. We aim to provide the most recent and accurate information about the satta industry." + }, + { + question: "How do I register on the website?", + answer: "To register, click on the 'Sign Up' or 'Register' button on our homepage. Fill in the required details and follow the on-screen instructions to complete the registration process." + }, + { + question: "Is it legal to use this website?", + answer: "Online betting laws vary by jurisdiction. It is the responsibility of users to be aware of and comply with their local laws regarding online gambling. Please consult your local regulations before using our website." + }, + { + question: "How is my personal data protected?", + answer: "We take user privacy very seriously. All personal data is stored securely, and we employ measures to protect against unauthorized access. For more details, please refer to our Privacy Policy." + }, + { + question: "Can I delete my account?", + answer: "Yes, you can request account deletion by contacting our support team. Please note that some information might be retained for legal or operational reasons." + }, + { + question: "How do I deposit and withdraw money?", + answer: "To deposit or withdraw money, go to the 'Wallet' or 'Account' section on our website. Supported payment methods include PhonePay, PayTM, Credit Card, and Debit Card. Follow the instructions provided and ensure you are familiar with our terms regarding deposits and withdrawals." + }, + { + question: "Is there a minimum deposit or withdrawal amount?", + answer: "Yes, the minimum deposit is 100 RUPAY and the minimum withdrawal is 1000 RUPAY." + }, + { + question: "What should I do if I encounter a problem?", + answer: "If you face any issues, please contact our support team at support@matkasatta.com or use the 'Contact Us' form on our website." + }, + { + question: "Do you promote responsible gambling?", + answer: "Absolutely. We believe in promoting a responsible gambling environment. If you or someone you know has a gambling problem, please seek help and guidance immediately." + }, + { + question: "Are the games on matkasatta.com fair?", + answer: "Yes, all games are operated with a fair system, and we ensure transparency in all our operations." + } ]; + return ( <> -
+
{/* FAQ Section */}
{faqs.map((faq, index) => ( diff --git a/src/pages/FaqPage.js b/src/pages/FaqPage.js new file mode 100644 index 0000000..d21a570 --- /dev/null +++ b/src/pages/FaqPage.js @@ -0,0 +1,17 @@ +import { useState } from "react"; +import Header from "./Header"; +import Faq from "./Faq"; +import Footer from "./Footer"; + +const FaqPage = () => { + + return ( +
+
+ +
+
+ ); +}; + +export default FaqPage; diff --git a/src/pages/Footer.js b/src/pages/Footer.js index 8021f1c..c68d034 100644 --- a/src/pages/Footer.js +++ b/src/pages/Footer.js @@ -1,13 +1,9 @@ import React from 'react'; -import Faq from './Faq'; const Footer = () => { return ( <>
- {/* FAQ Section */} - - {/* Footer Section */}