Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 28 additions & 6 deletions components/filters/SearchValueMarketplaceFilter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,22 @@
:label="$t('searchValue')"
/>
<!-- Marketplace select -->
<UiMultiSelect
v-model="selectedMarketplaces"
:options="resolvedMarketplaceOptions"
:label="$t('marketplace')"
override-value="all"
/>
<div class="flex">
<div class="mr-6 w-20">
<UiCheckbox
v-model="isEbay"
:label="$t('useEbayMarketplace')"
/>
</div>
<UiMultiSelect

v-model="selectedMarketplaces"
:disabled="isEbay"
:options="resolvedMarketplaceOptions"
:label="$t('marketplace')"
override-value="all"
/>
</div>
<!-- Search Frequency -->
<UiDropdown
v-if="premiumMarkets"
Expand All @@ -35,12 +45,24 @@ const hasBasicPlan = useUserStore().currentPlan?.product == 'basic' || !useUserS

const premiumMarkets = ref(false)
const model = defineModel<Filter>()
const isEbay = ref(false)

const resolvedMarketplaceOptions = ref<Options[]>(detectLocationNA() ? usMarketplaces : marketplaces)

const selectedMarketplaces = ref<Options[]>([])

watch(isEbay, (newVal) => {
if (newVal) {
model.value!.marketplace = 'Ebay'
}
})

