mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Add Filter Status Indicator
This commit is contained in:
parent
79236796df
commit
c779035a75
10 changed files with 107 additions and 0 deletions
50
src/components/filterdialog/filterIndicator.js
Normal file
50
src/components/filterdialog/filterIndicator.js
Normal file
|
@ -0,0 +1,50 @@
|
|||
import './filterIndicator.scss';
|
||||
|
||||
export function getFilterStatus(query) {
|
||||
return Boolean(
|
||||
query.Filters
|
||||
|| query.VideoTypes
|
||||
|| query.SeriesStatus
|
||||
|| query.Is4K
|
||||
|| (query.IsHD !== undefined && query.IsHD !== null)
|
||||
|| query.IsSD
|
||||
|| query.Is3D
|
||||
|| query.HasSubtitles
|
||||
|| query.HasTrailer
|
||||
|| query.HasSpecialFeature
|
||||
|| query.HasThemeSong
|
||||
|| query.HasThemeVideo
|
||||
|| query.IsMissing
|
||||
|| query.ParentIndexNumber
|
||||
|| query.Genres
|
||||
|| query.Tags
|
||||
|| query.Years
|
||||
|| query.OfficialRatings
|
||||
|| query.IsUnaired
|
||||
);
|
||||
}
|
||||
|
||||
export function setFilterStatus(page, hasFilters) {
|
||||
const btnFilter = page.querySelector('.btnFilter');
|
||||
|
||||
if (btnFilter) {
|
||||
let indicatorElem = btnFilter.querySelector('.filterIndicator');
|
||||
|
||||
if (!indicatorElem && hasFilters) {
|
||||
btnFilter.insertAdjacentHTML(
|
||||
'beforeend',
|
||||
'<div class="filterIndicator">!</div>'
|
||||
);
|
||||
btnFilter.classList.add('btnFilterWithIndicator');
|
||||
indicatorElem = btnFilter.querySelector('.filterIndicator');
|
||||
}
|
||||
|
||||
if (indicatorElem) {
|
||||
if (hasFilters) {
|
||||
indicatorElem.classList.remove('hide');
|
||||
} else {
|
||||
indicatorElem.classList.add('hide');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
25
src/components/filterdialog/filterIndicator.scss
Normal file
25
src/components/filterdialog/filterIndicator.scss
Normal file
|
@ -0,0 +1,25 @@
|
|||
.btnFilterWithIndicator {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.btnFilterWithIndicator > div {
|
||||
margin-left: 3px;
|
||||
}
|
||||
|
||||
.filterIndicator {
|
||||
color: #fff;
|
||||
position: absolute;
|
||||
top: -7px;
|
||||
right: 0;
|
||||
width: 1.6em;
|
||||
height: 1.6em;
|
||||
z-index: 100000000;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 45%;
|
||||
border-radius: 100em;
|
||||
box-shadow: 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
|
||||
background: #03a9f4;
|
||||
font-weight: bold;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue