Compare commits
No commits in common. "36bf5ece75ad896004ef8166aad6eea66b987f69" and "dc499be4b77070a51f5393c0c787383d05099023" have entirely different histories.
36bf5ece75
...
dc499be4b7
|
@ -1,5 +1,5 @@
|
|||
import {Component} from "preact";
|
||||
import {fromStorage, Feature, ReplacementType} from "../../storage/exports.js";
|
||||
import {fromStorage, Feature} from "../../storage/exports.js";
|
||||
import {Setting, type SettingProps} from "./index.js";
|
||||
|
||||
type State = {
|
||||
|
@ -39,13 +39,6 @@ export class AnonymizeUsernamesSetting extends Component<SettingProps, State> {
|
|||
}
|
||||
|
||||
const replacementType = data.value.replacementType;
|
||||
const replacementTypeOptions = Object.values(ReplacementType).map((key) => (
|
||||
<option selected={key === replacementType} value={key}>
|
||||
{key
|
||||
.replace(/-/g, " ")
|
||||
.replace(/(\b[a-z])/gi, (character) => character.toUpperCase())}
|
||||
</option>
|
||||
));
|
||||
|
||||
return (
|
||||
<Setting {...this.props}>
|
||||
|
@ -59,7 +52,15 @@ export class AnonymizeUsernamesSetting extends Component<SettingProps, State> {
|
|||
<ul class="checkbox-list">
|
||||
<li>
|
||||
<select onChange={this.replacementTypeChanged}>
|
||||
{replacementTypeOptions}
|
||||
<option
|
||||
selected={replacementType === "numerical"}
|
||||
value="numerical"
|
||||
>
|
||||
Numerical
|
||||
</option>
|
||||
<option selected={replacementType === "hashed"} value="hashed">
|
||||
Hashed
|
||||
</option>
|
||||
</select>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
/**
|
||||
* The different types of username replacements for the Anonymize Usernames
|
||||
* feature.
|
||||
*/
|
||||
export enum ReplacementType {
|
||||
Hashed = "hashed",
|
||||
Numerical = "numerical",
|
||||
}
|
||||
|
||||
/**
|
||||
* Type guard check to see if a string is a valid {@link ReplacementType}.
|
||||
* @param input The string to check.
|
||||
*/
|
||||
export function isReplacementType(input: string): input is ReplacementType {
|
||||
return Object.values(ReplacementType).includes(input as ReplacementType);
|
||||
}
|
||||
|
||||
/**
|
||||
* The data stored for the Anonymize Usernames feature.
|
||||
*/
|
||||
export type AnonymizeUsernamesData = {
|
||||
replacementType: ReplacementType;
|
||||
};
|
|
@ -1,18 +1,23 @@
|
|||
import {createValue, type Value} from "@holllo/webextension-storage";
|
||||
import browser from "webextension-polyfill";
|
||||
import {type AnonymizeUsernamesData} from "./anonymize-usernames.js";
|
||||
import {Data, Feature, MiscellaneousFeature} from "./enums.js";
|
||||
import {collectHideTopicsData} from "./hide-topics.js";
|
||||
import {defaultKnownGroups} from "./known-groups.js";
|
||||
import {collectUsernameColors} from "./username-color.js";
|
||||
import {collectUserLabels} from "./user-label.js";
|
||||
|
||||
export * from "./anonymize-usernames.js";
|
||||
export * from "./enums.js";
|
||||
export * from "./hide-topics.js";
|
||||
export * from "./username-color.js";
|
||||
export * from "./user-label.js";
|
||||
|
||||
/**
|
||||
* The data stored for the Anonymize Usernames feature.
|
||||
*/
|
||||
export type AnonymizeUsernamesData = {
|
||||
replacementType: "numerical" | "hashed";
|
||||
};
|
||||
|
||||
/**
|
||||
* The data stored for the Hide Votes feature.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue