Skip to content

Commit feef5a8

Browse files
authored
[feat] Enhance Event Status Handling with Planned and Cancelled States; Refactor UI Components for Consistent Status Display (#162)
1 parent 732017b commit feef5a8

File tree

7 files changed

+940
-940
lines changed

7 files changed

+940
-940
lines changed

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"test": "vitest"
1212
},
1313
"dependencies": {
14-
"@fluentui/react-components": "^9.63.0",
14+
"@fluentui/react-components": "^9.64.0",
1515
"@telekom/scale-components": "3.0.0-beta.155",
1616
"@telekom/scale-components-react": "3.0.0-beta.155",
1717
"ahooks": "^3.8.4",
@@ -31,12 +31,12 @@
3131
"@farmfe/core": "^1.7.5",
3232
"@farmfe/js-plugin-postcss": "^1.12.0",
3333
"@farmfe/plugin-react": "^1.2.6",
34-
"@tailwindcss/postcss": "^4.1.6",
34+
"@tailwindcss/postcss": "^4.1.7",
3535
"@testing-library/react": "^16.3.0",
3636
"@types/lodash": "^4.17.16",
37-
"@types/node": "^22.15.17",
38-
"@types/react": "^19.1.3",
39-
"@types/react-dom": "^19.1.3",
37+
"@types/node": "^22.15.18",
38+
"@types/react": "^19.1.4",
39+
"@types/react-dom": "^19.1.5",
4040
"@types/react-helmet": "^6.1.11",
4141
"autoprefixer": "^10.4.21",
4242
"core-js": "^3.42.0",
@@ -46,7 +46,7 @@
4646
"react-refresh": "^0.17.0",
4747
"tailwindcss": "3.4.17",
4848
"tailwindcss-scoped-preflight": "^3.4.12",
49-
"typescript-eslint": "^8.32.0"
49+
"typescript-eslint": "^8.32.1"
5050
},
51-
"packageManager": "pnpm@10.10.0"
51+
"packageManager": "pnpm@10.11.0"
5252
}

pnpm-lock.yaml

Lines changed: 912 additions & 922 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Components/Event/Enums.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,11 @@ export enum EventStatus {
6060
Observing = "Observing",
6161
Resolved = "Resolved",
6262

63+
Planned = "Planned",
6364
Modified = "Modified",
6465
InProgress = "InProgress",
6566
Completed = "Completed",
67+
Cancelled = "Cancelled",
6668

6769
Reopened = "Reopened",
6870
Changed = "Changed",
@@ -74,7 +76,7 @@ export enum EventStatus {
7476
* @version 0.1.0
7577
*/
7678
export function IsOpenStatus(status: EventStatus): boolean {
77-
return ![EventStatus.Completed, EventStatus.Resolved].includes(status);
79+
return ![EventStatus.Completed, EventStatus.Resolved, EventStatus.Cancelled].includes(status);
7880
}
7981

8082
/**
@@ -102,5 +104,9 @@ export function GetStatusString(status: EventStatus): string {
102104
return StatusEnum.Reopened;
103105
case EventStatus.Changed:
104106
return StatusEnum.Changed;
107+
case EventStatus.Planned:
108+
return StatusEnum.Planned;
109+
case EventStatus.Cancelled:
110+
return StatusEnum.Cancelled;
105111
}
106112
}

src/Components/Event/EventCard.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,9 @@ export function EventCard({ Event }: { Event: Models.IEvent }) {
4747
Impact Type:
4848
</label>
4949

50-
{Event.Type !== EventType.Maintenance &&
51-
<label className="text-xl font-medium text-slate-600 whitespace-nowrap">
52-
Current Status:
53-
</label>}
50+
<label className="text-xl font-medium text-slate-600 whitespace-nowrap">
51+
Current Status:
52+
</label>
5453

5554
<label className="text-xl font-medium text-slate-600">
5655
Start At:
@@ -73,10 +72,9 @@ export function EventCard({ Event }: { Event: Models.IEvent }) {
7372
{Event.Type}
7473
</label>
7574

76-
{Event.Type !== EventType.Maintenance &&
77-
<label className="text-xl font-medium text-slate-700">
78-
{Event.Status}
79-
</label>}
75+
<label className="text-xl font-medium text-slate-700">
76+
{Event.Status}
77+
</label>
8078

8179
<label className="text-xl font-medium text-slate-700">
8280
{dayjs(Event.Start).tz(Dic.TZ).format(Dic.TimeTZ)}

src/Components/Event/EventEditor.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export function EventEditor({ Event }: { Event: Models.IEvent }) {
8181
{Object.values(EventStatus)
8282
.slice(
8383
State.type === EventType.Maintenance ? 4 : 0,
84-
State.type === EventType.Maintenance ? 7 : 4
84+
State.type === EventType.Maintenance ? 9 : 4
8585
).map((status, i) =>
8686
<ScaleDropdownSelectItem value={status} key={i}>
8787
{status}

src/Services/Status.Entities.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,6 @@ export const enum StatusEnum {
6363
Resolved = "resolved",
6464
Scheduled = "scheduled",
6565
System = "SYSTEM",
66+
Planned = "planned",
67+
Cancelled = "cancelled",
6668
}

src/Services/Status.Trans.V2.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export function TransformerV2({ Components, Events }: { Components: StatusEntity
133133
Title: event.title,
134134
Start: dayjs(event.start_date).toDate(),
135135
Type: type,
136-
Status: type === EventType.Maintenance ? EventStatus.Modified : EventStatus.Analysing,
136+
Status: type === EventType.Maintenance ? EventStatus.Planned : EventStatus.Analysing,
137137
Histories: new Set(),
138138
RegionServices: new Set(),
139139
};
@@ -186,12 +186,16 @@ export function TransformerV2({ Components, Events }: { Components: StatusEntity
186186
break;
187187

188188
case StatusEnum.Scheduled:
189+
case StatusEnum.Planned:
190+
return EventStatus.Planned;
189191
case StatusEnum.Modified:
190192
return EventStatus.Modified;
191193
case StatusEnum.InProgress:
192194
return EventStatus.InProgress;
193195
case StatusEnum.Completed:
194196
return EventStatus.Completed;
197+
case StatusEnum.Cancelled:
198+
return EventStatus.Cancelled;
195199

196200
case StatusEnum.Changed:
197201
case StatusEnum.ImpactChanged:

0 commit comments

Comments
 (0)