mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-05 12:36:50 -07:00
Upgrade TypeScript and core-js
(cherry picked from commit 148480909917f69ff3b2ca547ccb4716dd56606e) Closes #5306
This commit is contained in:
parent
44a5654918
commit
198a13755f
6 changed files with 37 additions and 16 deletions
|
@ -1,4 +1,5 @@
|
|||
import { createSelector } from 'reselect';
|
||||
import AlbumAppState from 'App/State/AlbumAppState';
|
||||
import AppState from 'App/State/AppState';
|
||||
import Artist from 'Artist/Artist';
|
||||
import { createArtistSelectorForHook } from './createArtistSelector';
|
||||
|
@ -7,7 +8,7 @@ function createArtistAlbumsSelector(artistId: number) {
|
|||
return createSelector(
|
||||
(state: AppState) => state.albums,
|
||||
createArtistSelectorForHook(artistId),
|
||||
(albums, artist = {} as Artist) => {
|
||||
(albums: AlbumAppState, artist = {} as Artist) => {
|
||||
const { isFetching, isPopulated, error, items } = albums;
|
||||
|
||||
const filteredAlbums = items.filter(
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
import { createSelector } from 'reselect';
|
||||
import AppState from 'App/State/AppState';
|
||||
import Artist from 'Artist/Artist';
|
||||
import MetadataProfile from 'typings/MetadataProfile';
|
||||
import { createArtistSelectorForHook } from './createArtistSelector';
|
||||
|
||||
function createArtistMetadataProfileSelector(artistId: number) {
|
||||
return createSelector(
|
||||
(state: AppState) => state.settings.metadataProfiles.items,
|
||||
createArtistSelectorForHook(artistId),
|
||||
(metadataProfiles, artist = {} as Artist) => {
|
||||
(metadataProfiles: MetadataProfile[], artist = {} as Artist) => {
|
||||
return metadataProfiles.find((profile) => {
|
||||
return profile.id === artist.metadataProfileId;
|
||||
});
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
import { createSelector } from 'reselect';
|
||||
import AppState from 'App/State/AppState';
|
||||
import Artist from 'Artist/Artist';
|
||||
import QualityProfile from 'typings/QualityProfile';
|
||||
import { createArtistSelectorForHook } from './createArtistSelector';
|
||||
|
||||
function createArtistQualityProfileSelector(artistId: number) {
|
||||
return createSelector(
|
||||
(state: AppState) => state.settings.qualityProfiles.items,
|
||||
createArtistSelectorForHook(artistId),
|
||||
(qualityProfiles, artist = {} as Artist) => {
|
||||
(qualityProfiles: QualityProfile[], artist = {} as Artist) => {
|
||||
return qualityProfiles.find(
|
||||
(profile) => profile.id === artist.qualityProfileId
|
||||
);
|
||||
|
|
|
@ -6,15 +6,33 @@ import isTomorrow from 'Utilities/Date/isTomorrow';
|
|||
import isYesterday from 'Utilities/Date/isYesterday';
|
||||
import translate from 'Utilities/String/translate';
|
||||
|
||||
function getRelativeDate(date, shortDateFormat, showRelativeDates, { timeFormat, includeSeconds = false, timeForToday = false } = {}) {
|
||||
interface GetRelativeDateOptions {
|
||||
timeFormat?: string;
|
||||
includeSeconds?: boolean;
|
||||
timeForToday?: boolean;
|
||||
}
|
||||
|
||||
function getRelativeDate(
|
||||
date: string | undefined,
|
||||
shortDateFormat: string,
|
||||
showRelativeDates: boolean,
|
||||
{
|
||||
timeFormat,
|
||||
includeSeconds = false,
|
||||
timeForToday = false,
|
||||
}: GetRelativeDateOptions = {}
|
||||
) {
|
||||
if (!date) {
|
||||
return null;
|
||||
return '';
|
||||
}
|
||||
|
||||
const isTodayDate = isToday(date);
|
||||
|
||||
if (isTodayDate && timeForToday && timeFormat) {
|
||||
return formatTime(date, timeFormat, { includeMinuteZero: true, includeSeconds });
|
||||
return formatTime(date, timeFormat, {
|
||||
includeMinuteZero: true,
|
||||
includeSeconds,
|
||||
});
|
||||
}
|
||||
|
||||
if (!showRelativeDates) {
|
Loading…
Add table
Add a link
Reference in a new issue