@openpeepshq/react 0.8.2 → 0.8.4
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/components/post/pieces/EventLocation.js +4 -2
- package/dist/components/post/post-form/ResourceForm.js +3 -2
- package/dist/hooks/posts/useResourceComposer.js +1 -1
- package/package.json +2 -2
- package/src/components/post/pieces/EventLocation.tsx +4 -2
- package/src/components/post/post-form/ResourceForm.tsx +12 -8
- package/src/hooks/posts/useResourceComposer.ts +1 -1
|
@@ -29,14 +29,16 @@ export function EventLocation({ post, preview = true, truncate = false, occurren
|
|
|
29
29
|
return (_jsx("a", { href: jamLink, className: "text-primary text-sm underline", children: t('events.location.jam', { defaultValue: 'Jam Event' }) }));
|
|
30
30
|
}
|
|
31
31
|
if (event.url) {
|
|
32
|
-
return (_jsx("a", { href: event.url, className: "text-primary text-sm underline", children: t('events.location.
|
|
32
|
+
return (_jsx("a", { href: event.url, className: "text-primary text-sm underline", children: t('events.location.external', { defaultValue: 'External Event' }) }));
|
|
33
33
|
}
|
|
34
34
|
return null;
|
|
35
35
|
}
|
|
36
36
|
if (preview) {
|
|
37
37
|
return (_jsx("div", { className: "flex items-center gap-1 text-sm", children: physicalLocation ? (_jsxs(_Fragment, { children: [_jsx(MapPin, { className: "h-4 w-4 shrink-0" }), _jsx("span", { children: truncate
|
|
38
38
|
? truncateText(physicalLocation.text)
|
|
39
|
-
: physicalLocation.text })] })) : event.jam ? (_jsxs(_Fragment, { children: [_jsx(PhoneCall, { className: "h-4 w-4 shrink-0" }), _jsx("a", { href: jamLink, target: "_blank", rel: "noreferrer", className: "text-primary hover:underline", children: t('events.location.jam', { defaultValue: 'Jam Event' }) })] })) : event.url ? (_jsxs(_Fragment, { children: [_jsx(LinkIcon, { className: "h-4 w-4 shrink-0" }), _jsxs("a", { href: event.url, target: "_blank", rel: "noreferrer", className: "text-primary inline-flex items-center gap-1 hover:underline", children: [t('events.location.
|
|
39
|
+
: physicalLocation.text })] })) : event.jam ? (_jsxs(_Fragment, { children: [_jsx(PhoneCall, { className: "h-4 w-4 shrink-0" }), _jsx("a", { href: jamLink, target: "_blank", rel: "noreferrer", className: "text-primary hover:underline", children: t('events.location.jam', { defaultValue: 'Jam Event' }) })] })) : event.url ? (_jsxs(_Fragment, { children: [_jsx(LinkIcon, { className: "h-4 w-4 shrink-0" }), _jsxs("a", { href: event.url, target: "_blank", rel: "noreferrer", className: "text-primary inline-flex items-center gap-1 hover:underline", children: [t('events.location.external', {
|
|
40
|
+
defaultValue: 'External Event',
|
|
41
|
+
}), _jsx(ExternalLink, { className: "h-4 w-4" })] })] })) : null }));
|
|
40
42
|
}
|
|
41
43
|
return (_jsxs("div", { className: "mt-4 flex gap-x-4", children: [_jsx("div", { className: "border-foreground/20 flex items-center justify-center rounded-md border px-4 py-1", children: physicalLocation ? (_jsx(MapPin, { className: "text-muted-foreground my-3", size: 24 })) : event.jam ? (_jsx(PhoneCall, { className: "text-muted-foreground my-3", size: 24 })) : event.url ? (_jsx(LinkIcon, { className: "text-muted-foreground my-3", size: 24 })) : null }), _jsx("div", { children: physicalLocation ? (_jsx("p", { children: truncate
|
|
42
44
|
? truncateText(physicalLocation.text)
|
|
@@ -86,9 +86,10 @@ export const ResourceForm = ({ postData, onChange, isEdit = false, groupOnly = f
|
|
|
86
86
|
defaultValue: 'https://example.com',
|
|
87
87
|
}), inputMode: "url", spellCheck: false, error: urlInvalid, "aria-invalid": urlIssue, "aria-describedby": urlIssue ? 'resource-url-error' : undefined, onChange: (event) => patchResource({ url: event.target.value }) }), urlIssue ? (_jsx("span", { id: "resource-url-error", role: urlInvalid ? 'alert' : 'status', "data-testid": "resources-url-error", className: urlInvalid
|
|
88
88
|
? 'text-destructive mt-1 text-sm'
|
|
89
|
-
: 'text-muted-foreground mt-1 text-sm', children: urlMessage })) : null] })) : (_jsxs("div", { className: "space-y-2", children: [
|
|
89
|
+
: 'text-muted-foreground mt-1 text-sm', children: urlMessage })) : null] })) : (_jsxs("div", { className: "space-y-2", children: [resource.resourceKind === 'gallery' ||
|
|
90
|
+
(resource.attachments ?? []).length === 0 ? (_jsx(Button, { variant: "outline", action: kindActions[resource.resourceKind], children: t('resources.form.addMedia', {
|
|
90
91
|
defaultValue: 'Add files',
|
|
91
|
-
}) }), attachments.previews, attachments.inputs, mediaMissing ? (_jsx("p", { role: "status", className: "text-muted-foreground text-sm", children: t('resources.validation.mediaRequired', {
|
|
92
|
+
}) })) : null, attachments.previews, attachments.inputs, mediaMissing ? (_jsx("p", { role: "status", className: "text-muted-foreground text-sm", children: t('resources.validation.mediaRequired', {
|
|
92
93
|
defaultValue: 'Add the media or link this resource needs',
|
|
93
94
|
}) })) : null] })), _jsx(OpenpeepsMarkdownInput, { rows: 8, maxLength: 4000, value: resource.content ?? '', onChange: (content) => patchResource({ content }), placeholder: t('resources.form.descriptionPlaceholder', {
|
|
94
95
|
defaultValue: 'Describe this resource',
|
|
@@ -65,7 +65,7 @@ const issueMessage = (issue, t) => {
|
|
|
65
65
|
};
|
|
66
66
|
const submitErrorMessage = (err, t) => {
|
|
67
67
|
const message = err instanceof Error ? err.message : '';
|
|
68
|
-
if (message === 'Forbidden') {
|
|
68
|
+
if (message === 'Forbidden' || message === 'postCreateForbidden') {
|
|
69
69
|
return t('resources.validation.audienceForbidden', {
|
|
70
70
|
defaultValue: 'Choose a group you can post this resource in.',
|
|
71
71
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openpeepshq/react",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"simple-icons": "^16.31.0",
|
|
53
53
|
"uuidv7": "^1.0.2",
|
|
54
54
|
"@openpeepshq/client": "^0.2.1",
|
|
55
|
-
"@openpeepshq/greenscreen": "^0.2.1",
|
|
56
55
|
"@openpeepshq/common": "^0.4.0",
|
|
56
|
+
"@openpeepshq/greenscreen": "^0.2.1",
|
|
57
57
|
"@openpeepshq/react-ui": "^0.4.1"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
@@ -64,7 +64,7 @@ export function EventLocation({
|
|
|
64
64
|
if (event.url) {
|
|
65
65
|
return (
|
|
66
66
|
<a href={event.url} className="text-primary text-sm underline">
|
|
67
|
-
{t('events.location.
|
|
67
|
+
{t('events.location.external', { defaultValue: 'External Event' })}
|
|
68
68
|
</a>
|
|
69
69
|
);
|
|
70
70
|
}
|
|
@@ -104,7 +104,9 @@ export function EventLocation({
|
|
|
104
104
|
rel="noreferrer"
|
|
105
105
|
className="text-primary inline-flex items-center gap-1 hover:underline"
|
|
106
106
|
>
|
|
107
|
-
{t('events.location.
|
|
107
|
+
{t('events.location.external', {
|
|
108
|
+
defaultValue: 'External Event',
|
|
109
|
+
})}
|
|
108
110
|
<ExternalLink className="h-4 w-4" />
|
|
109
111
|
</a>
|
|
110
112
|
</>
|
|
@@ -224,14 +224,18 @@ export const ResourceForm = ({
|
|
|
224
224
|
</Label>
|
|
225
225
|
) : (
|
|
226
226
|
<div className="space-y-2">
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
227
|
+
{/* Only galleries take more than one file; other kinds pick once. */}
|
|
228
|
+
{resource.resourceKind === 'gallery' ||
|
|
229
|
+
(resource.attachments ?? []).length === 0 ? (
|
|
230
|
+
<Button
|
|
231
|
+
variant="outline"
|
|
232
|
+
action={kindActions[resource.resourceKind]}
|
|
233
|
+
>
|
|
234
|
+
{t('resources.form.addMedia', {
|
|
235
|
+
defaultValue: 'Add files',
|
|
236
|
+
})}
|
|
237
|
+
</Button>
|
|
238
|
+
) : null}
|
|
235
239
|
{attachments.previews}
|
|
236
240
|
{attachments.inputs}
|
|
237
241
|
{mediaMissing ? (
|
|
@@ -92,7 +92,7 @@ const submitErrorMessage = (
|
|
|
92
92
|
t: (key: string, options: { defaultValue: string }) => string,
|
|
93
93
|
) => {
|
|
94
94
|
const message = err instanceof Error ? err.message : '';
|
|
95
|
-
if (message === 'Forbidden') {
|
|
95
|
+
if (message === 'Forbidden' || message === 'postCreateForbidden') {
|
|
96
96
|
return t('resources.validation.audienceForbidden', {
|
|
97
97
|
defaultValue: 'Choose a group you can post this resource in.',
|
|
98
98
|
});
|