Mark merchant vs trade site listings

Fixes #563
This commit is contained in:
kvan7
2025-08-22 21:47:13 -05:00
parent 3a64e003f6
commit b0ceb4efde
6 changed files with 22 additions and 3 deletions

View File

@@ -39,12 +39,14 @@
"Update to 2" "Update to 2"
], ],
"cSpell.words": [ "cSpell.words": [
"Atzoatl",
"corruptionjewel", "corruptionjewel",
"Defences", "Defences",
"DIVCARD", "DIVCARD",
"divinable", "divinable",
"edps", "edps",
"ilvl", "ilvl",
"Kalandra",
"keybinds", "keybinds",
"Knockback", "Knockback",
"nonunique", "nonunique",

View File

@@ -35,6 +35,7 @@ export function createFilters(
trade: { trade: {
offline: false, offline: false,
onlineInLeague: false, onlineInLeague: false,
merchant: false,
listed: undefined, listed: undefined,
currency: opts.currency, currency: opts.currency,
league: opts.league, league: opts.league,

View File

@@ -79,6 +79,7 @@ export interface ItemFilters {
trade: { trade: {
offline: boolean; offline: boolean;
onlineInLeague: boolean; onlineInLeague: boolean;
merchant: boolean;
listed: string | undefined; listed: string | undefined;
currency: string | undefined; currency: string | undefined;
league: string; league: string;

View File

@@ -8,7 +8,7 @@
<td class="px-2 whitespace-nowrap"> <td class="px-2 whitespace-nowrap">
<span <span
:class="{ :class="{
'line-through': result.priceCurrency === 'chaos', 'line-through': false,
}" }"
>{{ result.priceAmount }} {{ result.priceCurrency }}</span >{{ result.priceAmount }} {{ result.priceCurrency }}</span
> >
@@ -47,7 +47,10 @@
</td> </td>
<td class="pr-2 pl-4 whitespace-nowrap"> <td class="pr-2 pl-4 whitespace-nowrap">
<div class="inline-flex items-center"> <div class="inline-flex items-center">
<div class="account-status" :class="result.accountStatus"></div> <div
class="account-status"
:class="result.isMerchant ? 'merchant' : result.accountStatus"
></div>
<div class="ml-1 font-sans text-xs"> <div class="ml-1 font-sans text-xs">
{{ result.relativeDate }} {{ result.relativeDate }}
</div> </div>

View File

@@ -430,10 +430,14 @@ export default defineComponent({
height: 0.375rem; height: 0.375rem;
border-radius: 100%; border-radius: 100%;
&.online { &.merchant {
/* */ /* */
} }
&.online {
@apply bg-pink-400;
}
&.offline { &.offline {
@apply bg-red-600; @apply bg-red-600;
} }

View File

@@ -29,6 +29,7 @@ import { ModifierType } from "@/parser/modifiers";
import { Cache } from "./Cache"; import { Cache } from "./Cache";
import { filterInPseudo } from "../filters/pseudo"; import { filterInPseudo } from "../filters/pseudo";
import { parseAffixStrings } from "@/parser/Parser"; import { parseAffixStrings } from "@/parser/Parser";
import { rand } from "@vueuse/core";
export const CATEGORY_TO_TRADE_ID = new Map([ export const CATEGORY_TO_TRADE_ID = new Map([
[ItemCategory.Map, "map"], [ItemCategory.Map, "map"],
@@ -287,6 +288,7 @@ export interface PricingResult {
priceCurrency: string; priceCurrency: string;
isMine: boolean; isMine: boolean;
hasNote: boolean; hasNote: boolean;
isMerchant: boolean;
accountName: string; accountName: string;
accountStatus: "offline" | "online" | "afk"; accountStatus: "offline" | "online" | "afk";
ign: string; ign: string;
@@ -317,6 +319,11 @@ export function createTradeRequest(
}; };
const { query } = body; const { query } = body;
if (filters.trade.merchant) {
// FIXME: actually do something
console.log("do something cause merchant");
}
if (filters.trade.currency) { if (filters.trade.currency) {
propSet( propSet(
query.filters, query.filters,
@@ -1021,6 +1028,7 @@ export async function requestResults(
priceCurrency: result.listing.price?.currency ?? "no price", priceCurrency: result.listing.price?.currency ?? "no price",
hasNote: result.item.note != null, hasNote: result.item.note != null,
isMine: result.listing.account.name === opts.accountName, isMine: result.listing.account.name === opts.accountName,
isMerchant: rand(0, 2) !== 0,
ign: result.listing.account.lastCharacterName, ign: result.listing.account.lastCharacterName,
accountName: result.listing.account.name, accountName: result.listing.account.name,
accountStatus: result.listing.account.online accountStatus: result.listing.account.online