From 087f2c24f60642edec13ea0264610eeaadd54ae9 Mon Sep 17 00:00:00 2001 From: Mathias Oterhals Myklebust Date: Fri, 23 Aug 2024 14:00:51 +0200 Subject: [PATCH] chore(salaryCalculator): prettify --- .../radioButtonGroup.module.css | 12 +-- .../salaryCalculator.module.css | 10 +-- .../utils/calculateSalary.ts | 47 ++++++----- src/salaryAndBenefits/utils/salaryData.ts | 79 +++++++++---------- 4 files changed, 73 insertions(+), 75 deletions(-) diff --git a/src/components/forms/radioButtonGroup/radioButtonGroup.module.css b/src/components/forms/radioButtonGroup/radioButtonGroup.module.css index 208d09b0d..193076c3e 100644 --- a/src/components/forms/radioButtonGroup/radioButtonGroup.module.css +++ b/src/components/forms/radioButtonGroup/radioButtonGroup.module.css @@ -1,10 +1,10 @@ .fieldset { - border: 0 none; - padding: 0; + border: 0 none; + padding: 0; } .wrapper { - display: flex; - flex-direction: column; - gap: 0.5rem; -} \ No newline at end of file + display: flex; + flex-direction: column; + gap: 0.5rem; +} diff --git a/src/salaryAndBenefits/components/salaryCalculator/salaryCalculator.module.css b/src/salaryAndBenefits/components/salaryCalculator/salaryCalculator.module.css index 99961ac01..464990c85 100644 --- a/src/salaryAndBenefits/components/salaryCalculator/salaryCalculator.module.css +++ b/src/salaryAndBenefits/components/salaryCalculator/salaryCalculator.module.css @@ -1,5 +1,5 @@ -.calculator{ - display: flex; - flex-direction: column; - gap: 2rem; -} \ No newline at end of file +.calculator { + display: flex; + flex-direction: column; + gap: 2rem; +} diff --git a/src/salaryAndBenefits/utils/calculateSalary.ts b/src/salaryAndBenefits/utils/calculateSalary.ts index b23dc7290..6e1e1ec6b 100644 --- a/src/salaryAndBenefits/utils/calculateSalary.ts +++ b/src/salaryAndBenefits/utils/calculateSalary.ts @@ -1,29 +1,28 @@ import { payscale } from "./salaryData"; - + interface PayScale { - [year: number]: { - [examinationYear: number]: number; - }; - } - - const salaryPayscale: PayScale = payscale; - - export function calculateSalary( - currentYear: number, - examinationYear: number, - degree: string - ): number { + [year: number]: { + [examinationYear: number]: number; + }; +} + +const salaryPayscale: PayScale = payscale; - const degreeValue = degree === "bachelor" ? 1 : 0; - const adjustedYear = (examinationYear + degreeValue); - return salaryPayscale[currentYear][adjustedYear]; - } +export function calculateSalary( + currentYear: number, + examinationYear: number, + degree: string, +): number { + const degreeValue = degree === "bachelor" ? 1 : 0; + const adjustedYear = examinationYear + degreeValue; + return salaryPayscale[currentYear][adjustedYear]; +} - export function calculatePension(salary: number): number { - return Math.round(salary * 0.07); - } +export function calculatePension(salary: number): number { + return Math.round(salary * 0.07); +} - export function maxExperience(thisYear: number): number { - const years = Object.keys(salaryPayscale[thisYear]).map(Number) - return Math.min(...years); - } \ No newline at end of file +export function maxExperience(thisYear: number): number { + const years = Object.keys(salaryPayscale[thisYear]).map(Number); + return Math.min(...years); +} diff --git a/src/salaryAndBenefits/utils/salaryData.ts b/src/salaryAndBenefits/utils/salaryData.ts index 24a8b85f6..10c359d9a 100644 --- a/src/salaryAndBenefits/utils/salaryData.ts +++ b/src/salaryAndBenefits/utils/salaryData.ts @@ -1,41 +1,40 @@ export const payscale = { - 2024: { - 2024 : 600000, - 2023 : 635833, - 2022 : 681829, - 2021 : 734982, - 2020 : 789982, - 2019 : 838539, - 2018 : 879553, - 2017 : 916886, - 2016 : 949000, - 2015 : 977333, - 2014 : 1005324, - 2013 : 1031405, - 2012 : 1064738, - 2011 : 1091489, - 2010 : 1113742, - 2009 : 1138742, - 2008 : 1166667, - 2007 : 1192460, - 2006 : 1210126, - 2005 : 1233560, - 2004 : 1264767, - 2003 : 1289780, - 2002 : 1299680, - 2001 : 1295953, - 2000 : 1305501, - 1999 : 1328501, - 1998 : 1349349, - 1997 : 1365121, - 1996 : 1384832, - 1995 : 1399711, - 1994 : 1422069, - 1993 : 1429358, - 1992 : 1452891, - 1991 : 1458021, - 1990 : 1467321, - 1989 : 1484721 - } - } ; - \ No newline at end of file + 2024: { + 2024: 600000, + 2023: 635833, + 2022: 681829, + 2021: 734982, + 2020: 789982, + 2019: 838539, + 2018: 879553, + 2017: 916886, + 2016: 949000, + 2015: 977333, + 2014: 1005324, + 2013: 1031405, + 2012: 1064738, + 2011: 1091489, + 2010: 1113742, + 2009: 1138742, + 2008: 1166667, + 2007: 1192460, + 2006: 1210126, + 2005: 1233560, + 2004: 1264767, + 2003: 1289780, + 2002: 1299680, + 2001: 1295953, + 2000: 1305501, + 1999: 1328501, + 1998: 1349349, + 1997: 1365121, + 1996: 1384832, + 1995: 1399711, + 1994: 1422069, + 1993: 1429358, + 1992: 1452891, + 1991: 1458021, + 1990: 1467321, + 1989: 1484721, + }, +};