@brikka/locations 1.0.11 → 1.0.12
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/dist/index.js +61 -38
- package/dist/index.mjs +123 -0
- package/package.json +20 -21
- package/dist/index.cjs +0 -146
- /package/dist/{index.d.cts → index.d.mts} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,38 +1,60 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var admin = require('@compill/admin');
|
|
4
|
+
var form = require('@compill/form');
|
|
5
|
+
var formMaps = require('@compill/form-maps');
|
|
6
|
+
var hooks = require('@compill/hooks');
|
|
7
|
+
var js = require('@mdi/js');
|
|
8
|
+
var Yup = require('yup');
|
|
9
|
+
var jsxRuntime = require('@soperio/jsx-runtime');
|
|
10
|
+
var components = require('@compill/components');
|
|
11
|
+
var next = require('@compill/next');
|
|
12
|
+
var ui = require('@valerya/ui');
|
|
13
|
+
var layout = require('@brikka/layout');
|
|
14
|
+
|
|
15
|
+
function _interopNamespace(e) {
|
|
16
|
+
if (e && e.__esModule) return e;
|
|
17
|
+
var n = Object.create(null);
|
|
18
|
+
if (e) {
|
|
19
|
+
Object.keys(e).forEach(function (k) {
|
|
20
|
+
if (k !== 'default') {
|
|
21
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
22
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function () { return e[k]; }
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
n.default = e;
|
|
30
|
+
return Object.freeze(n);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
var Yup__namespace = /*#__PURE__*/_interopNamespace(Yup);
|
|
12
34
|
|
|
13
35
|
// src/lib/AddLocationButton.tsx
|
|
14
|
-
var editForm = (lat, lng, mapZoom, locationTypeLabel) => FormHelper.array(
|
|
15
|
-
mapsHelper("location", `Search a ${locationTypeLabel}`, lat, lng, mapZoom),
|
|
16
|
-
FormHelper.condition("location", (location) => location != null && Object.keys(location).length > 0, FormHelper.array(
|
|
17
|
-
FormHelper.divider(),
|
|
18
|
-
FormHelper.input("map.addressName", "Name"),
|
|
19
|
-
FormHelper.input("map.addressStreet", "Address", false, void 0, { disabled: true })
|
|
36
|
+
var editForm = (lat, lng, mapZoom, locationTypeLabel) => form.FormHelper.array(
|
|
37
|
+
formMaps.mapsHelper("location", `Search a ${locationTypeLabel}`, lat, lng, mapZoom),
|
|
38
|
+
form.FormHelper.condition("location", (location) => location != null && Object.keys(location).length > 0, form.FormHelper.array(
|
|
39
|
+
form.FormHelper.divider(),
|
|
40
|
+
form.FormHelper.input("map.addressName", "Name"),
|
|
41
|
+
form.FormHelper.input("map.addressStreet", "Address", false, void 0, { disabled: true })
|
|
20
42
|
))
|
|
21
43
|
);
|
|
22
44
|
var editInitialValues = () => ({
|
|
23
45
|
type: "google",
|
|
24
46
|
location: {}
|
|
25
47
|
});
|
|
26
|
-
var editSchema =
|
|
48
|
+
var editSchema = Yup__namespace.object().shape({
|
|
27
49
|
// name: Yup.string().required("Please set a name for your organisation"),
|
|
28
50
|
// type: Yup.string().required("Please select a type"),
|
|
29
51
|
});
|
|
30
52
|
function NewLocationButton({ api, lat, lng, mapZoom, locationTypeLabel = "location", ...props }) {
|
|
31
|
-
const { isOpen, onOpen, modalProps } = useModal();
|
|
32
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
33
|
-
/* @__PURE__ */ jsx(ButtonBarButton, { size: "md", icon: mdiPlus, onClick: onOpen, ...props, children: "New Venue" }),
|
|
34
|
-
isOpen && /* @__PURE__ */ jsx(
|
|
35
|
-
ItemEditDialog,
|
|
53
|
+
const { isOpen, onOpen, modalProps } = hooks.useModal();
|
|
54
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
55
|
+
/* @__PURE__ */ jsxRuntime.jsx(admin.ButtonBarButton, { size: "md", icon: js.mdiPlus, onClick: onOpen, ...props, children: "New Venue" }),
|
|
56
|
+
isOpen && /* @__PURE__ */ jsxRuntime.jsx(
|
|
57
|
+
admin.ItemEditDialog,
|
|
36
58
|
{
|
|
37
59
|
api,
|
|
38
60
|
form: editForm(lat, lng, mapZoom, locationTypeLabel),
|
|
@@ -54,33 +76,33 @@ function NewLocationButton({ api, lat, lng, mapZoom, locationTypeLabel = "locati
|
|
|
54
76
|
] });
|
|
55
77
|
}
|
|
56
78
|
function SidebarMapsCard({ title, location }) {
|
|
57
|
-
const copy = useCopyToClipboard(location?.address ?? location?.name ?? "", "Address copied!");
|
|
79
|
+
const copy = hooks.useCopyToClipboard(location?.address ?? location?.name ?? "", "Address copied!");
|
|
58
80
|
const googleMapsLink = `https://www.google.com/maps/search/?api=1&query=${location?.lat},${location?.lng}`;
|
|
59
81
|
if (!location)
|
|
60
82
|
return null;
|
|
61
83
|
if (!location.name && !location.address && location.media)
|
|
62
84
|
return null;
|
|
63
|
-
return /* @__PURE__ */ jsx(SidebarCard, { icon: mdiMapMarker, title: title || "Location", children: /* @__PURE__ */ jsxs("div", { bgColor: "white", p: "5", children: [
|
|
64
|
-
(location.name || location.address) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
65
|
-
/* @__PURE__ */ jsxs("div", { ps: "2", dflex: true, alignItems: "center", children: [
|
|
66
|
-
/* @__PURE__ */ jsx("span", { flexGrow: true, children: location.name ? location.name : location.address }),
|
|
67
|
-
/* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(
|
|
68
|
-
IconButton,
|
|
85
|
+
return /* @__PURE__ */ jsxRuntime.jsx(layout.SidebarCard, { icon: js.mdiMapMarker, title: title || "Location", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { bgColor: "white", p: "5", children: [
|
|
86
|
+
(location.name || location.address) && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
87
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { ps: "2", dflex: true, alignItems: "center", children: [
|
|
88
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { flexGrow: true, children: location.name ? location.name : location.address }),
|
|
89
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
90
|
+
ui.IconButton,
|
|
69
91
|
{
|
|
70
92
|
variant: "borderless",
|
|
71
93
|
scheme: "secondary",
|
|
72
94
|
size: "lg",
|
|
73
95
|
rounded: "full",
|
|
74
|
-
icon: mdiContentCopy,
|
|
96
|
+
icon: js.mdiContentCopy,
|
|
75
97
|
onClick: copy
|
|
76
98
|
}
|
|
77
99
|
) })
|
|
78
100
|
] }),
|
|
79
|
-
location.name && location.address && /* @__PURE__ */ jsx("div", { ps: "2", textColor: "slate-600", textSize: "sm", children: location.address })
|
|
101
|
+
location.name && location.address && /* @__PURE__ */ jsxRuntime.jsx("div", { ps: "2", textColor: "slate-600", textSize: "sm", children: location.address })
|
|
80
102
|
] }),
|
|
81
|
-
location.media && /* @__PURE__ */ jsxs("div", { aspectRatio: "16/10", group: true, position: "relative", children: [
|
|
82
|
-
/* @__PURE__ */ jsx(
|
|
83
|
-
NextImageFill,
|
|
103
|
+
location.media && /* @__PURE__ */ jsxRuntime.jsxs("div", { aspectRatio: "16/10", group: true, position: "relative", children: [
|
|
104
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
105
|
+
next.NextImageFill,
|
|
84
106
|
{
|
|
85
107
|
showLoadingStates: true,
|
|
86
108
|
src: location.media?.url ?? "",
|
|
@@ -95,8 +117,8 @@ function SidebarMapsCard({ title, location }) {
|
|
|
95
117
|
height: location.media?.height ?? 0
|
|
96
118
|
}
|
|
97
119
|
),
|
|
98
|
-
/* @__PURE__ */ jsx("a", { href: googleMapsLink, target: "_blank", rel: "nofollow", children: /* @__PURE__ */ jsx(
|
|
99
|
-
FlexCenter,
|
|
120
|
+
/* @__PURE__ */ jsxRuntime.jsx("a", { href: googleMapsLink, target: "_blank", rel: "nofollow", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
121
|
+
components.FlexCenter,
|
|
100
122
|
{
|
|
101
123
|
opacity: "0",
|
|
102
124
|
groupHover_opacity: "100",
|
|
@@ -120,4 +142,5 @@ function SidebarMapsCard({ title, location }) {
|
|
|
120
142
|
] }) });
|
|
121
143
|
}
|
|
122
144
|
|
|
123
|
-
|
|
145
|
+
exports.NewLocationButton = NewLocationButton;
|
|
146
|
+
exports.SidebarMapsCard = SidebarMapsCard;
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { ButtonBarButton, ItemEditDialog } from '@compill/admin';
|
|
2
|
+
import { FormHelper } from '@compill/form';
|
|
3
|
+
import { mapsHelper } from '@compill/form-maps';
|
|
4
|
+
import { useModal, useCopyToClipboard } from '@compill/hooks';
|
|
5
|
+
import { mdiPlus, mdiMapMarker, mdiContentCopy } from '@mdi/js';
|
|
6
|
+
import * as Yup from 'yup';
|
|
7
|
+
import { jsxs, Fragment, jsx } from '@soperio/jsx-runtime';
|
|
8
|
+
import { FlexCenter } from '@compill/components';
|
|
9
|
+
import { NextImageFill } from '@compill/next';
|
|
10
|
+
import { IconButton } from '@valerya/ui';
|
|
11
|
+
import { SidebarCard } from '@brikka/layout';
|
|
12
|
+
|
|
13
|
+
// src/lib/AddLocationButton.tsx
|
|
14
|
+
var editForm = (lat, lng, mapZoom, locationTypeLabel) => FormHelper.array(
|
|
15
|
+
mapsHelper("location", `Search a ${locationTypeLabel}`, lat, lng, mapZoom),
|
|
16
|
+
FormHelper.condition("location", (location) => location != null && Object.keys(location).length > 0, FormHelper.array(
|
|
17
|
+
FormHelper.divider(),
|
|
18
|
+
FormHelper.input("map.addressName", "Name"),
|
|
19
|
+
FormHelper.input("map.addressStreet", "Address", false, void 0, { disabled: true })
|
|
20
|
+
))
|
|
21
|
+
);
|
|
22
|
+
var editInitialValues = () => ({
|
|
23
|
+
type: "google",
|
|
24
|
+
location: {}
|
|
25
|
+
});
|
|
26
|
+
var editSchema = Yup.object().shape({
|
|
27
|
+
// name: Yup.string().required("Please set a name for your organisation"),
|
|
28
|
+
// type: Yup.string().required("Please select a type"),
|
|
29
|
+
});
|
|
30
|
+
function NewLocationButton({ api, lat, lng, mapZoom, locationTypeLabel = "location", ...props }) {
|
|
31
|
+
const { isOpen, onOpen, modalProps } = useModal();
|
|
32
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
33
|
+
/* @__PURE__ */ jsx(ButtonBarButton, { size: "md", icon: mdiPlus, onClick: onOpen, ...props, children: "New Venue" }),
|
|
34
|
+
isOpen && /* @__PURE__ */ jsx(
|
|
35
|
+
ItemEditDialog,
|
|
36
|
+
{
|
|
37
|
+
api,
|
|
38
|
+
form: editForm(lat, lng, mapZoom, locationTypeLabel),
|
|
39
|
+
initialValues: editInitialValues,
|
|
40
|
+
formToQueryData: (values) => ({
|
|
41
|
+
type: "google",
|
|
42
|
+
ext_id: values.map.googleMapsPlaceId,
|
|
43
|
+
lat: values.map.lat,
|
|
44
|
+
lng: values.map.lng,
|
|
45
|
+
name: values.map.addressName,
|
|
46
|
+
address: values.map.addressStreet,
|
|
47
|
+
mapZoom
|
|
48
|
+
}),
|
|
49
|
+
itemLabel: locationTypeLabel,
|
|
50
|
+
formikProps: { validationSchema: editSchema },
|
|
51
|
+
...modalProps
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
] });
|
|
55
|
+
}
|
|
56
|
+
function SidebarMapsCard({ title, location }) {
|
|
57
|
+
const copy = useCopyToClipboard(location?.address ?? location?.name ?? "", "Address copied!");
|
|
58
|
+
const googleMapsLink = `https://www.google.com/maps/search/?api=1&query=${location?.lat},${location?.lng}`;
|
|
59
|
+
if (!location)
|
|
60
|
+
return null;
|
|
61
|
+
if (!location.name && !location.address && location.media)
|
|
62
|
+
return null;
|
|
63
|
+
return /* @__PURE__ */ jsx(SidebarCard, { icon: mdiMapMarker, title: title || "Location", children: /* @__PURE__ */ jsxs("div", { bgColor: "white", p: "5", children: [
|
|
64
|
+
(location.name || location.address) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
65
|
+
/* @__PURE__ */ jsxs("div", { ps: "2", dflex: true, alignItems: "center", children: [
|
|
66
|
+
/* @__PURE__ */ jsx("span", { flexGrow: true, children: location.name ? location.name : location.address }),
|
|
67
|
+
/* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(
|
|
68
|
+
IconButton,
|
|
69
|
+
{
|
|
70
|
+
variant: "borderless",
|
|
71
|
+
scheme: "secondary",
|
|
72
|
+
size: "lg",
|
|
73
|
+
rounded: "full",
|
|
74
|
+
icon: mdiContentCopy,
|
|
75
|
+
onClick: copy
|
|
76
|
+
}
|
|
77
|
+
) })
|
|
78
|
+
] }),
|
|
79
|
+
location.name && location.address && /* @__PURE__ */ jsx("div", { ps: "2", textColor: "slate-600", textSize: "sm", children: location.address })
|
|
80
|
+
] }),
|
|
81
|
+
location.media && /* @__PURE__ */ jsxs("div", { aspectRatio: "16/10", group: true, position: "relative", children: [
|
|
82
|
+
/* @__PURE__ */ jsx(
|
|
83
|
+
NextImageFill,
|
|
84
|
+
{
|
|
85
|
+
showLoadingStates: true,
|
|
86
|
+
src: location.media?.url ?? "",
|
|
87
|
+
alt: "Google Maps",
|
|
88
|
+
size: "33vw",
|
|
89
|
+
sm_size: "33vw",
|
|
90
|
+
md_size: "33vw",
|
|
91
|
+
lg_size: "448px",
|
|
92
|
+
xl_size: "448px",
|
|
93
|
+
x2_size: "448px",
|
|
94
|
+
width: location.media?.width ?? 0,
|
|
95
|
+
height: location.media?.height ?? 0
|
|
96
|
+
}
|
|
97
|
+
),
|
|
98
|
+
/* @__PURE__ */ jsx("a", { href: googleMapsLink, target: "_blank", rel: "nofollow", children: /* @__PURE__ */ jsx(
|
|
99
|
+
FlexCenter,
|
|
100
|
+
{
|
|
101
|
+
opacity: "0",
|
|
102
|
+
groupHover_opacity: "100",
|
|
103
|
+
position: "absolute",
|
|
104
|
+
top: "0",
|
|
105
|
+
start: "0",
|
|
106
|
+
w: "full",
|
|
107
|
+
h: "full",
|
|
108
|
+
bgColor: "black",
|
|
109
|
+
bgOpacity: "50",
|
|
110
|
+
textColor: "white",
|
|
111
|
+
fontWeight: "500",
|
|
112
|
+
textSize: "lg",
|
|
113
|
+
transition: "all",
|
|
114
|
+
easing: "in-out",
|
|
115
|
+
duration: "500",
|
|
116
|
+
children: "Open in Google Maps"
|
|
117
|
+
}
|
|
118
|
+
) })
|
|
119
|
+
] })
|
|
120
|
+
] }) });
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export { NewLocationButton, SidebarMapsCard };
|
package/package.json
CHANGED
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brikka/locations",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"private": false,
|
|
5
5
|
"sideEffects": false,
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"module": "./dist/index.js",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.mjs",
|
|
9
8
|
"types": "./dist/index.d.ts",
|
|
10
9
|
"exports": {
|
|
11
10
|
".": {
|
|
12
11
|
"types": "./dist/index.d.ts",
|
|
13
|
-
"import": "./dist/index.
|
|
14
|
-
"require": "./dist/index.
|
|
12
|
+
"import": "./dist/index.mjs",
|
|
13
|
+
"require": "./dist/index.js"
|
|
15
14
|
}
|
|
16
15
|
},
|
|
17
16
|
"devDependencies": {
|
|
18
17
|
"eslint": "^9.38.0",
|
|
19
18
|
"typescript": "5.9.2",
|
|
20
19
|
"@types/react": "^18.3.1",
|
|
21
|
-
"@repo/
|
|
22
|
-
"@repo/
|
|
20
|
+
"@repo/eslint-config": "0.0.0",
|
|
21
|
+
"@repo/typescript-config": "0.0.0"
|
|
23
22
|
},
|
|
24
23
|
"peerDependencies": {
|
|
25
24
|
"react": "^18.3.1",
|
|
@@ -28,19 +27,19 @@
|
|
|
28
27
|
"dependencies": {
|
|
29
28
|
"@mdi/js": "^7.4.47",
|
|
30
29
|
"yup": "^1.1.0",
|
|
31
|
-
"@soperio/react": "1.0.
|
|
32
|
-
"@
|
|
33
|
-
"@
|
|
34
|
-
"@
|
|
35
|
-
"@compill/
|
|
36
|
-
"@
|
|
37
|
-
"@
|
|
38
|
-
"@compill/auth": "1.0.
|
|
39
|
-
"@compill/
|
|
40
|
-
"@compill/hooks": "1.0.
|
|
41
|
-
"@compill/next": "1.0.
|
|
42
|
-
"@compill/
|
|
43
|
-
"@compill/
|
|
30
|
+
"@soperio/react": "1.0.21",
|
|
31
|
+
"@soperio/jsx-runtime": "1.0.21",
|
|
32
|
+
"@valerya/ui": "1.0.21",
|
|
33
|
+
"@compill/admin": "1.0.107",
|
|
34
|
+
"@compill/api": "1.0.62",
|
|
35
|
+
"@brikka/layout": "1.0.85",
|
|
36
|
+
"@compill/components": "1.0.55",
|
|
37
|
+
"@compill/auth": "1.0.82",
|
|
38
|
+
"@compill/form": "1.0.72",
|
|
39
|
+
"@compill/hooks": "1.0.48",
|
|
40
|
+
"@compill/next": "1.0.63",
|
|
41
|
+
"@compill/models": "1.0.17",
|
|
42
|
+
"@compill/form-maps": "1.0.19"
|
|
44
43
|
},
|
|
45
44
|
"publishConfig": {
|
|
46
45
|
"access": "public"
|
package/dist/index.cjs
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var admin = require('@compill/admin');
|
|
4
|
-
var form = require('@compill/form');
|
|
5
|
-
var formMaps = require('@compill/form-maps');
|
|
6
|
-
var hooks = require('@compill/hooks');
|
|
7
|
-
var js = require('@mdi/js');
|
|
8
|
-
var Yup = require('yup');
|
|
9
|
-
var jsxRuntime = require('@soperio/jsx-runtime');
|
|
10
|
-
var components = require('@compill/components');
|
|
11
|
-
var next = require('@compill/next');
|
|
12
|
-
var ui = require('@valerya/ui');
|
|
13
|
-
var layout = require('@brikka/layout');
|
|
14
|
-
|
|
15
|
-
function _interopNamespace(e) {
|
|
16
|
-
if (e && e.__esModule) return e;
|
|
17
|
-
var n = Object.create(null);
|
|
18
|
-
if (e) {
|
|
19
|
-
Object.keys(e).forEach(function (k) {
|
|
20
|
-
if (k !== 'default') {
|
|
21
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
22
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
23
|
-
enumerable: true,
|
|
24
|
-
get: function () { return e[k]; }
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
n.default = e;
|
|
30
|
-
return Object.freeze(n);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
var Yup__namespace = /*#__PURE__*/_interopNamespace(Yup);
|
|
34
|
-
|
|
35
|
-
// src/lib/AddLocationButton.tsx
|
|
36
|
-
var editForm = (lat, lng, mapZoom, locationTypeLabel) => form.FormHelper.array(
|
|
37
|
-
formMaps.mapsHelper("location", `Search a ${locationTypeLabel}`, lat, lng, mapZoom),
|
|
38
|
-
form.FormHelper.condition("location", (location) => location != null && Object.keys(location).length > 0, form.FormHelper.array(
|
|
39
|
-
form.FormHelper.divider(),
|
|
40
|
-
form.FormHelper.input("map.addressName", "Name"),
|
|
41
|
-
form.FormHelper.input("map.addressStreet", "Address", false, void 0, { disabled: true })
|
|
42
|
-
))
|
|
43
|
-
);
|
|
44
|
-
var editInitialValues = () => ({
|
|
45
|
-
type: "google",
|
|
46
|
-
location: {}
|
|
47
|
-
});
|
|
48
|
-
var editSchema = Yup__namespace.object().shape({
|
|
49
|
-
// name: Yup.string().required("Please set a name for your organisation"),
|
|
50
|
-
// type: Yup.string().required("Please select a type"),
|
|
51
|
-
});
|
|
52
|
-
function NewLocationButton({ api, lat, lng, mapZoom, locationTypeLabel = "location", ...props }) {
|
|
53
|
-
const { isOpen, onOpen, modalProps } = hooks.useModal();
|
|
54
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
55
|
-
/* @__PURE__ */ jsxRuntime.jsx(admin.ButtonBarButton, { size: "md", icon: js.mdiPlus, onClick: onOpen, ...props, children: "New Venue" }),
|
|
56
|
-
isOpen && /* @__PURE__ */ jsxRuntime.jsx(
|
|
57
|
-
admin.ItemEditDialog,
|
|
58
|
-
{
|
|
59
|
-
api,
|
|
60
|
-
form: editForm(lat, lng, mapZoom, locationTypeLabel),
|
|
61
|
-
initialValues: editInitialValues,
|
|
62
|
-
formToQueryData: (values) => ({
|
|
63
|
-
type: "google",
|
|
64
|
-
ext_id: values.map.googleMapsPlaceId,
|
|
65
|
-
lat: values.map.lat,
|
|
66
|
-
lng: values.map.lng,
|
|
67
|
-
name: values.map.addressName,
|
|
68
|
-
address: values.map.addressStreet,
|
|
69
|
-
mapZoom
|
|
70
|
-
}),
|
|
71
|
-
itemLabel: locationTypeLabel,
|
|
72
|
-
formikProps: { validationSchema: editSchema },
|
|
73
|
-
...modalProps
|
|
74
|
-
}
|
|
75
|
-
)
|
|
76
|
-
] });
|
|
77
|
-
}
|
|
78
|
-
function SidebarMapsCard({ title, location }) {
|
|
79
|
-
const copy = hooks.useCopyToClipboard(location?.address ?? location?.name ?? "", "Address copied!");
|
|
80
|
-
const googleMapsLink = `https://www.google.com/maps/search/?api=1&query=${location?.lat},${location?.lng}`;
|
|
81
|
-
if (!location)
|
|
82
|
-
return null;
|
|
83
|
-
if (!location.name && !location.address && location.media)
|
|
84
|
-
return null;
|
|
85
|
-
return /* @__PURE__ */ jsxRuntime.jsx(layout.SidebarCard, { icon: js.mdiMapMarker, title: title || "Location", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { bgColor: "white", p: "5", children: [
|
|
86
|
-
(location.name || location.address) && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
87
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { ps: "2", dflex: true, alignItems: "center", children: [
|
|
88
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { flexGrow: true, children: location.name ? location.name : location.address }),
|
|
89
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
90
|
-
ui.IconButton,
|
|
91
|
-
{
|
|
92
|
-
variant: "borderless",
|
|
93
|
-
scheme: "secondary",
|
|
94
|
-
size: "lg",
|
|
95
|
-
rounded: "full",
|
|
96
|
-
icon: js.mdiContentCopy,
|
|
97
|
-
onClick: copy
|
|
98
|
-
}
|
|
99
|
-
) })
|
|
100
|
-
] }),
|
|
101
|
-
location.name && location.address && /* @__PURE__ */ jsxRuntime.jsx("div", { ps: "2", textColor: "slate-600", textSize: "sm", children: location.address })
|
|
102
|
-
] }),
|
|
103
|
-
location.media && /* @__PURE__ */ jsxRuntime.jsxs("div", { aspectRatio: "16/10", group: true, position: "relative", children: [
|
|
104
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
105
|
-
next.NextImageFill,
|
|
106
|
-
{
|
|
107
|
-
showLoadingStates: true,
|
|
108
|
-
src: location.media?.url ?? "",
|
|
109
|
-
alt: "Google Maps",
|
|
110
|
-
size: "33vw",
|
|
111
|
-
sm_size: "33vw",
|
|
112
|
-
md_size: "33vw",
|
|
113
|
-
lg_size: "448px",
|
|
114
|
-
xl_size: "448px",
|
|
115
|
-
x2_size: "448px",
|
|
116
|
-
width: location.media?.width ?? 0,
|
|
117
|
-
height: location.media?.height ?? 0
|
|
118
|
-
}
|
|
119
|
-
),
|
|
120
|
-
/* @__PURE__ */ jsxRuntime.jsx("a", { href: googleMapsLink, target: "_blank", rel: "nofollow", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
121
|
-
components.FlexCenter,
|
|
122
|
-
{
|
|
123
|
-
opacity: "0",
|
|
124
|
-
groupHover_opacity: "100",
|
|
125
|
-
position: "absolute",
|
|
126
|
-
top: "0",
|
|
127
|
-
start: "0",
|
|
128
|
-
w: "full",
|
|
129
|
-
h: "full",
|
|
130
|
-
bgColor: "black",
|
|
131
|
-
bgOpacity: "50",
|
|
132
|
-
textColor: "white",
|
|
133
|
-
fontWeight: "500",
|
|
134
|
-
textSize: "lg",
|
|
135
|
-
transition: "all",
|
|
136
|
-
easing: "in-out",
|
|
137
|
-
duration: "500",
|
|
138
|
-
children: "Open in Google Maps"
|
|
139
|
-
}
|
|
140
|
-
) })
|
|
141
|
-
] })
|
|
142
|
-
] }) });
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
exports.NewLocationButton = NewLocationButton;
|
|
146
|
-
exports.SidebarMapsCard = SidebarMapsCard;
|
|
File without changes
|