I believe most errors are fixed. Rewrite is basically complete

This commit is contained in:
Gabriel Brown 2024-10-21 12:32:53 -05:00
parent 2e36b01266
commit 3f477e8dfb
4 changed files with 14 additions and 11 deletions

View File

@ -11,7 +11,6 @@ import {
export default class AccessoryBar extends React.Component<any> { export default class AccessoryBar extends React.Component<any> {
render () { render () {
const { onSend, isTyping } = this.props; const { onSend, isTyping } = this.props;
return ( return (
<ThemedView style={styles.container}> <ThemedView style={styles.container}>
<Button onPress={() => pickImageAsync(onSend)} name='photo' /> <Button onPress={() => pickImageAsync(onSend)} name='photo' />

View File

@ -3,12 +3,12 @@ import * as Linking from 'expo-linking';
import { import {
Platform, Platform,
StyleSheet, StyleSheet,
TouchableOpacity,
StyleProp, StyleProp,
ViewStyle ViewStyle
} from 'react-native'; } from 'react-native';
import { ThemedText, ThemedView } from '@/components/theme/Theme'; import { ThemedText, ThemedView } from '@/components/theme/Theme';
import MapView from 'react-native-maps'; import MapView from 'react-native-maps';
import { TouchableOpacity } from 'react-native-gesture-handler';
type Props = { type Props = {
currentMessage: any; currentMessage: any;

View File

@ -132,7 +132,13 @@ const RelationshipView: React.FC<RelationshipProps> = ({ pfpUrl }) => {
if (!status || !status.relationship) { if (!status || !status.relationship) {
// Case 1: Not in a relationship // Case 1: Not in a relationship
return showRequestRelationship ? ( return showRequestRelationship ? (
<ThemedView>
<RequestRelationship onRequestSent={handleRequestSent} /> <RequestRelationship onRequestSent={handleRequestSent} />
<TextButton
width={220} height={60} text='Stop searching' fontSize={18}
onPress={() => setShowRequestRelationship(false)}
/>
</ThemedView>
) : ( ) : (
<TextButton <TextButton
width={220} height={60} text='Request Relationship' fontSize={18} width={220} height={60} text='Request Relationship' fontSize={18}
@ -162,13 +168,8 @@ const RelationshipView: React.FC<RelationshipProps> = ({ pfpUrl }) => {
</ThemedView> </ThemedView>
<ThemedView style={styles.buttonContainer}> <ThemedView style={styles.buttonContainer}>
<TextButton <TextButton
width={100} height={40} width={150} height={40}
text='Accept' fontSize={18} text='Cancel Request' fontSize={18}
onPress={handleAcceptRequest}
/>
<TextButton
width={100} height={40}
text='Reject' fontSize={18}
onPress={handleRejectRequest} onPress={handleRejectRequest}
/> />
</ThemedView> </ThemedView>
@ -291,7 +292,6 @@ const styles = StyleSheet.create({
marginBottom: 10, marginBottom: 10,
}, },
buttonContainer: { buttonContainer: {
flexDirection: 'row',
justifyContent: 'space-around', justifyContent: 'space-around',
width: '100%', width: '100%',
marginTop: 20, marginTop: 20,

View File

@ -134,6 +134,10 @@ export const updateRelationshipStatus = async (userId: number, status: 'accepted
}), }),
}); });
if (!response.ok) { if (!response.ok) {
if (status === 'rejected') {
console.log('Relationship deleted.');
return null;
}
throw new Error( throw new Error(
`Error updating relationship status: ${response.status} ${response.statusText}` `Error updating relationship status: ${response.status} ${response.statusText}`
); );