Skip to content

Commit

Permalink
corrected earning card
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsan6sha committed Mar 23, 2024
1 parent 4f74db0 commit 3441d28
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 9 deletions.
20 changes: 18 additions & 2 deletions apps/box/src/components/Cards/EarningCard.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { FxBox, FxCard, FxRefreshIcon } from '@functionland/component-library';
import { BottomSheetModalMethods } from '@gorhom/bottom-sheet/lib/typescript/types';
import { ActivityIndicator, Text } from 'react-native';
import { ActivityIndicator, Text, View, StyleSheet } from 'react-native';

type EarningCardProps = React.ComponentProps<typeof FxBox> & {
data: { totalFula: string };
Expand Down Expand Up @@ -37,10 +37,26 @@ export const EarningCard = ({
<FxCard.Row>
<FxCard.Row.Title>Total fula</FxCard.Row.Title>
<FxCard.Row.Data>
{totalFula === 'NaN' ? <Text>0</Text> : <Text>{totalFula}</Text>}
<View style={styles.totalFulaContainer}>
{totalFula === 'NaN' ? <Text>0</Text> : <Text style={styles.totalFula}>{totalFula}</Text>}
<Text style={styles.superscript}> (x10⁻¹⁸)</Text>
</View>
</FxCard.Row.Data>
</FxCard.Row>
)}
</FxCard>
);
};

const styles = StyleSheet.create({
totalFulaContainer: {
flexDirection: 'row',
alignItems: 'baseline',
},
totalFula: {

},
superscript: {
fontSize: 10, // Smaller font size for superscript notation
},
});
7 changes: 5 additions & 2 deletions apps/box/src/stores/useUserProfileStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,23 +230,26 @@ const createUserProfileSlice: StateCreator<
}
await fula.isReady(false);
const account = await blockchain.getAccount();
console.log({ account: account });
const earnings = await blockchain.assetsBalance(
account.account,
'100',
'100'
);
console.log({ earnings: earnings });
set({
earnings: earnings.amount,
});
} catch (error) {
if (!error.toString().includes('response: 400')) {
console.log('Bad request: ', error.toString());
}
throw error;
} finally {
set({
earnings: 'NaN',
});
throw error;
} finally {

}
},
logout: () => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@babel/preset-env": "^7.1.6",
"@ethersproject/shims": "^5.7.0",
"@functionland/fula-sec": "^2.0.0",
"@functionland/react-native-fula": "1.54.7",
"@functionland/react-native-fula": "1.54.8",
"@gorhom/bottom-sheet": "^4.5.1",
"@metamask/sdk-react": "^0.14.2",
"@notifee/react-native": "^7.8.2",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2412,10 +2412,10 @@
"@babel/runtime" "~7.17.2"
"@protobuf-ts/runtime" "~2.2.2"

"@functionland/[email protected].7":
version "1.54.7"
resolved "https://registry.yarnpkg.com/@functionland/react-native-fula/-/react-native-fula-1.54.7.tgz#02a5950d08b319b1c9d8fdf41bb1767892a6ea0d"
integrity sha512-AGr6PiFkjnQLHTnZWEu38o5DxD7C+GvJSX7qSdU6wneNBjORDqjstEUhGbQeN+gGN5Cf8G9XC4tq8TkFAGrE1w==
"@functionland/[email protected].8":
version "1.54.8"
resolved "https://registry.yarnpkg.com/@functionland/react-native-fula/-/react-native-fula-1.54.8.tgz#77c37db5aa7340c7a07fa6bbf83ee6e243ca4121"
integrity sha512-y/m0Kr6LLlVbDJGMwPptzAN+pG4iG+9AKG2ol4gQ79FiTkR96a6yAIqwDTOuFz3knod/JpVlH8xlLJgxRHxM6g==
dependencies:
"@polkadot/api" "^9.11.3"
"@polkadot/keyring" "^10.2.6"
Expand Down

0 comments on commit 3441d28

Please sign in to comment.