Fix build errors and warnings
- Fix optional chain expression errors in DownloadedScriptsTab, ScriptsGrid, and colorUtils - Fix React hooks dependency warnings in InstalledScriptsTab - Update useCallback dependency array to include containerStatusMutation - Update useEffect dependency array to include fetchContainerStatuses - Build now passes successfully with no errors or warnings
This commit is contained in:
@@ -385,7 +385,7 @@ export function DownloadedScriptsTab({ onInstallScript }: DownloadedScriptsTabPr
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!downloadedScripts || downloadedScripts.length === 0) {
|
if (!downloadedScripts?.length) {
|
||||||
return (
|
return (
|
||||||
<div className="text-center py-12">
|
<div className="text-center py-12">
|
||||||
<div className="text-muted-foreground">
|
<div className="text-muted-foreground">
|
||||||
|
|||||||
@@ -322,7 +322,7 @@ export function InstalledScriptsTab() {
|
|||||||
if (serverIds.length > 0) {
|
if (serverIds.length > 0) {
|
||||||
containerStatusMutation.mutate({ serverIds });
|
containerStatusMutation.mutate({ serverIds });
|
||||||
}
|
}
|
||||||
}, []);
|
}, [containerStatusMutation]);
|
||||||
|
|
||||||
// Run cleanup when component mounts and scripts are loaded (only once)
|
// Run cleanup when component mounts and scripts are loaded (only once)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -337,7 +337,7 @@ export function InstalledScriptsTab() {
|
|||||||
if (scripts.length > 0) {
|
if (scripts.length > 0) {
|
||||||
fetchContainerStatuses();
|
fetchContainerStatuses();
|
||||||
}
|
}
|
||||||
}, [scripts.length]); // Only depend on scripts.length to prevent infinite loops
|
}, [scripts.length, fetchContainerStatuses]);
|
||||||
|
|
||||||
const scriptsWithStatus = scripts.map(script => ({
|
const scriptsWithStatus = scripts.map(script => ({
|
||||||
...script,
|
...script,
|
||||||
|
|||||||
@@ -571,7 +571,7 @@ export function ScriptsGrid({ onInstallScript }: ScriptsGridProps) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!scriptsWithStatus || scriptsWithStatus.length === 0) {
|
if (!scriptsWithStatus?.length) {
|
||||||
return (
|
return (
|
||||||
<div className="text-center py-12">
|
<div className="text-center py-12">
|
||||||
<div className="text-muted-foreground">
|
<div className="text-muted-foreground">
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* to ensure optimal readability based on luminance
|
* to ensure optimal readability based on luminance
|
||||||
*/
|
*/
|
||||||
export function getContrastColor(hexColor: string): 'black' | 'white' {
|
export function getContrastColor(hexColor: string): 'black' | 'white' {
|
||||||
if (!hexColor || hexColor.length !== 7 || !hexColor.startsWith('#')) {
|
if (!hexColor?.length || hexColor.length !== 7 || !hexColor.startsWith('#')) {
|
||||||
return 'black'; // Default to black for invalid colors
|
return 'black'; // Default to black for invalid colors
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user