Highlight the new server with yellor color

This commit is contained in:
Harish Vishwakarma
2024-10-27 23:17:09 +05:30
parent 34601c479e
commit 74e7fd2af2

View File

@@ -47,12 +47,27 @@ interface Server {
description: string; description: string;
inviteCode: string; inviteCode: string;
disabled: boolean; disabled: boolean;
new: boolean; // Add the new field
} }
interface CachedData { // Add a styled component for the new text color
timestamp: number; const NewServerWrapper = styled.div`
data: Server[]; color: yellow;
}
// Make all text yellow, including description
* {
color: yellow !important;
}
a {
color: yellow;
}
// Target the description specifically if needed
[class*="description"] {
color: yellow !important;
}
`;
const CACHE_KEY = "server_list_cache"; const CACHE_KEY = "server_list_cache";
const CACHE_DURATION = 1 * 60 * 1000; // 1 minutes in milliseconds const CACHE_DURATION = 1 * 60 * 1000; // 1 minutes in milliseconds
@@ -177,19 +192,22 @@ const Home: React.FC = () => {
</CategoryButton> </CategoryButton>
); );
if (server.disabled) { const content = server.disabled ? (
return (
<DisabledButtonWrapper key={server.id}> <DisabledButtonWrapper key={server.id}>
{buttonContent} {buttonContent}
</DisabledButtonWrapper> </DisabledButtonWrapper>
); ) : (
} else {
return (
<Link to={linkTo} key={server.id}> <Link to={linkTo} key={server.id}>
{buttonContent} {buttonContent}
</Link> </Link>
); );
}
// Wrap with NewServerWrapper if server is new
return server.new ? (
<NewServerWrapper key={server.id}>{content}</NewServerWrapper>
) : (
content
);
}; };
if (loading) { if (loading) {