My Account

Branch

Description

  • The Default Branch page displays a user's favorite store location within the account section.
  • Built using Composition API, TypeScript, TailwindCSS, and Nuxt 3.
  • Supports responsive design and user personalization.

Purpose

  • Show the user's selected default branch with relevant details (name, address, distance, etc.).
  • Offer quick access to routing, branch changes, and more branch details.
  • Provide a fallback UI for users without a selected default branch.

Use Cases

  • View Favorite Branch: Users can see their currently selected default branch.
  • Check Branch Details: Address, opening time, and distance from current location are displayed.
  • Route Planning: Users can click to view the route to the default branch.
  • Change Default Branch: Users can open a modal to select a new favorite branch.
  • No Branch Selected: A fallback UI encourages users to select one.

Expectations

  • Graceful loading with TsLoadingCircularSpinner.
  • Mobile and desktop variants of the heading (TsTitle vs TsTypography).
  • Smooth fallback UI if no branch is set.
  • Responsive layout optimized for mobile and large screens.
  • Interactive buttons trigger branch routing or selection modals.

Developer Strategies

  • Load branch details from branchStore (Pinia).
  • Use onMounted to simulate loading with pageLoading state.
  • Leverage useDevice() to tailor layout for desktop vs mobile.
  • Lazy load components using defineAsyncComponent for better performance.
  • Use useTranslation() for i18n support throughout.

TODOs for Developer

  • Show branch image, name, address, and distance.
  • Route plan and change branch CTA buttons.
  • Improve accessibility (add ARIA roles, keyboard navigation).
  • Add error handling if branchStore.defaultBranch fails to load.
  • Write unit tests for branch selection, display, and routing behavior.
  • Add logging for interactions (view_branch, change_branch, etc.).
  • Extract hardcoded time values like "07:00" into config or store.

API Endpoints

ActionEndpointDescription
getDefaultBranch(userId)GET /users/:userId/default-branchFetches the user’s currently selected default branch.
setDefaultBranchPOST /users/:userId/default-branchSets or updates the user's default branch.
getBranchesNearbyGET /branches?lat=&lng=Retrieves nearby branches for the user’s location
getBranchDetails(slug)GET /branches/:slugFetches detailed info about a specific branch.

Components Used

Component | Description

ActionEndpoint
TsCardMain layout container
TsTypography/ TsTitlePage heading (responsive to device type)
TsButtonFor route planning and branch change CTAs
TsIconIcons for time and distance
TsCardBranchInfoStructured container for branch image/content/actions
TsImageDisplays branch/store image
TsRow /TsColumnLayout grid system
TsLoadingCircularSpinnerSpinner displayed while loading initial address data
NuxtLinkWithLocaleNavigation to full branch details page

Flow Summary

Render

  • On mount: show loading spinner → fetch default branch from branchStore.
  • If branch exists: render branch details inside TsCardBranchInfo. Branch Exist
  • If no branch: show fallback UI encouraging user to select a branch. Branch Not Exist

Copyright © 2026