refactor: use reusable ProfileLink component on home screen#204
Open
Saurav09s wants to merge 2 commits into
Open
refactor: use reusable ProfileLink component on home screen#204Saurav09s wants to merge 2 commits into
Saurav09s wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the mobile HomeScreen to render platform/profile links using a new reusable ProfileLink component, aiming to replace the previously hardcoded platform badge UI.
Changes:
- Added a new
ProfileLinkcomponent for displaying a platform + username row with an “Open” affordance. - Updated
HomeScreento render up to 4 links viaProfileLinkand show a “+N” overflow indicator. - Reorganized the HomeScreen layout around the links/QR/actions sections.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| apps/mobile/src/screens/HomeScreen.tsx | Switches platform link rendering to ProfileLink and rearranges sections, but currently introduces JSX syntax issues. |
| apps/mobile/src/components/ProfileLink.tsx | Introduces the reusable link row component used by HomeScreen. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+144
to
+150
| <ProfileLink | ||
| key={link.id} | ||
| platform={platform?.name || link.platform} | ||
| username={link.username} | ||
| url={link.url} | ||
| onPress={() => Linking.openURL(link.url)} | ||
| /> |
Comment on lines
18
to
23
| import { APP_URL, API_BASE_URL } from '../config'; | ||
| import type { NativeStackNavigationProp } from '@react-navigation/native-stack'; | ||
| import type { RootStackParamList } from '../navigation/MainTabs'; | ||
| import ProfileLink from '../components/ProfileLink'; | ||
| import { Linking } from 'react-native'; | ||
|
|
Comment on lines
+309
to
+311
| marginTop: SPACING.md, | ||
| gap: SPACING.sm, | ||
| }, |
Comment on lines
+46
to
+69
| const styles = StyleSheet.create({ | ||
| card: { | ||
| flexDirection: 'row', | ||
| alignItems: 'center', | ||
| justifyContent: 'space-between', | ||
| padding: 16, | ||
| borderRadius: 12, | ||
| backgroundColor: '#161616', | ||
| marginBottom: 12, | ||
| }, | ||
| platform: { | ||
| fontSize: 16, | ||
| fontWeight: '600', | ||
| color: '#ffffff', | ||
| }, | ||
| username: { | ||
| marginTop: 4, | ||
| fontSize: 14, | ||
| color: '#a1a1aa', | ||
| }, | ||
| link: { | ||
| fontSize: 14, | ||
| fontWeight: '600', | ||
| color: '#4f8cff', |
| padding: 16, | ||
| borderRadius: 12, | ||
| backgroundColor: '#161616', | ||
| marginBottom: 12, |
Comment on lines
+12
to
+18
| type ProfileLinkProps = { | ||
| platform: string; | ||
| username: string; | ||
| url: string; | ||
| onPress?: () => void; | ||
| }; | ||
|
|
Comment on lines
+19
to
+42
| export default function ProfileLink({ | ||
| platform, | ||
| username, | ||
| url, | ||
| onPress, | ||
| }: ProfileLinkProps) { | ||
| const handlePress = () => { | ||
| if (onPress) { | ||
| onPress(); | ||
| return; | ||
| } | ||
|
|
||
| Linking.openURL(url); | ||
| }; | ||
|
|
||
| return ( | ||
| <Pressable style={styles.card} onPress={handlePress}> | ||
| <View> | ||
| <Text style={styles.platform}>{platform}</Text> | ||
| <Text style={styles.username}>{username}</Text> | ||
| </View> | ||
|
|
||
| <Text style={styles.link}>Open</Text> | ||
| </Pressable> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Refactored HomeScreen to use reusable ProfileLink component.
Changes
Testing