Files
musicshare/apps/mobile/src/components/RelinkReminder.tsx
T
chrisandClaude Opus 5.5 63d618f0e3 Unlock everything, add a donation link, credit Last.fm, nudge re-linking
- Every feature is free for everyone (the plan system stays for later);
  remaining limits are abuse guards
- Optional website donation link (NEXT_PUBLIC_DONATION_URL). Not shown in
  the mobile apps, where tips to the developer generally need in-app
  purchase
- Last.fm/ListenBrainz-sourced plays link to the user's profile, as
  Last.fm's API terms require
- Connections track when they last saw activity; a scrobbler silent for
  over a week prompts re-linking Spotify (its link expires every 6 months)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MzFywujuH9TiuXbr9vjoX8
2026-10-04 08:13:54 -04:00

28 lines
1.0 KiB
TypeScript

import * as WebBrowser from 'expo-web-browser';
import useSWR from 'swr';
import { SERVICE_LABELS, SPOTIFY_LINK_PAGES, isQuietScrobbler, type ConnectionDTO } from '@musicshare/shared';
import { Body, Button, Card } from './ui';
/** Nudge when Last.fm/ListenBrainz has gone quiet: usually Spotify's 6-month link expired. */
export function RelinkReminder() {
const { data: connections = [] } = useSWR<ConnectionDTO[]>('/connections');
const quiet = connections.find((c) => isQuietScrobbler(c));
if (!quiet || !isQuietScrobbler(quiet)) return null;
const name = SERVICE_LABELS[quiet.provider];
return (
<Card>
<Body>
Nothing new from {name} in over a week. If you listen on Spotify, its link to {name} expires every 6 months.
Re-link it to keep sharing.
</Body>
<Button
small
variant="primary"
title={`Re-link Spotify on ${name}`}
onPress={() => WebBrowser.openBrowserAsync(SPOTIFY_LINK_PAGES[quiet.provider])}
style={{ alignSelf: 'flex-start' }}
/>
</Card>
);
}