Skip to content

Commit

Permalink
feat: show GitHub token info only when token is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
HikaruEgashira committed Dec 30, 2024
1 parent 4cf7851 commit d7f7e27
Showing 1 changed file with 29 additions and 25 deletions.
54 changes: 29 additions & 25 deletions src/components/SearchHero/HeroContent.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { motion } from 'framer-motion';
import { Waves } from 'lucide-react';
import { useGitHubToken } from '../../context/GitHubTokenContext';

export function HeroContent() {
const { token } = useGitHubToken();
return (
<motion.div
initial={{ opacity: 0, y: 20 }}
Expand All @@ -27,32 +29,34 @@ export function HeroContent() {
</p>
</div>

<div className="p-4 bg-blue-50 dark:bg-blue-900/20 rounded-lg max-w-md mx-auto">
<h2 className="font-medium text-blue-700 dark:text-blue-300 mb-2">
πŸ”‘ GitHub Token Required
</h2>
<p className="text-sm text-gray-600 dark:text-gray-400 mb-3">
To use Surf Board, you'll need a GitHub personal access token with repository read permissions.
</p>
<div className="space-y-2">
<a
href="https://github.com/settings/tokens/new"
target="_blank"
rel="noopener noreferrer"
className="text-sm text-blue-600 dark:text-blue-400 hover:underline block"
>
β†’ Create a GitHub Token
</a>
<a
href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens"
target="_blank"
rel="noopener noreferrer"
className="text-sm text-blue-600 dark:text-blue-400 hover:underline block"
>
β†’ Learn more about GitHub tokens
</a>
{!token && (
<div className="p-4 bg-blue-50 dark:bg-blue-900/20 rounded-lg max-w-md mx-auto">
<h2 className="font-medium text-blue-700 dark:text-blue-300 mb-2">
πŸ”‘ GitHub Token Required
</h2>
<p className="text-sm text-gray-600 dark:text-gray-400 mb-3">
To use Surf Board, you'll need a GitHub personal access token with repository read permissions.
</p>
<div className="space-y-2">
<a
href="https://github.com/settings/tokens/new"
target="_blank"
rel="noopener noreferrer"
className="text-sm text-blue-600 dark:text-blue-400 hover:underline block"
>
β†’ Create a GitHub Token
</a>
<a
href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens"
target="_blank"
rel="noopener noreferrer"
className="text-sm text-blue-600 dark:text-blue-400 hover:underline block"
>
β†’ Learn more about GitHub tokens
</a>
</div>
</div>
</div>
)}

<div className="text-sm text-gray-500 dark:text-gray-400">
Get started by entering your search query above ↑
Expand Down

0 comments on commit d7f7e27

Please sign in to comment.