@mui-toolpad-extended-tuni/calendar 3.0.1 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,29 +5,64 @@ Calendar microservice extension for MUI Toolpad Extended TUNI. This package prov
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
- npm install @mui-toolpad-extended-tuni/calendar
8
+ npm install @mui-toolpad-extended-tuni/calendar @mui-toolpad-extended-tuni/main @mui-toolpad-extended-tuni/core
9
9
  ```
10
10
 
11
- **Note**: This package requires `mui-toolpad-extended-tuni@^3.0.0` as a peer dependency.
11
+ **Important**: You must also install `@mui-toolpad-extended-tuni/main` and `@mui-toolpad-extended-tuni/core` as they are required peer dependencies.
12
12
 
13
- ## Peer Dependencies
13
+ ## Required Peer Dependencies
14
14
 
15
- - `mui-toolpad-extended-tuni@^3.0.0`
15
+ This package requires the following peer dependencies to be installed:
16
+
17
+ ### Required Packages
18
+ - **`@mui-toolpad-extended-tuni/main`**: ^3.4.0 - **MUST be installed separately**
19
+ - **`@mui-toolpad-extended-tuni/core`**: ^3.2.0 - **MUST be installed separately** (also required by main)
20
+
21
+ ### React & UI Framework
16
22
  - `react@^19.0.0`
17
23
  - `react-dom@^19.0.0`
18
24
  - `react-router-dom@^7.0.0`
19
25
  - `@mui/material@^7.0.0`
20
26
  - `@mui/icons-material@^7.0.0`
21
27
  - `@mui/x-date-pickers@^7.0.0`
28
+ - `@emotion/react@^11.0.0`
29
+ - `@emotion/styled@^11.0.0`
30
+
31
+ ### Calendar Dependencies
22
32
  - `@fullcalendar/core@^6.0.0`
23
33
  - `@fullcalendar/daygrid@^6.0.0`
24
34
  - `@fullcalendar/interaction@^6.0.0`
25
35
  - `@fullcalendar/react@^6.0.0`
26
36
  - `@fullcalendar/timegrid@^6.0.0`
27
- - `@emotion/react@^11.0.0`
28
- - `@emotion/styled@^11.0.0`
29
37
  - `luxon@^3.0.0`
30
38
 
39
+ ### Installation Example
40
+
41
+ ```bash
42
+ npm install @mui-toolpad-extended-tuni/calendar @mui-toolpad-extended-tuni/main @mui-toolpad-extended-tuni/core \
43
+ react react-dom react-router-dom \
44
+ @mui/material @mui/icons-material @mui/x-date-pickers \
45
+ @emotion/react @emotion/styled \
46
+ @fullcalendar/core @fullcalendar/daygrid @fullcalendar/interaction @fullcalendar/react @fullcalendar/timegrid \
47
+ luxon
48
+ ```
49
+
50
+ ## API Configuration
51
+
52
+ **Note**: The calendar package does not make direct API calls. It receives events through the EventBus system from other microservices (primarily the courses package). However, you can configure calendar endpoints if you plan to add direct API integration in the future.
53
+
54
+ ### Default Endpoints
55
+
56
+ If you need to configure calendar endpoints for future API integration:
57
+
58
+ - `get: "api/calendar/"` - GET list of calendar events
59
+ - `getById: "api/calendar/:id"` - GET event by ID
60
+ - `post: "api/calendar/"` - POST create new event
61
+ - `put: "api/calendar/:id/"` - PUT update event
62
+ - `delete: "api/calendar/:id/"` - DELETE event
63
+
64
+ **Current Implementation**: The calendar currently uses EventBus to receive events from other microservices. Direct API endpoints are reserved for future use.
65
+
31
66
  ## Usage
32
67
 
33
68
  ### Basic Setup
@@ -194,6 +229,71 @@ Events from courses are automatically color-coded:
194
229
  - **By Level**: Basic (light), Intermediate (medium), Advanced (dark) shades
195
230
  - **By Type**: Different event types (lecture, exercise, exam, etc.) have distinct styling
196
231
 
232
+ ## Data Types
233
+
234
+ ### CalendarEvent
235
+
236
+ Calendar event object displayed in the calendar.
237
+
238
+ ```typescript
239
+ interface CalendarEvent {
240
+ id: string; // Unique event ID
241
+ title: string; // Event title
242
+ start: Date | string; // Event start date/time (ISO string or Date)
243
+ end?: Date | string; // Event end date/time (optional)
244
+ backgroundColor?: string; // Background color (hex)
245
+ borderColor?: string; // Border color (hex)
246
+ textColor?: string; // Text color (hex)
247
+ extendedProps?: { // Additional event metadata
248
+ courseCode?: string; // Course code (if from courses package)
249
+ courseTitle?: string; // Course title
250
+ type?: string; // Event type
251
+ description?: string; // Event description
252
+ location?: string; // Event location
253
+ [key: string]: any; // Additional custom properties
254
+ };
255
+ }
256
+ ```
257
+
258
+ ### CalendarEventType
259
+
260
+ Type of calendar event.
261
+
262
+ ```typescript
263
+ type CalendarEventType =
264
+ | "lecture" // Lecture events
265
+ | "exercise" // Exercise sessions
266
+ | "exam" // Examinations
267
+ | "deadline" // Assignment deadlines
268
+ | "other" // Other events
269
+ | "meeting" // Meetings
270
+ | "maintenance"; // Maintenance windows
271
+ ```
272
+
273
+ ### EventBus Event Format
274
+
275
+ Events received from EventBus (e.g., from courses package) follow this structure:
276
+
277
+ ```typescript
278
+ interface Event {
279
+ id: string;
280
+ title: string;
281
+ start: string; // ISO date string
282
+ end: string; // ISO date string
283
+ metadata: {
284
+ source: string; // Event source (e.g., "courses")
285
+ type?: CalendarEventType; // Event type
286
+ courseCode?: string; // Course code
287
+ courseTitle?: string; // Course title
288
+ subject?: string; // Course subject
289
+ courseLevel?: "basic" | "intermediate" | "advanced";
290
+ description?: string;
291
+ location?: string;
292
+ [key: string]: any; // Additional metadata
293
+ };
294
+ }
295
+ ```
296
+
197
297
  ## Exports
198
298
 
199
299
  ### Components
@@ -205,9 +305,13 @@ Events from courses are automatically color-coded:
205
305
 
206
306
  ### Store
207
307
  - `useCalendarStore` - Zustand store for calendar management
308
+ - `createCalendarEvent` - Helper function to create calendar events
309
+ - `getContrastColor` - Helper function to get contrasting text color
208
310
 
209
311
  ### Types
210
- - `CalendarEventType` - Calendar event type (lecture, exercise, exam, deadline, other, meeting, maintenance)
312
+ - `CalendarEvent` - Calendar event interface
313
+ - `CalendarEventType` - Calendar event type enumeration
314
+ - `CalendarApiEndpoints` - API endpoint configuration type (for future use)
211
315
 
212
316
  ## Features
213
317