-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SF Claim Summary Improvements (#165)
Relates to #169, partially resolved by adding hyperlink elements in 3 places: - WATonomous Finance System "logo" at top left - "View Claim" button in SFAdminContentTable - Ticket Tree on claim summary pages --------- Co-authored-by: Anson He <[email protected]>
- Loading branch information
1 parent
f0df110
commit c24055c
Showing
14 changed files
with
433 additions
and
155 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
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
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
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,123 @@ | ||
import React from 'react' | ||
import { Text, Box, Stack, Link } from '@chakra-ui/react' | ||
import { useGetPreserveParamsHref } from '../hooks/hooks' | ||
import { useRecoilValue } from 'recoil' | ||
import { currentTicketState, currentTreeState } from '../state/atoms' | ||
|
||
const TreeViewWithLinks = () => { | ||
const currentTicket = useRecoilValue(currentTicketState) | ||
const currentTree = useRecoilValue(currentTreeState) | ||
const getPreserveParamsHref = useGetPreserveParamsHref() | ||
|
||
const sortTickets = (ticketList) => { | ||
return ticketList.toSorted((a, b) => a._id - b._id) | ||
} | ||
|
||
const getFundingItemTree = (fi) => ( | ||
<Box key={fi.code} m="0 !important"> | ||
<Link href={getPreserveParamsHref(fi.path)}> | ||
<Box | ||
bgColor="blue.200" | ||
m="4px 10% 0" | ||
p="4px 8px" | ||
borderRadius="8px" | ||
> | ||
<Text | ||
fontWeight={ | ||
currentTicket.code === fi.code ? '800' : '600' | ||
} | ||
fontSize="xs" | ||
> | ||
{fi.codename} | ||
</Text> | ||
</Box> | ||
</Link> | ||
{sortTickets(fi.personalPurchases).map((ppr) => { | ||
return ( | ||
<Link key={ppr.code} href={getPreserveParamsHref(ppr.path)}> | ||
<Box | ||
bgColor="cyan.200" | ||
m="4px 0 0 20%" | ||
p="4px 8px" | ||
borderRadius="8px" | ||
> | ||
<Text | ||
fontWeight={ | ||
currentTicket.code === ppr.code | ||
? '800' | ||
: '600' | ||
} | ||
fontSize="xs" | ||
> | ||
{ppr.codename} | ||
</Text> | ||
</Box> | ||
</Link> | ||
) | ||
})} | ||
{sortTickets(fi.uwFinancePurchases).map((upr) => { | ||
return ( | ||
<Link key={upr.code} href={getPreserveParamsHref(upr.path)}> | ||
<Box | ||
bgColor="teal.200" | ||
m="4px 0 0 20%" | ||
p="4px 8px" | ||
borderRadius="8px" | ||
> | ||
<Text | ||
fontWeight={ | ||
currentTicket.code === upr.code | ||
? '800' | ||
: '600' | ||
} | ||
fontSize="xs" | ||
> | ||
{upr.codename} | ||
</Text> | ||
</Box> | ||
</Link> | ||
) | ||
})} | ||
</Box> | ||
) | ||
|
||
if ( | ||
!currentTicket.type || | ||
!currentTree || | ||
Object.keys(currentTree).length === 0 | ||
) | ||
return <Text>No tree to display</Text> | ||
|
||
// Special Case: WATO Cash | ||
// OR UPR/PPR with fi_link to WATO Cash | ||
if (currentTree.sf_link === -1) { | ||
return <Stack>{getFundingItemTree(currentTree)}</Stack> | ||
} | ||
|
||
return ( | ||
<Stack w="100%"> | ||
<Link href={getPreserveParamsHref(currentTree.path)}> | ||
<Box | ||
bgColor="purple.200" | ||
p="4px 8px" | ||
mr="20%" | ||
borderRadius="8px" | ||
> | ||
<Text | ||
fontWeight={ | ||
currentTicket.code === currentTree.code | ||
? '800' | ||
: '600' | ||
} | ||
fontSize="xs" | ||
> | ||
{currentTree.codename} | ||
</Text> | ||
</Box> | ||
</Link> | ||
{sortTickets(currentTree.fundingItems).map(getFundingItemTree)} | ||
</Stack> | ||
) | ||
} | ||
|
||
export default TreeViewWithLinks |
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
Oops, something went wrong.