Break down the entire codebase into smaller, reusable components to improve maintainability, reduce code duplication, and make the codebase more scalable.
-
LoadingSpinner.tsx- Loading states -
EmptyState.tsx- Empty state messages (move from profile) -
ErrorState.tsx- Error messages -
RefreshControl.tsx- Pull to refresh wrapper -
BottomSheet.tsx- Reusable bottom sheet modal -
ConfirmDialog.tsx- Confirmation dialogs -
Avatar.tsx- User avatar (move from profile) -
Badge.tsx- Notification badges, status badges -
Divider.tsx- Horizontal/vertical dividers
-
FeedCard.tsx- Main post card for feed -
FeedHeader.tsx- Post author info -
FeedContent.tsx- Post text content -
FeedImages.tsx- Post image gallery -
FeedActions.tsx- Like, comment, share buttons -
FeedStats.tsx- Likes, comments count -
TokenBadge.tsx- Tokenized post indicator -
CreatePostButton.tsx- Floating action button -
CreatePostModal.tsx- Post creation modal
-
ProfileAvatar.tsx -
ProfileHeader.tsx -
ProfileCard.tsx -
ProfileTabs.tsx -
PostCard.tsx -
EmptyState.tsx -
PostsTab.tsx -
PortfolioTab.tsx -
RepliesTab.tsx -
LikesTab.tsx -
ProfileMenu.tsx -
FollowButton.tsx- Reusable follow/unfollow button -
ProfileStats.tsx- Followers, following, posts count
-
BalanceCard.tsx- Main balance display -
TokenCard.tsx- Individual token balance -
TransactionCard.tsx- Transaction history item -
TransactionList.tsx- List of transactions -
SendForm.tsx- Send SOL form -
QRCode.tsx- QR code display/scanner -
WalletActions.tsx- Send, receive, swap buttons
-
ChatList.tsx- List of chats -
ChatCard.tsx- Individual chat preview -
MessageBubble.tsx- Individual message -
MessageList.tsx- Messages container -
MessageInput.tsx- Message input with send button -
ChatHeader.tsx- Chat screen header -
TipModal.tsx- Send tip in chat
-
PostDetail.tsx- Full post view -
PostHeader.tsx- Post author and actions -
PostContent.tsx- Post text and images -
PostActions.tsx- Like, comment, share, tip -
PostStats.tsx- Detailed stats -
CommentSection.tsx- Comments container -
CommentCard.tsx- Individual comment -
CommentInput.tsx- Add comment input -
TipButton.tsx- Tip post button -
BuyTokenButton.tsx- Buy post token button
-
SearchBar.tsx- Search input -
SearchTabs.tsx- Users, Posts, Tokens tabs -
UserSearchCard.tsx- User search result -
PostSearchCard.tsx- Post search result -
TokenSearchCard.tsx- Token search result -
RecentSearches.tsx- Recent search history
-
NotificationCard.tsx- Individual notification -
NotificationList.tsx- List of notifications -
NotificationBadge.tsx- Unread count badge
-
GameCard.tsx- Mini-app preview card -
GameHeader.tsx- Game screen header -
BetInput.tsx- Bet amount input -
GameResult.tsx- Win/loss result display -
SwapForm.tsx- Token swap form -
SwapPreview.tsx- Swap preview/confirmation -
HistoryCard.tsx- Game/swap history item
-
AuthLayout.tsx- Auth screen wrapper -
AuthHeader.tsx- Auth screen header -
SignInForm.tsx- Sign in form -
SignUpForm.tsx- Sign up form -
VerificationInput.tsx- Email verification code input -
SocialButtons.tsx- Social login buttons (future)
-
FormInput.tsx- Enhanced input with validation -
FormTextArea.tsx- Multi-line input -
FormButton.tsx- Styled button with loading state -
FormLabel.tsx- Form field label -
FormError.tsx- Error message display -
ImagePicker.tsx- Image selection component -
AmountInput.tsx- Numeric input for amounts
-
ScreenWrapper.tsx- Common screen wrapper -
Header.tsx- Reusable header -
TabBar.tsx- Custom tab bar -
SafeArea.tsx- Safe area wrapper -
KeyboardAvoidingView.tsx- Keyboard handling wrapper
- Common components (LoadingSpinner, EmptyState, Avatar, etc.)
- Feed components (most used across app)
- Profile components (already started)
- Post detail components
- Wallet components
- Chat components
- Search components
- Notification components
- Mini-app components
- Auth components
- Form components
- Layout components
- Single Responsibility: Each component should do one thing well
- Reusability: Components should be generic enough to use in multiple places
- Props Interface: Always define TypeScript interfaces for props
- Composition: Prefer composition over complex components
- Styling: Use Tailwind classes consistently
- Performance: Use React.memo for expensive components
- Testing: Add tests for complex components (future)
- PascalCase for component files:
ComponentName.tsx - Group related components in folders
- Export from index files for cleaner imports
// Before
import { Component } from '@/components/folder/Component';
// After (with index.ts)
import { Component } from '@/components/folder';- Create common components
- Refactor feed screen to use new components
- Refactor remaining screens one by one
- Create index.ts files for each component folder
- Update all imports across the codebase
- Remove duplicate code
- Test all screens thoroughly
- Reduced code duplication
- Easier maintenance
- Faster feature development
- Better code organization
- Improved testability
- Consistent UI/UX