This repository has been archived on 2026-11-17. You can view files and clone it, but cannot push or open issues or pull requests.
gitgram-ai/gitgram/web/components/LoadLatestButton.tsx
caelum0x 50d986473e feat: round-6 external harvest (19 more features, all products green)
- gitgram-web (4): per-image alt-text accessibility, "New posts" load-latest pill
- gitgram-backend (1): per-user muted words/tags moderation (MutedWord model + matcher)
- gitgram-mobile (4): swipe-to-action list rows, soft-reset event bus (tap tab scroll-top)
- aitm-api (7): gitnexus api_impact blast-radius/risk endpoints (reuse vendored gitnexus)
- aitm-mcp (3): MCP handshake instructions, context-efficient beads output projections

Note: gitgram-backend adds MutedWord Prisma model — run prisma migrate at deploy.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-28 19:04:16 +03:00

45 lines
1.6 KiB
TypeScript

'use client'
interface LoadLatestButtonProps {
/** Number of fresh posts waiting to be loaded. */
count: number
/** Invoked when the user taps the pill: scroll to top + refetch first page. */
onPress: () => void
}
/**
* Floating "New posts" pill, ported from Bluesky's LoadLatestBtn to the
* product's stack (Tailwind + CSS variables instead of react-native-reanimated).
*
* Surfaces content that arrived after the feed was rendered. The host feed is
* responsible for detecting new posts (poll / realtime) and supplying `count`;
* this component is purely presentational so it stays small and testable.
*/
export default function LoadLatestButton({ count, onPress }: LoadLatestButtonProps) {
if (count <= 0) return null
const label = count === 1 ? '1 new post' : `${count} new posts`
return (
<div className="sticky top-2 z-20 flex justify-center pointer-events-none">
<button
type="button"
onClick={onPress}
aria-label={`Load ${label}`}
className="pointer-events-auto flex items-center gap-2 px-4 py-2 rounded-full bg-[var(--primary)] text-white text-sm font-semibold shadow-lg hover:brightness-110 active:scale-95 transition focus:outline-none focus:ring-2 focus:ring-[var(--primary)] focus:ring-offset-2 focus:ring-offset-[var(--background)]"
>
<svg
className="w-4 h-4"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
aria-hidden="true"
>
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M5 15l7-7 7 7" />
</svg>
<span>{label}</span>
</button>
</div>
)
}