Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions travel-planner-mobile/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
extends: ["expo", "prettier"],
plugins: ["prettier"],
rules: {
"prettier/prettier": "warn",
},
};
43 changes: 43 additions & 0 deletions travel-planner-mobile/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files

.vscode

# dependencies
node_modules/

# Expo
.expo/
dist/
web-build/
expo-env.d.ts

# Native
*.orig.*
*.jks
*.p8
*.p12
*.key
*.mobileprovision

# Metro
.metro-health-check*

# debug
npm-debug.*
yarn-debug.*
yarn-error.*

# macOS
.DS_Store
*.pem

# local env files
.env*.local

# typescript
*.tsbuildinfo

# amplify
.amplify
amplify_outputs*
amplifyconfiguration*
39 changes: 39 additions & 0 deletions travel-planner-mobile/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React, { useEffect } from "react";

import { Amplify } from "aws-amplify";
import {
Authenticator,
InAppMessageDisplay,
InAppMessagingProvider,
} from "@aws-amplify/ui-react-native";

import outputs from "./amplify_outputs.json";
import { AppNavigator } from "./src/navigation";
import {
initializeInAppMessaging,
syncMessages,
} from "aws-amplify/in-app-messaging";

Amplify.configure(outputs);
initializeInAppMessaging();

const App = () => {
useEffect(() => {
// Messages from your campaigns need to be synced from the backend before they
// can be displayed. You can trigger this anywhere in your app. Here you are
// syncing just once when this component (your app) renders for the first time.
syncMessages();
}, []);
return (
<Authenticator.Provider>
<Authenticator>
<InAppMessagingProvider>
<InAppMessageDisplay />
<AppNavigator />
</InAppMessagingProvider>
</Authenticator>
</Authenticator.Provider>
);
};

export default App;
16 changes: 16 additions & 0 deletions travel-planner-mobile/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
MIT No Attribution

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
229 changes: 229 additions & 0 deletions travel-planner-mobile/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,229 @@
# Travel Planner App

https://github.com/user-attachments/assets/da3ba7d3-49f0-498a-9fee-f2493938771f

A comprehensive travel planning application built with Expo and TypeScript, featuring AI-assisted trip planning, destination discovery, and activity management.

## 🚀 Technology Stack

- **Frontend:** Expo (React Native)
- **Language:** TypeScript
- **Backend:** AWS Amplify Gen 2
- **Authentication:** Amazon Cognito
- **Database:** Amazon DynamoDB
- **Storage:** Amazon S3
- **AI Integration:** Amazon Bedrock
- **In-app messaging:** AWS End User Messaging

## 🔧 Setup & Installation

1. **Prerequisites**
```bash

- Preferably latest versions of
- node
- npm
- expo-cli
- A configured AWS account on your development machine.
- A mobile test device or emulator/simulator
```

2. **Installation**
```bash
# Clone the repository
git clone [repository-url]

# Install dependencies
npm install --force

3. **Running the Sandbox for AWS Amplify**
```bash
npx ampx sandbox
```
## 🔄 Development Workflow

1. **Running the App**
```bash
# Run on iOS
npx expo run:ios

