Refactor code for consistency: standardize formatting and improve readability across multiple Svelte components
Some checks failed
SteamWarCI Build failed
Some checks failed
SteamWarCI Build failed
This commit is contained in:
@@ -18,24 +18,22 @@
|
||||
-->
|
||||
|
||||
<script lang="ts">
|
||||
import {permissions} from "@stores/stores.ts";
|
||||
import {Select, SelectContent, SelectItem} from "@components/ui/select";
|
||||
import {SelectTrigger} from "@components/ui/select/index.js";
|
||||
import {permsRepo} from "@repo/perms.ts";
|
||||
import { permissions } from "@stores/stores.ts";
|
||||
import { Select, SelectContent, SelectItem } from "@components/ui/select";
|
||||
import { SelectTrigger } from "@components/ui/select/index.js";
|
||||
import { permsRepo } from "@repo/perms.ts";
|
||||
|
||||
const {
|
||||
perms, uuid
|
||||
}: { perms: string[], uuid: string } = $props();
|
||||
const { perms, uuid }: { perms: string[]; uuid: string } = $props();
|
||||
|
||||
let value = $state(perms);
|
||||
let prevValue = $state(perms);
|
||||
|
||||
function onChange(change: string[]) {
|
||||
$permissions.perms.forEach(perm => {
|
||||
$permissions.perms.forEach((perm) => {
|
||||
if (prevValue.includes(perm) && !change.includes(perm)) {
|
||||
$permsRepo.removePerm(uuid, perm)
|
||||
$permsRepo.removePerm(uuid, perm);
|
||||
} else if (!prevValue.includes(perm) && change.includes(perm)) {
|
||||
$permsRepo.addPerm(uuid, perm)
|
||||
$permsRepo.addPerm(uuid, perm);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -53,4 +51,4 @@
|
||||
<SelectItem value={permission}>{permission}</SelectItem>
|
||||
{/each}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</Select>
|
||||
|
||||
Reference in New Issue
Block a user