Skip to content

Commit

Permalink
chore: Improve <Socials /> Farcaster URL processing (coinbase#1688)
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcramer authored Dec 3, 2024
1 parent bae7ec6 commit 49c4e59
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/identity/components/Socials.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ describe('Socials', () => {
);
expect(screen.getByTestId('ockSocials_Farcaster')).toHaveAttribute(
'href',
'farcasteruser',
'https://warpcast.com/farcasteruser',
);
expect(screen.getByTestId('ockSocials_Website')).toHaveAttribute(
'href',
Expand Down
2 changes: 1 addition & 1 deletion src/identity/utils/getSocialPlatformDetails.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('PLATFORM_CONFIG', () => {

it('should generate correct Farcaster URL', () => {
const url = PLATFORM_CONFIG.farcaster.href('username');
expect(url).toBe('username');
expect(url).toBe('https://warpcast.com/username');
});

it('should return website URL as-is', () => {
Expand Down
5 changes: 4 additions & 1 deletion src/identity/utils/getSocialPlatformDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ export const PLATFORM_CONFIG: Record<
icon: githubSvg,
},
farcaster: {
href: (value) => value,
href: (value) => {
const username = value.split('/').pop();
return `https://warpcast.com/${username}`;
},
icon: warpcastSvg,
},
website: {
Expand Down

0 comments on commit 49c4e59

Please sign in to comment.