# Run on Android
npx expo run:android
```

## 📁 Project Structure

```
src/
├── components/
│ └── common/
│ └── Header/
│ ├── Header.tsx
│ ├── Header.styles.ts
│ └── index.ts
├── navigation/
│ ├── AppNavigator.tsx
│ ├── TabNavigator.tsx
│ ├── navigationTypes.ts
│ ├── navigationOptions.tsx
│ └── index.ts
├── screens/
│ ├── Home/
│ │ ├── HomeScreen.tsx
│ │ ├── HomeScreenComponents.tsx
│ │ ├── HomeScreenHooks.ts
│ │ └── styles.ts
│ ├── AIAssistant/
│ │ ├── AIAssistantScreen.tsx
│ │ ├── AIAssistantComponents.tsx
│ │ ├── AIAssistantHooks.ts
│ │ └── styles.ts
│ ├── Profile/
│ │ ├── ProfileScreen.tsx
│ │ ├── ProfileComponents.tsx
│ │ ├── ProfileHooks.ts
│ │ └── styles.ts
│ ├── TripDetail/
│ │ ├── TripDetailScreen.tsx
│ │ ├── TripDetailComponents.tsx
│ │ ├── TripDetailHooks.ts
│ │ └── styles.ts
│ ├── ActivityDetail/
│ │ ├── ActivityDetailScreen.tsx
│ │ ├── ActivityDetailComponents.tsx
│ │ ├── ActivityDetailHooks.ts
│ │ └── styles.ts
│ └── DestinationDetail/
│ ├── DestinationDetailScreen.tsx
│ ├── DestinationDetailComponents.tsx
│ ├── DestinationDetailHooks.ts
│ └── styles.ts
```

## 🎯 Features

### Authentication
- User sign-up and sign-in functionality
- Profile management with customizable avatar

### In-App Messaging
- Integrated AWS Amplify In-App Messaging
- Real-time message synchronization
- Custom message display component
- Campaign-based messaging support

### Navigation
- Bottom tab navigation for main screens
- Stack navigation for detailed views
- Type-safe navigation using TypeScript

### Home Screen
- Display upcoming trips
- Show popular destinations
- List available activities
- Quick access to AI travel planning

### AI Assistant
- AI-powered travel planning
- Natural language interaction
- Automated trip creation
- Intelligent activity suggestions

### Profile Management
- User information display
- Profile picture management
- Trip history
- AWS S3 integration for image storage

### Trip Management
- Detailed trip information
- Flight details
- Accommodation information
- Associated activities

## 📱 Screen Details

### HomeScreen
- Displays upcoming trips
- Shows popular destinations
- Lists available activities
- Features a floating action button for new trip creation

### AIAssistantScreen
- Chat interface for AI interaction
- Natural language processing for trip planning
- Automated creation of trips, activities, and bookings

### ProfileScreen
- User information display
- Profile picture management
- Recent trips display
- Account settings

### TripDetailScreen
- Comprehensive trip information
- Flight details
- Accommodation information
- Associated activities

### ActivityDetailScreen
- Detailed activity information
- Duration and pricing
- Location details
- Availability status

### DestinationDetailScreen
- Destination overview
- Local activities
- Climate information
- Travel recommendations

## 🔐 Type Safety

The application uses TypeScript throughout, with comprehensive type definitions for:
- Navigation parameters
- API responses
- Component props
- State management
- AWS Amplify interactions

## 🎨 Styling

- Consistent color scheme throughout the app
- Responsive design using StyleSheet
- Shared components for consistent UI elements
- Platform-specific adjustments where necessary

## 📦 State Management

- Local state management using React hooks
- AWS Amplify for data persistence
- Custom hooks for business logic
- Proper type definitions for state

## 🛡 Best Practices

1. **Code Organization**
- Separate concerns (components, hooks, styles)
- Consistent file naming
- Modular component structure

2. **Type Safety**
- Comprehensive TypeScript usage
- Proper type definitions
- Interface segregation

3. **Performance**
- Proper use of useMemo and useCallback
- Efficient re-rendering strategies
- Optimized list rendering

4. **Error Handling**
- Comprehensive error catching
- User-friendly error messages
- Graceful fallbacks


## 📝 License

This library is licensed under the MIT-0 License. See the LICENSE file.
11 changes: 11 additions & 0 deletions travel-planner-mobile/amplify/auth/pre-sign-up/handler.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { PreSignUpTriggerHandler } from "aws-lambda";

export const handler: PreSignUpTriggerHandler = async (event) => {
const email = event.request.userAttributes["email"];

if (!email.endsWith("gmail.com")) {
throw new Error("Invalid email domain");
}

return event;
};
5 changes: 5 additions & 0 deletions travel-planner-mobile/amplify/auth/pre-sign-up/resource.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { defineFunction } from "@aws-amplify/backend";

export const preSignUp = defineFunction({
name: "pre-sign-up",
});
22 changes: 22 additions & 0 deletions travel-planner-mobile/amplify/auth/resource.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { defineAuth } from "@aws-amplify/backend";
import { preSignUp } from "./pre-sign-up/resource";

export const auth = defineAuth({
loginWith: {
email: {
verificationEmailSubject: "Welcome to the your sample app!",
verificationEmailBody: (code) =>
`Your verification code is for Amplify AI Travel Planner: ${code()}`,
verificationEmailStyle: "CODE",
},
},
userAttributes: {
preferredUsername: {
required: true,
mutable: true,
},
},
triggers: {
preSignUp,
},
});
Loading