3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-11 04:45:02 +00:00

Reformat all files with Prettier

This commit is contained in:
Dragory 2021-09-11 19:06:51 +03:00
parent 0cde0d46d2
commit ac79eb09f5
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
206 changed files with 727 additions and 888 deletions

View file

@ -7,23 +7,23 @@ export type LevelEntry = [string, number]; // id, level
export function Levels({ levels, setLevels }) {
function addLevel() {
setLevels(arr => [...arr, ["", LEVEL_MODERATOR]]);
setLevels((arr) => [...arr, ["", LEVEL_MODERATOR]]);
}
function removeLevel(index) {
setLevels(arr => [...arr].splice(index, 1));
setLevels((arr) => [...arr].splice(index, 1));
}
function updateLevelId(index, id) {
const validId = id.replace(/[^0-9]/g, "");
setLevels(arr => {
setLevels((arr) => {
arr[index][0] = validId;
return [...arr];
});
}
function updateLevelLevel(index, level) {
setLevels(arr => {
setLevels((arr) => {
arr[index][1] = parseInt(level, 10);
return [...arr];
});
@ -33,8 +33,8 @@ export function Levels({ levels, setLevels }) {
<div>
{levels.map(([id, level], index) => (
<div key={index}>
<input value={id} onChange={e => updateLevelId(index, e.target.value)} />
<select value={level} onChange={e => updateLevelLevel(index, e.target.value)}>
<input value={id} onChange={(e) => updateLevelId(index, e.target.value)} />
<select value={level} onChange={(e) => updateLevelLevel(index, e.target.value)}>
<option value={LEVEL_ADMIN}>Admin</option>
<option value={LEVEL_MODERATOR}>Moderator</option>
</select>