Update Home.tsx
parent
736a89803d
commit
5f0505d7d0
|
|
@ -49,13 +49,8 @@ interface Server {
|
||||||
inviteCode: string;
|
inviteCode: string;
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
new: boolean;
|
new: boolean;
|
||||||
sortorder: number;
|
|
||||||
showcolor: string;
|
showcolor: string;
|
||||||
}
|
sortorder: number;
|
||||||
|
|
||||||
interface CachedData {
|
|
||||||
timestamp: number;
|
|
||||||
data: Server[];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add a styled component for the new text color
|
// Add a styled component for the new text color
|
||||||
|
|
@ -68,12 +63,13 @@ const NewServerWrapper = styled.div`
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
// Add a styled component for servers with custom colors
|
// Dynamic color wrapper component
|
||||||
const ColoredServerWrapper = styled.div<{ customColor: string }>`
|
const ColorWrapper = styled.div<{ color: string }>`
|
||||||
|
color: ${props => props.color};
|
||||||
display: contents;
|
display: contents;
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: ${props => props.customColor};
|
color: ${props => props.color};
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|
@ -108,7 +104,7 @@ const Home: React.FC = () => {
|
||||||
const fetchAndCacheData = async () => {
|
const fetchAndCacheData = async () => {
|
||||||
try {
|
try {
|
||||||
const csvUrl =
|
const csvUrl =
|
||||||
"https://docs.google.com/spreadsheets/d/1kNF50scEUJVJ9KD-0_ibX43vJiOzdHrmgauLoSoBy34/export?format=csv&gid=0";
|
"https://docs.google.com/spreadsheets/d/e/2PACX-1vRY41D-NgTE6bC3kTN3dRpisI-DoeHG8Eg7n31xb1CdydWjOLaphqYckkTiaG9oIQSWP92h3NE-7cpF/pub?gid=0&single=true&output=csv";
|
||||||
|
|
||||||
// Add cache-busting parameter to prevent browser caching
|
// Add cache-busting parameter to prevent browser caching
|
||||||
const urlWithCacheBust = `${csvUrl}&_cb=${Date.now()}`;
|
const urlWithCacheBust = `${csvUrl}&_cb=${Date.now()}`;
|
||||||
|
|
@ -210,20 +206,13 @@ const Home: React.FC = () => {
|
||||||
<Link to={linkTo}>{buttonContent}</Link>
|
<Link to={linkTo}>{buttonContent}</Link>
|
||||||
);
|
);
|
||||||
|
|
||||||
// Apply custom color if showcolor is specified
|
if (server.showcolor && server.showcolor.trim()) {
|
||||||
if (server.showcolor && server.showcolor.trim() !== '') {
|
content = <ColorWrapper color={server.showcolor}>{content}</ColorWrapper>;
|
||||||
content = (
|
} else if (server.new) {
|
||||||
<ColoredServerWrapper customColor={server.showcolor}>
|
content = <NewServerWrapper>{content}</NewServerWrapper>;
|
||||||
{content}
|
|
||||||
</ColoredServerWrapper>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return server.new ? (
|
return content;
|
||||||
<NewServerWrapper>{content}</NewServerWrapper>
|
|
||||||
) : (
|
|
||||||
content
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue