From 76357d2cf5e6ca99955a5b7ea534574993bc5be8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=20Gramn=C3=A6s=20Tjernshaugen?= Date: Tue, 10 Sep 2024 14:58:40 +0200 Subject: [PATCH] Fix penalties page for new mark system --- .../components/Settings/Penalties/Mark.tsx | 8 ++++---- .../components/Settings/Penalties/index.tsx | 2 +- src/profile/models/Penalty.ts | 19 ++++++++----------- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/profile/components/Settings/Penalties/Mark.tsx b/src/profile/components/Settings/Penalties/Mark.tsx index 63b40d4b..df89b04e 100644 --- a/src/profile/components/Settings/Penalties/Mark.tsx +++ b/src/profile/components/Settings/Penalties/Mark.tsx @@ -17,13 +17,13 @@ const penaltyContent = (description: string, expiration: string, category: strin `; export interface IProps { - markUser: IMark; + mark: IMark; } -export const Mark = ({ markUser: { mark, expiration_date } }: IProps) => { - const expiration = DateTime.fromISO(expiration_date).toFormat('d MMMM y'); +export const Mark = ({ mark }: IProps) => { + const expiration = DateTime.fromISO(mark.expiration_date).toFormat('d MMMM y'); const added = DateTime.fromISO(mark.added_date); - const completion = getPenaltyCompletion(expiration_date); + const completion = getPenaltyCompletion(mark.expiration_date); const category = getMarkCategory(mark.category); const active = completion < 100; diff --git a/src/profile/components/Settings/Penalties/index.tsx b/src/profile/components/Settings/Penalties/index.tsx index 4c97b8ee..34b923ef 100644 --- a/src/profile/components/Settings/Penalties/index.tsx +++ b/src/profile/components/Settings/Penalties/index.tsx @@ -46,7 +46,7 @@ class Marks extends Component<{}, IState> { ifNone="Du har ingen prikker" loaded={loaded} penalties={marks} - render={(mark) => } + render={(mark) => } /> }; export interface IMark { - /** Max length of 155 characters */ expiration_date: IsoDateTime; - mark: { - title: string; - added_date: IsoDate; - given_by: null; // Requires changes in OW4 API. - last_changed_date: IsoDateTime; - last_changed_by: null; // Requires changes in OW4 API. - category: MarkCategory; - /** Max length of 255 characters */ - description: string; - }; + title: string; + added_date: IsoDate; + given_by: null; // Requires changes in OW4 API. + last_changed_date: IsoDateTime; + last_changed_by: null; // Requires changes in OW4 API. + category: MarkCategory; + /** Max length of 255 characters */ + description: string; } export interface ISuspension {