Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,11 @@ pnpm build
- Browse the maintainer issue inventory in [docs/open-source/issue-backlog.md](./docs/open-source/issue-backlog.md).
- Use the issue templates in [`.github/ISSUE_TEMPLATE`](./.github/ISSUE_TEMPLATE).
- Review [SECURITY.md](./SECURITY.md) before reporting vulnerabilities.

### Quick Buy Shortcut

On desktop, creator cards display a keyboard shortcut hint.

Press `K` while focused on a creator card to open the Quick Buy flow.

Mobile behavior remains unchanged.
11 changes: 11 additions & 0 deletions src/components/common/CreatorCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import CreatorDropCountdown from '@/components/common/CreatorDropCountdown';
import CreatorHandleHoverCard from '@/components/common/CreatorHandleHoverCard';
import { CREATOR_CARD_MEDIA_RADIUS_CLASS } from '@/utils/creatorCardTokens';


interface CreatorCardProps {
creator: Course;
className?: string;
Expand Down Expand Up @@ -507,6 +508,16 @@ const CreatorCard: React.FC<CreatorCardProps> = ({
? 'Retry Purchase'
: 'Buy Key'}
</AsyncButton>
<div className="flex items-center gap-2">
<BuyButton creator={creator} />

<span
className="hidden md:inline-flex items-center rounded border px-1.5 py-0.5 text-[10px] text-muted-foreground"
aria-label="Quick buy keyboard shortcut"
>
⌘K
</span>
</div>
</div>

<BuyActionHelperText
Expand Down
20 changes: 20 additions & 0 deletions src/hooks/useQuickBuyShortcut.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { useEffect } from 'react';

export const useQuickBuyShortcut = () => {
useEffect(() => {
const handleKeyDown = (e: KeyboardEvent) => {
if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === 'k') {
// Find the hovered or focused creator card
const hoveredCard = document.querySelector('.creator-card:hover');
if (hoveredCard) {
const buyButton = hoveredCard.querySelector('button') as HTMLButtonElement;
buyButton?.click();
e.preventDefault();
}
}
};

window.addEventListener('keydown', handleKeyDown);
return () => window.removeEventListener('keydown', handleKeyDown);
}, []);
};
2 changes: 2 additions & 0 deletions src/pages/LandingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
const FEATURED_CREATOR_FOLLOWER_COUNT: number | null = null;
const FEATURED_CREATOR_KEY_HOLDER_COUNT = 0;


const getFeaturedCreatorKeyHolderCopy = (count: number | null) => {
if (count == null) {
return {
Expand All @@ -86,6 +87,7 @@
explanation: 'Number of wallets that currently hold at least one key.',
};
};
useQuickBuyShortcut();

Check failure on line 90 in src/pages/LandingPage.tsx

View workflow job for this annotation

GitHub Actions / verify

React Hook "useQuickBuyShortcut" cannot be called at the top level. React Hooks must be called in a React function component or a custom React Hook function

// Fallback demo data in case API fails
const DEMO_CREATORS: Course[] = [
Expand Down
Loading