1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Merge pull request #4583 from thornbill/library-tabs

Add enum for library tab values
This commit is contained in:
Bill Thornton 2023-05-09 10:43:53 -04:00 committed by GitHub
commit af51150b07
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 75 additions and 46 deletions

View file

@ -13,6 +13,7 @@ import '../../elements/emby-checkbox/emby-checkbox';
import ServerConnections from '../ServerConnections';
import toast from '../toast/toast';
import template from './homeScreenSettings.template.html';
import { LibraryTab } from '../../types/libraryTab.ts';
const numConfigurableSections = 7;
@ -48,110 +49,110 @@ function getLandingScreenOptions(type) {
if (type === 'movies') {
list.push({
name: globalize.translate('Movies'),
value: 'movies',
value: LibraryTab.Movies,
isDefault: true
});
list.push({
name: globalize.translate('Suggestions'),
value: 'suggestions'
value: LibraryTab.Suggestions
});
list.push({
name: globalize.translate('Trailers'),
value: 'trailers'
value: LibraryTab.Trailers
});
list.push({
name: globalize.translate('Favorites'),
value: 'favorites'
value: LibraryTab.Favorites
});
list.push({
name: globalize.translate('Collections'),
value: 'collections'
value: LibraryTab.Collections
});
list.push({
name: globalize.translate('Genres'),
value: 'genres'
value: LibraryTab.Genres
});
} else if (type === 'tvshows') {
list.push({
name: globalize.translate('Shows'),
value: 'shows',
value: LibraryTab.Shows,
isDefault: true
});
list.push({
name: globalize.translate('Suggestions'),
value: 'suggestions'
value: LibraryTab.Suggestions
});
list.push({
name: globalize.translate('TabUpcoming'),
value: 'upcoming'
value: LibraryTab.Upcoming
});
list.push({
name: globalize.translate('Genres'),
value: 'genres'
value: LibraryTab.Genres
});
list.push({
name: globalize.translate('TabNetworks'),
value: 'networks'
value: LibraryTab.Networks
});
list.push({
name: globalize.translate('Episodes'),
value: 'episodes'
value: LibraryTab.Episodes
});
} else if (type === 'music') {
list.push({
name: globalize.translate('Albums'),
value: 'albums',
value: LibraryTab.Albums,
isDefault: true
});
list.push({
name: globalize.translate('Suggestions'),
value: 'suggestions'
value: LibraryTab.Suggestions
});
list.push({
name: globalize.translate('HeaderAlbumArtists'),
value: 'albumartists'
value: LibraryTab.AlbumArtists
});
list.push({
name: globalize.translate('Artists'),
value: 'artists'
value: LibraryTab.Artists
});
list.push({
name: globalize.translate('Playlists'),
value: 'playlists'
value: LibraryTab.Playlists
});
list.push({
name: globalize.translate('Songs'),
value: 'songs'
value: LibraryTab.Songs
});
list.push({
name: globalize.translate('Genres'),
value: 'genres'
value: LibraryTab.Genres
});
} else if (type === 'livetv') {
list.push({
name: globalize.translate('Programs'),
value: 'programs',
value: LibraryTab.Programs,
isDefault: true
});
list.push({
name: globalize.translate('Guide'),
value: 'guide'
value: LibraryTab.Guide
});
list.push({
name: globalize.translate('Channels'),
value: 'channels'
value: LibraryTab.Channels
});
list.push({
name: globalize.translate('Recordings'),
value: 'recordings'
value: LibraryTab.Recordings
});
list.push({
name: globalize.translate('Schedule'),
value: 'schedule'
value: LibraryTab.Schedule
});
list.push({
name: globalize.translate('Series'),
value: 'series'
value: LibraryTab.Series
});
}

View file

@ -10,6 +10,7 @@ import '../../styles/scrollstyles.scss';
import '../../elements/emby-itemscontainer/emby-itemscontainer';
import '../../elements/emby-tabs/emby-tabs';
import '../../elements/emby-button/emby-button';
import { LibraryTab } from '../../types/libraryTab.ts';
import Dashboard from '../../utils/dashboard';
function enableScrollX() {
@ -201,15 +202,15 @@ function setScrollClasses(elem, scrollX) {
function getDefaultTabIndex(folderId) {
switch (userSettings.get('landing-' + folderId)) {
case 'guide':
case LibraryTab.Guide:
return 1;
case 'channels':
case LibraryTab.Channels:
return 2;
case 'recordings':
case LibraryTab.Recordings:
return 3;
case 'schedule':
case LibraryTab.Schedule:
return 4;
case 'series':
case LibraryTab.Series:
return 5;
default:
return 0;

View file

@ -9,6 +9,7 @@ import dom from '../../scripts/dom';
import imageLoader from '../../components/images/imageLoader';
import { playbackManager } from '../../components/playback/playbackmanager';
import globalize from '../../scripts/globalize';
import { LibraryTab } from '../../types/libraryTab.ts';
import Dashboard from '../../utils/dashboard';
import Events from '../../utils/events.ts';
@ -249,16 +250,16 @@ function getTabs() {
function getDefaultTabIndex(folderId) {
switch (userSettings.get('landing-' + folderId)) {
case 'suggestions':
case LibraryTab.Suggestions:
return 1;
case 'favorites':
case LibraryTab.Favorites:
return 3;
case 'collections':
case LibraryTab.Collections:
return 4;
case 'genres':
case LibraryTab.Genres:
return 5;
default:

View file

@ -9,12 +9,14 @@ import imageLoader from '../../components/images/imageLoader';
import libraryMenu from '../../scripts/libraryMenu';
import * as mainTabsManager from '../../components/maintabsmanager';
import globalize from '../../scripts/globalize';
import { LibraryTab } from '../../types/libraryTab.ts';
import Dashboard from '../../utils/dashboard';
import '../../styles/scrollstyles.scss';
import '../../elements/emby-itemscontainer/emby-itemscontainer';
import '../../elements/emby-tabs/emby-tabs';
import '../../elements/emby-button/emby-button';
import '../../styles/flexstyles.scss';
import Dashboard from '../../utils/dashboard';
function itemsPerRow() {
const screenWidth = dom.getWindowSize().innerWidth;
@ -194,22 +196,22 @@ function getTabs() {
function getDefaultTabIndex(folderId) {
switch (userSettings.get('landing-' + folderId)) {
case 'suggestions':
case LibraryTab.Suggestions:
return 1;
case 'albumartists':
case LibraryTab.AlbumArtists:
return 2;
case 'artists':
case LibraryTab.Artists:
return 3;
case 'playlists':
case LibraryTab.Playlists:
return 4;
case 'songs':
case LibraryTab.Songs:
return 5;
case 'genres':
case LibraryTab.Genres:
return 6;
default:

View file

@ -12,6 +12,7 @@ import globalize from '../../scripts/globalize';
import '../../styles/scrollstyles.scss';
import '../../elements/emby-itemscontainer/emby-itemscontainer';
import '../../elements/emby-button/emby-button';
import { LibraryTab } from '../../types/libraryTab.ts';
import Dashboard from '../../utils/dashboard';
import Events from '../../utils/events.ts';
import autoFocuser from '../../components/autoFocuser';
@ -34,19 +35,19 @@ function getTabs() {
function getDefaultTabIndex(folderId) {
switch (userSettings.get('landing-' + folderId)) {
case 'suggestions':
case LibraryTab.Suggestions:
return 1;
case 'upcoming':
case LibraryTab.Upcoming:
return 2;
case 'genres':
case LibraryTab.Genres:
return 3;
case 'networks':
case LibraryTab.Networks:
return 4;
case 'episodes':
case LibraryTab.Episodes:
return 5;
default:

23
src/types/libraryTab.ts Normal file
View file

@ -0,0 +1,23 @@
export enum LibraryTab {
Albums = 'albums',
AlbumArtists = 'albumartists',
Artists = 'artists',
Channels = 'channels',
Collections = 'collections',
Episodes = 'episodes',
Favorites = 'favorites',
Genres = 'genres',
Guide = 'guide',
Movies = 'movies',
Networks = 'networks',
Playlists = 'playlists',
Programs = 'programs',
Recordings = 'recordings',
Schedule = 'schedule',
Series = 'series',
Shows = 'shows',
Songs = 'songs',
Suggestions = 'suggestions',
Trailers = 'trailers',
Upcoming = 'upcoming'
}