mirror of
https://github.com/Kvan7/Exiled-Exchange-2.git
synced 2026-09-21 04:05:48 +00:00
add currency type filter, closes #753
This commit is contained in:
@@ -103,14 +103,20 @@ export default defineComponent({
|
||||
// FiltersBlock.vue
|
||||
const filtersBlock = ref<ComponentPublicInstance<{}, {}>>(null!)
|
||||
|
||||
watch(() => props.item, (item) => {
|
||||
watch(() => props.item, (item, prevItem) => {
|
||||
presets.value = createPresets(item, {
|
||||
league: selectedLeague.value!,
|
||||
chaosPriceThreshold: widget.value.chaosPriceThreshold,
|
||||
collapseListings: widget.value.collapseListings,
|
||||
activateStockFilter: widget.value.activateStockFilter,
|
||||
searchStatRange: widget.value.searchStatRange,
|
||||
useEn: (AppConfig().language === 'cmn-Hant' && AppConfig().realm === 'pc-ggg')
|
||||
useEn: (AppConfig().language === 'cmn-Hant' && AppConfig().realm === 'pc-ggg'),
|
||||
currency: (prevItem &&
|
||||
item.info.namespace === prevItem.info.namespace &&
|
||||
item.info.refName === prevItem.info.refName &&
|
||||
presets.value.presets.length === 1)
|
||||
? presets.value.presets[0].filters.trade.currency
|
||||
: undefined
|
||||
})
|
||||
|
||||
if ((!props.advancedCheck && !widget.value.smartInitialSearch) ||
|
||||
|
||||
@@ -10,6 +10,7 @@ export const SPECIAL_SUPPORT_GEM = ['Empower Support', 'Enlighten Support', 'Enh
|
||||
interface CreateOptions {
|
||||
league: string
|
||||
chaosPriceThreshold: number
|
||||
currency: string | undefined
|
||||
collapseListings: 'app' | 'api'
|
||||
activateStockFilter: boolean
|
||||
exact: boolean
|
||||
@@ -26,6 +27,7 @@ export function createFilters (
|
||||
offline: false,
|
||||
onlineInLeague: PERMANENT_LEAGUES.includes(opts.league),
|
||||
listed: undefined,
|
||||
currency: opts.currency,
|
||||
league: opts.league,
|
||||
chaosPriceThreshold: opts.chaosPriceThreshold,
|
||||
collapseListings: opts.collapseListings
|
||||
|
||||
@@ -11,6 +11,7 @@ export function createPresets (
|
||||
opts: {
|
||||
league: string
|
||||
chaosPriceThreshold: number
|
||||
currency: string | undefined
|
||||
collapseListings: 'app' | 'api'
|
||||
activateStockFilter: boolean
|
||||
searchStatRange: number
|
||||
|
||||
@@ -68,6 +68,7 @@ export interface ItemFilters {
|
||||
offline: boolean
|
||||
onlineInLeague: boolean
|
||||
listed: string | undefined
|
||||
currency: string | undefined
|
||||
league: string
|
||||
chaosPriceThreshold: number
|
||||
collapseListings: 'api' | 'app'
|
||||
|
||||
@@ -22,12 +22,17 @@
|
||||
</template>
|
||||
</div>
|
||||
<div class="flex flex-col gap-y-1">
|
||||
<div class="mb-1 h-6">
|
||||
<ui-toggle v-if="!filters.trade.offline"
|
||||
<div class="mb-1">
|
||||
<ui-toggle :class="{ 'invisible': filters.trade.offline }"
|
||||
v-model="filters.trade.onlineInLeague">{{ t('In League') }}</ui-toggle>
|
||||
</div>
|
||||
<ui-radio v-for="league of tradeLeagues" :key="league.id"
|
||||
v-model="filters.trade.league" :value="league.id">{{ league.id }}</ui-radio>
|
||||
<template v-if="byTime">
|
||||
<ui-radio class="mt-3" v-model="filters.trade.currency" :value="undefined">{{ t('Any Currency') }}</ui-radio>
|
||||
<ui-radio v-model="filters.trade.currency" value="chaos">{{ t('Chaos Orb') }}</ui-radio>
|
||||
<ui-radio v-model="filters.trade.currency" value="divine">{{ t('Divine Orb') }}</ui-radio>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -73,7 +78,10 @@ export default defineComponent({
|
||||
"3 Days Ago": "До 3-х дней",
|
||||
"1 Week Ago": "До 1-й недели",
|
||||
"2 Weeks Ago": "До 2-х недель",
|
||||
"1 Month Ago": "До 1-го месяца"
|
||||
"1 Month Ago": "До 1-го месяца",
|
||||
"Any Currency": "Любая валюта",
|
||||
"Chaos Orb": "Сфера хаоса",
|
||||
"Divine Orb": "Божествен. сфера"
|
||||
}
|
||||
}
|
||||
</i18n>
|
||||
|
||||
@@ -257,7 +257,11 @@ export function createTradeRequest (filters: ItemFilters, stats: StatFilter[], i
|
||||
}
|
||||
const { query } = body
|
||||
|
||||
if (filters.trade.chaosPriceThreshold !== 0) {
|
||||
if (filters.trade.currency) {
|
||||
propSet(query.filters, 'trade_filters.filters.price.option', filters.trade.currency)
|
||||
}
|
||||
|
||||
if (filters.trade.chaosPriceThreshold !== 0 && filters.trade.currency !== 'divine') {
|
||||
propSet(query.filters, 'trade_filters.filters.price.min', filters.trade.chaosPriceThreshold)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user