Skip to content

feat: build Profile and Settings screens with real data from APIΒ #59

Description

@Josue19-08

πŸ”– Title

Build Profile and Settings screens β€” currently tapping the header avatar or settings icon does nothing


πŸ“„ Description

Two screens referenced in the UI do not exist:

Profile screen β€” the avatar circle in `Header.tsx` has no `onPress`. There is no profile screen anywhere in the codebase. The avatar uses `https://via.placeholder.com/40\` as a placeholder URL which will not load on native builds.

Settings screen β€” the gear icon in `Header.tsx` has no `onPress`. There is no settings screen. The `Header.tsx` greeting is hardcoded as `"Good evening, JosuΓ©"` β€” it is neither time-aware nor user-aware.


βœ… Tasks to complete

Profile screen:

  • Create `app/(tabs)/profile.tsx` (or `components/pages/ProfileScreen.tsx`) with:
    • User avatar (from API or local state; fallback to initials if no image)
    • Display name and username
    • Stellar wallet address (truncated with copy-to-clipboard button)
    • Reputation score display (numeric + progress bar)
    • Stats row: total loans, total deposited, member since date
    • "Edit Profile" button (navigates to edit profile form)
    • "Disconnect Wallet" button
  • Create `hooks/profile/use-profile.ts` β€” fetches `GET /users/me` from API, stores result in state, handles loading and error states
  • Wire `Header.tsx` avatar `TouchableOpacity` to navigate to profile screen

Settings screen:

  • Create `app/settings.tsx` (or `components/pages/SettingsScreen.tsx`) with:
    • Notification preferences toggle (loan reminders on/off)
    • Language selector
    • Dark/light mode toggle
    • Privacy policy link
    • Terms of service link
    • App version display
    • "Sign out" button (clears token + redirects to sign-in)
  • Create `hooks/settings/use-settings.ts` β€” reads/writes settings from `AsyncStorage`
  • Wire `Header.tsx` gear icon `TouchableOpacity` to navigate to settings screen

Header fix:

  • Make greeting in `Header.tsx` time-aware: "Good morning" (5–11), "Good afternoon" (12–17), "Good evening" (18–23), "Good night" (0–4)
  • Replace placeholder avatar URL with real user avatar from profile data; fall back to a circle with user initials if no image is available
  • Install `expo-secure-store` or confirm `AsyncStorage` is available for settings persistence

πŸ“š Documentation/context for AI

https://github.com/TrustUp-app/TrustUp-Frontend/tree/main/docs

Files to create:

  • `app/(tabs)/profile.tsx` or `components/pages/ProfileScreen.tsx`
  • `app/settings.tsx` or `components/pages/SettingsScreen.tsx`
  • `hooks/profile/use-profile.ts`
  • `hooks/settings/use-settings.ts`

Files to modify:

  • `components/shared/Header.tsx` (add onPress to avatar and gear icon, fix dynamic greeting)

πŸ—’οΈ Additional notes

  • The API endpoint for profile is `GET /users/me` (requires Bearer JWT token in Authorization header)
  • Wallet address should be displayed as `G...XXXX` (first 4 + last 4 chars) with a copy icon next to it
  • "Sign out" must clear the JWT from secure storage AND reset navigation to the sign-in screen
  • Settings do not require an API call β€” persist locally with AsyncStorage
  • Use `EXPO_PUBLIC_API_URL` env variable for the base URL (add to `.env.example` if not present)

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions