Skip to content

Commit ac57776

Browse files
committed
feat(ui): drop CS flag
1 parent a5e740e commit ac57776

File tree

2 files changed

+11
-43
lines changed

2 files changed

+11
-43
lines changed

frontend_vue/src/components/SearchFilterTokensHeader.vue

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,14 @@
4646
<script setup lang="ts">
4747
import { ref, computed, watch } from 'vue';
4848
import type { ComputedRef } from 'vue';
49-
import type {
50-
TokenServicesType,
51-
TokenServiceType,
52-
} from '@/utils/tokenServices';
49+
import type { TokenServicesType } from '@/utils/tokenServices';
5350
import { tokenServices } from '@/utils/tokenServices';
54-
import { TOKENS_TYPE } from '@/components/constants.ts';
5551
import SearchBar from '@/components/ui/SearchBar.vue';
5652
import FilterButton from '@/components/ui/FilterButton.vue';
5753
import { TOKEN_CATEGORY } from '@/components/constants.ts';
5854
import { sqlInjectionPattern } from '@/utils/utils';
5955
import { debounce } from '@/utils/utils';
6056
61-
const props = defineProps<{
62-
showCrowdstrike?: boolean;
63-
}>();
64-
6557
const emits = defineEmits([
6658
'filtered-list',
6759
'filter-category',
@@ -72,22 +64,12 @@ const emits = defineEmits([
7264
const filterValue = ref('');
7365
const searchValue = ref('');
7466
75-
const availableTokenServices = computed(() => {
76-
if (props.showCrowdstrike) {
77-
return tokenServices;
78-
}
79-
const { [TOKENS_TYPE.CROWDSTRIKE_CC]: _, ...rest } = tokenServices;
80-
return rest;
81-
});
82-
83-
const filteredList: ComputedRef<
84-
TokenServicesType | [string, TokenServiceType]
85-
> = computed(() => {
86-
const filteredByCategory = filterByCategory(availableTokenServices.value);
87-
const filteredBySearch = filterBySearch(availableTokenServices.value);
67+
const filteredList: ComputedRef<TokenServicesType> = computed(() => {
68+
const filteredByCategory = filterByCategory(tokenServices);
69+
const filteredBySearch = filterBySearch(tokenServices);
8870
8971
if (!filterValue.value && !searchValue.value) {
90-
return availableTokenServices.value;
72+
return tokenServices;
9173
}
9274
9375
if (filterValue.value && !searchValue.value) {
@@ -101,11 +83,11 @@ const filteredList: ComputedRef<
10183
return filterBySearch(filteredByCategory);
10284
});
10385
104-
function filterBySearch(list: TokenServicesType) {
86+
function filterBySearch(list: TokenServicesType): TokenServicesType {
10587
if (!searchValue.value) {
10688
return list;
10789
}
108-
return Object.entries(list).reduce((acc, [key, val]) => {
90+
return Object.entries(list).reduce<TokenServicesType>((acc, [key, val]) => {
10991
if (val.label.toLowerCase().includes(searchValue.value.toLowerCase())) {
11092
return { ...acc, [key]: val };
11193
}
@@ -121,11 +103,11 @@ function filterBySearch(list: TokenServicesType) {
121103
}, {});
122104
}
123105
124-
function filterByCategory(list: TokenServicesType) {
106+
function filterByCategory(list: TokenServicesType): TokenServicesType {
125107
if (!filterValue.value) {
126108
return list;
127109
}
128-
return Object.entries(list).reduce((acc, [key, val]) => {
110+
return Object.entries(list).reduce<TokenServicesType>((acc, [key, val]) => {
129111
if (
130112
Array.isArray(val.category) &&
131113
val.category.includes(filterValue.value)

frontend_vue/src/views/HomeView.vue

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
</h2>
2626
</div>
2727
<SearchFilterTokensHeader
28-
:show-crowdstrike="showCrowdStrike"
2928
@filtered-list="filteredList = $event"
3029
@filter-search="searchValue = $event"
3130
@filter-category="filterValue = $event"
@@ -64,36 +63,23 @@
6463
</template>
6564

6665
<script setup lang="ts">
67-
import { ref, watch, computed } from 'vue';
66+
import { ref, watch } from 'vue';
6867
import type { Ref } from 'vue';
69-
import { useRoute } from 'vue-router';
7068
import { tokenServices } from '@/utils/tokenServices';
7169
import type {
7270
TokenServicesType,
7371
TokenServiceType,
7472
} from '@/utils/tokenServices';
75-
import { TOKENS_TYPE } from '@/components/constants';
7673
import AppLayoutGrid from '@/layout/AppLayoutGrid.vue';
7774
import CardToken from '@/components/ui/CardToken.vue';
7875
import { useModal } from 'vue-final-modal';
7976
import ModalToken from '@/components/ModalToken.vue';
8077
import SearchFilterTokensHeader from '@/components/SearchFilterTokensHeader.vue';
8178
import solitaireVictory from '@/utils/solitaireVictory';
8279
83-
const route = useRoute();
84-
const showCrowdStrike = computed(() => route.query.crowdstrike === '1');
85-
86-
const initialTokenServices = computed(() => {
87-
if (showCrowdStrike.value) {
88-
return tokenServices;
89-
}
90-
const { [TOKENS_TYPE.CROWDSTRIKE_CC]: _, ...rest } = tokenServices;
91-
return rest;
92-
});
93-
9480
const filterValue = ref('');
9581
const searchValue = ref('');
96-
const filteredList: Ref<TokenServicesType> = ref(initialTokenServices.value);
82+
const filteredList: Ref<TokenServicesType> = ref(tokenServices);
9783
const animationType = ref('move-grid');
9884
9985
function handleClickToken(selectedToken: string) {

0 commit comments

Comments
 (0)