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
43 changes: 43 additions & 0 deletions frontend-challenge/court-review-app/.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

# dependencies
node_modules/

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

# Native
.kotlin/
*.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

app-example

# generated native folders
/ios
/android
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "recommendations": ["expo.vscode-expo-tools"] }
7 changes: 7 additions & 0 deletions frontend-challenge/court-review-app/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.organizeImports": "explicit",
"source.sortMembers": "explicit"
}
}
19 changes: 19 additions & 0 deletions frontend-challenge/court-review-app/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import 'react-native-gesture-handler';
import * as React from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import CourtList from './components/CourtList';
import CourtDetail from './components/CourtDetail';

const Stack = createStackNavigator();

export default function App() {
return (
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen name="Courts" component={CourtList} />
<Stack.Screen name="CourtDetail" component={CourtDetail} options={{ title: 'Court Details' }} />
</Stack.Navigator>
</NavigationContainer>
);
}
50 changes: 50 additions & 0 deletions frontend-challenge/court-review-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Welcome to your Expo app 👋

This is an [Expo](https://expo.dev) project created with [`create-expo-app`](https://www.npmjs.com/package/create-expo-app).

## Get started

1. Install dependencies

```bash
npm install
```

2. Start the app

```bash
npx expo start
```

In the output, you'll find options to open the app in a

- [development build](https://docs.expo.dev/develop/development-builds/introduction/)
- [Android emulator](https://docs.expo.dev/workflow/android-studio-emulator/)
- [iOS simulator](https://docs.expo.dev/workflow/ios-simulator/)
- [Expo Go](https://expo.dev/go), a limited sandbox for trying out app development with Expo

You can start developing by editing the files inside the **app** directory. This project uses [file-based routing](https://docs.expo.dev/router/introduction).

## Get a fresh project

When you're ready, run:

```bash
npm run reset-project
```

This command will move the starter code to the **app-example** directory and create a blank **app** directory where you can start developing.

## Learn more

To learn more about developing your project with Expo, look at the following resources:

- [Expo documentation](https://docs.expo.dev/): Learn fundamentals, or go into advanced topics with our [guides](https://docs.expo.dev/guides).
- [Learn Expo tutorial](https://docs.expo.dev/tutorial/introduction/): Follow a step-by-step tutorial where you'll create a project that runs on Android, iOS, and the web.

## Join the community

Join our community of developers creating universal apps.

- [Expo on GitHub](https://github.com/expo/expo): View our open source platform and contribute.
- [Discord community](https://chat.expo.dev): Chat with Expo users and ask questions.
49 changes: 49 additions & 0 deletions frontend-challenge/court-review-app/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"expo": {
"name": "court-review-app",
"slug": "court-review-app",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/images/icon.png",
"scheme": "courtreviewapp",
"userInterfaceStyle": "automatic",
"newArchEnabled": true,
"ios": {
"supportsTablet": true
},
"android": {
"adaptiveIcon": {
"backgroundColor": "#E6F4FE",
"foregroundImage": "./assets/images/android-icon-foreground.png",
"backgroundImage": "./assets/images/android-icon-background.png",
"monochromeImage": "./assets/images/android-icon-monochrome.png"
},
"edgeToEdgeEnabled": true,
"predictiveBackGestureEnabled": false
},
"web": {
"output": "static",
"favicon": "./assets/images/favicon.png"
},
"plugins": [
"expo-router",
[
"expo-splash-screen",
{
"image": "./assets/images/splash-icon.png",
"imageWidth": 200,
"resizeMode": "contain",
"backgroundColor": "#ffffff",
"dark": {
"backgroundColor": "#000000"
}
}
],
"expo-font"
],
"experiments": {
"typedRoutes": true,
"reactCompiler": true
}
}
}
5 changes: 5 additions & 0 deletions frontend-challenge/court-review-app/app/_layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Stack } from "expo-router";

export default function RootLayout() {
return <Stack />;
}
171 changes: 171 additions & 0 deletions frontend-challenge/court-review-app/app/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
import { PlayfairDisplay_700Bold, PlayfairDisplay_700Bold_Italic, useFonts } from '@expo-google-fonts/playfair-display';
import { Ubuntu_700Bold } from "@expo-google-fonts/ubuntu";
import React from 'react';
import { Button, FlatList, ImageBackground, StyleSheet, Text, TextInput, TouchableOpacity, View } from 'react-native';
import { courts } from '../data/courtsMock';

const tennisGreen = '#586545';
const tennisBrown = '#8B5736';

type Review = {
reviewer: string;
stars: string;
comment: string;
};

type Court = {
id: number;
name: string;
location: string;
surfaceType: string;
rating: number;
reviews: Review[];
};

export default function HomeScreen() {
let [fontsLoaded] = useFonts({ Ubuntu_700Bold, PlayfairDisplay_700Bold, PlayfairDisplay_700Bold_Italic});


const [search, setSearch] = React.useState('');
const [selectedCourt, setSelectedCourt] = React.useState<Court | null>(null);
const [reviewer, setReviewer] = React.useState('');
const [stars, setStars] = React.useState('5');
const [comment, setComment] = React.useState('');
const [reviews, setReviews] = React.useState<Review[]>([]);

React.useEffect(() => {
setReviews(selectedCourt?.reviews || []);
}, [selectedCourt]);

const filteredCourts = courts.filter(
c => c.name.toLowerCase().includes(search.toLowerCase()) ||
c.location.toLowerCase().includes(search.toLowerCase())
);

const handleAddReview = () => {
if (!reviewer || !comment) return;
const newReview: Review = { reviewer, stars, comment };
setReviews([...reviews, newReview]);
setReviewer('');
setStars('5');
setComment('');
};

if (!fontsLoaded) {
return <View><Text>Loading fonts...</Text></View>;
}

const bg = require('../assets/images/bg.jpg');
if (!selectedCourt) {
return (
<ImageBackground source={bg} style={styles.fullBg}>
<View style={[styles.container, { backgroundColor: tennisGreen, opacity: 0.93 }]}>
<Text style={styles.logo}>
<Text style={{ fontFamily: 'PlayfairDisplay_700Bold', fontWeight: 'bold', color: '#fff' }}>tennis</Text>
<Text style={{ fontFamily: 'PlayfairDisplay_700Italic', fontStyle: 'italic', color: '#fff' }}>club</Text>
</Text>
<TextInput
style={styles.search}
placeholder="Search court or location..."
placeholderTextColor="#bbb"
value={search}
onChangeText={setSearch}
/>
<FlatList
data={filteredCourts}
keyExtractor={item => item.id.toString()}
renderItem={({ item }) => (
<TouchableOpacity
style={styles.card}
onPress={() => setSelectedCourt(item)}
>
<Text
style={[
styles.courtName,
{ fontFamily: 'Ubuntu_700Bold', color: '#162660' }
]}
>
{item.name}
</Text>

<Text style={{ color: '#fff' }}>
{item.location} | {item.surfaceType} | ⭐ {item.rating}
</Text>
</TouchableOpacity>
)}
/>
</View>
</ImageBackground>
);
}

return (
<ImageBackground source={bg} style={styles.fullBg}>
<View style={[styles.container, { backgroundColor: tennisBrown, opacity: 0.97 }]}>
<TouchableOpacity onPress={() => setSelectedCourt(null)} style={styles.backButton}>
<Text style={{ fontWeight: 'bold', color: tennisGreen }}>{'< Back to list'}</Text>
</TouchableOpacity>
<Text style={styles.logo}>
<Text style={{ fontFamily: 'PlayfairDisplay_700Bold', fontWeight: 'bold', color: '#fff' }}>tennis</Text>
<Text style={{ fontFamily: 'PlayfairDisplay_700Italic', fontStyle: 'italic', color: '#fff' }}>club</Text>
</Text>
<Text style={[styles.title, { color: '#fff' }]}>{selectedCourt.name}</Text>
<Text style={{ color: '#fff' }}>
{selectedCourt.location} | {selectedCourt.surfaceType} | ⭐ {selectedCourt.rating}
</Text>
<Text style={styles.sectionTitle}>Reviews</Text>
<FlatList
data={reviews}
keyExtractor={(_, idx) => idx.toString()}
renderItem={({ item }) => (
<View style={styles.reviewBox}>
<Text style={styles.reviewer}>{item.reviewer}: {item.stars}★</Text>
<Text>{item.comment}</Text>
</View>
)}
ListEmptyComponent={<Text style={{ color: '#fff' }}>No reviews yet.</Text>}
/>
<Text style={styles.sectionTitle}>Add a Review</Text>
<TextInput
style={styles.input}
placeholder="Your Name"
value={reviewer}
onChangeText={setReviewer}
placeholderTextColor="#bbb"
/>
<TextInput
style={styles.input}
placeholder="Stars (1-5)"
value={stars}
onChangeText={setStars}
keyboardType="numeric"
placeholderTextColor="#bbb"
/>
<TextInput
style={styles.input}
placeholder="Comment"
value={comment}
onChangeText={setComment}
multiline
placeholderTextColor="#bbb"
/>
<Button title="Submit Review" onPress={handleAddReview} color={tennisGreen} />
</View>
</ImageBackground>
);
}

const styles = StyleSheet.create({
fullBg: { flex: 1, resizeMode: "cover" },
container: { flex: 1, padding: 20, justifyContent: "center" },
logo: { fontSize: 40, textAlign: "center", marginBottom: 10 },
courtName: { fontSize: 18, fontWeight: 'bold', color: "#fff" },
title: { fontSize: 22, fontWeight: 'bold', marginBottom: 4 },
search: { backgroundColor: "#fff", borderRadius: 8, padding: 10, marginBottom: 12, fontSize: 16 },
card: { backgroundColor: tennisBrown, padding: 16, marginBottom: 12, borderRadius: 12, shadowColor: "#333", shadowOpacity: 0.15, shadowRadius: 10 },
sectionTitle: { fontSize: 16, fontWeight: 'bold', marginTop: 18, marginBottom: 4, color: "#fff" },
input: { backgroundColor: "#fff", borderRadius: 5, padding: 8, marginBottom: 8, fontSize: 16 },
reviewBox: { backgroundColor: "#e7fbe7", borderRadius: 6, padding: 8, marginBottom: 6 },
reviewer: { fontWeight: '600', color: '#222' },
backButton: { marginBottom: 8, marginTop: 0 },
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading