Skip to content

Commit

Permalink
Leaderboard navi changes - now navigates! (#52)
Browse files Browse the repository at this point in the history
* working step 1

* getting navigation set up in leaderboard

* linting yay

* Update frontend/components/PopularUser.tsx

Co-authored-by: Ania Misiorek <[email protected]>

---------

Co-authored-by: Ania Misiorek <[email protected]>
  • Loading branch information
leoRysing and aniamisiorek authored Apr 18, 2024
1 parent 586bd1d commit 9f62fc3
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 25 deletions.
15 changes: 12 additions & 3 deletions frontend/components/PopularUser.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
import React from 'react';
import {Image, StyleSheet, Text, View} from 'react-native';
import {Image, StyleSheet, Text, View, TouchableOpacity} from 'react-native';
import { Leader } from '../types/types';
import { Ionicons } from '@expo/vector-icons';
import { useNavigation } from '@react-navigation/native';
import { OutsideProfileNavProp } from '../types/navigationTypes';

type PopularUserProps = {
leader: Leader;
index: number
}

const PopularUser: React.FC<PopularUserProps> = ({ leader, index }: PopularUserProps) => {
const navigation = useNavigation<OutsideProfileNavProp>();
const handlePress = () => {
navigation.navigate('Profile',
{screen: "FollowerProfile", params: { user: leader.leader_user}
});
};

return (
<View style={styles.container}>
<TouchableOpacity style={styles.container} onPress={handlePress}>
{/* Column for image */}
<Text style={styles.rank}>{index + 1}</Text>
<View style={[styles.column, styles.imageColumn]}>
Expand Down Expand Up @@ -43,7 +52,7 @@ const PopularUser: React.FC<PopularUserProps> = ({ leader, index }: PopularUserP
{leader.follower_count}
</Text>
</View>
</View>
</TouchableOpacity>
);
};

Expand Down
1 change: 1 addition & 0 deletions frontend/components/ProfileBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ const ProfileBanner = ({ user }: ProfileBannerProps) => {

<ProfileBio
fullName={`${user.first_name || session?.user.firstName} ${user.last_name || session?.user.lastName}`}
username={`${user.username || session?.user.username}`}
description="profile description? Lorem ipsum dolor sit amet, consectetur adipiscing elit.Praesent vel nisi sed diam ultricies viverra sit amet nec dolor...."
/>
</View>
Expand Down
13 changes: 11 additions & 2 deletions frontend/components/ProfileBio.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
import { View, Text } from 'react-native'
import { View, Text, StyleSheet } from 'react-native'
import React from 'react'

interface ProfileBioProps {
fullName: string
username: string
description: string
}

const ProfileBio = ({ fullName, description }: ProfileBioProps) => {
const ProfileBio = ({ fullName, username, description }: ProfileBioProps) => {
return (
<View className='flex flex-col space-y-1 w-96'>
<Text className='text-base font-bold'>{fullName}</Text>
{username != "" && <Text style={styles.username}>@{username}</Text> }
<Text>{description}</Text>
</View>
)
}

const styles = StyleSheet.create({
username: {
color: "#02AD98",
marginBottom: 10,
}
})

export default ProfileBio
2 changes: 1 addition & 1 deletion frontend/reducers/onboarding/onboardingReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const onboardingSlice = createSlice({
financialGoalsShortTerm: [],
financialGoalsLongTerm: [],
financialLiteracy: [],
isOnboarding: 'onboarding', // 'onboarding', 'normal', 'makingPost'
isOnboarding: 'normal', // 'onboarding', 'normal', 'makingPost'
},
reducers: {
updateFirstName(state, action) {
Expand Down
15 changes: 11 additions & 4 deletions frontend/types/navigationTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,27 @@ export type RootStackParamList = {
Confirmation: undefined;
LongTermGoals: undefined;
ShortTermGoals: undefined;
Profile: undefined;
Profile: undefined | { screen: "FollowerProfile"; params: { user: User } };
ProfilePage: undefined;
FollowerProfile: { user: User }
Followers: { label: string, users: User[] };
};

// AuthPage: undefined;
// TutorialPage: undefined;
// MainApp: undefined;
export type ProfileOtherStack = {
Profile: undefined | { screen: "FollowerProfile"; params: { user: User } };
};

export type OutsideProfileNavProp = StackNavigationProp<ProfileOtherStack>;

export type AuthNavigationProp = StackNavigationProp<
RootStackParamList
>;

export type ProfileParamList = {
FollowerProfile: { user: User }
Followers: { label: string, users: User[] };
}

export type LevelPageNavigationProp = StackNavigationProp<
RootStackParamList,
'LevelPage'
Expand Down
20 changes: 5 additions & 15 deletions frontend/types/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
export interface User {
id: string;
first_name: string;
last_name: string;
username: string;
pass_word: string;
email: string;
risk_tolerance: string;
years_of_experience: number;
image_url: string;
id: string,
first_name: string;
last_name: string;
username: string;
image_url: string;
}

export type FinancialGoal = {
Expand Down Expand Up @@ -79,12 +75,6 @@ export interface ProfileRouteParams {
export interface FollowerRouteParams {
users: User[],
label: string
}export interface User {
id: string,
first_name: string;
last_name: string;
username: string;
image_url: string;
}

export type FinancialGoal = {
Expand Down

0 comments on commit 9f62fc3

Please sign in to comment.