@meith/web 0.23.0 → 0.23.2
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/app/(board)/[slug]/new/page.tsx +7 -5
- package/app/(board)/thread/[slug]/edit/page.tsx +7 -5
- package/app/(board)/thread/[slug]/page.tsx +19 -1
- package/app/(board)/thread/[slug]/reply/page.tsx +7 -5
- package/package.json +48 -48
- package/src/components/admin/forum-forms.tsx +172 -54
- package/src/components/admin/marketplace-listing.tsx +1 -1
- package/src/components/content/composer-recovery.tsx +19 -1
- package/src/components/content/edit-post-form.tsx +3 -2
- package/src/components/content/markdown-editor.tsx +123 -104
- package/src/components/content/new-thread-form.tsx +3 -2
- package/src/components/content/reply-form.tsx +3 -2
- package/src/components/moderation/thread-surgery-form.tsx +51 -47
- package/src/components/moderation/thread-tools-form.tsx +67 -87
- package/src/server/marketplace-admin.ts +2 -2
- package/src/server/upgrade-notice.ts +1 -1
- package/src/theme/contract.fixture.ts +2 -2
- package/src/view/admin-copy.ts +9 -0
- package/src/view/content-copy.ts +11 -6
- package/src/view/forum-display.ts +1 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
+
import type { ReactNode } from 'react'
|
|
3
4
|
import { useCallback, useEffect, useId, useRef, useState } from 'react'
|
|
4
5
|
|
|
5
6
|
import type { MemberSuggestion } from '@meith/accounts'
|
|
@@ -84,7 +85,7 @@ export interface MarkdownEditorProps {
|
|
|
84
85
|
readonly hint?: React.ReactNode
|
|
85
86
|
readonly scope?: PreviewScope
|
|
86
87
|
readonly attachTo?: AttachmentTarget | undefined
|
|
87
|
-
readonly toolbar?:
|
|
88
|
+
readonly toolbar?: ReactNode
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
export function MarkdownEditor({
|
|
@@ -99,7 +100,7 @@ export function MarkdownEditor({
|
|
|
99
100
|
hint,
|
|
100
101
|
scope = 'post',
|
|
101
102
|
attachTo,
|
|
102
|
-
toolbar
|
|
103
|
+
toolbar,
|
|
103
104
|
}: MarkdownEditorProps) {
|
|
104
105
|
const field = useRef<HTMLTextAreaElement>(null)
|
|
105
106
|
const attachmentInput = useRef<HTMLInputElement>(null)
|
|
@@ -308,6 +309,9 @@ export function MarkdownEditor({
|
|
|
308
309
|
}
|
|
309
310
|
|
|
310
311
|
const writing = !enhanced || tab === 'write'
|
|
312
|
+
const onWriteTab = enhanced && tab === 'write'
|
|
313
|
+
const showThemedToolbar = toolbar != null && onWriteTab
|
|
314
|
+
const showBuiltInToolbar = toolbar == null && onWriteTab
|
|
311
315
|
|
|
312
316
|
const tabClass = (active: boolean): string =>
|
|
313
317
|
cn(
|
|
@@ -359,121 +363,136 @@ export function MarkdownEditor({
|
|
|
359
363
|
)}
|
|
360
364
|
</div>
|
|
361
365
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
>
|
|
369
|
-
{TOOLS.map((tool) => (
|
|
370
|
-
<button
|
|
371
|
-
key={tool.labelKey}
|
|
372
|
-
type="button"
|
|
373
|
-
onMouseDown={(event) => event.preventDefault()}
|
|
374
|
-
onClick={() => {
|
|
375
|
-
if (field.current !== null) runTool(field.current, tool, copy)
|
|
376
|
-
}}
|
|
377
|
-
title={
|
|
378
|
-
tool.shortcut === undefined
|
|
379
|
-
? fromCopy(copy, tool.labelKey)
|
|
380
|
-
: formatFromCopy(copy, 'composer.toolShortcut', {
|
|
381
|
-
label: fromCopy(copy, tool.labelKey),
|
|
382
|
-
key: tool.shortcut.toUpperCase(),
|
|
383
|
-
})
|
|
384
|
-
}
|
|
385
|
-
aria-label={fromCopy(copy, tool.labelKey)}
|
|
386
|
-
{...(tool.shortcut === undefined
|
|
387
|
-
? {}
|
|
388
|
-
: { 'aria-keyshortcuts': `Control+${tool.shortcut}` })}
|
|
389
|
-
className="min-w-8 rounded px-2 py-1 text-xs font-medium text-muted-foreground hover:bg-background hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring"
|
|
390
|
-
>
|
|
391
|
-
<span aria-hidden="true">{tool.glyph}</span>
|
|
392
|
-
</button>
|
|
393
|
-
))}
|
|
394
|
-
|
|
395
|
-
{attachTo !== undefined && (
|
|
396
|
-
<button
|
|
397
|
-
type="button"
|
|
398
|
-
disabled={attachmentUpload === 'uploading'}
|
|
399
|
-
onMouseDown={(event) => event.preventDefault()}
|
|
400
|
-
onClick={() => attachmentInput.current?.click()}
|
|
401
|
-
title={fromCopy(copy, 'composer.tool.attachment')}
|
|
402
|
-
aria-label={fromCopy(copy, 'composer.tool.attachment')}
|
|
403
|
-
className="min-w-8 rounded px-2 py-1 text-xs font-medium text-muted-foreground hover:bg-background hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:opacity-50"
|
|
404
|
-
>
|
|
405
|
-
<span aria-hidden="true">Attach</span>
|
|
406
|
-
</button>
|
|
407
|
-
)}
|
|
408
|
-
</div>
|
|
409
|
-
)}
|
|
410
|
-
|
|
411
|
-
<div
|
|
412
|
-
{...(enhanced
|
|
413
|
-
? { role: 'tabpanel', id: `${panelId}-write`, 'aria-labelledby': `${panelId}-write-tab` }
|
|
414
|
-
: {})}
|
|
415
|
-
hidden={!writing}
|
|
416
|
-
className="relative"
|
|
417
|
-
>
|
|
418
|
-
<textarea
|
|
419
|
-
ref={field}
|
|
420
|
-
id={id}
|
|
421
|
-
name={name}
|
|
422
|
-
rows={rows}
|
|
423
|
-
required={required === true && writing}
|
|
424
|
-
defaultValue={defaultValue}
|
|
425
|
-
{...(maxLength === undefined ? {} : { maxLength })}
|
|
426
|
-
onKeyDown={onKeyDown}
|
|
427
|
-
onPaste={onPaste}
|
|
428
|
-
onInput={(event) => {
|
|
429
|
-
fit()
|
|
430
|
-
syncMentionToken(event.currentTarget)
|
|
431
|
-
}}
|
|
432
|
-
onSelect={(event) => syncMentionToken(event.currentTarget)}
|
|
433
|
-
onBlur={() => setMentionToken(null)}
|
|
434
|
-
{...(enhanced && mentionToken !== null && mentionMatches.length > 0
|
|
435
|
-
? {
|
|
436
|
-
role: 'combobox',
|
|
437
|
-
'aria-expanded': true,
|
|
438
|
-
'aria-controls': `${panelId}-mentions`,
|
|
439
|
-
'aria-activedescendant': `${panelId}-mention-${mentionActive}`,
|
|
440
|
-
'aria-autocomplete': 'list' as const,
|
|
441
|
-
}
|
|
442
|
-
: {})}
|
|
443
|
-
className="w-full rounded-md border border-input bg-card px-3 py-2 font-normal text-sm leading-relaxed focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring"
|
|
444
|
-
/>
|
|
366
|
+
<div className="flex flex-col">
|
|
367
|
+
{showThemedToolbar && (
|
|
368
|
+
<div className="overflow-hidden rounded-t-md border border-b-0 border-input">
|
|
369
|
+
{toolbar}
|
|
370
|
+
</div>
|
|
371
|
+
)}
|
|
445
372
|
|
|
446
|
-
{
|
|
373
|
+
{showBuiltInToolbar && (
|
|
447
374
|
<div
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
aria-
|
|
451
|
-
className="
|
|
375
|
+
role="group"
|
|
376
|
+
aria-label={fromCopy(copy, 'composer.formatting')}
|
|
377
|
+
aria-controls={id}
|
|
378
|
+
className="flex flex-wrap gap-0.5 rounded-t-md border border-b-0 border-input bg-muted/40 p-1"
|
|
452
379
|
>
|
|
453
|
-
{
|
|
380
|
+
{TOOLS.map((tool) => (
|
|
454
381
|
<button
|
|
455
|
-
key={
|
|
382
|
+
key={tool.labelKey}
|
|
456
383
|
type="button"
|
|
457
|
-
id={`${panelId}-mention-${index}`}
|
|
458
|
-
role="option"
|
|
459
|
-
aria-selected={index === mentionActive}
|
|
460
384
|
onMouseDown={(event) => event.preventDefault()}
|
|
461
385
|
onClick={() => {
|
|
462
|
-
if (field.current !== null)
|
|
386
|
+
if (field.current !== null) runTool(field.current, tool, copy)
|
|
463
387
|
}}
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
388
|
+
title={
|
|
389
|
+
tool.shortcut === undefined
|
|
390
|
+
? fromCopy(copy, tool.labelKey)
|
|
391
|
+
: formatFromCopy(copy, 'composer.toolShortcut', {
|
|
392
|
+
label: fromCopy(copy, tool.labelKey),
|
|
393
|
+
key: tool.shortcut.toUpperCase(),
|
|
394
|
+
})
|
|
395
|
+
}
|
|
396
|
+
aria-label={fromCopy(copy, tool.labelKey)}
|
|
397
|
+
{...(tool.shortcut === undefined
|
|
398
|
+
? {}
|
|
399
|
+
: { 'aria-keyshortcuts': `Control+${tool.shortcut}` })}
|
|
400
|
+
className="min-w-8 rounded px-2 py-1 text-xs font-medium text-muted-foreground hover:bg-background hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring"
|
|
471
401
|
>
|
|
472
|
-
|
|
402
|
+
<span aria-hidden="true">{tool.glyph}</span>
|
|
473
403
|
</button>
|
|
474
404
|
))}
|
|
405
|
+
|
|
406
|
+
{attachTo !== undefined && (
|
|
407
|
+
<button
|
|
408
|
+
type="button"
|
|
409
|
+
disabled={attachmentUpload === 'uploading'}
|
|
410
|
+
onMouseDown={(event) => event.preventDefault()}
|
|
411
|
+
onClick={() => attachmentInput.current?.click()}
|
|
412
|
+
title={fromCopy(copy, 'composer.tool.attachment')}
|
|
413
|
+
aria-label={fromCopy(copy, 'composer.tool.attachment')}
|
|
414
|
+
className="min-w-8 rounded px-2 py-1 text-xs font-medium text-muted-foreground hover:bg-background hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:opacity-50"
|
|
415
|
+
>
|
|
416
|
+
<span aria-hidden="true">Attach</span>
|
|
417
|
+
</button>
|
|
418
|
+
)}
|
|
475
419
|
</div>
|
|
476
420
|
)}
|
|
421
|
+
|
|
422
|
+
<div
|
|
423
|
+
{...(enhanced
|
|
424
|
+
? {
|
|
425
|
+
role: 'tabpanel',
|
|
426
|
+
id: `${panelId}-write`,
|
|
427
|
+
'aria-labelledby': `${panelId}-write-tab`,
|
|
428
|
+
}
|
|
429
|
+
: {})}
|
|
430
|
+
hidden={!writing}
|
|
431
|
+
className="relative"
|
|
432
|
+
>
|
|
433
|
+
<textarea
|
|
434
|
+
ref={field}
|
|
435
|
+
id={id}
|
|
436
|
+
name={name}
|
|
437
|
+
rows={rows}
|
|
438
|
+
required={required === true && writing}
|
|
439
|
+
defaultValue={defaultValue}
|
|
440
|
+
{...(maxLength === undefined ? {} : { maxLength })}
|
|
441
|
+
onKeyDown={onKeyDown}
|
|
442
|
+
onPaste={onPaste}
|
|
443
|
+
onInput={(event) => {
|
|
444
|
+
fit()
|
|
445
|
+
syncMentionToken(event.currentTarget)
|
|
446
|
+
}}
|
|
447
|
+
onSelect={(event) => syncMentionToken(event.currentTarget)}
|
|
448
|
+
onBlur={() => setMentionToken(null)}
|
|
449
|
+
{...(enhanced && mentionToken !== null && mentionMatches.length > 0
|
|
450
|
+
? {
|
|
451
|
+
role: 'combobox',
|
|
452
|
+
'aria-expanded': true,
|
|
453
|
+
'aria-controls': `${panelId}-mentions`,
|
|
454
|
+
'aria-activedescendant': `${panelId}-mention-${mentionActive}`,
|
|
455
|
+
'aria-autocomplete': 'list' as const,
|
|
456
|
+
}
|
|
457
|
+
: {})}
|
|
458
|
+
className={cn(
|
|
459
|
+
'w-full rounded-md border border-input bg-card px-3 py-2 font-normal text-sm leading-relaxed focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring',
|
|
460
|
+
onWriteTab && 'rounded-t-none border-t-0',
|
|
461
|
+
)}
|
|
462
|
+
/>
|
|
463
|
+
|
|
464
|
+
{enhanced && mentionToken !== null && mentionMatches.length > 0 && (
|
|
465
|
+
<div
|
|
466
|
+
id={`${panelId}-mentions`}
|
|
467
|
+
role="listbox"
|
|
468
|
+
aria-label={fromCopy(copy, 'composer.mention.suggestions')}
|
|
469
|
+
className="absolute inset-x-0 top-full z-10 mt-1 max-h-48 overflow-y-auto rounded-md border border-border bg-card py-1 text-sm shadow-lg"
|
|
470
|
+
>
|
|
471
|
+
{mentionMatches.map((candidate, index) => (
|
|
472
|
+
<button
|
|
473
|
+
key={candidate.id}
|
|
474
|
+
type="button"
|
|
475
|
+
id={`${panelId}-mention-${index}`}
|
|
476
|
+
role="option"
|
|
477
|
+
aria-selected={index === mentionActive}
|
|
478
|
+
onMouseDown={(event) => event.preventDefault()}
|
|
479
|
+
onClick={() => {
|
|
480
|
+
if (field.current !== null) applyMention(field.current, candidate)
|
|
481
|
+
}}
|
|
482
|
+
onMouseEnter={() => setMentionActive(index)}
|
|
483
|
+
className={cn(
|
|
484
|
+
'block w-full px-3 py-1.5 text-start',
|
|
485
|
+
index === mentionActive
|
|
486
|
+
? 'bg-muted text-foreground'
|
|
487
|
+
: 'text-foreground hover:bg-muted',
|
|
488
|
+
)}
|
|
489
|
+
>
|
|
490
|
+
@{candidate.username}
|
|
491
|
+
</button>
|
|
492
|
+
))}
|
|
493
|
+
</div>
|
|
494
|
+
)}
|
|
495
|
+
</div>
|
|
477
496
|
</div>
|
|
478
497
|
|
|
479
498
|
{attachTo !== undefined && (
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
+
import type { ReactNode } from 'react'
|
|
3
4
|
import { useActionState } from 'react'
|
|
4
5
|
|
|
5
6
|
import type { UploadLimits } from '@meith/attachments/limits'
|
|
@@ -29,7 +30,7 @@ export function NewThreadForm({
|
|
|
29
30
|
canPostPoll,
|
|
30
31
|
attachmentLimits,
|
|
31
32
|
draft,
|
|
32
|
-
toolbar
|
|
33
|
+
toolbar,
|
|
33
34
|
copy,
|
|
34
35
|
}: {
|
|
35
36
|
forumId: number
|
|
@@ -39,7 +40,7 @@ export function NewThreadForm({
|
|
|
39
40
|
canPostPoll: boolean
|
|
40
41
|
attachmentLimits: UploadLimits | null
|
|
41
42
|
draft: Draft | null
|
|
42
|
-
toolbar?:
|
|
43
|
+
toolbar?: ReactNode
|
|
43
44
|
copy: Copy
|
|
44
45
|
}) {
|
|
45
46
|
const [state, action] = useActionState(createThreadAction, EMPTY_STATE)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
+
import type { ReactNode } from 'react'
|
|
3
4
|
import { useActionState } from 'react'
|
|
4
5
|
|
|
5
6
|
import type { UploadLimits } from '@meith/attachments/limits'
|
|
@@ -24,7 +25,7 @@ export function ReplyForm({
|
|
|
24
25
|
attachmentLimits,
|
|
25
26
|
draft,
|
|
26
27
|
collapsible = false,
|
|
27
|
-
toolbar
|
|
28
|
+
toolbar,
|
|
28
29
|
copy,
|
|
29
30
|
}: {
|
|
30
31
|
threadId: number
|
|
@@ -34,7 +35,7 @@ export function ReplyForm({
|
|
|
34
35
|
attachmentLimits: UploadLimits | null
|
|
35
36
|
draft: Draft | null
|
|
36
37
|
collapsible?: boolean
|
|
37
|
-
toolbar?:
|
|
38
|
+
toolbar?: ReactNode
|
|
38
39
|
copy: Copy
|
|
39
40
|
}) {
|
|
40
41
|
const [state, action] = useActionState(createReplyAction, EMPTY_STATE)
|
|
@@ -36,59 +36,63 @@ export function ThreadSurgeryForm({
|
|
|
36
36
|
return (
|
|
37
37
|
<>
|
|
38
38
|
{rights.split && splitPoints.length > 0 && (
|
|
39
|
-
<form action={splitAction} className="flex flex-
|
|
39
|
+
<form action={splitAction} className="flex flex-col gap-2">
|
|
40
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
41
|
+
<input type="hidden" name="threadId" value={threadId} />
|
|
42
|
+
<label className="flex items-center gap-2 text-xs">
|
|
43
|
+
<span className="sr-only">{fromCopy(copy, 'moderationForm.surgery.fromSr')}</span>
|
|
44
|
+
<select name="fromPostId" className={FIELD}>
|
|
45
|
+
{splitPoints.map((point) => (
|
|
46
|
+
<option key={point.id} value={point.id}>
|
|
47
|
+
{formatFromCopy(copy, 'moderationForm.surgery.splitPoint', {
|
|
48
|
+
number: point.number,
|
|
49
|
+
author: point.author,
|
|
50
|
+
})}
|
|
51
|
+
</option>
|
|
52
|
+
))}
|
|
53
|
+
</select>
|
|
54
|
+
</label>
|
|
55
|
+
<label className="flex items-center gap-2 text-xs">
|
|
56
|
+
<span className="sr-only">{fromCopy(copy, 'moderationForm.surgery.titleSr')}</span>
|
|
57
|
+
<input
|
|
58
|
+
type="text"
|
|
59
|
+
name="title"
|
|
60
|
+
required
|
|
61
|
+
minLength={3}
|
|
62
|
+
maxLength={150}
|
|
63
|
+
placeholder={fromCopy(copy, 'moderationForm.newThreadTitle')}
|
|
64
|
+
className={`${FIELD} w-48`}
|
|
65
|
+
/>
|
|
66
|
+
</label>
|
|
67
|
+
<button type="submit" className={BUTTON}>
|
|
68
|
+
{fromCopy(copy, 'moderationForm.surgery.split')}
|
|
69
|
+
</button>
|
|
70
|
+
</div>
|
|
40
71
|
<FormError message={splitState.error} />
|
|
41
|
-
<input type="hidden" name="threadId" value={threadId} />
|
|
42
|
-
<label className="flex items-center gap-2 text-xs">
|
|
43
|
-
<span className="sr-only">{fromCopy(copy, 'moderationForm.surgery.fromSr')}</span>
|
|
44
|
-
<select name="fromPostId" className={FIELD}>
|
|
45
|
-
{splitPoints.map((point) => (
|
|
46
|
-
<option key={point.id} value={point.id}>
|
|
47
|
-
{formatFromCopy(copy, 'moderationForm.surgery.splitPoint', {
|
|
48
|
-
number: point.number,
|
|
49
|
-
author: point.author,
|
|
50
|
-
})}
|
|
51
|
-
</option>
|
|
52
|
-
))}
|
|
53
|
-
</select>
|
|
54
|
-
</label>
|
|
55
|
-
<label className="flex items-center gap-2 text-xs">
|
|
56
|
-
<span className="sr-only">{fromCopy(copy, 'moderationForm.surgery.titleSr')}</span>
|
|
57
|
-
<input
|
|
58
|
-
type="text"
|
|
59
|
-
name="title"
|
|
60
|
-
required
|
|
61
|
-
minLength={3}
|
|
62
|
-
maxLength={150}
|
|
63
|
-
placeholder={fromCopy(copy, 'moderationForm.newThreadTitle')}
|
|
64
|
-
className={`${FIELD} w-48`}
|
|
65
|
-
/>
|
|
66
|
-
</label>
|
|
67
|
-
<button type="submit" className={BUTTON}>
|
|
68
|
-
{fromCopy(copy, 'moderationForm.surgery.split')}
|
|
69
|
-
</button>
|
|
70
72
|
</form>
|
|
71
73
|
)}
|
|
72
74
|
|
|
73
75
|
{rights.merge && (
|
|
74
|
-
<form action={mergeAction} className="flex flex-
|
|
76
|
+
<form action={mergeAction} className="flex flex-col gap-2">
|
|
77
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
78
|
+
<input type="hidden" name="threadId" value={threadId} />
|
|
79
|
+
<label className="flex items-center gap-2 text-xs">
|
|
80
|
+
<span className="sr-only">{fromCopy(copy, 'moderationForm.surgery.mergeSr')}</span>
|
|
81
|
+
<input
|
|
82
|
+
type="number"
|
|
83
|
+
name="targetThreadId"
|
|
84
|
+
required
|
|
85
|
+
min={1}
|
|
86
|
+
step={1}
|
|
87
|
+
placeholder={fromCopy(copy, 'moderationForm.surgery.mergePlaceholder')}
|
|
88
|
+
className={`${FIELD} w-40`}
|
|
89
|
+
/>
|
|
90
|
+
</label>
|
|
91
|
+
<button type="submit" className={`${BUTTON} border-destructive/40 text-destructive`}>
|
|
92
|
+
{fromCopy(copy, 'moderationForm.surgery.merge')}
|
|
93
|
+
</button>
|
|
94
|
+
</div>
|
|
75
95
|
<FormError message={mergeState.error} />
|
|
76
|
-
<input type="hidden" name="threadId" value={threadId} />
|
|
77
|
-
<label className="flex items-center gap-2 text-xs">
|
|
78
|
-
<span className="sr-only">{fromCopy(copy, 'moderationForm.surgery.mergeSr')}</span>
|
|
79
|
-
<input
|
|
80
|
-
type="number"
|
|
81
|
-
name="targetThreadId"
|
|
82
|
-
required
|
|
83
|
-
min={1}
|
|
84
|
-
step={1}
|
|
85
|
-
placeholder={fromCopy(copy, 'moderationForm.surgery.mergePlaceholder')}
|
|
86
|
-
className={`${FIELD} w-40`}
|
|
87
|
-
/>
|
|
88
|
-
</label>
|
|
89
|
-
<button type="submit" className={`${BUTTON} border-destructive/40 text-destructive`}>
|
|
90
|
-
{fromCopy(copy, 'moderationForm.surgery.merge')}
|
|
91
|
-
</button>
|
|
92
96
|
</form>
|
|
93
97
|
)}
|
|
94
98
|
</>
|
|
@@ -11,36 +11,6 @@ import { type Copy, fromCopy } from '../shell/copy'
|
|
|
11
11
|
const BUTTON =
|
|
12
12
|
'inline-flex h-8 items-center rounded-md border border-border px-3 text-xs font-medium hover:opacity-90 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring'
|
|
13
13
|
|
|
14
|
-
function ToolButton({
|
|
15
|
-
threadId,
|
|
16
|
-
tool,
|
|
17
|
-
label,
|
|
18
|
-
destructive,
|
|
19
|
-
}: {
|
|
20
|
-
threadId: number
|
|
21
|
-
tool: string
|
|
22
|
-
label: string
|
|
23
|
-
destructive?: boolean
|
|
24
|
-
}) {
|
|
25
|
-
const [state, action] = useActionState(threadToolAction, EMPTY_STATE)
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<form action={action} className="inline">
|
|
29
|
-
<FormError message={state.error} />
|
|
30
|
-
<input type="hidden" name="threadId" value={threadId} />
|
|
31
|
-
<input type="hidden" name="tool" value={tool} />
|
|
32
|
-
<button
|
|
33
|
-
type="submit"
|
|
34
|
-
className={
|
|
35
|
-
destructive === true ? `${BUTTON} border-destructive/40 text-destructive` : BUTTON
|
|
36
|
-
}
|
|
37
|
-
>
|
|
38
|
-
{label}
|
|
39
|
-
</button>
|
|
40
|
-
</form>
|
|
41
|
-
)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
14
|
export interface MoveOption {
|
|
45
15
|
readonly id: number
|
|
46
16
|
readonly title: string
|
|
@@ -65,73 +35,83 @@ export function ThreadToolsForm({
|
|
|
65
35
|
copy: Copy
|
|
66
36
|
children?: React.ReactNode
|
|
67
37
|
}) {
|
|
68
|
-
const [
|
|
38
|
+
const [state, action] = useActionState(threadToolAction, EMPTY_STATE)
|
|
69
39
|
|
|
70
40
|
return (
|
|
71
41
|
<section
|
|
72
42
|
aria-label={heading}
|
|
73
|
-
className="flex flex-
|
|
43
|
+
className="flex flex-col gap-2 rounded-lg border border-border bg-secondary px-4 py-3"
|
|
74
44
|
>
|
|
75
|
-
<
|
|
76
|
-
|
|
77
|
-
{rights.lock && (
|
|
78
|
-
<ToolButton
|
|
79
|
-
threadId={threadId}
|
|
80
|
-
tool={isLocked ? 'unlock' : 'lock'}
|
|
81
|
-
label={
|
|
82
|
-
isLocked
|
|
83
|
-
? fromCopy(copy, 'moderationForm.tool.unlock')
|
|
84
|
-
: fromCopy(copy, 'moderationForm.tool.lock')
|
|
85
|
-
}
|
|
86
|
-
/>
|
|
87
|
-
)}
|
|
88
|
-
{rights.stick && (
|
|
89
|
-
<ToolButton
|
|
90
|
-
threadId={threadId}
|
|
91
|
-
tool={isSticky ? 'unstick' : 'stick'}
|
|
92
|
-
label={
|
|
93
|
-
isSticky
|
|
94
|
-
? fromCopy(copy, 'moderationForm.tool.unpin')
|
|
95
|
-
: fromCopy(copy, 'moderationForm.tool.pin')
|
|
96
|
-
}
|
|
97
|
-
/>
|
|
98
|
-
)}
|
|
99
|
-
{rights.delete && (
|
|
100
|
-
<ToolButton
|
|
101
|
-
threadId={threadId}
|
|
102
|
-
tool="delete"
|
|
103
|
-
label={fromCopy(copy, 'moderationForm.tool.deleteThread')}
|
|
104
|
-
destructive
|
|
105
|
-
/>
|
|
106
|
-
)}
|
|
45
|
+
<div className="flex flex-wrap items-center gap-3">
|
|
46
|
+
<span className="text-xs font-medium text-muted-foreground">{heading}</span>
|
|
107
47
|
|
|
108
|
-
|
|
109
|
-
<form action={moveAction} className="flex items-center gap-2">
|
|
110
|
-
<FormError message={moveState.error} />
|
|
48
|
+
<form action={action} className="flex flex-wrap items-center gap-3">
|
|
111
49
|
<input type="hidden" name="threadId" value={threadId} />
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
<
|
|
115
|
-
|
|
116
|
-
|
|
50
|
+
|
|
51
|
+
{rights.lock && (
|
|
52
|
+
<button
|
|
53
|
+
type="submit"
|
|
54
|
+
name="tool"
|
|
55
|
+
value={isLocked ? 'unlock' : 'lock'}
|
|
56
|
+
className={BUTTON}
|
|
57
|
+
>
|
|
58
|
+
{isLocked
|
|
59
|
+
? fromCopy(copy, 'moderationForm.tool.unlock')
|
|
60
|
+
: fromCopy(copy, 'moderationForm.tool.lock')}
|
|
61
|
+
</button>
|
|
62
|
+
)}
|
|
63
|
+
{rights.stick && (
|
|
64
|
+
<button
|
|
65
|
+
type="submit"
|
|
66
|
+
name="tool"
|
|
67
|
+
value={isSticky ? 'unstick' : 'stick'}
|
|
68
|
+
className={BUTTON}
|
|
117
69
|
>
|
|
118
|
-
{
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
70
|
+
{isSticky
|
|
71
|
+
? fromCopy(copy, 'moderationForm.tool.unpin')
|
|
72
|
+
: fromCopy(copy, 'moderationForm.tool.pin')}
|
|
73
|
+
</button>
|
|
74
|
+
)}
|
|
75
|
+
{rights.delete && (
|
|
76
|
+
<button
|
|
77
|
+
type="submit"
|
|
78
|
+
name="tool"
|
|
79
|
+
value="delete"
|
|
80
|
+
className={`${BUTTON} border-destructive/40 text-destructive`}
|
|
81
|
+
>
|
|
82
|
+
{fromCopy(copy, 'moderationForm.tool.deleteThread')}
|
|
83
|
+
</button>
|
|
84
|
+
)}
|
|
85
|
+
|
|
86
|
+
{rights.move && moveTargets.length > 0 && (
|
|
87
|
+
<span className="flex items-center gap-2">
|
|
88
|
+
<label className="flex items-center gap-2 text-xs">
|
|
89
|
+
<span className="sr-only">{fromCopy(copy, 'moderationForm.moveTo')}</span>
|
|
90
|
+
<select
|
|
91
|
+
name="toForumId"
|
|
92
|
+
className="h-8 rounded-md border border-border bg-background px-2 text-xs focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring"
|
|
93
|
+
>
|
|
94
|
+
{moveTargets.map((forum) => (
|
|
95
|
+
<option key={forum.id} value={forum.id}>
|
|
96
|
+
{forum.title}
|
|
97
|
+
</option>
|
|
98
|
+
))}
|
|
99
|
+
</select>
|
|
100
|
+
</label>
|
|
101
|
+
<button type="submit" name="tool" value="move" className={BUTTON}>
|
|
102
|
+
{fromCopy(copy, 'moderationForm.tool.move')}
|
|
103
|
+
</button>
|
|
104
|
+
<button type="submit" name="tool" value="copy" className={BUTTON}>
|
|
105
|
+
{fromCopy(copy, 'moderationForm.tool.copy')}
|
|
106
|
+
</button>
|
|
107
|
+
</span>
|
|
108
|
+
)}
|
|
131
109
|
</form>
|
|
132
|
-
)}
|
|
133
110
|
|
|
134
|
-
|
|
111
|
+
{children}
|
|
112
|
+
</div>
|
|
113
|
+
|
|
114
|
+
<FormError message={state.error} />
|
|
135
115
|
</section>
|
|
136
116
|
)
|
|
137
117
|
}
|
|
@@ -93,12 +93,12 @@ export interface MarketplaceCatalogView {
|
|
|
93
93
|
function installSteps(kind: ListingKind, packageName: string): readonly string[] {
|
|
94
94
|
return kind === 'plugin'
|
|
95
95
|
? [
|
|
96
|
-
`
|
|
96
|
+
`npm install ${packageName}`,
|
|
97
97
|
`community plugin:add ${packageName}`,
|
|
98
98
|
'Rebuild and redeploy for it to take effect.',
|
|
99
99
|
]
|
|
100
100
|
: [
|
|
101
|
-
`
|
|
101
|
+
`npm install ${packageName}`,
|
|
102
102
|
'Register it in community.config.ts (and set it as defaultTheme if it should be the board default).',
|
|
103
103
|
'Rebuild and redeploy for it to take effect.',
|
|
104
104
|
]
|
|
@@ -6,7 +6,7 @@ import { planUpgrade, type UpgradeState, upgradeNotice } from '@meith/upgrade'
|
|
|
6
6
|
|
|
7
7
|
import { activeDefinitions } from './plugin-host'
|
|
8
8
|
|
|
9
|
-
export const CODE_VERSION = '0.23.
|
|
9
|
+
export const CODE_VERSION = '0.23.2'
|
|
10
10
|
|
|
11
11
|
export async function pendingUpgradeNotice(): Promise<string | null> {
|
|
12
12
|
if (env.DATA_SOURCE !== 'postgres') return null
|
|
@@ -326,8 +326,8 @@ export const SLOT_FIXTURES: { readonly [K in SlotName]?: SlotFixture<K> } = {
|
|
|
326
326
|
},
|
|
327
327
|
|
|
328
328
|
ThreadRow: {
|
|
329
|
-
model: { thread: THREAD, select: null },
|
|
330
|
-
requires: ['Bikeshedding the bike shed', '/thread/91-bikeshedding', '27'],
|
|
329
|
+
model: { thread: { ...THREAD, visibility: 'deleted' }, select: null },
|
|
330
|
+
requires: ['Bikeshedding the bike shed', '/thread/91-bikeshedding', '27', 'data-visibility'],
|
|
331
331
|
},
|
|
332
332
|
|
|
333
333
|
SubforumList: {
|
package/src/view/admin-copy.ts
CHANGED
|
@@ -55,6 +55,14 @@ export function forumAdminCopy(t: Translator = untranslated()): Readonly<Record<
|
|
|
55
55
|
'adminForum.perm.grant',
|
|
56
56
|
'adminForum.perm.deny',
|
|
57
57
|
'adminForum.perm.ancestor',
|
|
58
|
+
'adminForum.permGroup.viewing',
|
|
59
|
+
'adminForum.permGroup.posting',
|
|
60
|
+
'adminForum.permGroup.ownContent',
|
|
61
|
+
'adminForum.permGroup.moderation',
|
|
62
|
+
'adminForum.permGroup.attachments',
|
|
63
|
+
'adminForum.permGroup.approvals',
|
|
64
|
+
'adminForum.permGroup.other',
|
|
65
|
+
'adminForum.inheritsAll',
|
|
58
66
|
'adminForum.copied',
|
|
59
67
|
'adminForum.copyNote',
|
|
60
68
|
'adminForum.topLevel',
|
|
@@ -99,6 +107,7 @@ export function forumAdminCopy(t: Translator = untranslated()): Readonly<Record<
|
|
|
99
107
|
'adminForum.perm.inheritedFrom',
|
|
100
108
|
'adminForum.saveGroup',
|
|
101
109
|
'adminForum.copyTo',
|
|
110
|
+
'adminForum.overridesSet',
|
|
102
111
|
],
|
|
103
112
|
t,
|
|
104
113
|
),
|