diff --git a/frontend/mockdata/mockData.ts b/frontend/mockdata/mockData.ts index d3b9feee..2dd461dc 100644 --- a/frontend/mockdata/mockData.ts +++ b/frontend/mockdata/mockData.ts @@ -7,10 +7,10 @@ import { DepartmentReadModel, DetailedBooking, EngagementPerCustomerReadModel, - Forecast, OrganisationReadModel, WeeklyBookingReadModel, } from "@/api-types"; +import { Forecast } from "@/types"; const MockWeeklyBookingReadModel: WeeklyBookingReadModel = { totalHolidayHours: 0, diff --git a/frontend/src/api-types.ts b/frontend/src/api-types.ts index b9011533..747dc4b6 100644 --- a/frontend/src/api-types.ts +++ b/frontend/src/api-types.ts @@ -9,6 +9,8 @@ * --------------------------------------------------------------- */ +import { Forecast } from "./types"; + export interface BookedHoursPerWeek { /** @format int32 */ year: number; @@ -20,11 +22,6 @@ export interface BookedHoursPerWeek { dateString: string; bookingModel: WeeklyBookingReadModel; } -export interface BookedHoursPerMonth { - month: number; - year: number; - bookingModel: WeeklyBookingReadModel; -} export interface BookingDetails { /** @minLength 1 */ projectName: string; @@ -70,15 +67,6 @@ export interface ConsultantReadModel { forecasts?: Forecast[]; } -export interface Forecast { - id: number; - month: number; - year: number; - forecastValue: number; - hasBeenChanged: boolean; - valueAddedManually: number; -} - export interface ConsultantWriteModel { /** @minLength 1 */ name: string; @@ -137,11 +125,6 @@ export interface DetailedBooking { hours: WeeklyHours[]; } -export interface MonthlyDetailedBooking { - bookingDetails: BookingDetails; - hours: MonthlyHours[]; -} - export interface EngagementPerCustomerReadModel { /** @format int32 */ customerId: number; @@ -308,11 +291,6 @@ export interface WeeklyHours { hours: number; } -export interface MonthlyHours { - month: number; - hours: number; -} - export interface CustomersWithProjectsReadModel { customerId: number; customerName: string; diff --git a/frontend/src/components/Forecast/ForecastRows.tsx b/frontend/src/components/Forecast/ForecastRows.tsx index e990bfca..c8e8b09c 100644 --- a/frontend/src/components/Forecast/ForecastRows.tsx +++ b/frontend/src/components/Forecast/ForecastRows.tsx @@ -1,14 +1,8 @@ "use client"; -import { - BookedHoursPerWeek, - ConsultantReadModel, - ProjectWithCustomerModel, - WeeklyBookingReadModel, -} from "@/api-types"; +import { ConsultantReadModel, ProjectWithCustomerModel } from "@/api-types"; import React, { useContext, useEffect, useState } from "react"; -import { AlertCircle, CheckCircle, ChevronDown, Plus } from "react-feather"; +import { Plus } from "react-feather"; import { DetailedBookingRows } from "@/components/Staffing/DetailedBookingRows"; -import { WeekCell } from "@/components/Staffing/WeekCell"; import { useModal } from "@/hooks/useModal"; import { usePathname } from "next/navigation"; import { @@ -20,14 +14,7 @@ import { setDetailedBookingHours } from "@/components/Staffing/DetailedBookingRo import { FilteredContext } from "@/hooks/ConsultantFilterProvider"; import { DateTime } from "luxon"; import Image from "next/image"; -import { INTERNAL_CUSTOMER_NAME } from "../Staffing/helpers/utils"; import { MonthCell } from "./MonthCell"; -import { - getMonthOfWeek, - MonthDistributionOfWeek, - weekToWeekType, -} from "./WeekToMonthConverter"; -import { Month } from "date-fns"; import { bookingForMonth, transformToMonthlyData, diff --git a/frontend/src/components/Forecast/HoveredMonth.tsx b/frontend/src/components/Forecast/HoveredMonth.tsx index 0ddbeebe..6593b1d3 100644 --- a/frontend/src/components/Forecast/HoveredMonth.tsx +++ b/frontend/src/components/Forecast/HoveredMonth.tsx @@ -1,8 +1,4 @@ -import { - BookingType, - ConsultantReadModel, - MonthlyDetailedBooking, -} from "@/api-types"; +import { BookingType, ConsultantReadModel } from "@/api-types"; import { getColorByStaffingType, getIconByBookingType, @@ -12,6 +8,8 @@ import { transformDetailedBookingToMonthlyData, transformToMonthlyData, } from "./TransformWeekDataToMonth"; +import { MonthlyDetailedBooking, MonthlyHours } from "@/types"; + function isMonthBookingZeroHours( detailedBooking: MonthlyDetailedBooking, hoveredRowMonth: number, @@ -116,7 +114,7 @@ export function HoveredMonth(props: {

{ detailedBooking.hours.find( - (hour) => hour.month % 100 == hoveredRowMonth, + (hour: MonthlyHours) => hour.month % 100 == hoveredRowMonth, )?.hours }

diff --git a/frontend/src/components/Forecast/MonthCell.tsx b/frontend/src/components/Forecast/MonthCell.tsx index a7c9340c..aaf6fab0 100644 --- a/frontend/src/components/Forecast/MonthCell.tsx +++ b/frontend/src/components/Forecast/MonthCell.tsx @@ -1,5 +1,5 @@ -import { BookedHoursPerMonth, ConsultantReadModel } from "@/api-types"; -import { HoveredWeek } from "@/components/Staffing/HoveredWeek"; +import { ConsultantReadModel } from "@/api-types"; +import { BookedHoursPerMonth } from "@/types"; import InfoPill from "@/components/Staffing/InfoPill"; import { AlertTriangle, diff --git a/frontend/src/components/Forecast/TransformWeekDataToMonth.ts b/frontend/src/components/Forecast/TransformWeekDataToMonth.ts index e1bdc10f..ae92b7da 100644 --- a/frontend/src/components/Forecast/TransformWeekDataToMonth.ts +++ b/frontend/src/components/Forecast/TransformWeekDataToMonth.ts @@ -1,13 +1,15 @@ import { - BookedHoursPerMonth, BookedHoursPerWeek, BookingDetails, DetailedBooking, - MonthlyDetailedBooking, - MonthlyHours, WeeklyBookingReadModel, } from "@/api-types"; import { getMonthOfWeek, weekToWeekType } from "./WeekToMonthConverter"; +import { + BookedHoursPerMonth, + MonthlyDetailedBooking, + MonthlyHours, +} from "@/types"; function round2Decimals(num: number) { return Math.round(num * 2) / 2; diff --git a/frontend/src/components/Staffing/HoveredWeek.tsx b/frontend/src/components/Staffing/HoveredWeek.tsx index 87130c0f..f8892f6d 100644 --- a/frontend/src/components/Staffing/HoveredWeek.tsx +++ b/frontend/src/components/Staffing/HoveredWeek.tsx @@ -4,7 +4,6 @@ import { getIconByBookingType, isWeekBookingZeroHours, } from "@/components/Staffing/helpers/utils"; -import React from "react"; export function HoveredWeek(props: { hoveredRowWeek: number; diff --git a/frontend/src/components/Staffing/helpers/utils.tsx b/frontend/src/components/Staffing/helpers/utils.tsx index c3bf870f..3cfb376b 100644 --- a/frontend/src/components/Staffing/helpers/utils.tsx +++ b/frontend/src/components/Staffing/helpers/utils.tsx @@ -3,7 +3,6 @@ import { ConsultantReadModel, DetailedBooking, EngagementState, - MonthlyDetailedBooking, } from "@/api-types"; import React, { ReactElement } from "react"; import { diff --git a/frontend/src/types.ts b/frontend/src/types.ts index 392564d1..fed45a9e 100644 --- a/frontend/src/types.ts +++ b/frontend/src/types.ts @@ -1,4 +1,10 @@ -import { BookingType, ConsultantReadModel, EngagementState } from "@/api-types"; +import { + BookingDetails, + BookingType, + ConsultantReadModel, + EngagementState, + WeeklyBookingReadModel, +} from "@/api-types"; export type YearRange = { label: string; @@ -21,6 +27,30 @@ export interface updateBookingHoursBody { endWeek?: number; } +export interface BookedHoursPerMonth { + month: number; + year: number; + bookingModel: WeeklyBookingReadModel; +} + +export interface Forecast { + id: number; + month: number; + year: number; + forecastValue: number; + hasBeenChanged: boolean; + valueAddedManually: number; +} + +export interface MonthlyDetailedBooking { + bookingDetails: BookingDetails; + hours: MonthlyHours[]; +} +export interface MonthlyHours { + month: number; + hours: number; +} + export interface updateProjectStateBody { engagementId: string; projectState: EngagementState;