Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: popular collections #5654

Merged
merged 41 commits into from
Apr 20, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
42a18c1
feat: init
floyd-li Apr 10, 2023
77946a3
feat(wip): popular collections
floyd-li Apr 12, 2023
11b36f6
feat(wip): add collection filter
floyd-li Apr 12, 2023
809c01d
feat(wip): popular collection
floyd-li Apr 12, 2023
320c656
feat: display fix
floyd-li Apr 13, 2023
3c30108
feat: handle redirect
floyd-li Apr 13, 2023
9320fe3
feat: count owners
floyd-li Apr 13, 2023
17459b6
feat: remove test data
floyd-li Apr 13, 2023
94ee766
feat: add mobile filter
floyd-li Apr 13, 2023
f7ce248
Squashed commit of the following:
floyd-li Apr 13, 2023
f0f5221
feat: add query params
floyd-li Apr 13, 2023
936f31b
Merge branch 'main' into feat/popular-collections
floyd-li Apr 13, 2023
e7d06d4
fix: rmrk2 rename
floyd-li Apr 13, 2023
e4c3a85
fix: code review suggestion
floyd-li Apr 14, 2023
cf72aac
fix: deepsource issue
floyd-li Apr 14, 2023
d1ceff0
refactor: router redirect
floyd-li Apr 14, 2023
5f060ba
refactor: review suggestion
floyd-li Apr 15, 2023
f5adad0
refactor: review suggestions
floyd-li Apr 15, 2023
20482b4
refactor: review suggestions
floyd-li Apr 15, 2023
5aec002
refactor: review suggestions
floyd-li Apr 16, 2023
a8ae00e
Merge branch 'main' into feat/popular-collections
floyd-li Apr 17, 2023
f1066c8
feat: click update
floyd-li Apr 17, 2023
b703311
feat: mobile filter
floyd-li Apr 17, 2023
4107b76
fix: ui update
floyd-li Apr 17, 2023
3e04710
feat: add margin
floyd-li Apr 17, 2023
9c36906
Merge branch 'main' into feat/popular-collections
floyd-li Apr 17, 2023
8a95731
feat: sticky button
floyd-li Apr 17, 2023
ccf4ca0
fix: use computed
floyd-li Apr 17, 2023
91dfa6b
fix: array concat error
floyd-li Apr 17, 2023
4f75b7d
refactor: rename to collections
floyd-li Apr 17, 2023
3436cd0
fix: collection concat issue
floyd-li Apr 18, 2023
5c663ea
feat: collection name sort
floyd-li Apr 18, 2023
5444839
Merge branch 'main' into feat/popular-collections
floyd-li Apr 18, 2023
e6c1614
feat: hide popular collection in detail
floyd-li Apr 18, 2023
48d2dea
refactor: fix codeclimate
floyd-li Apr 18, 2023
6861864
refactor: fix codeclimate
floyd-li Apr 18, 2023
9c7163b
fix: update var name
floyd-li Apr 19, 2023
3fcf73b
fix: code review suggestion
floyd-li Apr 19, 2023
a842b7e
refactor: get collection from query string
floyd-li Apr 19, 2023
63e9d13
refactor: use isExploreItems
floyd-li Apr 19, 2023
d4c8614
Update components/shared/filters/modules/PopularCollections.vue
floyd-li Apr 19, 2023
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
Prev Previous commit
Next Next commit
refactor: review suggestions
  • Loading branch information
floyd-li committed Apr 15, 2023
commit f5adad04785e5ebce4449d94190bc367062d2420
22 changes: 11 additions & 11 deletions components/shared/filters/modules/PopularCollections.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<div class="p-4">
<o-field v-for="collection in collections" :key="collection.id">
<NeoCheckbox
:value="checkedCollection.includes(collection.id)"
:value="checkedCollections.includes(collection.id)"
class="mr-0"
@input="toggleCollection(collection)">
</NeoCheckbox>
Expand Down Expand Up @@ -84,14 +84,14 @@ const props = withDefaults(

const emit = defineEmits(['resetPage'])

const checkedCollection = ref<string[]>([])
const checkedCollections = ref<string[]>([])

const toggleCollection = (collection: Collection) => {
const index = checkedCollection.value.indexOf(collection.id)
const index = checkedCollections.value.indexOf(collection.id)
if (index > -1) {
checkedCollection.value.splice(index, 1)
checkedCollections.value.splice(index, 1)
} else {
checkedCollection.value.push(collection.id)
checkedCollections.value.push(collection.id)
}
if (urlPrefix.value !== collection.chain) {
$store.dispatch('setUrlPrefix', collection.chain)
Expand All @@ -102,7 +102,7 @@ const toggleCollection = (collection: Collection) => {
},
query: {
...restQuery,
collection: checkedCollection.value.join(','),
collection: checkedCollections.value.join(','),
},
})
} else {
Expand All @@ -112,18 +112,18 @@ const toggleCollection = (collection: Collection) => {

const getSearchParam = () => {
if (props.dataModel === 'query') {
checkedCollection.value =
checkedCollections.value =
(route.query?.collection as string)?.split(',').filter((x) => !!x) || []
} else {
checkedCollection.value = exploreFiltersStore.collection || []
checkedCollections.value = exploreFiltersStore.collections || []
}
}

const toggleSearchParam = () => {
if (props.dataModel === 'query') {
applyToUrl({ collection: checkedCollection.value.join(',') })
applyToUrl({ collection: checkedCollections.value.join(',') })
} else {
exploreFiltersStore.setCollection(checkedCollection.value)
exploreFiltersStore.setCollections(checkedCollections.value)
}
}

Expand All @@ -137,7 +137,7 @@ watch(
if (props.dataModel === 'query') {
return route.query?.collection
} else {
return exploreFiltersStore.collection
return exploreFiltersStore.collections
}
},
getSearchParam,
Expand Down
8 changes: 4 additions & 4 deletions stores/exploreFilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface State {
// price
min: number | undefined
max: number | undefined
collection: string[] | undefined
collections: string[] | undefined
}

export const useExploreFiltersStore = defineStore('exploreFilters', {
Expand All @@ -16,7 +16,7 @@ export const useExploreFiltersStore = defineStore('exploreFilters', {
owned: false,
min: undefined,
max: undefined,
collection: undefined,
collections: undefined,
}),
getters: {
getStatusFilters: (state) => ({ listed: state.listed, owned: state.owned }),
Expand All @@ -39,8 +39,8 @@ export const useExploreFiltersStore = defineStore('exploreFilters', {
this.min = payload.min
this.max = payload.max
},
setCollection(payload) {
this.collection = payload
setCollections(payload) {
this.collections = payload
},
},
})