@stoker-platform/web-app 0.5.122 → 0.5.124
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/CHANGELOG.md +12 -0
- package/package.json +1 -1
- package/src/Calendar.tsx +44 -5
- package/src/Maintenance.tsx +2 -2
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/Calendar.tsx
CHANGED
|
@@ -85,6 +85,21 @@ import { useConnection } from "./providers/ConnectionProvider"
|
|
|
85
85
|
import { SortingState } from "@tanstack/react-table"
|
|
86
86
|
import { cn } from "./lib/utils"
|
|
87
87
|
|
|
88
|
+
function getExclusiveEnd(inclusiveEnd: Date, timezone: string): Date {
|
|
89
|
+
return DateTime.fromJSDate(inclusiveEnd).setZone(timezone).startOf("day").plus({ days: 1 }).toJSDate()
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function getInclusiveEnd(exclusiveEnd: Date, timezone: string): Date {
|
|
93
|
+
return DateTime.fromJSDate(exclusiveEnd).setZone(timezone).startOf("day").minus({ days: 1 }).toJSDate()
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function isAllDayEvent(record: StokerRecord, calendarConfig: CalendarConfig): boolean {
|
|
97
|
+
if (calendarConfig.allDayField !== undefined) {
|
|
98
|
+
return !!record[calendarConfig.allDayField]
|
|
99
|
+
}
|
|
100
|
+
return !!(calendarConfig.fullCalendarLarge?.defaultAllDay || calendarConfig.fullCalendarSmall?.defaultAllDay)
|
|
101
|
+
}
|
|
102
|
+
|
|
88
103
|
function Row({
|
|
89
104
|
collection,
|
|
90
105
|
record,
|
|
@@ -655,10 +670,13 @@ export function Calendar({
|
|
|
655
670
|
resourceEditable: !isPendingServer && !isUpdateDisabled && hasReourceUpdateAccess,
|
|
656
671
|
}
|
|
657
672
|
if (calendarConfig.endField && record[calendarConfig.endField]) {
|
|
658
|
-
|
|
673
|
+
const rawEnd = record[calendarConfig.endField].toDate()
|
|
674
|
+
event.end = isAllDayEvent(record, calendarConfig) ? getExclusiveEnd(rawEnd, timezone) : rawEnd
|
|
659
675
|
}
|
|
660
676
|
if (calendarConfig.allDayField !== undefined) {
|
|
661
677
|
event.allDay = record[calendarConfig.allDayField]
|
|
678
|
+
} else if (isAllDayEvent(record, calendarConfig)) {
|
|
679
|
+
event.allDay = true
|
|
662
680
|
}
|
|
663
681
|
if (calendarConfig.resourceField && record[calendarConfig.resourceField] !== undefined) {
|
|
664
682
|
const resource = getResource(labels.collection, record, calendarConfig.resourceField)
|
|
@@ -722,6 +740,7 @@ export function Calendar({
|
|
|
722
740
|
hasEndUpdateAccess,
|
|
723
741
|
hasReourceUpdateAccess,
|
|
724
742
|
isGlobalLoading,
|
|
743
|
+
timezone,
|
|
725
744
|
])
|
|
726
745
|
|
|
727
746
|
const updateEvent = useCallback(
|
|
@@ -733,10 +752,23 @@ export function Calendar({
|
|
|
733
752
|
|
|
734
753
|
const updatedFields: Partial<StokerRecord> = {}
|
|
735
754
|
if (calendarConfig.startField && info.event.start) {
|
|
736
|
-
|
|
755
|
+
const startDate = info.event.allDay
|
|
756
|
+
? DateTime.fromJSDate(info.event.start).setZone(timezone).startOf("day").toJSDate()
|
|
757
|
+
: info.event.start
|
|
758
|
+
updatedFields[calendarConfig.startField] = Timestamp.fromDate(startDate)
|
|
737
759
|
}
|
|
738
760
|
if (calendarConfig.endField && info.event.start) {
|
|
739
|
-
|
|
761
|
+
let endDate: Date
|
|
762
|
+
if (info.event.allDay) {
|
|
763
|
+
if (info.event.end) {
|
|
764
|
+
endDate = getInclusiveEnd(info.event.end, timezone)
|
|
765
|
+
} else {
|
|
766
|
+
endDate = DateTime.fromJSDate(info.event.start).setZone(timezone).startOf("day").toJSDate()
|
|
767
|
+
}
|
|
768
|
+
} else {
|
|
769
|
+
endDate = info.event.end ?? info.event.start
|
|
770
|
+
}
|
|
771
|
+
updatedFields[calendarConfig.endField] = Timestamp.fromDate(endDate)
|
|
740
772
|
}
|
|
741
773
|
if (calendarConfig.allDayField !== undefined) {
|
|
742
774
|
updatedFields[calendarConfig.allDayField] = info.event.allDay
|
|
@@ -816,7 +848,7 @@ export function Calendar({
|
|
|
816
848
|
})
|
|
817
849
|
}
|
|
818
850
|
},
|
|
819
|
-
[calendarConfig, list, unscheduledRecords, recordTitleField, recordTitle],
|
|
851
|
+
[calendarConfig, list, unscheduledRecords, recordTitleField, recordTitle, timezone],
|
|
820
852
|
)
|
|
821
853
|
|
|
822
854
|
const createEvent = useCallback(
|
|
@@ -1021,7 +1053,14 @@ export function Calendar({
|
|
|
1021
1053
|
createEvent({ start: info.date })
|
|
1022
1054
|
},
|
|
1023
1055
|
select(info: DateSelectArg) {
|
|
1024
|
-
|
|
1056
|
+
if (info.allDay && info.end) {
|
|
1057
|
+
createEvent({
|
|
1058
|
+
start: info.start,
|
|
1059
|
+
end: getInclusiveEnd(info.end, timezone),
|
|
1060
|
+
})
|
|
1061
|
+
} else {
|
|
1062
|
+
createEvent({ start: info.start, end: info.end })
|
|
1063
|
+
}
|
|
1025
1064
|
},
|
|
1026
1065
|
eventInteractive: true,
|
|
1027
1066
|
height: "auto",
|
package/src/Maintenance.tsx
CHANGED
|
@@ -2,8 +2,8 @@ import { Card, CardContent, CardHeader, CardTitle } from "./components/ui/card"
|
|
|
2
2
|
|
|
3
3
|
export default function Maintenance() {
|
|
4
4
|
return (
|
|
5
|
-
<div className="flex justify-center items-center h-
|
|
6
|
-
<Card>
|
|
5
|
+
<div className="flex justify-center items-center h-screen p-5 bg-white">
|
|
6
|
+
<Card className="relative bottom-8 bg-white text-black border-gray-200">
|
|
7
7
|
<CardHeader>
|
|
8
8
|
<CardTitle>Maintenance Mode</CardTitle>
|
|
9
9
|
</CardHeader>
|