Skip to content

Commit

Permalink
refactor: logic complexity
Browse files Browse the repository at this point in the history
  • Loading branch information
geolffreym committed Jan 8, 2025
1 parent 79aff28 commit 40c752f
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,8 @@ export default function FinanceBalanceStatistics() {
<>
<Card>
<CardHeader
title="Balance Statistics"
subheader="Income vs Outcome over time"
title="Statistics"
subheader="Income vs outcome"
sx={{ px: 0 }}
action={
<ButtonBase
Expand Down
20 changes: 10 additions & 10 deletions src/sections/finance/components/finance-contacts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,19 @@ export default function FinanceContactsCarousel({
if (time == null) time = 500;
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
(pos = +pos), (time = +time);

window.requestAnimationFrame(function step(currentTime) {
start = !start ? currentTime : start;
let progress = currentTime - start;
if (currentPos < pos) {
window.scrollTo(0, ((pos - currentPos) * progress) / time + currentPos);
} else {
window.scrollTo(0, currentPos - ((currentPos - pos) * progress) / time);
}
if (progress < time) {
window.requestAnimationFrame(step);
} else {
window.scrollTo(0, pos);
}

const lgPos = ((pos - currentPos) * progress) / time + currentPos;
const gtPos = currentPos - ((currentPos - pos) * progress) / time
window.scrollTo(0, currentPos < pos ? lgPos : gtPos);

progress < time
? window.requestAnimationFrame(step)
: window.scrollTo(0, pos);

});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ const FinanceDepositFromStripe = () => {
This feature is coming soon.
</TextMaxLine>
<TextMaxLine color={'text.secondary'} variant={'body2'} line={2} sx={{ mb: 2 }}>
We’re working hard to bring this section to life. Check back soon!
We’re working hard to bring this feature to life.
<br /> Check back soon!
</TextMaxLine>
</Box>
<Box></Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,10 @@ function FinanceQuickTransferModal({
}: ConfirmTransferDialogProps) {
const sessionData = useSelector((state: any) => state.auth.session);
const { generatePayload } = useNotificationPayload(sessionData);
const { transfer, loading: transferLoading, error } = useTransfer();
const { sendNotification } = useNotifications();
const [message, setMessage] = useState('');

const { transfer, loading: transferLoading, error } = useTransfer();

// Check if we have a valid profile or not
const hasProfile = !!contactInfo;

Expand Down
13 changes: 7 additions & 6 deletions src/sections/finance/components/finance-quick-transfer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,13 @@ export default function FinanceQuickTransfer({
useEffect(() => {
const currentProfile = list?.[carousel.currentIndex];
if (currentProfile?.ownedBy?.address) {
setWalletAddress(currentProfile.ownedBy.address);
dispatch(
storeAddress({ address: currentProfile.ownedBy.address, profileId: currentProfile.id })
);
const profileId = currentProfile.id
const address = currentProfile.ownedBy.address;

setWalletAddress(address);
dispatch(storeAddress({ address, profileId }));
}
}, [carousel.currentIndex, list, dispatch]);
}, [carousel.currentIndex, list]);

// Merge initialList into local list when it changes
useEffect(() => {
Expand Down Expand Up @@ -311,7 +312,7 @@ export default function FinanceQuickTransfer({
sx={{
width: 1,
mx: 'auto',
maxWidth: AVATAR_SIZE * 7 + 160,
// maxWidth: AVATAR_SIZE * 7 + 160,
}}
>
{list?.map((profile, index) => (
Expand Down

0 comments on commit 40c752f

Please sign in to comment.