@openpeepshq/react 0.9.23 → 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.
@@ -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') })] })] }) }))] }), _jsx("footer", { className: "bg-background absolute bottom-3", children: _jsx("p", { className: "ml-4 text-center", children: t('navigation.poweredBy') }) })] }));
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
  }
@@ -56,6 +56,7 @@ export declare const useServerInfo: () => {
56
56
  contactEmail?: string | undefined;
57
57
  privacyPolicy?: string | undefined;
58
58
  termsAndConditions?: string | undefined;
59
+ bugReportUrl?: string | undefined;
59
60
  };
60
61
  content: {
61
62
  aboutPage?: string | undefined;
@@ -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;
@@ -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(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] }));
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.9.23",
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 } = serverInfo.communityConfig?.info ?? {};
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
- <div className="h-[90%] overflow-y-auto">
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>
@@ -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"