@mui-toolpad-extended-tuni/calendar 3.0.2 → 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
@@ -15,8 +15,8 @@ npm install @mui-toolpad-extended-tuni/calendar @mui-toolpad-extended-tuni/main
15
15
  This package requires the following peer dependencies to be installed:
16
16
 
17
17
  ### Required Packages
18
- - **`@mui-toolpad-extended-tuni/main`**: ^3.3.0 - **MUST be installed separately**
19
- - **`@mui-toolpad-extended-tuni/core`**: ^3.1.0 - **MUST be installed separately** (also required by main)
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
20
 
21
21
  ### React & UI Framework
22
22
  - `react@^19.0.0`
@@ -47,6 +47,22 @@ npm install @mui-toolpad-extended-tuni/calendar @mui-toolpad-extended-tuni/main
47
47
  luxon
48
48
  ```
49
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
+
50
66
  ## Usage
51
67
 
52
68
  ### Basic Setup
@@ -213,6 +229,71 @@ Events from courses are automatically color-coded:
213
229
  - **By Level**: Basic (light), Intermediate (medium), Advanced (dark) shades
214
230
  - **By Type**: Different event types (lecture, exercise, exam, etc.) have distinct styling
215
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
+
216
297
  ## Exports
217
298
 
218
299
  ### Components
@@ -224,9 +305,13 @@ Events from courses are automatically color-coded:
224
305
 
225
306
  ### Store
226
307
  - `useCalendarStore` - Zustand store for calendar management
308
+ - `createCalendarEvent` - Helper function to create calendar events
309
+ - `getContrastColor` - Helper function to get contrasting text color
227
310
 
228
311
  ### Types
229
- - `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)
230
315
 
231
316
  ## Features
232
317