@openpeepshq/react 0.11.0 → 0.12.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.
Files changed (36) hide show
  1. package/dist/components/jams/JamLobby.js +16 -8
  2. package/dist/components/post/post-form/ComposeAttachments.d.ts +1 -3
  3. package/dist/components/post/post-form/ComposeAttachments.js +7 -19
  4. package/dist/components/post/post-form/ComposeAttachments.test.js +13 -22
  5. package/dist/components/post/post-form/EventForm.js +2 -2
  6. package/dist/components/post/post-form/ResourceForm.js +0 -2
  7. package/dist/components/resources/CategoryPathPicker.js +2 -1
  8. package/dist/components/resources/ResourceLibrary.js +5 -5
  9. package/dist/components/resources/ResourceLibrary.test.js +83 -1
  10. package/dist/components/server-data/context.d.ts +2 -0
  11. package/dist/contexts/openpeeps/hooks/other.d.ts +2 -0
  12. package/dist/hooks/settings/useNotificationPreferences.d.ts +1 -0
  13. package/dist/hooks/settings/useNotificationPreferences.js +7 -2
  14. package/dist/pages/admin/ApiKeys.js +14 -6
  15. package/dist/pages/admin/ConfigurationEmail.js +2 -2
  16. package/dist/pages/admin/ConfigurationSso.js +1 -1
  17. package/dist/pages/admin/community/CommunityTheme.js +1 -1
  18. package/dist/pages/admin/community/useCommunityConfig.d.ts +4 -0
  19. package/dist/pages/auth/RequestResetPassword.js +1 -1
  20. package/dist/pages/settings/NotificationPreferences.js +7 -3
  21. package/dist/pages/settings/NotificationPreferences.test.d.ts +1 -0
  22. package/dist/pages/settings/NotificationPreferences.test.js +119 -0
  23. package/package.json +3 -3
  24. package/src/components/jams/JamLobby.tsx +123 -102
  25. package/src/components/post/post-form/ComposeAttachments.tsx +4 -20
  26. package/src/components/post/post-form/EventForm.tsx +2 -2
  27. package/src/components/post/post-form/ResourceForm.tsx +2 -3
  28. package/src/components/resources/CategoryPathPicker.tsx +2 -1
  29. package/src/components/resources/ResourceLibrary.tsx +5 -5
  30. package/src/hooks/settings/useNotificationPreferences.ts +12 -1
  31. package/src/pages/admin/ApiKeys.tsx +20 -9
  32. package/src/pages/admin/ConfigurationEmail.tsx +2 -2
  33. package/src/pages/admin/ConfigurationSso.tsx +2 -1
  34. package/src/pages/admin/community/CommunityTheme.tsx +29 -0
  35. package/src/pages/auth/RequestResetPassword.tsx +1 -1
  36. package/src/pages/settings/NotificationPreferences.tsx +38 -12
