From 7bbb2f3557b1d4df526a24e48f1c6e459914ebab Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Sun, 3 Jan 2021 22:53:51 +0100 Subject: [PATCH] Added tag filter dialog. --- assets/components/dialog/dialog.vue | 106 +++++++++++++++++++++++++++ assets/components/form/checkbox.vue | 99 +++++++++++++++++++++++++ assets/components/header/filters.vue | 69 +++++++++++++++++ assets/components/header/header.vue | 12 ++- assets/css/_forms.scss | 5 ++ assets/css/style.scss | 1 + assets/js/entities/actions.js | 2 +- assets/js/main.js | 8 ++ assets/js/releases/actions.js | 2 +- assets/js/tags/actions.js | 2 +- assets/js/ui/actions.js | 10 ++- assets/js/ui/mutations.js | 6 +- assets/js/ui/state.js | 4 +- public/img/icons/cross.svg | 5 ++ public/img/icons/cross2.svg | 5 ++ public/img/icons/cross3.svg | 5 ++ seeds/00_tags.js | 2 +- src/scrapers/kink.js | 2 +- 18 files changed, 329 insertions(+), 16 deletions(-) create mode 100644 assets/components/dialog/dialog.vue create mode 100644 assets/components/form/checkbox.vue create mode 100644 assets/components/header/filters.vue create mode 100644 assets/css/_forms.scss create mode 100644 public/img/icons/cross.svg create mode 100644 public/img/icons/cross2.svg create mode 100644 public/img/icons/cross3.svg diff --git a/assets/components/dialog/dialog.vue b/assets/components/dialog/dialog.vue new file mode 100644 index 00000000..6a5b7ac7 --- /dev/null +++ b/assets/components/dialog/dialog.vue @@ -0,0 +1,106 @@ + + + + + diff --git a/assets/components/form/checkbox.vue b/assets/components/form/checkbox.vue new file mode 100644 index 00000000..8af364aa --- /dev/null +++ b/assets/components/form/checkbox.vue @@ -0,0 +1,99 @@ + + + + + diff --git a/assets/components/header/filters.vue b/assets/components/header/filters.vue new file mode 100644 index 00000000..68b5e6af --- /dev/null +++ b/assets/components/header/filters.vue @@ -0,0 +1,69 @@ + + + + + diff --git a/assets/components/header/header.vue b/assets/components/header/header.vue index bbd654a8..d3ea6d4a 100644 --- a/assets/components/header/header.vue +++ b/assets/components/header/header.vue @@ -147,8 +147,8 @@ @@ -157,6 +157,11 @@ + + dayjs(dateA).isAfter(dateB), isBefore: (dateA, dateB) => dayjs(dateA).isBefore(dateB), }, + beforeCreate() { + this.uid = uid; + uid += 1; + }, }); app.directive('tooltip', { diff --git a/assets/js/releases/actions.js b/assets/js/releases/actions.js index f65939f2..32453f19 100644 --- a/assets/js/releases/actions.js +++ b/assets/js/releases/actions.js @@ -24,7 +24,7 @@ function initReleasesActions(store, router) { after, before, orderBy, - exclude: store.state.ui.filter, + exclude: store.state.ui.tagFilter, }); return { diff --git a/assets/js/tags/actions.js b/assets/js/tags/actions.js index 63d2113a..9ff07740 100644 --- a/assets/js/tags/actions.js +++ b/assets/js/tags/actions.js @@ -99,7 +99,7 @@ function initTagsActions(store, _router) { before, orderBy: orderBy === 'DATE_DESC' ? 'DATE_DESC' : 'DATE_ASC', offset: Math.max(0, (pageNumber - 1)) * limit, - exclude: store.state.ui.filter, + exclude: store.state.ui.tagFilter.filter(tagFilter => tagFilter !== tagSlug), }); return { diff --git a/assets/js/ui/actions.js b/assets/js/ui/actions.js index 7b7b2b37..ee8ca345 100644 --- a/assets/js/ui/actions.js +++ b/assets/js/ui/actions.js @@ -2,9 +2,11 @@ import { graphql } from '../api'; import { curateRelease, curateActor } from '../curate'; function initUiActions(_store, _router) { - function setFilter({ commit }, filter) { - commit('setFilter', filter); - localStorage.setItem('filter', filter); + function setTagFilter({ commit }, filter) { + const tagFilter = Array.from(new Set(filter)); + + commit('setTagFilter', tagFilter); + localStorage.setItem('tagFilter', tagFilter); } function setRange({ commit }, range) { @@ -184,7 +186,7 @@ function initUiActions(_store, _router) { return { search, - setFilter, + setTagFilter, setRange, setBatch, setSfw, diff --git a/assets/js/ui/mutations.js b/assets/js/ui/mutations.js index 728955ce..76184f2f 100644 --- a/assets/js/ui/mutations.js +++ b/assets/js/ui/mutations.js @@ -1,5 +1,5 @@ -function setFilter(state, filter) { - state.filter = filter; +function setTagFilter(state, tagFilter) { + state.tagFilter = tagFilter; } function setRange(state, range) { @@ -19,7 +19,7 @@ function setTheme(state, theme) { } export default { - setFilter, + setTagFilter, setRange, setBatch, setSfw, diff --git a/assets/js/ui/state.js b/assets/js/ui/state.js index 363736b2..302692eb 100644 --- a/assets/js/ui/state.js +++ b/assets/js/ui/state.js @@ -1,10 +1,10 @@ -const storedFilter = localStorage.getItem('filter'); +const storedTagFilter = localStorage.getItem('tagFilter'); const storedBatch = localStorage.getItem('batch'); const storedSfw = localStorage.getItem('sfw'); const storedTheme = localStorage.getItem('theme'); export default { - filter: storedFilter ? storedFilter.split(',') : [], + tagFilter: storedTagFilter ? storedTagFilter.split(',') : [], range: 'latest', batch: storedBatch || 'all', sfw: storedSfw === 'true' || false, diff --git a/public/img/icons/cross.svg b/public/img/icons/cross.svg new file mode 100644 index 00000000..9ffcb7fd --- /dev/null +++ b/public/img/icons/cross.svg @@ -0,0 +1,5 @@ + + +cross + + diff --git a/public/img/icons/cross2.svg b/public/img/icons/cross2.svg new file mode 100644 index 00000000..0b03beef --- /dev/null +++ b/public/img/icons/cross2.svg @@ -0,0 +1,5 @@ + + +cross2 + + diff --git a/public/img/icons/cross3.svg b/public/img/icons/cross3.svg new file mode 100644 index 00000000..c45560d8 --- /dev/null +++ b/public/img/icons/cross3.svg @@ -0,0 +1,5 @@ + + +cross3 + + diff --git a/seeds/00_tags.js b/seeds/00_tags.js index e1104c6b..b192f241 100644 --- a/seeds/00_tags.js +++ b/seeds/00_tags.js @@ -709,7 +709,7 @@ const tags = [ { name: 'pissing', slug: 'pissing', - priority: 6, + priority: 8, }, { name: 'POV', diff --git a/src/scrapers/kink.js b/src/scrapers/kink.js index 85229fd1..2f8a62b1 100644 --- a/src/scrapers/kink.js +++ b/src/scrapers/kink.js @@ -6,7 +6,7 @@ function scrapeAll(scenes) { return scenes.map(({ query }) => { const release = {}; - const href = query.url('.shoot-thumb-title a'); + const href = query.url('.shoot-thumb-info > a'); release.url = `https://kink.com${href}`; release.shootId = href.split('/').slice(-1)[0];