Skip to content

Commit

Permalink
Fix penalties page for new mark system
Browse files Browse the repository at this point in the history
  • Loading branch information
jotjern committed Sep 10, 2024
1 parent ce4747a commit 76357d2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
8 changes: 4 additions & 4 deletions src/profile/components/Settings/Penalties/Mark.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/profile/components/Settings/Penalties/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class Marks extends Component<{}, IState> {
ifNone="Du har ingen prikker"
loaded={loaded}
penalties={marks}
render={(mark) => <Mark markUser={mark as IMark} key={mark.expiration_date} />}
render={(mark) => <Mark mark={mark as IMark} key={mark.expiration_date} />}
/>
<PenaltyPane
name="Suspensjoner"
Expand Down
19 changes: 8 additions & 11 deletions src/profile/models/Penalty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,15 @@ export const getMarkCategory = (category: MarkCategory): MarkCategoryStrings =>
};

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 {
Expand Down

0 comments on commit 76357d2

Please sign in to comment.