@@ -169,8 +169,10 @@ export const AdminApiKeys = () => {
169
169
  const cardLabels = {
170
170
  expiresLabel: t('admin.apiKeys.expiresAt', { defaultValue: 'Expires at' }),
171
171
  neverLabel: t('common.states.never', { defaultValue: 'Never' }),
172
- revokeLabel: t('admin.apiKeys.revoke', { defaultValue: 'Revoke' }),
173
- revokedLabel: t('admin.apiKeys.revoked', { defaultValue: 'Revoked' }),
172
+ revokeLabel: t('settings.accessTokens.revoke', { defaultValue: 'Revoke' }),
173
+ revokedLabel: t('settings.accessTokens.revoked', {
174
+ defaultValue: 'Revoked',
175
+ }),
174
176
  noScopesLabel: t('admin.apiKeys.noScopes', { defaultValue: 'No scopes' }),
175
177
  };
176
178
 
@@ -214,7 +216,9 @@ export const AdminApiKeys = () => {
214
216
  </div>
215
217
  <div className="space-y-2">
216
218
  <Label htmlFor="svc-expiration">
217
- {t('admin.apiKeys.expiration', { defaultValue: 'Expiration' })}
219
+ {t('settings.accessTokens.expiration', {
220
+ defaultValue: 'Expiration',
221
+ })}
218
222
  </Label>
219
223
  <select
220
224
  id="svc-expiration"
@@ -226,9 +230,12 @@ export const AdminApiKeys = () => {
226
230
  >
227
231
  {EXPIRATION_OPTIONS.map((option) => (
228
232
  <option key={option.value} value={option.value}>
229
- {t(`admin.apiKeys.expirationOptions.${option.labelKey}`, {
230
- defaultValue: EXPIRATION_OPTION_DEFAULTS[option.labelKey],
231
- })}
233
+ {t(
234
+ `settings.accessTokens.expirationOptions.${option.labelKey}`,
235
+ {
236
+ defaultValue: EXPIRATION_OPTION_DEFAULTS[option.labelKey],
237
+ },
238
+ )}
232
239
  </option>
233
240
  ))}
234
241
  </select>
@@ -324,7 +331,9 @@ export const AdminApiKeys = () => {
324
331
 
325
332
  <Button variant="default" disabled={creating} action={create}>
326
333
  {creating
327
- ? t('admin.apiKeys.creating', { defaultValue: 'Creating...' })
334
+ ? t('settings.accessTokens.creating', {
335
+ defaultValue: 'Creating...',
336
+ })
328
337
  : t('admin.apiKeys.create', {
329
338
  defaultValue: 'Create Service Token',
330
339
  })}
@@ -333,7 +342,7 @@ export const AdminApiKeys = () => {
333
342
  {createdToken ? (
334
343
  <div className="rounded-md border p-3">
335
344
  <p className="text-sm font-semibold">
336
- {t('admin.apiKeys.copyWarning', {
345
+ {t('settings.accessTokens.copyWarning', {
337
346
  defaultValue:
338
347
  'Copy this token now. It will not be shown again.',
339
348
  })}
@@ -342,7 +351,9 @@ export const AdminApiKeys = () => {
342
351
  <code className="break-all text-sm">{createdToken}</code>
343
352
  <button
344
353
  type="button"
345
- title={t('admin.apiKeys.copy', { defaultValue: 'Copy' })}
354
+ title={t('settings.accessTokens.copy', {
355
+ defaultValue: 'Copy',
356
+ })}
346
357
  onClick={() => void navigator.clipboard.writeText(createdToken)}
347
358
  >
348
359
  <Copy className="size-4" />
@@ -328,14 +328,14 @@ export function AdminConfigurationEmail() {
328
328
  </label>
329
329
  <Button
330
330
  variant="secondary"
331
- title={t('configuration.email.sendTest')}
331
+ title={t('configuration.email.testTitle')}
332
332
  action={handleSendTest}
333
333
  disabled={sending}
334
334
  data-testid="admin-email-send-test"
335
335
  >
336
336
  {sending
337
337
  ? t('common.states.loading')
338
- : t('configuration.email.sendTest')}
338
+ : t('configuration.email.testTitle')}
339
339
  </Button>
340
340
  </div>
341
341
  <p className="mt-3 text-xs opacity-70">
@@ -171,7 +171,8 @@ export function AdminConfigurationSso() {
171
171
  <div>
172
172
  <p className="font-medium">{item.name}</p>
173
173
  <p className="text-muted-foreground text-xs">
174
- {t(`configuration.sso.kind.${item.kind}`)} · {item.id}
174
+ {t(`configuration.sso.types.${item.kind}.title`)} ·{' '}
175
+ {item.id}
175
176
  </p>
176
177
  </div>
177
178
  <div className="flex gap-2">
@@ -232,6 +232,35 @@ export function AdminConfigurationCommunityTheme() {
232
232
  </p>
233
233
  </div>
234
234
 
235
+ {/* jam lobby background */}
236
+ <div className="border p-4">
237
+ <h4 className="my-4 text-lg font-semibold">
238
+ {t('configuration.community.jamLobbyBackground')}
239
+ </h4>
240
+ <span>
241
+ {t('configuration.community.jamLobbyBackgroundDescription')}
242
+ </span>
243
+ <div className="flex flex-wrap gap-x-4">
244
+ {(['light', 'dark'] as Mode[]).map((mode) =>
245
+ fileInput(
246
+ (file) =>
247
+ uploadInto(
248
+ file,
249
+ (c, url) => (c.theme[mode].jamLobbyBackground = url),
250
+ 'configuration.community.jamLobbyBackground',
251
+ ),
252
+ t(
253
+ `configuration.community.${mode}Theme.uploadJamLobbyBackground`,
254
+ ),
255
+ cfg.theme[mode].jamLobbyBackground,
256
+ ),
257
+ )}
258
+ </div>
259
+ <p className="py-3 text-sm">
260
+ {t('configuration.community.jamLobbyBackgroundRequirements')}
261
+ </p>
262
+ </div>
263
+
235
264
  {/* background */}
236
265
  <div className="border p-4">
237
266
  <h4 className="my-4 text-lg font-semibold">
@@ -97,7 +97,7 @@ export function RequestResetPassword() {
97
97
  )}
98
98
 
99
99
  <Button
100
- title={t('auth.requestResetPassword.title', {
100
+ title={t('auth.requestResetPassword.heading', {
101
101
  defaultValue: 'Request Password Reset',
102
102
  })}
103
103
  action={handleSubmit}
@@ -234,6 +234,7 @@ export function NotificationPreferences() {
234
234
  saving,
235
235
  status,
236
236
  clearStatus,
237
+ dirty,
237
238
  } = useNotificationPreferences({
238
239
  ensurePush: vapidKey
239
240
  ? async () => {
@@ -282,19 +283,44 @@ export function NotificationPreferences() {
282
283
  </Toast>
283
284
  ) : null}
284
285
 
285
- <div className="pt-3">
286
- <Button
287
- variant="default"
288
- className="w-full"
289
- action={save}
290
- disabled={saving}
291
- data-testid="settings-save-button"
286
+ {dirty ? (
287
+ // Sticky so the save control stays reachable when the form is
288
+ // longer than the viewport (the "where do I save this?" gap).
289
+ <div
290
+ data-testid="settings-unsaved-bar"
291
+ className="border-border bg-surface sticky bottom-0 z-10 mt-4 flex items-center justify-between gap-4 rounded-t-lg border-t p-3 shadow-lg"
292
292
  >
293
- {saving
294
- ? t('common.submitting', { defaultValue: 'Submitting…' })
295
- : t('common.submit', { defaultValue: 'Submit' })}
296
- </Button>
297
- </div>
293
+ <p className="text-sm font-medium">
294
+ {t('settings.notifications.unsavedChanges', {
295
+ defaultValue: 'You have unsaved changes.',
296
+ })}
297
+ </p>
298
+ <Button
299
+ variant="default"
300
+ action={save}
301
+ disabled={saving}
302
+ data-testid="settings-save-button"
303
+ >
304
+ {saving
305
+ ? t('common.submitting', { defaultValue: 'Submitting…' })
306
+ : t('common.submit', { defaultValue: 'Submit' })}
307
+ </Button>
308
+ </div>
309
+ ) : (
310
+ <div className="pt-3">
311
+ <Button
312
+ variant="default"
313
+ className="w-full"
314
+ action={save}
315
+ disabled={saving}
316
+ data-testid="settings-save-button"
317
+ >
318
+ {saving
319
+ ? t('common.submitting', { defaultValue: 'Submitting…' })
320
+ : t('common.submit', { defaultValue: 'Submit' })}
321
+ </Button>
322
+ </div>
323
+ )}
298
324
  </section>
299
325
  );
300
326
  }