All files / app/(dynamic)/last-will/editor/final page.tsx

84.61% Statements 11/13
50% Branches 2/4
100% Functions 4/4
81.81% Lines 9/11

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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60                              22x   5x 5x 5x     3x 3x     3x               3x       3x                                          
'use client'
import { redirect } from 'next/navigation'
import { useEffect } from 'react'
import isAuth from '../../../../../components/Auth/isAuth'
import { Headline } from '../../../../../components/Headline/Headline'
import { Icon } from '../../../../../components/Icon/Icon'
import { LastWill } from '../../../../../components/LastWill/LastWill'
import { routes } from '../../../../../services/routes/routes'
import { useAppDispatch, useAppSelector } from '../../../../../store/hooks'
import { setProgressKeys } from '../../../../../store/lastwill/lastwill'
import { SidebarPages } from '../../../../../types/sidebar'
 
/**
 * Final Page for copy last will.
 */
const Final = () => {
	// Global State
	const dispatch = useAppDispatch()
	const planType = useAppSelector((state) => state.auth.sessionData?.decodedAccessToken.paymentPlan)
	const isInititalizedAuth = useAppSelector((state) => state.auth.isInitialized)
 
	// Use to handle sidebar display state and progress
	useEffect(() => {
		dispatch(setProgressKeys(SidebarPages.FINAL))
	}, [dispatch])
 
	Iif (!isInititalizedAuth) {
		return (
			<div className="container mt-5">
				<p>Laden...</p>
			</div>
		)
	}
 
	Iif (planType === 'free') {
		redirect(routes.lastWill.buy())
	}
 
	return (
		<div className="container mb-12 mt-5 flex flex-1 flex-col">
			<Headline className="hidden md:mb-8 lg:block">Abschreiben</Headline>
 
			<div className="flex">
				<Icon icon="edit" className="mr-2" />
				<Headline level={3} size="text-lg">
					Vorlage zum Abschreiben
				</Headline>
			</div>
			<div className="pb-2">
				Ein gültiges Testament muss vom Erblasser handschriftlich und eigenhändig verfasst und unterzeichnet werden.
			</div>
 
			{/* Generated Last Will */}
			<LastWill />
		</div>
	)
}
 
export default isAuth(Final, 'protected')