moderator-toolbox-nxg-for-reddit / modules/proposals/components/proposalFilter

modules/proposals/components/proposalFilter

Functions

filterOptions()

filterOptions(items): FilterOptions

Defined in: extension/data/modules/proposals/components/proposalFilter.ts:40

Derives the distinct subreddits, action types, and sources present in a list, so the filter dropdowns only offer values that would actually match something.

Parameters

items

ProposalAt[]

The (unfiltered) proposals for the current view.

Returns

FilterOptions


filterSortProposals()

filterSortProposals(items, f): ProposalAt[]

Defined in: extension/data/modules/proposals/components/proposalFilter.ts:63

Applies the active filters and sort to a list of proposals. Does not mutate the input.

Parameters

items

ProposalAt[]

The proposals to narrow.

f

ProposalFilters

The active filter/sort selection.

Returns

ProposalAt[]

Interfaces

FilterOptions

Defined in: extension/data/modules/proposals/components/proposalFilter.ts:29

The set of selectable options derived from a list of proposals (for the dropdowns).

Properties

actionTypes

actionTypes: object[]

Defined in: extension/data/modules/proposals/components/proposalFilter.ts:31

label

label: string

value

value: "approve" | "remove" | "ban" | "mute" | "unmute" | "lock" | "removal-reason" | "unlock" | "distinguish" | "marknsfw" | "sticky" | "unban" | "userflair"

sources

sources: ProposalSource[]

Defined in: extension/data/modules/proposals/components/proposalFilter.ts:32

subreddits

subreddits: string[]

Defined in: extension/data/modules/proposals/components/proposalFilter.ts:30


ProposalFilters

Defined in: extension/data/modules/proposals/components/proposalFilter.ts:14

Active filter/sort selection; empty string means “no filter on this field”.

Properties

actionType

actionType: "" | "approve" | "remove" | "ban" | "mute" | "unmute" | "lock" | "removal-reason" | "unlock" | "distinguish" | "marknsfw" | "sticky" | "unban" | "userflair"

Defined in: extension/data/modules/proposals/components/proposalFilter.ts:18

Restrict to one action type, or ‘’ for all.

sort

sort: "newest" | "oldest"

Defined in: extension/data/modules/proposals/components/proposalFilter.ts:22

Age ordering.

source

source: "" | ProposalSource

Defined in: extension/data/modules/proposals/components/proposalFilter.ts:20

Restrict to one source (training/second-opinion), or ‘’ for all.

subreddit

subreddit: string

Defined in: extension/data/modules/proposals/components/proposalFilter.ts:16

Restrict to one subreddit (case-insensitive), or ‘’ for all.

Variables

defaultFilters

const defaultFilters: ProposalFilters

Defined in: extension/data/modules/proposals/components/proposalFilter.ts:26

The default (no filters, newest first).