moderator-toolbox-nxg-for-reddit / modules/usernotes/components/AddUserNotePopup

modules/usernotes/components/AddUserNotePopup

Functions

AddUserNotePopup()

AddUserNotePopup(__namedParameters): Element

Defined in: extension/data/modules/usernotes/components/AddUserNotePopup.tsx:111

Renders a draggable popup with Toolbox and Native Notes tabs for adding, editing, and viewing usernotes.

Parameters

__namedParameters

AddUserNotePopupProps

Returns

Element


showAddUserNotePopup()

showAddUserNotePopup(props): () => void

Defined in: extension/data/modules/usernotes/components/AddUserNotePopup.tsx:776

Mounts the AddUserNotePopup as a managed popup and returns a cleanup function.

Parameters

props

Omit<AddUserNotePopupProps, "onClose">

Popup props; onClose is supplied by the popup manager.

Returns

() => void

Interfaces

AddUserNotePopupProps

Defined in: extension/data/modules/usernotes/components/AddUserNotePopup.tsx:38

Props for the AddUserNotePopup component.

Properties

archivingAvailable?

optional archivingAvailable?: boolean

Defined in: extension/data/modules/usernotes/components/AddUserNotePopup.tsx:90

Whether archiving is available (NXG-canonical layouts only; the legacy v6 page can’t carry archive attributions).

colors

colors: UserNoteColor[]

Defined in: extension/data/modules/usernotes/components/AddUserNotePopup.tsx:52

Available note type colors for the subreddit.

contextID?

optional contextID?: string

Defined in: extension/data/modules/usernotes/components/AddUserNotePopup.tsx:97

Reddit fullname of the linked thing (e.g. a comment or post), used as context for the note.

currentUser?

optional currentUser?: string

Defined in: extension/data/modules/usernotes/components/AddUserNotePopup.tsx:92

The acting moderator’s username, for local attribution display.

findColor

findColor: (key) => UserNoteColor

Defined in: extension/data/modules/usernotes/components/AddUserNotePopup.tsx:56

Resolves a note type key to its color/label definition.

Parameters
key

string

Returns

UserNoteColor

initialNotes

initialNotes: ExistingNote[]

Defined in: extension/data/modules/usernotes/components/AddUserNotePopup.tsx:54

Existing notes to show in the history pane.

initialPosition

initialPosition: object

Defined in: extension/data/modules/usernotes/components/AddUserNotePopup.tsx:50

Where to position the draggable popup on initial render.

left

left: number

top

top: number

initialTabIndex?

optional initialTabIndex?: number

Defined in: extension/data/modules/usernotes/components/AddUserNotePopup.tsx:99

Tab index to open by default (0 = Toolbox Notes, 1 = Native Notes).

onArchiveNote?

optional onArchiveNote?: (noteId) => Promise<void>

Defined in: extension/data/modules/usernotes/components/AddUserNotePopup.tsx:83

Archives a note (hidden but kept). Only provided when the layout supports it.

Parameters
noteId

number

Returns

Promise<void>

onClose

onClose: () => void

Defined in: extension/data/modules/usernotes/components/AddUserNotePopup.tsx:95

Returns

void

onEditNote

onEditNote: (noteId, data) => Promise<void>

Defined in: extension/data/modules/usernotes/components/AddUserNotePopup.tsx:75

Called when the moderator edits a recently-created note.

Parameters
noteId

number

The note’s per-user index.

data
note

string

type

string | undefined

Returns

Promise<void>

onRefreshNotes?

optional onRefreshNotes?: () => Promise<ExistingNote[]>

Defined in: extension/data/modules/usernotes/components/AddUserNotePopup.tsx:94

Called after mount to replace the initial history with freshly loaded Toolbox notes.

Returns

Promise<ExistingNote[]>

onRemoveNote

onRemoveNote: (noteId) => Promise<void>

Defined in: extension/data/modules/usernotes/components/AddUserNotePopup.tsx:81

Called when the moderator deletes a note. Deletion is real - the note is removed from the wiki (its index is never reused).

Parameters
noteId

number

The note’s per-user index.

Returns

Promise<void>

onSave

onSave: (data) => Promise<void | ExistingNote>

Defined in: extension/data/modules/usernotes/components/AddUserNotePopup.tsx:61

Called when the moderator saves a new note.

Parameters
data
banMessage

string

note

string

triggerBan

boolean

type

string | undefined

Returns

Promise<void | ExistingNote>

The saved note (with server-assigned id/time), or void on failure.

onUnarchiveNote?

optional onUnarchiveNote?: (noteId) => Promise<void>

Defined in: extension/data/modules/usernotes/components/AddUserNotePopup.tsx:85

Clears a note’s archived state.

Parameters
noteId

number

Returns

Promise<void>

subreddit

subreddit: string

Defined in: extension/data/modules/usernotes/components/AddUserNotePopup.tsx:39

subRequire?

optional subRequire?: SubUsernoteRequire

Defined in: extension/data/modules/usernotes/components/AddUserNotePopup.tsx:107

The subreddit’s usernote save-requirement flags and enforcement mode. Combined with the acting moderator’s personal settings to decide whether a type/text/link is required before saving; see resolveUsernoteRequirements.

targetIsMod?

optional targetIsMod?: boolean

Defined in: extension/data/modules/usernotes/components/AddUserNotePopup.tsx:101

When true, auto-ban options are suppressed since mods cannot be banned.

user

user: string

Defined in: extension/data/modules/usernotes/components/AddUserNotePopup.tsx:40