refactor(web): key actions component filter props

This commit is contained in:
Zack Spear
2023-09-27 20:13:23 -07:00
committed by Zack Spear
parent c1b509220e
commit 2581254a02

View File

@@ -3,16 +3,28 @@ import { storeToRefs } from 'pinia';
import { useServerStore } from '~/store/server';
defineProps<{
const props = defineProps<{
filterBy?: string[] | undefined;
filterOut?: string[] | undefined;
t: any;
}>();
const { keyActions } = storeToRefs(useServerStore());
const filteredKeyActions = computed(() => {
if (!keyActions.value || (!props.filterOut && !props.filterBy)) return keyActions.value;
return keyActions.value.filter((action: { name: string; }) => {
return props.filterOut
? !props.filterOut?.includes(action.name)
: props.filterBy?.includes(action.name);
});
});
</script>
<template>
<ul v-if="keyActions" class="flex flex-col gap-y-8px">
<li v-for="action in keyActions" :key="action.name">
<ul v-if="filteredKeyActions" class="flex flex-col gap-y-8px">
<li v-for="action in filteredKeyActions" :key="action.name">
<BrandButton
class="w-full sm:max-w-300px"
:disabled="action?.disabled"