import {Component} from "preact"; import { fromStorage, isReplacementType, Feature, ReplacementType, } from "../../storage/exports.js"; import {Setting, type SettingProps} from "./index.js"; type State = { data?: Awaited>>; }; export class AnonymizeUsernamesSetting extends Component { constructor(props: SettingProps) { super(props); this.state = { data: undefined, }; } async componentDidMount(): Promise { const data = await fromStorage(Feature.AnonymizeUsernames); this.setState({data}); } replacementTypeChanged = async (event: Event) => { const newValue = (event.target as HTMLInputElement)!.value; const {data} = this.state; if (data === undefined || !isReplacementType(newValue)) { return; } data.value.replacementType = newValue; await data.save(); this.setState({data}); }; render() { const {data} = this.state; if (data === undefined) { return; } const replacementType = data.value.replacementType; const replacementTypeOptions = Object.values(ReplacementType).map((key) => ( )); return (

Anonymizes usernames by replacing them with "Anonymous #".
Note that User Labels and Username Colors will still be applied to any usernames as normal.

); } }