Create-account links for Last.fm and ListenBrainz, and Link Spotify for ListenBrainz

ListenBrainz accounts are MusicBrainz accounts, so its sign-up link goes to MusicBrainz.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-15 12:02:40 -04:00
co-authored by Claude Opus 5.5
parent d64e810866
commit 804493aee0
5 changed files with 41 additions and 15 deletions
@@ -1,8 +1,7 @@
import { useState } from 'react';
import { Linking } from 'react-native';
import { mutate } from 'swr';
import { SERVICE_LABELS } from '@musicshare/shared';
import { SignInError, signInWithService } from '@/lib/connect';
import { SignInError, openSignupPage, signInWithService } from '@/lib/connect';
import { Button } from '../ui';
import { ErrorText, SetupActions, SetupHeader, type SetupProps } from './common';
@@ -57,7 +56,7 @@ export function ServiceSignInSetup({
/>
<ErrorText>{error}</ErrorText>
<SetupActions primary="Sign in with Last.fm" loading={busy} onPrimary={run} onSkip={onDone} skipLabel={skipLabel} />
<Button small title="New to Last.fm? Create an account" onPress={() => Linking.openURL('https://www.last.fm/join')} />
<Button small title="New to Last.fm? Create an account" onPress={() => openSignupPage('lastfm')} />
</>
);
}
@@ -1,9 +1,9 @@
import { useState } from 'react';
import { Linking, Pressable, StyleSheet, Text, View } from 'react-native';
import { Pressable, StyleSheet, Text, View } from 'react-native';
import useSWR, { mutate } from 'swr';
import type { ConnectionDTO } from '@musicshare/shared';
import { api } from '@/lib/api';
import { SignInError, openSpotifyLinkPage, signInWithService } from '@/lib/connect';
import { SignInError, openSignupPage, openSpotifyLinkPage, signInWithService } from '@/lib/connect';
import { successHaptic } from '@/lib/haptics';
import { colors, radius, space } from '@/lib/theme';
import { Body, Button, Field } from '../ui';
@@ -108,7 +108,7 @@ export function SpotifySetup({ onDone, skipLabel }: SetupProps) {
onPress={() => setVia('listenbrainz')}
title="ListenBrainz"
badge="Open source"
detail="Free and run by a nonprofit. Enter your ListenBrainz username."
detail="Free and run by a nonprofit. Enter your ListenBrainz username, then approve Spotify on ListenBrainz."
/>
{via === 'listenbrainz' && (
@@ -123,9 +123,16 @@ export function SpotifySetup({ onDone, skipLabel }: SetupProps) {
)}
<Button title={skipLabel ?? 'Not now'} onPress={onDone} />
</View>
<Body muted style={styles.small} onPress={() => Linking.openURL(via === 'listenbrainz' ? 'https://listenbrainz.org/login/' : 'https://www.last.fm/join')}>
No account yet? Create one free on {via === 'listenbrainz' ? 'ListenBrainz' : 'Last.fm'} first.
</Body>
{via && (
<View style={{ gap: space.xs }}>
<Button small title={`No account? Create one on ${via === 'listenbrainz' ? 'MusicBrainz' : 'Last.fm'}`} onPress={() => openSignupPage(via)} />
{via === 'listenbrainz' && (
<Body muted style={styles.small}>
ListenBrainz uses MusicBrainz accounts. After creating one, sign in to ListenBrainz once, then come back.
</Body>
)}
</View>
)}
</>
);
}