-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui): Show when the plaid link was last updated in the UI.
There is now a card at the bottom of the budgeting sidebar that shows when the plaid link was last updated. If you mouse over it it will also show when the last attempt was made (not possible on mobile atm). This is only present when the `plaidLink` sub object of a link is populated.
- Loading branch information
1 parent
6e19c00
commit 061115e
Showing
5 changed files
with
46 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* eslint-disable max-len */ | ||
import React from 'react'; | ||
import { formatDistanceToNow } from 'date-fns'; | ||
|
||
import MSpan from '@monetr/interface/components/MSpan'; | ||
import { useLink } from '@monetr/interface/hooks/links'; | ||
|
||
interface PlaidLastUpdatedCardProps { | ||
linkId: number | null; | ||
} | ||
|
||
export default function PlaidLastUpdatedCard(props: PlaidLastUpdatedCardProps): JSX.Element { | ||
const link = useLink(props?.linkId); | ||
|
||
if (!link?.data?.plaidLink) { | ||
return null; | ||
} | ||
|
||
const lastUpdateString = !!link?.data?.plaidLink?.lastSuccessfulUpdate ? | ||
formatDistanceToNow(link.data.plaidLink.lastSuccessfulUpdate) : | ||
'Never'; | ||
|
||
const lastAttemptString = !!link?.data?.plaidLink?.lastAttemptedUpdate ? | ||
formatDistanceToNow(link.data.plaidLink.lastAttemptedUpdate) : | ||
'Never'; | ||
|
||
return ( | ||
<div className='p-2 group border-[thin] dark:border-dark-monetr-border rounded-lg w-full ease-in-out transition-[height] h-10 hover:h-16 hover:delay-0 delay-500 hover:dark:border-dark-monetr-border-string' > | ||
<MSpan size='sm' color='subtle'> | ||
Last Updated: { lastUpdateString } ago | ||
</MSpan> | ||
<MSpan size='sm' color='subtle' className='transition-opacity opacity-0 group-hover:opacity-100 delay-500 group-hover:delay-0'> | ||
Last Attempt: { lastAttemptString } ago | ||
</MSpan> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters