@openpeepshq/react 0.9.22 → 0.10.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/dist/components/navigation/SideBar.js +3 -3
- package/dist/components/server-data/context.d.ts +1 -0
- package/dist/contexts/openpeeps/hooks/other.d.ts +1 -0
- package/dist/pages/Welcome.js +3 -1
- package/dist/pages/admin/community/CommunityLinks.js +6 -2
- package/dist/pages/admin/community/useCommunityConfig.d.ts +2 -0
- package/package.json +3 -3
- package/src/components/navigation/SideBar.tsx +16 -2
- package/src/pages/Welcome.tsx +9 -0
- package/src/pages/admin/community/CommunityLinks.tsx +29 -0
|
@@ -21,13 +21,13 @@ export function SideBar({ onClose, mainMenu, profileMenu } = {}) {
|
|
|
21
21
|
const t = useT();
|
|
22
22
|
const hrefOf = useHrefOf();
|
|
23
23
|
const logoSmall = getTheme(serverInfo.communityConfig, profileSettings).logoSmall;
|
|
24
|
-
const { name, tagLine } = serverInfo.communityConfig?.info ?? {};
|
|
24
|
+
const { name, tagLine, bugReportUrl } = serverInfo.communityConfig?.info ?? {};
|
|
25
25
|
const homeHref = hrefOf({ type: 'home' });
|
|
26
26
|
const registerHref = hrefOf({ type: 'auth', mode: 'register' });
|
|
27
27
|
const loginHref = hrefOf({ type: 'auth', mode: 'login' });
|
|
28
28
|
const aboutHref = hrefOf({ type: 'about' });
|
|
29
|
-
return (_jsxs("div", { className: "bg-background text-foreground relative h-screen w-full pt-3 md:h-full", children: [_jsxs("div", { className: "h-[90%] overflow-y-auto", children: [_jsxs("div", { className: "flex w-full items-center justify-between px-4 md:items-start", children: [_jsx("a", { href: homeHref, children: logoSmall && (_jsx("img", { src: logoSmall, alt: "logo", className: "h-10 object-contain" })) }), onClose && (_jsxs("button", { type: "button", title: t('common.close'), "aria-label": t('common.close'), className: "flex md:hidden", onClick: onClose, children: [_jsx(X, { "aria-hidden": "true" }), _jsx("span", { className: "sr-only", children: t('common.close') })] }))] }), profile?.type === 'local' ? (_jsxs(_Fragment, { children: [profileMenu, mainMenu] })) : (_jsx("div", { className: "mt-4 px-4", children: _jsxs("div", { className: "flex h-full flex-col items-center justify-center space-y-4", children: [name && (_jsx("p", { className: "text-center text-lg font-semibold", children: t('navigation.welcome', { name }) })), tagLine && _jsx("p", { className: "px-2 text-center text-sm", children: tagLine }), serverInfo.publicContent && (_jsx("span", { children: _jsx(Link, { action: aboutHref, className: "op-anchor text-sm", children: t('navigation.about', {
|
|
29
|
+
return (_jsxs("div", { className: "bg-background text-foreground relative h-screen w-full pt-3 md:h-full", children: [_jsxs("div", { className: "h-[90%] overflow-y-auto pb-14", children: [_jsxs("div", { className: "flex w-full items-center justify-between px-4 md:items-start", children: [_jsx("a", { href: homeHref, children: logoSmall && (_jsx("img", { src: logoSmall, alt: "logo", className: "h-10 object-contain" })) }), onClose && (_jsxs("button", { type: "button", title: t('common.close'), "aria-label": t('common.close'), className: "flex md:hidden", onClick: onClose, children: [_jsx(X, { "aria-hidden": "true" }), _jsx("span", { className: "sr-only", children: t('common.close') })] }))] }), profile?.type === 'local' ? (_jsxs(_Fragment, { children: [profileMenu, mainMenu] })) : (_jsx("div", { className: "mt-4 px-4", children: _jsxs("div", { className: "flex h-full flex-col items-center justify-center space-y-4", children: [name && (_jsx("p", { className: "text-center text-lg font-semibold", children: t('navigation.welcome', { name }) })), tagLine && _jsx("p", { className: "px-2 text-center text-sm", children: tagLine }), serverInfo.publicContent && (_jsx("span", { children: _jsx(Link, { action: aboutHref, className: "op-anchor text-sm", children: t('navigation.about', {
|
|
30
30
|
defaultValue: 'Learn more about {{communityName}}',
|
|
31
31
|
communityName: name,
|
|
32
|
-
}) }) })), _jsx(Button, { title: t('navigation.joinCommunity'), variant: "default", action: registerHref, children: t('navigation.joinCommunity') }), _jsxs("span", { className: "text-sm", children: [t('navigation.haveAccount'), ' ', _jsx(Link, { action: loginHref, children: t('navigation.logIn') })] })] }) }))] }),
|
|
32
|
+
}) }) })), _jsx(Button, { title: t('navigation.joinCommunity'), variant: "default", action: registerHref, children: t('navigation.joinCommunity') }), _jsxs("span", { className: "text-sm", children: [t('navigation.haveAccount'), ' ', _jsx(Link, { action: loginHref, children: t('navigation.logIn') })] })] }) }))] }), _jsxs("footer", { className: "bg-background absolute bottom-3", children: [bugReportUrl && /^https?:\/\//i.test(bugReportUrl) && (_jsx("p", { className: "ml-4 text-center", children: _jsx("a", { href: bugReportUrl, target: "_blank", rel: "noreferrer", className: "op-anchor text-sm", children: t('navigation.reportBug', { defaultValue: 'Report a bug' }) }) })), _jsx("p", { className: "ml-4 text-center", children: t('navigation.poweredBy') })] })] }));
|
|
33
33
|
}
|
|
@@ -89,6 +89,7 @@ export declare const otherHooks: (client: OpenpeepsClient) => {
|
|
|
89
89
|
contactEmail?: string | undefined;
|
|
90
90
|
privacyPolicy?: string | undefined;
|
|
91
91
|
termsAndConditions?: string | undefined;
|
|
92
|
+
bugReportUrl?: string | undefined;
|
|
92
93
|
};
|
|
93
94
|
content: {
|
|
94
95
|
aboutPage?: string | undefined;
|
package/dist/pages/Welcome.js
CHANGED
|
@@ -80,7 +80,9 @@ export function Welcome() {
|
|
|
80
80
|
return (_jsxs("div", { className: "relative col-span-3 min-h-[90vh] rounded-md bg-left-bottom bg-no-repeat p-6 pt-4", children: [_jsx("h1", { className: "mt-8 flex pb-4 text-5xl font-bold", children: t('welcome.heading', {
|
|
81
81
|
defaultValue: 'Welcome to {{name}}',
|
|
82
82
|
name: communityName,
|
|
83
|
-
}) }), _jsx("div", { className: "text-left", children: _jsx(Markdown, { source: welcomePage }) }), _jsx("div", { className: "my-4
|
|
83
|
+
}) }), _jsx("div", { className: "text-left", children: _jsx(Markdown, { source: welcomePage }) }), !account?.emailValidated ? (_jsx("div", { className: "my-4", children: t('auth.register.verificationReminder', {
|
|
84
|
+
defaultValue: "We've sent you a verification email. Check your inbox and click the link to verify your address.",
|
|
85
|
+
}) })) : null, _jsx("div", { className: "my-4 text-3xl font-bold", children: t('welcome.completeSetup', { defaultValue: 'Complete account setup' }) }), _jsx(AccessDeniedLoader, { queries: [postsQuery], children: items.map((item) => (_jsxs("div", { "data-testid": `welcome-checklist-${item.key}`, className: "mb-2 flex w-full cursor-pointer flex-row items-center justify-between rounded-md px-1 py-2", onClick: () => {
|
|
84
86
|
if (item.action)
|
|
85
87
|
item.action();
|
|
86
88
|
else if (item.route)
|
|
@@ -4,7 +4,7 @@ import { useForm } from 'react-hook-form';
|
|
|
4
4
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
5
5
|
import { communityConfigSchema, } from '@openpeepshq/common/types';
|
|
6
6
|
import { useT, useSetPageHeader } from '../../../index.js';
|
|
7
|
-
import { Button, Form, FormControl, FormField, FormItem, FormLabel, FormMessage, Input, Toast, } from '@openpeepshq/react-ui';
|
|
7
|
+
import { Button, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, Input, Toast, } from '@openpeepshq/react-ui';
|
|
8
8
|
import { useCommunityConfig } from './useCommunityConfig.js';
|
|
9
9
|
export function AdminConfigurationCommunityLinks() {
|
|
10
10
|
const t = useT();
|
|
@@ -31,5 +31,9 @@ export function AdminConfigurationCommunityLinks() {
|
|
|
31
31
|
if (isLoading || !draft) {
|
|
32
32
|
return (_jsx("div", { className: "text-muted-foreground flex h-32 items-center justify-center text-sm", children: t('common.form.loading', { defaultValue: 'Loading…' }) }));
|
|
33
33
|
}
|
|
34
|
-
return (_jsxs("div", { className: "p-4", children: [_jsx(Form, { ...form, children: _jsxs("form", { className: "flex flex-col gap-4", onSubmit: onSubmit, children: [_jsx(FormField, { control: form.control, name: "info.privacyPolicy", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: t('configuration.community.privacyPolicy') }), _jsx(FormControl, { children: _jsx(Input, { ...field, type: "text", value: field.value ?? '', "data-testid": "admin-community-links-privacy" }) }), _jsx(FormMessage, {})] })) }), _jsx(FormField, { control: form.control, name: "info.termsAndConditions", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: t('configuration.community.termsAndConditions') }), _jsx(FormControl, { children: _jsx(Input, { ...field, type: "text", value: field.value ?? '', "data-testid": "admin-community-links-terms" }) }), _jsx(FormMessage, {})] })) }), _jsx(
|
|
34
|
+
return (_jsxs("div", { className: "p-4", children: [_jsx(Form, { ...form, children: _jsxs("form", { className: "flex flex-col gap-4", onSubmit: onSubmit, children: [_jsx(FormField, { control: form.control, name: "info.privacyPolicy", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: t('configuration.community.privacyPolicy') }), _jsx(FormControl, { children: _jsx(Input, { ...field, type: "text", value: field.value ?? '', "data-testid": "admin-community-links-privacy" }) }), _jsx(FormMessage, {})] })) }), _jsx(FormField, { control: form.control, name: "info.termsAndConditions", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: t('configuration.community.termsAndConditions') }), _jsx(FormControl, { children: _jsx(Input, { ...field, type: "text", value: field.value ?? '', "data-testid": "admin-community-links-terms" }) }), _jsx(FormMessage, {})] })) }), _jsx(FormField, { control: form.control, name: "info.bugReportUrl", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: t('configuration.community.bugReportUrl', {
|
|
35
|
+
defaultValue: 'Bug report form URL',
|
|
36
|
+
}) }), _jsx(FormControl, { children: _jsx(Input, { ...field, type: "text", value: field.value ?? '', "data-testid": "admin-community-links-bug-report" }) }), _jsx(FormDescription, { children: t('configuration.community.bugReportUrlDescription', {
|
|
37
|
+
defaultValue: 'Link to an external bug report form. When set, a "Report a bug" link appears in the side menu.',
|
|
38
|
+
}) }), _jsx(FormMessage, {})] })) }), _jsx(Button, { type: "submit", variant: "default", title: t('configuration.community.save'), loading: form.formState.isSubmitting, "data-testid": "admin-community-links-save", children: t('configuration.community.save') })] }) }), status ? (_jsx(Toast, { variant: status.type, testId: "admin-community-links-toast", onDismiss: () => setStatus(null), children: status.message })) : null] }));
|
|
35
39
|
}
|
|
@@ -49,6 +49,7 @@ export declare function useCommunityConfig(): {
|
|
|
49
49
|
contactEmail?: string | undefined;
|
|
50
50
|
privacyPolicy?: string | undefined;
|
|
51
51
|
termsAndConditions?: string | undefined;
|
|
52
|
+
bugReportUrl?: string | undefined;
|
|
52
53
|
};
|
|
53
54
|
content: {
|
|
54
55
|
aboutPage?: string | undefined;
|
|
@@ -127,6 +128,7 @@ export declare function useCommunityConfig(): {
|
|
|
127
128
|
contactEmail?: string | undefined;
|
|
128
129
|
privacyPolicy?: string | undefined;
|
|
129
130
|
termsAndConditions?: string | undefined;
|
|
131
|
+
bugReportUrl?: string | undefined;
|
|
130
132
|
};
|
|
131
133
|
content: {
|
|
132
134
|
aboutPage?: string | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openpeepshq/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
"simple-icons": "^16.31.0",
|
|
53
53
|
"uuidv7": "^1.0.2",
|
|
54
54
|
"@openpeepshq/client": "^0.3.0",
|
|
55
|
-
"@openpeepshq/common": "^0.5.12",
|
|
56
55
|
"@openpeepshq/greenscreen": "^0.2.1",
|
|
57
|
-
"@openpeepshq/react-ui": "^0.4.1"
|
|
56
|
+
"@openpeepshq/react-ui": "^0.4.1",
|
|
57
|
+
"@openpeepshq/common": "^0.6.0"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"react": "^18.3.0 || ^19.0.0",
|
|
@@ -36,7 +36,8 @@ export function SideBar({ onClose, mainMenu, profileMenu }: SideBarProps = {}) {
|
|
|
36
36
|
serverInfo.communityConfig,
|
|
37
37
|
profileSettings,
|
|
38
38
|
).logoSmall;
|
|
39
|
-
const { name, tagLine } =
|
|
39
|
+
const { name, tagLine, bugReportUrl } =
|
|
40
|
+
serverInfo.communityConfig?.info ?? {};
|
|
40
41
|
const homeHref = hrefOf({ type: 'home' });
|
|
41
42
|
const registerHref = hrefOf({ type: 'auth', mode: 'register' });
|
|
42
43
|
const loginHref = hrefOf({ type: 'auth', mode: 'login' });
|
|
@@ -44,7 +45,8 @@ export function SideBar({ onClose, mainMenu, profileMenu }: SideBarProps = {}) {
|
|
|
44
45
|
|
|
45
46
|
return (
|
|
46
47
|
<div className="bg-background text-foreground relative h-screen w-full pt-3 md:h-full">
|
|
47
|
-
|
|
48
|
+
{/* pb keeps the last menu item scrollable above the absolute footer */}
|
|
49
|
+
<div className="h-[90%] overflow-y-auto pb-14">
|
|
48
50
|
<div className="flex w-full items-center justify-between px-4 md:items-start">
|
|
49
51
|
<a href={homeHref}>
|
|
50
52
|
{logoSmall && (
|
|
@@ -105,6 +107,18 @@ export function SideBar({ onClose, mainMenu, profileMenu }: SideBarProps = {}) {
|
|
|
105
107
|
)}
|
|
106
108
|
</div>
|
|
107
109
|
<footer className="bg-background absolute bottom-3">
|
|
110
|
+
{bugReportUrl && /^https?:\/\//i.test(bugReportUrl) && (
|
|
111
|
+
<p className="ml-4 text-center">
|
|
112
|
+
<a
|
|
113
|
+
href={bugReportUrl}
|
|
114
|
+
target="_blank"
|
|
115
|
+
rel="noreferrer"
|
|
116
|
+
className="op-anchor text-sm"
|
|
117
|
+
>
|
|
118
|
+
{t('navigation.reportBug', { defaultValue: 'Report a bug' })}
|
|
119
|
+
</a>
|
|
120
|
+
</p>
|
|
121
|
+
)}
|
|
108
122
|
<p className="ml-4 text-center">{t('navigation.poweredBy')}</p>
|
|
109
123
|
</footer>
|
|
110
124
|
</div>
|
package/src/pages/Welcome.tsx
CHANGED
|
@@ -132,6 +132,15 @@ export function Welcome() {
|
|
|
132
132
|
<Markdown source={welcomePage} />
|
|
133
133
|
</div>
|
|
134
134
|
|
|
135
|
+
{!account?.emailValidated ? (
|
|
136
|
+
<div className="my-4">
|
|
137
|
+
{t('auth.register.verificationReminder', {
|
|
138
|
+
defaultValue:
|
|
139
|
+
"We've sent you a verification email. Check your inbox and click the link to verify your address.",
|
|
140
|
+
})}
|
|
141
|
+
</div>
|
|
142
|
+
) : null}
|
|
143
|
+
|
|
135
144
|
<div className="my-4 text-3xl font-bold">
|
|
136
145
|
{t('welcome.completeSetup', { defaultValue: 'Complete account setup' })}
|
|
137
146
|
</div>
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
Button,
|
|
11
11
|
Form,
|
|
12
12
|
FormControl,
|
|
13
|
+
FormDescription,
|
|
13
14
|
FormField,
|
|
14
15
|
FormItem,
|
|
15
16
|
FormLabel,
|
|
@@ -101,6 +102,34 @@ export function AdminConfigurationCommunityLinks() {
|
|
|
101
102
|
</FormItem>
|
|
102
103
|
)}
|
|
103
104
|
/>
|
|
105
|
+
<FormField
|
|
106
|
+
control={form.control}
|
|
107
|
+
name="info.bugReportUrl"
|
|
108
|
+
render={({ field }) => (
|
|
109
|
+
<FormItem>
|
|
110
|
+
<FormLabel>
|
|
111
|
+
{t('configuration.community.bugReportUrl', {
|
|
112
|
+
defaultValue: 'Bug report form URL',
|
|
113
|
+
})}
|
|
114
|
+
</FormLabel>
|
|
115
|
+
<FormControl>
|
|
116
|
+
<Input
|
|
117
|
+
{...field}
|
|
118
|
+
type="text"
|
|
119
|
+
value={field.value ?? ''}
|
|
120
|
+
data-testid="admin-community-links-bug-report"
|
|
121
|
+
/>
|
|
122
|
+
</FormControl>
|
|
123
|
+
<FormDescription>
|
|
124
|
+
{t('configuration.community.bugReportUrlDescription', {
|
|
125
|
+
defaultValue:
|
|
126
|
+
'Link to an external bug report form. When set, a "Report a bug" link appears in the side menu.',
|
|
127
|
+
})}
|
|
128
|
+
</FormDescription>
|
|
129
|
+
<FormMessage />
|
|
130
|
+
</FormItem>
|
|
131
|
+
)}
|
|
132
|
+
/>
|
|
104
133
|
<Button
|
|
105
134
|
type="submit"
|
|
106
135
|
variant="default"
|