diff --git a/src/Components/StarPrompt/index.css b/src/Components/StarPrompt/index.css new file mode 100644 index 000000000..21f3b7237 --- /dev/null +++ b/src/Components/StarPrompt/index.css @@ -0,0 +1,3 @@ +.star-prompt .MuiTypography-root { + font-size: var(--env-var-font-size-medium); +} diff --git a/src/Components/StarPrompt/index.jsx b/src/Components/StarPrompt/index.jsx index 3f7b08f43..135a703d5 100644 --- a/src/Components/StarPrompt/index.jsx +++ b/src/Components/StarPrompt/index.jsx @@ -1,141 +1,118 @@ import React, { useState, useEffect } from 'react'; -import { Box, Typography, IconButton, Paper } from '@mui/material'; +import { Box, Typography, IconButton } from '@mui/material'; import CloseIcon from '@mui/icons-material/Close'; -import GitHubIcon from '@mui/icons-material/GitHub'; +import { useTheme } from '@emotion/react'; +import './index.css'; -const StarPrompt = ({ - repoUrl = 'https://github.com/bluewave-labs/checkmate', - title = 'Star Checkmate', - description = 'See the latest releases and help grow the community on GitHub', - storageKey = 'starPromptClosed' -}) => { +const StarPrompt = () => { const [isVisible, setIsVisible] = useState(false); - const [starCount, setStarCount] = useState('0'); + const STORAGE_KEY = 'starPromptClosed'; + const theme = useTheme(); useEffect(() => { - const fetchStarCount = async () => { - try { - const owner = 'bluewave-labs'; - const repo = 'checkmate'; - - const response = await fetch(`https://api.github.com/repos/${owner}/${repo}`); - const data = await response.json(); - - const count = data.stargazers_count; - const formattedCount = count >= 1000 - ? `${(count / 1000).toFixed(1)}k` - : count.toString(); - - setStarCount(formattedCount); - } catch (error) { - console.error('Error fetching star count:', error); - } - }; - - fetchStarCount(); - - const hasClosedPrompt = localStorage.getItem(storageKey); + const hasClosedPrompt = localStorage.getItem(STORAGE_KEY); if (!hasClosedPrompt) { setIsVisible(true); } - }, [storageKey]); + }, []); const handleClose = () => { - localStorage.setItem(storageKey, 'true'); + localStorage.setItem(STORAGE_KEY, 'true'); setIsVisible(false); }; const handleStarClick = () => { - window.open(repoUrl, '_blank'); + window.open('https://github.com/bluewave-labs/checkmate', '_blank'); }; if (!isVisible) return null; return ( - - - - - {title} + + + + Star Checkmate - + - - - {description} + + + See the latest releases and help grow the community on GitHub - - - Checkmate - - - {starCount} - - + /> - + ); };