Commit c20570bc authored by Milan DiGiuseppe's avatar Milan DiGiuseppe
Browse files

fix lint errors

parent c2595c96
{
"printWidth": 80
"printWidth": 100
}
......@@ -5788,6 +5788,16 @@
"@types/react": "*"
}
},
"@types/react-native-drawer": {
"version": "2.5.3",
"resolved": "https://registry.npmjs.org/@types/react-native-drawer/-/react-native-drawer-2.5.3.tgz",
"integrity": "sha512-BNWDikN5uRR7YFabI0cUR1Aswn07iwW3aTyJrpiLoNJ1MGL29dkMthKZqJZoHQ5nkhbiRPd+W4fGn4OFhzutXw==",
"dev": true,
"requires": {
"@types/react": "*",
"@types/react-native": "*"
}
},
"@types/react-native-indicators": {
"version": "0.16.0",
"resolved": "https://registry.npmjs.org/@types/react-native-indicators/-/react-native-indicators-0.16.0.tgz",
......
......@@ -23,7 +23,8 @@ interface AuthContextValues {
signOut: () => void;
}
const AuthContext = React.createContext<AuthContextValues>(undefined);
// @ts-ignore
const AuthContext = React.createContext<AuthContextValues>(undefined as AuthContextValues);
export const useAuthContext = () => useContext(AuthContext);
const AuthProvider: React.FC = ({ children }) => {
......@@ -75,7 +76,9 @@ const AuthProvider: React.FC = ({ children }) => {
try {
const result = await Google.logInAsync(GOOGLE_CONFIG);
if (result.type === 'success') {
const credential = Firebase.auth.GoogleAuthProvider.credential(result.idToken, result.accessToken);
const credential = Firebase.auth.GoogleAuthProvider.credential(
result.idToken, result.accessToken,
);
signInFirebase(credential);
} else {
// User cancelled login. Don't need to do anything
......
......@@ -43,7 +43,7 @@ const CacheFoundModal: React.FC<Props> = ({
cache,
onClose,
onSave,
onReport,
// onReport,
}) => {
if (!cache) {
return null;
......@@ -51,6 +51,7 @@ const CacheFoundModal: React.FC<Props> = ({
// TODO: move cache type contents into seperate components
const [moveMade, setMoveMade] = useState<boolean>(false);
// @ts-ignore
const [ticTacToeState, setTicTacToeState] = useState<TicTacToeBoardState>(SAMPLE_TICTACTOE_STATE);
const onCellPress = useCallback((row: number, col: number) => {
setMoveMade(true);
......
......@@ -33,9 +33,9 @@ interface Props {
}
const CacheListItem: React.FC<Props> = ({
found,
// found,
id,
message,
// message,
name,
cacheType,
......
import React, {
useEffect, useState, useRef, createContext, useContext, useCallback,
useEffect, useState, useRef, createContext, useContext, useCallback, ReactNode,
} from 'react';
import MapView, { LatLng } from 'react-native-maps';
import { useDispatch } from 'react-redux';
......@@ -51,6 +51,7 @@ export const UserLocationProvider: React.FC = ({ children }) => {
// Subscribe to user location updates
useEffect(() => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
let unsubscribe: () => void;
const subscribeToUserLocation = async () => {
......@@ -121,7 +122,7 @@ export const GeoMapFollow: React.FC = ({ children }) => {
interface GeoMapProps {
location: LatLng;
children?: any;
children?: ReactNode;
rotationEnabled?: boolean;
style?: ViewStyle;
}
......
import React from 'react';
import {
View, StyleSheet, ViewStyle, TouchableOpacity, Text,
View, StyleSheet, ViewStyle, TouchableOpacity,
} from 'react-native';
import { Icon } from 'react-native-elements';
import theme from '../theme';
......
import React, { useMemo, useCallback } from 'react';
import React, { useCallback } from 'react';
import { View, StyleSheet, Image } from 'react-native';
import { useRoute, useNavigation } from '@react-navigation/native';
import { useSelector } from 'react-redux';
......@@ -52,7 +52,7 @@ const CacheDetailScreen = () => {
const { navigate } = useNavigation();
const getSavedCache = makeGetSavedCache(id);
const cache = useSelector(getSavedCache);
const cacheLocation: LatLng = useMemo(() => ({ latitude: cache.lat, longitude: cache.lng }), [cache]);
const cacheLocation: LatLng = { latitude: cache.lat, longitude: cache.lng };
const onRevisitCachePress = useCallback(() => {
navigate('RevisitCache', { id, title: 'Revisit Cache' } as NavParams);
......@@ -61,11 +61,15 @@ const CacheDetailScreen = () => {
return (
<View style={{ flex: 1, justifyContent: 'space-between' }}>
<ScrollView contentContainerStyle={styles.container}>
<ProfileCard initials={cache.name[0]} name={cache.name} style={{ marginTop: theme.spacing.medium }} />
<ProfileCard
initials={cache.name[0]}
name={cache.name}
style={{ marginTop: theme.spacing.medium }}
/>
<View style={{ marginTop: theme.spacing.small }}>
{cache.type === 'Game' && (
<View style={{ alignItems: 'center' }}>
<TicTacToe boardState={INITIAL_TICTACTOE_STATE} onCellPress={() => alert('yuh')} />
<TicTacToe boardState={INITIAL_TICTACTOE_STATE} onCellPress={() => console.warn('yuh')} />
</View>
)}
{(cache.type === 'Photography' || cache.type === 'Outdoors') && (
......
......@@ -14,7 +14,6 @@ import { sampleCaches } from '../SampleCaches';
import { GeoMapSearch, UserLocationProvider } from '../components/GeoMap';
import UserLocationMarker from '../components/UserLocationMarker';
import theme from '../theme';
import { NavParams } from './CacheDetailScreen';
import MainDrawer from './MainDrawer';
import CacheFoundModal from '../components/CacheFoundModal';
import { useAuthContext } from '../auth/AuthProvider';
......@@ -73,11 +72,12 @@ const DiscoverScreen: React.FC = () => {
setModalOpen(false);
dispatch(saveCache({ ...cache, found: new Date().valueOf() }));
}, [dispatch, setModalOpen]);
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const onReport = useCallback((id) => {
dispatch(reportCache(id, '1', 'reported', idToken));
}, [dispatch]);
const drawerRef = useRef(null);
const drawerRef = useRef<Drawer>(null);
const onDrawerOpen = useCallback(() => drawerRef.current!.open(), [drawerRef]);
const onDrawerClose = useCallback(() => drawerRef.current!.close(), [drawerRef]);
......@@ -92,7 +92,6 @@ const DiscoverScreen: React.FC = () => {
content={<MainDrawer onClose={onDrawerClose} />}
tapToClose
openDrawerOffset={100}
tweenHandler={Drawer.tweenPresets.parallax}
>
<View style={{ flex: 1 }}>
<UserLocationProvider>
......@@ -150,6 +149,7 @@ const DiscoverScreen: React.FC = () => {
cache={currCache!}
onClose={() => setModalOpen(false)}
onSave={() => onSave(currCache!)}
onReport={() => { console.warn('implement me'); }}
/>
</View>
</Drawer>
......
import React from 'react';
import { useSelector } from 'react-redux';
import { useRoute, useNavigation } from '@react-navigation/native';
import {
View, StyleSheet, FlatList, Text,
} from 'react-native';
import {
Avatar, ListItem, Icon,
} from 'react-native-elements';
import { useRoute } from '@react-navigation/native';
import { View, FlatList } from 'react-native';
import { ListItem } from 'react-native-elements';
import CacheListItem from '../components/CacheListItem';
import { Cache } from '../store/caches/CachesState';
import GeoText from '../components/GeoText';
import theme from '../theme';
import {
getUserName,
getUserAvatarUri,
} from '../store/user/UserSelectors';
import { getGroupMemgers, getGroupCaches, getGroup } from '../store/groups/GroupSelectors';
import { Membership } from '../store/groups/GroupState';
const styles = StyleSheet.create({
avatar: {
backgroundColor: theme.colors.mediumgray,
marginTop: theme.spacing.medium,
},
});
const renderMember = (item: { item: Membership }) => {
const member = item.item;
......@@ -82,10 +62,8 @@ const renderCache = (item: {item: Cache}) => {
const GroupScreen = () => {
const { params } = useRoute();
const userName = useSelector(getUserName);
const userImageUrl = useSelector(getUserAvatarUri);
// @ts-ignore
const { groupId } = params;
const group = useSelector(getGroup(groupId));
const memberList = useSelector(getGroupMemgers(groupId));
......@@ -116,6 +94,7 @@ const GroupScreen = () => {
}}
/>
<FlatList
// @ts-ignore
data={Object.values(cacheList)}
renderItem={renderCache}
keyExtractor={(cache: Cache) => cache.id}
......@@ -135,6 +114,7 @@ const GroupScreen = () => {
}}
/>
<FlatList
// @ts-ignore
data={Object.values(memberList)}
renderItem={renderMember}
keyExtractor={(member: Membership) => member.userId}
......
import React, { useCallback, useMemo } from 'react';
import {
View, StyleSheet, Group, Alert,
View, StyleSheet, Alert,
} from 'react-native';
import {
Avatar, ListItem, Icon,
......@@ -62,11 +62,6 @@ const MainDrawer: React.FC<Props> = ({ onClose }) => {
navigate('Dev');
}, [onClose, navigate]);
const onGroupSettings = useCallback(() => {
// onClose();
navigate('Group', {});
}, [onClose, navigate]);
const onLogoutPress = useCallback(() => Alert.alert(
userName,
'Are you sure you want to log out?',
......
......@@ -25,6 +25,7 @@ const styles = StyleSheet.create({
},
});
// TODO: refactor LinearGradient so that it doesn't wrap children
const OnboardingScreen = () => {
const dispatch = useDispatch();
const { navigate } = useNavigation();
......@@ -36,6 +37,7 @@ const OnboardingScreen = () => {
return (
<Swiper loop={false} activeDotColor={theme.colors.white}>
{/* @ts-ignore */}
<LinearGradient colors={['#1B822E', '#AAEA61']} style={styles.slide}>
<GeoText variant={'title'} align={'center'} color={'white'}>
Welcome
......@@ -48,6 +50,7 @@ const OnboardingScreen = () => {
</GeoText>
</LinearGradient>
{/* @ts-ignore */}
<LinearGradient colors={['#1B5D82', '#61A8EA']} style={styles.slide}>
<GeoText variant={'title'} align={'center'} color={'white'}>
Geocaching
......@@ -56,10 +59,12 @@ const OnboardingScreen = () => {
<PhoneSvg />
</View>
<GeoText variant={'blurb'} align={'center'} color={'white'}>
Traditional geocaching uses GPS coordinates to hide and find physical caches. With GEO, the caches show up on your phone!
Traditional geocaching uses GPS coordinates to hide and find physical caches.
With GEO, the caches show up on your phone!
</GeoText>
</LinearGradient>
{/* @ts-ignore */}
<LinearGradient colors={['#821B7E', '#EA6192']} style={styles.slide}>
<GeoText variant={'title'} align={'center'} color={'white'}>
Rules of the Game
......
import React, { useMemo, useEffect, useRef } from 'react';
import React, { useEffect, useRef } from 'react';
import { View } from 'react-native';
import { useRoute } from '@react-navigation/native';
import { useSelector } from 'react-redux';
......@@ -13,7 +13,7 @@ const RevisitCacheScreen = () => {
const { params } = useRoute();
const getSavedCache = makeGetSavedCache((params as NavParams).id);
const cache = useSelector(getSavedCache);
const cacheLocation: LatLng = useMemo(() => ({ latitude: cache.lat, longitude: cache.lng }), [cache]);
const cacheLocation: LatLng = { latitude: cache.lat, longitude: cache.lng };
const mapRef = useRef<MapView>(null);
// Animation snaps screen to fit markers
......
......@@ -70,7 +70,10 @@ const TagScreen = () => {
title={'Choose'}
onPress={onSubmit}
disabled={!tag}
style={{ marginVertical: theme.spacing.medium, marginHorizontal: theme.spacing.screenPadding }}
style={{
marginVertical: theme.spacing.medium,
marginHorizontal: theme.spacing.screenPadding,
}}
/>
</ScreenContainer>
);
......
......@@ -73,7 +73,8 @@ const CacheMessageScreen: React.FC = () => {
const onScrollViewLayout = useCallback((event: LayoutChangeEvent) => {
setScrollWidth(event.nativeEvent.layout.width);
}, [setScrollWidth]);
const imageHeight = useMemo(() => (image ? (scrollWidth * image.height) / image.width : 0), [image, scrollWidth]);
const imageHeight = useMemo(() => (image ? (scrollWidth * image.height) / image.width : 0),
[image, scrollWidth]);
const onPickImage = async () => {
const result = await ImagePicker.launchImageLibraryAsync({
......
import React from 'react';
import { StyleSheet, View, Text } from 'react-native';
import { useNavigation } from '@react-navigation/native';
import { StyleSheet, View } from 'react-native';
import { ScrollView } from 'react-native-gesture-handler';
import { ListItem, Icon, Tile } from 'react-native-elements';
import { Tile } from 'react-native-elements';
import theme from '../../theme';
import ScreenContainer from './ScreenContainer';
......@@ -55,37 +54,33 @@ const items = [
},
];
const OutdoorsScreen: React.FC = () => {
const { navigate } = useNavigation();
return (
<ScreenContainer>
<View style={styles.container}>
<ScrollView
keyboardShouldPersistTaps={'handled'}
showsVerticalScrollIndicator={false}
>
{items.map(({ title, iconName }) => (
<Tile
key={title}
title={title}
featured
imageSrc={{ uri: 'https://picsum.photos/200' }}
icon={{
name: iconName,
type: 'font-awesome-5',
color: theme.colors.white,
size: 50,
}}
height={200}
width={200}
onPress={() => console.warn('yuh')}
/>
))}
</ScrollView>
</View>
</ScreenContainer>
);
};
const OutdoorsScreen: React.FC = () => (
<ScreenContainer>
<View style={styles.container}>
<ScrollView
keyboardShouldPersistTaps={'handled'}
showsVerticalScrollIndicator={false}
>
{items.map(({ title, iconName }) => (
<Tile
key={title}
title={title}
featured
imageSrc={{ uri: 'https://picsum.photos/200' }}
icon={{
name: iconName,
type: 'font-awesome-5',
color: theme.colors.white,
size: 50,
}}
height={200}
width={200}
onPress={() => console.warn('yuh')}
/>
))}
</ScrollView>
</View>
</ScreenContainer>
);
export default OutdoorsScreen;
......@@ -55,6 +55,7 @@ const PhotographyScreen: React.FC = () => {
const navigation = useNavigation();
const dispatch = useDispatch();
const image = useSelector(getPendingCacheImage);
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const setImage = useCallback((img: ImageInfo) => {
dispatch(setPendingCacheImage(img));
}, [dispatch]);
......@@ -76,7 +77,8 @@ const PhotographyScreen: React.FC = () => {
const onScrollViewLayout = useCallback((event: LayoutChangeEvent) => {
setScrollWidth(event.nativeEvent.layout.width);
}, [setScrollWidth]);
const imageHeight = useMemo(() => (image ? (scrollWidth * image.height) / image.width : 0), [image, scrollWidth]);
const imageHeight = useMemo(() => (image ? (scrollWidth * image.height) / image.width : 0),
[image, scrollWidth]);
const onNext = useCallback(() => {
navigation.navigate('CacheSubmit');
......
......@@ -43,7 +43,8 @@ const Row: React.FC<RowProps> = ({ row, rowState, onCellPress }) => (
<View style={{ flexDirection: 'row' }}>
{rowState.map((cellState, col) => (
<TouchableWithoutFeedback
key={`${col}`}
// eslint-disable-next-line react/no-array-index-key
key={col}
onPress={() => {
if (cellState === null) {
onCellPress(row, col);
......@@ -82,6 +83,7 @@ const TicTacToe: React.FC<TicTacToeProps> = ({ boardState, onCellPress, style })
<View style={style}>
{boardState.map((rowState, rowIndex) => (
<Row
// eslint-disable-next-line react/no-array-index-key
key={rowIndex}
rowState={rowState}
row={rowIndex}
......
......@@ -46,7 +46,11 @@ export const deleteCache = (id: string, idToken: string) => async (dispatch: Dis
});
};
export const geoSearch = (location: LatLng, uuid: string, idToken: string) => async (dispatch: Dispatch) => {
export const geoSearch = (
location: LatLng,
uuid: string,
idToken: string,
) => async (dispatch: Dispatch) => {
const response = await fetch(`${backendURL}/message/geosearch`
+ `?lat=${encodeURIComponent(location.latitude)}
&lng=${encodeURIComponent(location.longitude)}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment