Skip to content

fathrhys/SmartRoutine

Repository files navigation

SmartRoutine - Aplikasi Smart Life untuk Pelajar

SmartRoutine adalah aplikasi mobile berbasis React Native + Expo yang dirancang untuk membantu pelajar mengelola rutinitas harian dengan fokus pada kesehatan, disiplin, etika digital, dan pengembangan karakter.

πŸ“± Fitur Utama

1. Routine Management

  • Buat rutinitas harian dengan kategori (Belajar, Olahraga, Tidur, Ibadah, Digital, Custom)
  • Set waktu mulai dan durasi untuk setiap rutinitas
  • Pilih hari aktif (Mon-Sun)
  • Tambah catatan untuk setiap rutinitas
  • Edit dan hapus rutinitas dengan confirm dialog

2. Daily Tracking & Scoring

  • Checklist rutinitas yang sudah selesai hari ini
  • Sistem scoring otomatis: (selesai/total) Γ— 100%
  • Progress tracking dengan trend 7 hari
  • Streak counter untuk motivasi berkelanjutan

3. AI Coach

  • Rekomendasi based on data lokal (no API call)
  • Grade A-E berdasarkan score harian
  • Tips produktivitas sesuai goal (Disiplin/Sehat/Seimbang)
  • Suggested plan untuk hari berikutnya

4. Insights & Tips

  • Tips produktivitas (Pomodoro, Prioritas, No Multitask, dll)
  • Tips manajemen waktu (Time Blocking, 80/20 Rule, Buffer Time)
  • Tips digital wellness (20-20-20 Rule, No Phone Before Sleep, dll)
  • Real-time stats display

5. User Profile

  • Custom nama user
  • Set goal (Disiplin/Sehat/Seimbang)
  • Target score (0-100%)
  • Wake time & sleep time preferences
  • Export data backup

πŸ—οΈ Arsitektur

SmartRoutine/
β”œβ”€β”€ app/                      # Expo Router pages
β”‚   β”œβ”€β”€ index.tsx            # Root redirect
β”‚   β”œβ”€β”€ _layout.tsx          # Root layout
β”‚   β”œβ”€β”€ modal.tsx            # Modal pages
β”‚   └── (tabs)/              # Tab-based navigation
β”‚       β”œβ”€β”€ _layout.tsx      # Tab layout with Ionicons
β”‚       β”œβ”€β”€ index.tsx        # Dashboard
β”‚       β”œβ”€β”€ routine.tsx      # Routine management
β”‚       β”œβ”€β”€ coach.tsx        # AI Coach
β”‚       β”œβ”€β”€ progress.tsx     # Progress tracking
β”‚       β”œβ”€β”€ profile.tsx      # User profile
β”‚       └── explore.tsx      # Tips & insights
β”œβ”€β”€ components/              # Reusable React components
β”‚   β”œβ”€β”€ ErrorBoundary.tsx   # Error boundary
β”‚   β”œβ”€β”€ RoutineFormModal.tsx # Form untuk routine
β”‚   β”œβ”€β”€ RoutineItem.tsx     # List item
β”‚   └── ui/                 # UI components
β”œβ”€β”€ lib/                    # Business logic
β”‚   β”œβ”€β”€ routine.ts          # Routine CRUD & validation
β”‚   β”œβ”€β”€ profile.ts          # User profile
β”‚   β”œβ”€β”€ aiCoach.ts          # AI Coach logic
β”‚   β”œβ”€β”€ storage.ts          # AsyncStorage wrapper
β”‚   β”œβ”€β”€ errorHandler.ts     # Error handling utilities
β”‚   β”œβ”€β”€ categories.ts       # Category management
β”‚   └── stats/              # Stats computation
β”‚       β”œβ”€β”€ index.ts        # Main stats
β”‚       └── weekly.ts       # Weekly trend
β”œβ”€β”€ types/                  # TypeScript types
β”‚   └── routine.ts          # Routine types
β”œβ”€β”€ hooks/                  # Custom React hooks
β”œβ”€β”€ constants/              # App constants
└── jest.config.json        # Jest testing config

πŸ›‘οΈ Error Handling & Validation

Input Validation

  • Title: 2-100 karakter, no special chars
  • Time: Format HH:MM (00:00-23:59)
  • Duration: 1-1440 menit (1 hari max)
  • Days: Minimal 1 hari
  • Category: 2-30 karakter
  • Notes: Max 500 karakter

Error Boundary

  • React Error Boundary di root untuk catch global errors
  • Try-catch di semua async operations
  • User-friendly error messages
  • Graceful error display

Storage Validation

  • Max 5MB size check
  • JSON parse error handling
  • Fallback ke default values
  • Auto-cleanup corrupted data

πŸ“Š Data Models

Routine Type

type Routine = {
  id: string;                  // Unique ID
  title: string;              // Max 100 chars
  category: RoutineCategory;  // Belajar|Olahraga|Tidur|Ibadah|Digital|Lainnya
  time: string;              // HH:MM format
  days: RoutineDay[];        // Mon-Sun array
  durationMin: number;       // 1-1440 minutes
  notes?: string;            // Max 500 chars
  createdAt: string;         // ISO format
  updatedAt: string;         // ISO format
  doneDates: string[];       // YYYY-MM-DD array (completed dates)
};

type Profile = {
  name: string;
  goal: "Disiplin" | "Sehat" | "Seimbang";
  targetScore: number;       // 0-100
  wakeTime: string;         // HH:MM
  sleepTime: string;        // HH:MM
};

πŸš€ Getting Started

Prerequisites

  • Node.js 18+
  • npm atau yarn
  • Expo CLI: npm install -g expo-cli

Installation

# Clone repository
git clone <repo-url>
cd SmartRoutine

# Install dependencies
npm install

# Configure Python environment (if needed)
# The app will automatically detect your Python env

# Start development server
npm start

# Run on specific platform
npm run android    # Android Emulator
npm run ios       # iOS Simulator
npm run web       # Web browser

Development

# Run linter
npm run lint

# Run tests (setup required)
npm test

# Reset project to initial state
npm run reset-project

πŸ“ Testing

Jest Setup

Test files located in __tests__ folder. Example:

npm test -- __tests__/lib/routine.test.ts

Manual Testing Checklist

  • Create routine with all fields
  • Edit routine
  • Delete routine (confirm dialog)
  • Toggle done status
  • View progress/stats
  • View AI coach
  • Update profile
  • Reset all data
  • Test in light/dark mode
  • Test error states

πŸ” Security & Privacy

  • Local Storage Only: Semua data disimpan di device
  • No Cloud Sync: Data tidak dikirim ke server
  • No Tracking: Tidak ada analytics atau tracking
  • No Ads: Ad-free experience
  • Data Export: User bisa export/backup data

🎨 Theming

App supports light/dark mode based on system settings. Colors defined in constants/theme.ts:

  • Primary: Telkom Red (#DC143C)
  • Background: Light/Dark
  • Surface: Cards & modals
  • Text: Primary/Secondary colors
  • Border: Subtle dividers

πŸ”„ State Management

  • Local React state dengan useState
  • useMemo untuk expensive computations
  • useCallback untuk memoized functions
  • AsyncStorage untuk persistence

πŸ“± Responsive Design

  • Mobile-first approach
  • Flex layout for responsive UI
  • Safe area handling
  • Keyboard-aware inputs

πŸ› Known Issues & Limitations

  1. Notifications: Not yet implemented (dependency installed but not used)
  2. Offline Support: Works offline but no sync mechanism
  3. Data Backup: Manual export only (need UI for import)
  4. Performance: Consider virtualization for 100+ routines
  5. Accessibility: Minimal a11y labels (WIP)

πŸ“‹ Improvement Roadmap

High Priority

  • Implement push notifications/reminders
  • Add more unit tests
  • Improve accessibility (ARIA labels)
  • Add data import functionality

Medium Priority

  • Weekly statistics visualization (charts)
  • Notification reminders system
  • Local authentication (biometric/PIN)
  • Habit streak badges

Low Priority

  • Cloud sync capability
  • Share routines with friends
  • Integration with calendar
  • Wearable support

πŸ“š Dependencies

Core

  • expo: ^54.0.31
  • react-native: 0.81.5
  • react: 19.1.0
  • expo-router: ~6.0.22

Storage

  • @react-native-async-storage/async-storage: ^2.2.0

Navigation

  • @react-navigation/*: Latest stable

UI

  • @expo/vector-icons: ^15.0.3
  • expo-splash-screen: ~31.0.13

Notifications (Ready but not implemented)

  • expo-notifications: ~0.32.16

🀝 Contributing

  1. Fork repository
  2. Create feature branch (git checkout -b feature/AmazingFeature)
  3. Commit changes (git commit -m 'Add AmazingFeature')
  4. Push to branch (git push origin feature/AmazingFeature)
  5. Open Pull Request

πŸ“„ License

MIT License - see LICENSE file for details

πŸ’¬ Support

For issues and suggestions:

  1. Check existing GitHub issues
  2. Create detailed issue report
  3. Include device/OS info
  4. Attach error logs if applicable

πŸ™ Acknowledgments

  • Expo team untuk framework excellent
  • React Native community
  • Students dan educators yang memberikan feedback

Last Updated: January 23, 2026 Version: 1.0.0

About

togas-19-01-2026-23-01-2026

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors