Skip to content

snh3003/ayska-field-app

Repository files navigation

Login Screen -> Android & iOS Screenshot 2025-10-10 at 2 29 52 AM

Admin Dashboard Android & Employee Dashboard iOS Screenshot 2025-10-10 at 2 30 09 AM

Settings Page -> Android & iOS Screenshot 2025-10-10 at 2 30 18 AM

Employee Details -> Android & Doctor Details -> iOS Screenshot 2025-10-10 at 2 30 41 AM

Employee Details -> Android & Doctor Details -> iOS with extended CTS Screenshot 2025-10-10 at 2 30 48 AM

Data Flow (API → services → store → UI)

This app includes a typed service layer and Redux Toolkit store to fetch and render employee activities, team sales, and reports.

Services

  • src/api/client.ts: Axios wrapper injecting Bearer token and handling 401 (dispatches logout) and single retry on network/5xx.
  • src/services/EmployeeService.ts: getActivities(employeeId), submitActivity(payload).
  • src/services/AdminService.ts: getTeamSales(teamId).
  • src/services/ReportService.ts: getReports(start, end).

Store

  • src/store/index.ts: configureStore with auth, employee, admin reducers.
  • src/store/slices/authSlice.ts: minimal token+role with setCredentials, logout.
  • src/store/slices/employeeSlice.ts, adminSlice.ts: async thunks, loading/error states, selectors.

UI examples

  • src/screens/EmployeeDashboard.tsx, src/screens/AdminDashboard.tsx use store selectors and render minimal cards with loading/empty/error states.

Mock data

Small fixtures in src/fixtures/mockData.ts for local demos/tests.

Setup

npm install
npm run start

Tests

npm run test

Jest tests in __tests__/services/*.test.ts mock axios and cover success/error paths.

Development Guidelines

Pre-commit Hooks

The project uses an automated pre-commit hook that blocks commits containing duplicate files with " 2" suffix (a common Cursor IDE issue).

Test the hook:

.git/hooks/pre-commit

If hook blocks your commit:

# 1. Compare duplicate with original
diff "file.ts" "file 2.ts"

# 2. Delete if identical, or merge changes then delete
rm "file 2.ts"

# 3. Commit again
git commit -m "Your message"

Available Scripts

# Development
npm start                 # Start Expo dev server
npm run android          # Run on Android
npm run ios              # Run on iOS

# Code Quality
npm run lint             # Run ESLint
npm run lint:fix         # Fix linting issues
npm run type-check       # TypeScript type checking
npm test                 # Run tests
npm run test:watch       # Run tests in watch mode

# Duplicate File Management
npm run check-duplicates # Scan and clean duplicate files
npm run clean:duplicates # Alias for check-duplicates

# Pre-commit (runs automatically)
npm run pre-commit       # Duplicate check + linting

Preventing Duplicate Files

Cursor IDE sometimes creates files with " 2" suffix. The pre-commit hook prevents these from being committed.

Manual cleanup:

npm run check-duplicates  # Interactive scan and cleanup

See full documentation: docs/PREVENTING-DUPLICATE-FILES.md

Releases

No releases published

Packages

 
 
 

Contributors