Skip to content

Commit

Permalink
Merge pull request #21 from FLock-io/fix/ui-fixes
Browse files Browse the repository at this point in the history
Fix/UI fixes
  • Loading branch information
rodrigopavezi authored Aug 29, 2023
2 parents b3ffe67 + 758fa17 commit 73d2af1
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 38 deletions.
Empty file modified build/bin/main.bin
100755 → 100644
Empty file.
63 changes: 33 additions & 30 deletions src/renderer/components/Task.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ function Task({ task, goBack }: TaskProps) {
) : (
<LogViewer
hasLineNumbers={false}
height={460}
height={390}
data={logs.get(task.address)}
/>
)}
Expand All @@ -256,35 +256,38 @@ function Task({ task, goBack }: TaskProps) {
<Heading level={4}>Rounds and Balance Record</Heading>
</Box>

<DataTable
columns={[
{
align: 'center',
property: 'round',
header: 'Round',
primary: true,
},
{
align: 'center',
property: 'role',
header: 'Role',
render: (datum) => (
<Text>{datum.role === '1' ? 'Voter' : 'Proposer'} </Text>
),
},
{
align: 'center',
property: 'token',
header: 'Token Change',
},
{
align: 'center',
property: 'balance',
header: 'Round Balance',
},
]}
data={finalDataForReport}
/>
<Box overflow="auto" height="300px">
<DataTable
pin
columns={[
{
align: 'center',
property: 'round',
header: 'Round',
primary: true,
},
{
align: 'center',
property: 'role',
header: 'Role',
render: (datum) => (
<Text>{datum.role === '1' ? 'Voter' : 'Proposer'} </Text>
),
},
{
align: 'center',
property: 'token',
header: 'Token Change',
},
{
align: 'center',
property: 'balance',
header: 'Round Balance',
},
]}
data={finalDataForReport}
/>
</Box>
</Box>
<Box gap="medium">
<Box>
Expand Down
16 changes: 8 additions & 8 deletions src/renderer/hooks/useTaskData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ export const useTaskData = ({
};

const totalRewardedAmount = participantRewardedAmounts.reduce(
(partialSum, a) => Number(partialSum) + Number(a),
(partialSum, a) =>
Number(formatUnits(partialSum, 18)) + Number(formatUnits(a, 18)),
0
);

Expand Down Expand Up @@ -128,7 +129,7 @@ export const useTaskData = ({
args: [i],
}) as Promise<bigint>;
// eslint-disable-next-line no-await-in-loop
result.push({ round: i, accuracy: Number(await data) });
result.push({ round: i + 1, accuracy: Number(await data) / 10000 });
}
setAccuracies(result);
};
Expand All @@ -142,14 +143,13 @@ export const useTaskData = ({

const finalDataForReport = [];

for (let index = 0; index < participantRewardedAmounts.length; index++) {
const element = participantRewardedAmounts[index];
for (let index = 0; index < participantRoundBalance.length; index++) {
let tokenChangePercentage = '0%'; // Default value for the first element and when previous "token" is zero
let currentToken = element;
const currentToken = participantRoundBalance[index];
let prevToken = 0n;
index > 0
? (prevToken = participantRewardedAmounts[index - 1])
: (prevToken = participantRewardedAmounts[index]);
? (prevToken = participantRoundBalance[index - 1])
: (prevToken = participantRoundBalance[index]);

if (prevToken !== 0n) {
const tokenChange = ((currentToken - prevToken) / prevToken) * 100n;
Expand All @@ -164,7 +164,7 @@ export const useTaskData = ({
token: tokenChangePercentage,
balance: participantRoundBalance[index]
? formatUnits(participantRoundBalance[index], 18)
: '',
: '0',
});
}

Expand Down

0 comments on commit 73d2af1

Please sign in to comment.