@ossy/booking 1.15.5 → 1.15.7
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 +12 -0
- package/package.json +7 -7
- package/src/AvailabilityEditor.jsx +10 -6
- package/src/BookingForm.jsx +5 -5
- package/src/HeroCover.jsx +99 -0
- package/src/SalesSection.jsx +72 -0
- package/src/availability-setup.page.jsx +123 -340
- package/src/booking-card.component.jsx +67 -197
- package/src/booking-detail.page.jsx +102 -428
- package/src/bookings.page.jsx +36 -180
- package/src/cover.js +8 -0
- package/src/features.js +27 -0
- package/src/home.page.jsx +13 -0
- package/src/public-booking.page.jsx +163 -520
- package/src/service-card-slot.component.jsx +48 -0
- package/src/service-detail.component.jsx +38 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { View, Title, Text, Badge } from '@ossy/design-system'
|
|
3
|
+
|
|
4
|
+
export const metadata = { id: 'resource:booking/service/card' }
|
|
5
|
+
|
|
6
|
+
const formatPrice = (cents, currency) => {
|
|
7
|
+
if (cents === 0) return 'Free'
|
|
8
|
+
return new Intl.NumberFormat('sv-SE', { style: 'currency', currency }).format(cents / 100)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const formatDuration = (minutes) => {
|
|
12
|
+
if (!minutes) return '—'
|
|
13
|
+
if (minutes < 60) return `${minutes} min`
|
|
14
|
+
const h = Math.floor(minutes / 60)
|
|
15
|
+
const m = minutes % 60
|
|
16
|
+
return m === 0 ? `${h}h` : `${h}h ${m}min`
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Booking service card view — registered at `resource:booking/service/card`. */
|
|
20
|
+
export default function ServiceCardSlotComponent ({ resource }) {
|
|
21
|
+
if (!resource) return null
|
|
22
|
+
|
|
23
|
+
const { name, duration, price, currency = 'SEK', description, active } = resource.content || {}
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<View
|
|
27
|
+
surface="secondary"
|
|
28
|
+
roundness="m"
|
|
29
|
+
inset="m"
|
|
30
|
+
gap="xs"
|
|
31
|
+
layout="row"
|
|
32
|
+
justifyContent="space-between"
|
|
33
|
+
alignItems="flex-start"
|
|
34
|
+
>
|
|
35
|
+
<View gap="xs" style={{ flex: 1 }}>
|
|
36
|
+
<View layout="row" gap="s" alignItems="center">
|
|
37
|
+
<Title variant="secondary">{resource.name || name}</Title>
|
|
38
|
+
{active === false && <Badge label="Inactive" variant="neutral" size="s" />}
|
|
39
|
+
</View>
|
|
40
|
+
{description && <Text size="s" color="secondary">{description}</Text>}
|
|
41
|
+
</View>
|
|
42
|
+
<View gap="xs" alignItems="flex-end" style={{ flexShrink: 0 }}>
|
|
43
|
+
<Text weight="medium">{formatPrice(price, currency)}</Text>
|
|
44
|
+
<Text size="s" color="secondary">{formatDuration(duration)}</Text>
|
|
45
|
+
</View>
|
|
46
|
+
</View>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { View, Title, Text, Badge } from '@ossy/design-system'
|
|
3
|
+
|
|
4
|
+
export const metadata = { id: 'resource:booking/service/detail' }
|
|
5
|
+
|
|
6
|
+
const formatPrice = (cents, currency) => {
|
|
7
|
+
if (cents === 0) return 'Free'
|
|
8
|
+
return new Intl.NumberFormat('sv-SE', { style: 'currency', currency }).format(cents / 100)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const formatDuration = (minutes) => {
|
|
12
|
+
if (!minutes) return '—'
|
|
13
|
+
if (minutes < 60) return `${minutes} min`
|
|
14
|
+
const h = Math.floor(minutes / 60)
|
|
15
|
+
const m = minutes % 60
|
|
16
|
+
return m === 0 ? `${h}h` : `${h}h ${m}min`
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Booking service detail view — registered at `resource:booking/service/detail`. */
|
|
20
|
+
export default function ServiceDetailComponent ({ resource }) {
|
|
21
|
+
if (!resource) return null
|
|
22
|
+
|
|
23
|
+
const { name, duration, price, currency = 'SEK', description, active } = resource.content || {}
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<View stack gap="m" inset="m">
|
|
27
|
+
<View layout="row" gap="s" alignItems="center">
|
|
28
|
+
<Title>{resource.name || name}</Title>
|
|
29
|
+
{active === false && <Badge label="Inactive" variant="neutral" size="s" />}
|
|
30
|
+
</View>
|
|
31
|
+
{description && <Text color="secondary">{description}</Text>}
|
|
32
|
+
<View layout="row" gap="l">
|
|
33
|
+
<Text weight="medium">{formatPrice(price, currency)}</Text>
|
|
34
|
+
<Text color="secondary">{formatDuration(duration)}</Text>
|
|
35
|
+
</View>
|
|
36
|
+
</View>
|
|
37
|
+
)
|
|
38
|
+
}
|