refactor: remove unused imports and optimize dependencies in multiple components
This commit is contained in:
parent
03fb97f357
commit
b0fdc16d49
@ -1,5 +1,3 @@
|
|||||||
import { useState, useEffect } from "react";
|
|
||||||
|
|
||||||
export default function Translate() {
|
export default function Translate() {
|
||||||
return (
|
return (
|
||||||
<div className="flex justify-between items-center bg-gray-800 text-white px-2 mx-auto">
|
<div className="flex justify-between items-center bg-gray-800 text-white px-2 mx-auto">
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import { useState } from "react";
|
|
||||||
import Header from "./Header";
|
import Header from "./Header";
|
||||||
import Faq from "./Faq";
|
import Faq from "./Faq";
|
||||||
import Footer from "./Footer";
|
import Footer from "./Footer";
|
||||||
|
|||||||
@ -141,7 +141,7 @@ const GameList = () => {
|
|||||||
setCurrentTime(formattedTime);
|
setCurrentTime(formattedTime);
|
||||||
|
|
||||||
return () => clearInterval(interval);
|
return () => clearInterval(interval);
|
||||||
}, []);
|
}, [API_URL]);
|
||||||
|
|
||||||
// Show chart for selected team
|
// Show chart for selected team
|
||||||
const handleViewChart = async (team) => {
|
const handleViewChart = async (team) => {
|
||||||
|
|||||||
@ -106,7 +106,7 @@ const Home = () => {
|
|||||||
setCurrentTime(formattedTime);
|
setCurrentTime(formattedTime);
|
||||||
|
|
||||||
return () => clearInterval(interval);
|
return () => clearInterval(interval);
|
||||||
}, []);
|
}, [API_URL]);
|
||||||
|
|
||||||
// Show chart for selected team
|
// Show chart for selected team
|
||||||
const handleViewChart = async (team) => {
|
const handleViewChart = async (team) => {
|
||||||
@ -263,7 +263,7 @@ const Home = () => {
|
|||||||
|
|
||||||
{/* Contact Link */}
|
{/* Contact Link */}
|
||||||
<p className="mt-2 text-green-600 font-medium bg-white p-1 w-full lg:w-3/4 m-auto">
|
<p className="mt-2 text-green-600 font-medium bg-white p-1 w-full lg:w-3/4 m-auto">
|
||||||
हमसे संपर्क करने के लिए ➡ <a href="#" className="underline">यहाँ क्लिक करें</a>
|
हमसे संपर्क करने के लिए ➡ <a href="#" role="button" className="btn">Click Here</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
{/* Timestamp */}
|
{/* Timestamp */}
|
||||||
@ -474,3 +474,5 @@ const Home = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default Home;
|
export default Home;
|
||||||
|
|
||||||
|
const result = (condition1 && condition2) || (condition3 && condition4);
|
||||||
@ -140,7 +140,7 @@ const Home2 = () => {
|
|||||||
setCurrentTime(formattedTime);
|
setCurrentTime(formattedTime);
|
||||||
|
|
||||||
return () => clearInterval(interval);
|
return () => clearInterval(interval);
|
||||||
}, []);
|
}, [API_URL]);
|
||||||
|
|
||||||
// Show chart for selected team
|
// Show chart for selected team
|
||||||
const handleViewChart = async (team) => {
|
const handleViewChart = async (team) => {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect, useMemo } from 'react';
|
||||||
import { RefreshCw, Clock, ChevronDown, ChevronUp, Calendar, AlertTriangle } from 'lucide-react';
|
import { RefreshCw, Clock, ChevronDown, ChevronUp, Calendar, AlertTriangle } from 'lucide-react';
|
||||||
|
|
||||||
const MatkaResultsDashboard = () => {
|
const MatkaResultsDashboard = () => {
|
||||||
@ -9,7 +9,7 @@ const MatkaResultsDashboard = () => {
|
|||||||
const [expandedTeams, setExpandedTeams] = useState({});
|
const [expandedTeams, setExpandedTeams] = useState({});
|
||||||
|
|
||||||
// Matka teams and their scheduled times
|
// Matka teams and their scheduled times
|
||||||
const matkaTeams = [
|
const matkaTeams = useMemo(() => [
|
||||||
{
|
{
|
||||||
team: "Desawar Matka",
|
team: "Desawar Matka",
|
||||||
time: "5:00 AM",
|
time: "5:00 AM",
|
||||||
@ -46,7 +46,7 @@ const MatkaResultsDashboard = () => {
|
|||||||
description: "End your day with the Gali Matka results at 11:30 PM. Our platform offers live updates, daily charts, and expert tips to help you make informed decisions.",
|
description: "End your day with the Gali Matka results at 11:30 PM. Our platform offers live updates, daily charts, and expert tips to help you make informed decisions.",
|
||||||
tip: "Use the Gali Matka chart to track historical results and improve your guessing accuracy."
|
tip: "Use the Gali Matka chart to track historical results and improve your guessing accuracy."
|
||||||
}
|
}
|
||||||
];
|
], []);
|
||||||
|
|
||||||
// Format time
|
// Format time
|
||||||
const formatTime = (timeString) => {
|
const formatTime = (timeString) => {
|
||||||
@ -123,7 +123,7 @@ const MatkaResultsDashboard = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
generateMockResults();
|
generateMockResults();
|
||||||
}, []);
|
}, [matkaTeams]);
|
||||||
|
|
||||||
// Refresh data
|
// Refresh data
|
||||||
const handleRefresh = () => {
|
const handleRefresh = () => {
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|
||||||
const TeamMatchTable = () => {
|
const TeamMatchTable = () => {
|
||||||
const [teams, setTeams] = useState([
|
const [teams] = useState([
|
||||||
{ name: "GALI MATKA", time: "11:30 PM" },
|
{ name: "GALI MATKA", time: "11:30 PM" },
|
||||||
{ name: "GHAZIABAD MATKA", time: "9:30 PM" },
|
{ name: "GHAZIABAD MATKA", time: "9:30 PM" },
|
||||||
{ name: "FARIDABAD MATKA", time: "6:00 PM" },
|
{ name: "FARIDABAD MATKA", time: "6:00 PM" },
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect, useCallback } from 'react';
|
||||||
import { RefreshCw, Clock, ChevronDown, ChevronUp, Calendar, AlertTriangle } from 'lucide-react';
|
import { RefreshCw, Clock, ChevronDown, ChevronUp, Calendar, AlertTriangle } from 'lucide-react';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ const MatkaResultsDashboard = () => {
|
|||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchTodaysResults = async () => {
|
const fetchTodaysResults = useCallback(async () => {
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
setError(null);
|
setError(null);
|
||||||
@ -117,11 +117,11 @@ const MatkaResultsDashboard = () => {
|
|||||||
setError("Failed to load today's Matka data. Please try again later.");
|
setError("Failed to load today's Matka data. Please try again later.");
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
};
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchTodaysResults();
|
fetchTodaysResults();
|
||||||
}, []);
|
}, [fetchTodaysResults]);
|
||||||
|
|
||||||
const handleRefresh = () => {
|
const handleRefresh = () => {
|
||||||
fetchTodaysResults();
|
fetchTodaysResults();
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect, useCallback } from 'react';
|
||||||
import { RefreshCw, Clock } from 'lucide-react';
|
import { RefreshCw, Clock } from 'lucide-react';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import TeamMatchTable from './Teams';
|
import TeamMatchTable from './Teams';
|
||||||
@ -25,7 +25,7 @@ const TodaysMatch = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Fetch matches
|
// Fetch matches
|
||||||
const fetchMatches = async () => {
|
const fetchMatches = useCallback(async () => {
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
|
||||||
@ -68,12 +68,12 @@ const TodaysMatch = () => {
|
|||||||
setError("Failed to load match data. Please try again later.");
|
setError("Failed to load match data. Please try again later.");
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
};
|
}, []);
|
||||||
|
|
||||||
// On component mount
|
// On component mount
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchMatches();
|
fetchMatches();
|
||||||
}, []);
|
}, [fetchMatches]);
|
||||||
|
|
||||||
// Refresh handler
|
// Refresh handler
|
||||||
const handleRefresh = () => {
|
const handleRefresh = () => {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect, useMemo } from 'react';
|
||||||
import { RefreshCw, Clock, ChevronDown, ChevronUp, Calendar, AlertTriangle } from 'lucide-react';
|
import { RefreshCw, Clock, ChevronDown, ChevronUp, Calendar, AlertTriangle } from 'lucide-react';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ const MatkaResultsDashboard = () => {
|
|||||||
const API_URL = `http://${API_HOST}/api`;
|
const API_URL = `http://${API_HOST}/api`;
|
||||||
|
|
||||||
// Matka team descriptions and tips
|
// Matka team descriptions and tips
|
||||||
const matkaTeamInfo = {
|
const matkaTeamInfo = useMemo(() => ({
|
||||||
"Desawar Matka": {
|
"Desawar Matka": {
|
||||||
description: "Start your day with the latest Desawar Matka results at 5:00 AM. Our platform provides real-time updates and accurate results to help you stay ahead.",
|
description: "Start your day with the latest Desawar Matka results at 5:00 AM. Our platform provides real-time updates and accurate results to help you stay ahead.",
|
||||||
tip: "Analyze the Desawar Matka chart to identify patterns and trends for better predictions."
|
tip: "Analyze the Desawar Matka chart to identify patterns and trends for better predictions."
|
||||||
@ -39,7 +39,7 @@ const MatkaResultsDashboard = () => {
|
|||||||
description: "End your day with the Gali Matka results at 11:30 PM. Our platform offers live updates, daily charts, and expert tips to help you make informed decisions.",
|
description: "End your day with the Gali Matka results at 11:30 PM. Our platform offers live updates, daily charts, and expert tips to help you make informed decisions.",
|
||||||
tip: "Use the Gali Matka chart to track historical results and improve your guessing accuracy."
|
tip: "Use the Gali Matka chart to track historical results and improve your guessing accuracy."
|
||||||
}
|
}
|
||||||
};
|
}), []);
|
||||||
|
|
||||||
// Format time
|
// Format time
|
||||||
const formatTime = (timeString) => {
|
const formatTime = (timeString) => {
|
||||||
@ -124,7 +124,7 @@ const MatkaResultsDashboard = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
fetchTodaysResults();
|
fetchTodaysResults();
|
||||||
}, []);
|
}, [API_URL, matkaTeamInfo]);
|
||||||
|
|
||||||
// Refresh data
|
// Refresh data
|
||||||
const handleRefresh = () => {
|
const handleRefresh = () => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user