Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 56x 14x 16x 96x 96x 16x | import { MaterialSymbol } from 'material-symbols'
import { sidebarElements } from '../../../content/sidebar'
import { LastWillProfile } from '../../app/(dynamic)/(pages)/profile/last-will/page'
import { LastWillProfileResponse } from '../api/lastwill/getLastWills'
/**
* Prepare last wills for profile page.
* @param lastWills to prepare
* @returns prepared last wills
*/
export const prepareLastWills = (lastWills: LastWillProfileResponse[]): LastWillProfile[] => {
return lastWills.map((lastWill) => {
const steps = sidebarElements.map((element) => {
const isProgressKeyPresent = lastWill.progressKeys.includes(element.page)
return {
label: element.title,
icon: (isProgressKeyPresent ? 'check_circle' : 'cancel') as MaterialSymbol,
}
})
return {
id: lastWill._id,
title: lastWill.testator !== '' ? lastWill.testator : 'Testament',
createdAt: new Date(lastWill.createdAt),
updatedAt: new Date(lastWill.updatedAt),
steps: steps,
}
})
}
|