diff --git a/packages/app/src/components/StewardsList.tsx b/packages/app/src/components/StewardsList.tsx index 85fd7fe5..cf5c5b84 100644 --- a/packages/app/src/components/StewardsList.tsx +++ b/packages/app/src/components/StewardsList.tsx @@ -1,10 +1,8 @@ import { Image, Text, View, StyleSheet } from 'react-native'; import { InterRegular, InterSemiBold } from '../utils/webFonts'; import { StewardBlueIcon, StewardGreenIcon, VerifiedIconUri } from '../@constants/ColorTypeIcons'; -// import { NoAvatarIcon } from '../@constants/EmptyPicture'; import { useLocation } from 'react-router-native'; import { Colors } from '../utils/colors'; -import profilePictureArray from '../@constants/pfps'; import { useMediaQuery } from 'native-base'; const placeholderUsers = [0, 1, 2, 3, 4, 5, 6]; @@ -12,7 +10,7 @@ const placeholderUsers = [0, 1, 2, 3, 4, 5, 6]; interface StewardListProps { hideTitle?: boolean; imageUrl?: string; - listType: string; + listType: 'viewCollective' | 'viewStewards'; stewardData: { username: string; actions?: number; @@ -30,24 +28,25 @@ function StewardList({ imageUrl, listType, stewardData, stewards, hideTitle }: S return ( {!hideTitle && ( - - {/* {listType !== 'steward' && } - {listType === 'steward' && } */} - Stewards {`(0)`} + + {listType === 'viewCollective' && } + Stewards{listType === 'viewCollective' ? ` (0)` : ''} + {listType === 'viewStewards' && } )} - {listType == 'steward' && - (isDesktopResolution ? placeholderUsers.slice(0, 6) : placeholderUsers.slice(0, 5)).map((item) => ( - - - - {stewardData.username}{' '} - {stewardData.isVerified && } - - {stewardData.actions && {stewardData.actions} actions} - - ))} + {(isDesktopResolution ? placeholderUsers.slice(0, 6) : placeholderUsers.slice(0, 5)).map((item) => ( + + + + {stewardData.username}{' '} + {stewardData.isVerified && } + + {listType === 'viewStewards' && stewardData.actions && ( + {stewardData.actions} actions + )} + + ))} ); @@ -55,14 +54,16 @@ function StewardList({ imageUrl, listType, stewardData, stewards, hideTitle }: S const styles = StyleSheet.create({ stewardsHeader: { flex: 1 }, - firstIcon: { + titleIcon: { height: 32, width: 32, + marginRight: 8, }, rowImg: { height: 48, width: 48, - borderRadius: 26, + borderRadius: 24, + marginRight: 16, }, verifiedIcon: { height: 16, @@ -87,7 +88,6 @@ const styles = StyleSheet.create({ title: { fontSize: 16, ...InterSemiBold, - marginLeft: 16, width: '100%', color: Colors.black, }, diff --git a/packages/app/src/components/ViewCollective.tsx b/packages/app/src/components/ViewCollective.tsx index 2d75a2f3..b81c624c 100644 --- a/packages/app/src/components/ViewCollective.tsx +++ b/packages/app/src/components/ViewCollective.tsx @@ -1,7 +1,5 @@ -import { useCallback } from 'react'; import { StyleSheet, Text, View, Image } from 'react-native'; import { useState } from 'react'; -// import oceanUri from '../@constants/SafariImagePlaceholder'; import RowItem from './RowItem'; import RoundedButton from './RoundedButton'; import StewardList from './StewardsList'; @@ -18,21 +16,19 @@ import { Colors } from '../utils/colors'; import { Link, useMediaQuery } from 'native-base'; import Breadcrumb from './Breadcrumb'; import { formatTime } from '../hooks/functions/formatTime'; -import { formatAmount } from '../hooks/functions/formatUsdAmount'; interface ViewCollectiveProps { - imageUrl?: any; - title?: any; + imageUrl?: string; + title?: string; description?: string; - stewardsDesc?: any; - creationDate?: any; - stewardsPaid?: any; - paymentsMade?: any; - donationsReceived?: any; - totalPaidOut?: any; - currentPool?: any; - route?: any; - + stewardsDesc?: string; + creationDate?: number; + stewardsPaid?: number; + paymentsMade?: number; + donationsReceived?: number; + totalPaidOut?: number; + currentPool?: number; + route?: string; stewards?: {}; recentTransactions?: {}; isDonating: boolean; @@ -60,27 +56,27 @@ function ViewCollective({ const [isDesktopResolution] = useMediaQuery({ minWidth: 612, }); + // TODO: need actual token price const tokenPrice = 0.00018672442844237; - const formattedDonations: any = (donationsReceived / 10 ** 18).toFixed(3); - const usdValue = tokenPrice * formattedDonations; - const renderDonorsButton = useCallback( - () => - isDesktopResolution ? ( - <> - ) : ( - { - navigate(`/collective/${route}/donors`); - }} - /> - ), - [navigate, isDesktopResolution, route] - )(); + const decimalDonations = (donationsReceived ?? 0) / 10 ** 18; + const formattedDonations: string = decimalDonations.toFixed(3); + const usdValue = tokenPrice * decimalDonations; + + const renderDonorsButton = () => + isDesktopResolution ? ( + <> + ) : ( + { + navigate(`/collective/${route}/donors`); + }} + /> + ); if (isDesktopResolution) { return ( @@ -143,7 +139,7 @@ function ViewCollective({ console.log(stopDonationModal); }} /> - {renderDonorsButton} + {renderDonorsButton()} ) : ( @@ -158,7 +154,7 @@ function ViewCollective({ navigate(`/donate/${route}`); }} /> - {renderDonorsButton} + {renderDonorsButton()} )} @@ -167,16 +163,12 @@ function ViewCollective({ - + @@ -199,28 +191,20 @@ function ViewCollective({ /> )} - {totalPaidOut.length ? ( - - ) : ( - - )} - {currentPool.length ? ( - - ) : ( - - )} + + @@ -233,7 +217,7 @@ function ViewCollective({ isVerified: null as any, actions: null as any, }} - listType="steward" + listType="viewCollective" /> - + - In this code, we're checking if each of the values (donationsReceived, totalPaidOut, and currentPool) is - truthy (not null or undefined) before rendering the corresponding section. If the value is truthy, it will use - the actual value; otherwise, it will use 0 as the default value. {isDonating ? ( @@ -350,7 +326,7 @@ function ViewCollective({ console.log(stopDonationModal); }} /> - {renderDonorsButton} + {renderDonorsButton()} ) : ( @@ -365,7 +341,7 @@ function ViewCollective({ navigate(`/donate/${route}`); }} /> - {renderDonorsButton} + {renderDonorsButton()} )} @@ -377,7 +353,7 @@ function ViewCollective({ isVerified: true, actions: 730, }} - listType="steward" + listType="viewCollective" /> - <> - {isLoading ? ( -

Loading...

- ) : ( - subData?.map((t: any, index: number) => ( - - )) - )} - + {isLoading ? ( +

Loading...

+ ) : ( + subData?.map((t: any) => ( + + )) + )} ); } diff --git a/packages/app/src/pages/ViewStewardsPage.tsx b/packages/app/src/pages/ViewStewardsPage.tsx index 2021b280..037e4114 100644 --- a/packages/app/src/pages/ViewStewardsPage.tsx +++ b/packages/app/src/pages/ViewStewardsPage.tsx @@ -36,7 +36,7 @@ function ViewStewardsPage() { isVerified: true, actions: 730, }} - listType="steward" + listType="viewStewards" /> {/* Repeat StewardList component for other items */} @@ -60,7 +60,7 @@ function ViewStewardsPage() { isVerified: true, actions: 730, }} - listType="steward" + listType="viewStewards" />