@molecule/app-moderation-queue-vue
v1.1.1
Published
Moderation queue UI: flagged items list with approve/reject/escalate/mute actions, severity, and bulk-select
Maintainers
Readme
@molecule/app-moderation-queue-vue
Vue moderation queue UI.
Exports <ModerationQueue> — a list of flagged items with kind icon,
content preview, reason chip, severity color, per-row action buttons
(approve / reject / escalate / mute), and a bulk-select toolbar
(select-all checkbox + apply-to-selected action buttons). It is the Vue
counterpart of @molecule/app-moderation-queue-react: same props (React
names), same DOM for the same input.
All user-visible text is i18n'd via the companion locale bond
@molecule/app-locales-moderation-queue.
Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit
src/index.tsJSDoc, not this file.
Quick Start
import { createApp, defineComponent, h } from 'vue'
import { ModerationQueue, type ModerationItem } from '@molecule/app-moderation-queue-vue'
const items: ModerationItem[] = [
{
id: 'r-1',
kind: 'comment',
preview: h('p', 'Some flagged comment'),
reason: 'Hate speech',
reportedBy: '@alice',
reportedAt: '2 min ago',
severity: 'high',
},
]
const App = defineComponent({
setup() {
return () =>
h(ModerationQueue, {
items,
onApprove: (id) => api.approve(id),
onReject: (id) => api.reject(id),
onEscalate: (id) => api.escalate(id),
onMute: (id) => api.mute(id),
onBulkAction: (action, ids) => api.bulk(action, ids),
})
},
})
createApp(App).mount('#app')Type
feature
Installation
npm install @molecule/app-moderation-queue-vue @molecule/app-ui @molecule/app-ui-vue @molecule/app-vue vueAPI
Interfaces
ModerationItem
One flagged item awaiting moderator review.
interface ModerationItem {
/** Unique id used for selection + action callbacks. */
id: string
/** Content kind, drives icon + kind label. */
kind: ModerationItemKind
/** Pre-rendered preview slot (usually the offending content). */
preview: VNodeChild
/** Reason the item was flagged. Free-form string or pre-rendered node. */
reason: VNodeChild
/** Display name / id of the reporter, optional. */
reportedBy?: VNodeChild
/** When the report was filed (string or pre-formatted node). */
reportedAt: VNodeChild
/** Severity — colors the severity chip. */
severity?: ModerationItemSeverity
}ModerationQueueProps
Props accepted by the {@link ModerationQueue} component — the same props
@molecule/app-moderation-queue-react accepts.
interface ModerationQueueProps {
/** Flagged items to display. */
items: ModerationItem[]
/** Approve the item — content is allowed / kept. */
onApprove: (id: string) => void
/** Reject the item — content is removed / hidden. */
onReject: (id: string) => void
/** Escalate to a senior moderator / human review. Optional. */
onEscalate?: (id: string) => void
/** Mute the reporter / poster. Optional. */
onMute?: (id: string) => void
/** Apply an action to the currently-selected ids, if bulk select is in use. */
onBulkAction?: (action: ModerationBulkAction, ids: string[]) => void
/** Loading state — replaces the list with a spinner row. */
loading?: boolean
/** Empty-state slot rendered when `items` is empty and `loading` is false. */
emptyState?: VNodeChild
/** Extra classes for the outer container. */
className?: string
}Types
ModerationItemKind
Kind of content awaiting moderation. Drives the leading icon glyph
and the row's data-mol-kind attribute used by tests + AI agents.
type ModerationItemKind = 'post' | 'comment' | 'image' | 'message' | 'profile'ModerationItemSeverity
Severity assigned to a flagged item, used to color the severity chip.
Maps to ColorVariant: low→info, medium→warning, high→error.
type ModerationItemSeverity = 'low' | 'medium' | 'high'ModerationBulkAction
Bulk action a moderator can apply to selected ids.
type ModerationBulkAction = 'approve' | 'reject' | 'escalate' | 'mute'Functions
severityColor(severity)
Translates a severity to its ColorVariant. Exported for tests and
downstream consumers (chips, badges, summary tiles).
function severityColor(severity: ModerationItemSeverity | undefined): ColorVariantseverity— Severity bucket ('low','medium','high') or undefined.
Returns: Mapped ColorVariant, defaulting to 'info' when severity is omitted.
Constants
ModerationQueue
Moderation queue — a list of flagged items with kind icon, content preview, reason chip, severity color, per-row action buttons (approve / reject / escalate / mute), and a bulk-select toolbar (select-all checkbox + apply-to-selected action buttons).
All user-visible text comes from i18n keys in
@molecule/app-locales-moderation-queue. Styling is driven exclusively
through getClassMap().
const ModerationQueue: DefineComponent<
ExtractPropTypes<{
items: { type: PropType<ModerationItem[]>; required: true }
onApprove: { type: PropType<(id: string) => void>; required: true }
onReject: { type: PropType<(id: string) => void>; required: true }
onEscalate: { type: PropType<(id: string) => void>; default: undefined }
onMute: { type: PropType<(id: string) => void>; default: undefined }
onBulkAction: {
type: PropType<(action: ModerationBulkAction, ids: string[]) => void>
default: undefined
}
loading: { type: BooleanConstructor; default: boolean }
emptyState: null
className: StringConstructor
}>,
() => VNode,
{},
{},
{},
ComponentOptionsMixin,
ComponentOptionsMixin,
{},
string,
PublicProps,
Readonly<
ExtractPropTypes<{
items: { type: PropType<ModerationItem[]>; required: true }
onApprove: { type: PropType<(id: string) => void>; required: true }
onReject: { type: PropType<(id: string) => void>; required: true }
onEscalate: { type: PropType<(id: string) => void>; default: undefined }
onMute: { type: PropType<(id: string) => void>; default: undefined }
onBulkAction: {
type: PropType<(action: ModerationBulkAction, ids: string[]) => void>
default: undefined
}
loading: { type: BooleanConstructor; default: boolean }
emptyState: null
className: StringConstructor
}>
> &
Readonly<{}>,
{
onEscalate: (id: string) => void
onMute: (id: string) => void
onBulkAction: (action: ModerationBulkAction, ids: string[]) => void
loading: boolean
},
{},
{},
{},
string,
ComponentProvideOptions,
true,
{},
any
>props— Component props (see {@link ModerationQueueProps} in./types.js).
Returns: The moderation queue component.
Injection Notes
Requirements
Peer dependencies:
@molecule/app-ui^1.0.1@molecule/app-ui-vue^1.1.0@molecule/app-vue^3.5.0 || ^4.0.0vue^3.4.0
Runtime Dependencies
@molecule/app-ui@molecule/app-ui-vue@molecule/app-vuevueRequires a bonded ClassMap — rendering throws otherwise.
Selection state is internal (React's
useState): the component reports a bulk action throughonBulkActionand clears the selection afterwards.Node-valued item fields (
preview,reason,reportedBy,reportedAt) andemptyStatetake VNodes or plain text.
Translations
Translation strings are provided by @molecule/app-locales-moderation-queue.