watch(() => model.value!.marketplace, () => {
if (model.value?.marketplace == 'Ebay') {
isEbay.value = true
return
}

selectedMarketplaces.value = []
model.value?.marketplace.split(',').map((condidtionName) => {
const item = resolvedMarketplaceOptions.value.find(m => m.value == condidtionName)
Expand Down
2 changes: 1 addition & 1 deletion components/ui/Checkbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
>
<Icon
name="tabler:check"
class="size-4 text-slate-100"
class="size-6 text-slate-100"
:class="!modelValue ? 'invisible' : 'visible'"
/>
</button>
Expand Down
5 changes: 4 additions & 1 deletion components/ui/MultiSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@
<Listbox
v-model="selectedItems"
multiple
:disabled="disabled"
>
<ListboxButton
:aria-label="labelAria ?? 'Multi Select Dropdown'"
class="w-full px-4 py-2 rounded-lg border border-slate-600 bg-slate-700 text-white focus:outline-none focus:ring-2 focus:ring-indigo-400 flex items-center justify-between"
:class="disabled? 'cursor-not-allowed opacity-70' : 'cursor-pointer'"
@click="isOpen = !isOpen"
>
{{ selectedLabels }}
Expand Down Expand Up @@ -87,6 +89,7 @@ const props = defineProps<{
label?: string
hoverText?: string
labelAria?: string
disabled?: boolean
}>()

const emit = defineEmits<{
Expand All @@ -102,7 +105,7 @@ watch(() => model, () => {

// create the string that is displayed on the button eq. Ebay, AutoScout24
const selectedLabels = computed(() => {
if (selectedItems.value.length === 0) return ''
if (selectedItems.value.length === 0) return t('selectOption')
const rawSelectedItems = selectedItems.value.map(item => toRaw(item)) // Convert Proxies to raw objects
const selected = props.options
.filter(option => rawSelectedItems.some(selectedItem =>
Expand Down
2 changes: 0 additions & 2 deletions constants/CreateFilterConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export interface Options {

export const marketplaces: Options[] = [
{ value: 'all', label: 'allMarket' },
{ value: 'Ebay', label: 'Ebay' },
{ value: 'Kleinanzeigen', label: 'Kleinanzeigen' },
{ value: 'AutoScout24', label: 'autoScoutMarketplace' },
{ value: 'Facebook', label: 'facebookMarketplace', premium: true },
Expand All @@ -16,7 +15,6 @@ export const marketplaces: Options[] = [

export const usMarketplaces: Options[] = [
{ value: 'all', label: 'allMarket' },
{ value: 'Ebay', label: 'Ebay' },
{ value: 'Facebook', label: 'facebookMarketplace', premium: true },
{ value: 'Craigslist', label: 'craigslistMarketplace' },
]
Expand Down
4 changes: 3 additions & 1 deletion locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -670,5 +670,7 @@
"lowFuzzy": "Niedrige Toleranz",
"mediumFuzzy": "Mittlere Toleranz",
"fuzzyInfo": "Anzahl der Buchstaben, die sich von deinem Suchwert unterscheiden dürfen: (z.B. Auto -> Auot, entspricht Niedriger Toleranz) \n Vorsicht! Suchwerte mit Toleranz können andere Produkte mit einschließen. Diese Einstellung ist wegen des Rechenaufwands nur für zahlende Nutzer verfügbar.",
"hasBasicPlanRestriction": "Das kostenlose Abo ist auf eine Suche alle 6 Stunden beschränkt"
"hasBasicPlanRestriction": "Das kostenlose Abo ist auf eine Suche alle 6 Stunden beschränkt",
"useEbayMarketplace": "Ebay verwenden",
"selectOption": "Option auswählen"
}
4 changes: 3 additions & 1 deletion locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -670,5 +670,7 @@
"singleLetterChanged": "Single Letter added/removed",
"lowFuzzy": "Light Fuzziness",
"mediumFuzzy": "Medium Fuzziness",
"fuzzyInfo": "Amount of letters that can be different from your search value: ( Switch -> Swtich ) \n NOTE: changing this value can cause your search to match other products. This setting is restricted to paid tiers"
"fuzzyInfo": "Amount of letters that can be different from your search value: ( Switch -> Swtich ) \n NOTE: changing this value can cause your search to match other products. This setting is restricted to paid tiers",
"useEbayMarketplace": "Use Ebay",
"selectOption": "Select an option"
}
1 change: 0 additions & 1 deletion pages/filters/create.vue
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ async function loadEditParam() {
}
case 'IncludePlatforms': {
// construct the selected marketplaces from the string to test if it is all marketplaces selected
console.log(item.value)
const constuctedArray = constructOptionsFromString(item.value ?? '')
if (valididateAllMarketplace(constuctedArray)) {
filter.value.marketplace = 'all'
Expand Down
15 changes: 14 additions & 1 deletion src/api-client/sdk.gen.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This file is auto-generated by @hey-api/openapi-ts

import type { Options as ClientOptions, Composable, TDataShape, Client } from '@hey-api/client-nuxt';
import type { LoginFirebaseData, LoginFirebaseResponse, LoginFirebaseError, GetFiltersData, GetFiltersResponse, GetFiltersError, GetOptionsData, GetOptionsResponse, GetOptionsError, ReportMatchData, ReportMatchResponse, ReportMatchError, AddFilterData, AddFilterResponse, AddFilterError, DeleteFilterData, DeleteFilterError, DeleteFilterWithTokenData, DeleteFilterWithTokenError, GetFilterByTokenData, GetFilterByTokenResponse, GetFilterByTokenError, TestFilterData, TestFilterResponse, TestFilterError, GetLocationData, GetLocationResponse, GetLocationError, GetCountryData, GetCountryResponse, GetCountryError, GetMatchesData, GetMatchesResponse, GetMatchesError, GetStatsData, GetStatsResponse, GetStatsError, GetListingData, GetListingResponse, GetListingError, GetSubscriptionData, GetSubscriptionResponse, GetSubscriptionError, SubscribeData, SubscribeResponse, SubscribeError, CancelSubscriptionData, CancelSubscriptionResponse, CancelSubscriptionError, DoRedirectData, DoRedirectError, GetInfoData, GetInfoResponse, GetInfoError, CreateLinkData, CreateLinkResponse, CreateLinkError, ListLinksData, ListLinksResponse, ListLinksError, GetLinkData, GetLinkResponse, GetLinkError, UseLinkData, UseLinkError, GetMeData, GetMeResponse, GetMeError, UpdateMeData, UpdateMeResponse, UpdateMeError } from './types.gen';
import type { LoginFirebaseData, LoginFirebaseResponse, LoginFirebaseError, GetFiltersData, GetFiltersResponse, GetFiltersError, GetOptionsData, GetOptionsResponse, GetOptionsError, ReportMatchData, ReportMatchResponse, ReportMatchError, AddFilterData, AddFilterResponse, AddFilterError, DeleteFilterData, DeleteFilterError, DeleteFilterWithTokenData, DeleteFilterWithTokenError, GetFilterByTokenData, GetFilterByTokenResponse, GetFilterByTokenError, TestFilterData, TestFilterResponse, TestFilterError, GetLocationData, GetLocationResponse, GetLocationError, GetCountryData, GetCountryResponse, GetCountryError, GetFlipsData, GetFlipsResponse, GetFlipsError, GetMatchesData, GetMatchesResponse, GetMatchesError, GetStatsData, GetStatsResponse, GetStatsError, GetListingData, GetListingResponse, GetListingError, GetSubscriptionData, GetSubscriptionResponse, GetSubscriptionError, SubscribeData, SubscribeResponse, SubscribeError, CancelSubscriptionData, CancelSubscriptionResponse, CancelSubscriptionError, DoRedirectData, DoRedirectError, GetInfoData, GetInfoResponse, GetInfoError, CreateLinkData, CreateLinkResponse, CreateLinkError, ListLinksData, ListLinksResponse, ListLinksError, GetLinkData, GetLinkResponse, GetLinkError, UseLinkData, UseLinkError, GetMeData, GetMeResponse, GetMeError, UpdateMeData, UpdateMeResponse, UpdateMeError } from './types.gen';
import { client as _heyApiClient } from './client.gen';

export type Options<TComposable extends Composable, TData extends TDataShape = TDataShape, ResT = unknown, DefaultT = undefined> = ClientOptions<TComposable, TData, ResT, DefaultT> & {
Expand Down Expand Up @@ -180,6 +180,19 @@ export const getCountry = <TComposable extends Composable, DefaultT extends GetC
});
};

export const getFlips = <TComposable extends Composable, DefaultT extends GetFlipsResponse = GetFlipsResponse>(options: Options<TComposable, GetFlipsData, GetFlipsResponse, DefaultT>) => {
return (options.client ?? _heyApiClient).get<TComposable, GetFlipsResponse | DefaultT, GetFlipsError, DefaultT>({
security: [
{
name: 'Authorization',
type: 'apiKey'
}
],
url: '/api/flips/{category}',
...options
});
};

export const getMatches = <TComposable extends Composable, DefaultT extends GetMatchesResponse = GetMatchesResponse>(options: Options<TComposable, GetMatchesData, GetMatchesResponse, DefaultT>) => {
return (options.client ?? _heyApiClient).get<TComposable, GetMatchesResponse | DefaultT, GetMatchesError, DefaultT>({
security: [
Expand Down
74 changes: 74 additions & 0 deletions src/api-client/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@ export type FilterOptions = {

export type FilterType = 'Options' | 'NumberRange' | 'Text' | 'Date' | 'Radius' | 'Bool' | 'MultiSelect';

export type Flip = {
category?: string | null;
listing?: Listing;
serializedListing?: string | null;
medianPrice?: number | null;
potentialProfit?: number | null;
serializedSells?: string | null;
foundAt?: string | null;
recentSells?: Array<SoldFor> | null;
};

export type InviteLink = {
userId?: string;
id?: string;
Expand Down Expand Up @@ -125,6 +136,14 @@ export type ResultReport = {

export type SearchState = 'None' | 'Disabled' | 'DisabledError';

export type SoldFor = {
platform?: Platform;
key?: string | null;
price?: number | null;
date?: string | null;
id?: string | null;
};

export type StoredListing = {
platform?: Platform;
priceKind?: PriceKind;
Expand Down Expand Up @@ -752,6 +771,61 @@ export type GetCountryResponses = {

export type GetCountryResponse = GetCountryResponses[keyof GetCountryResponses];

export type GetFlipsData = {
body?: never;
path: {
category: string;
};
query?: {
limit?: number;
};
url: '/api/flips/{category}';
};

export type GetFlipsErrors = {
/**
* Bad Request
*/
400: {
/**
* Human readable id for this kind of error
*/
slug?: string;
/**
* More info about the error, may sometimes be sufficient to display to user
*/
message?: string;
};
/**
* Internal Server Error
*/
500: {
/**
* Human readable id for this kind of error
*/
slug?: string;
/**
* Unknown error occured
*/
message?: string;
/**
* Id for the error report with this id
*/
trace?: string;
};
};

export type GetFlipsError = GetFlipsErrors[keyof GetFlipsErrors];

export type GetFlipsResponses = {
/**
* OK
*/
200: Array<Flip>;
};

export type GetFlipsResponse = GetFlipsResponses[keyof GetFlipsResponses];

export type GetMatchesData = {
body?: never;
path?: never;
Expand Down