mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Fix implicit any TypeScript error
This commit is contained in:
parent
e30a252c8a
commit
57895e724c
23 changed files with 72 additions and 48 deletions
|
@ -2,7 +2,7 @@ import React, { FunctionComponent } from 'react';
|
||||||
import datetime from '../../../scripts/datetime';
|
import datetime from '../../../scripts/datetime';
|
||||||
import globalize from '../../../scripts/globalize';
|
import globalize from '../../../scripts/globalize';
|
||||||
|
|
||||||
const createButtonElement = ({index}) => ({
|
const createButtonElement = (index: number) => ({
|
||||||
__html: `<button
|
__html: `<button
|
||||||
type='button'
|
type='button'
|
||||||
is='paper-icon-button-light'
|
is='paper-icon-button-light'
|
||||||
|
@ -21,7 +21,7 @@ type IProps = {
|
||||||
EndHour?: number;
|
EndHour?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDisplayTime(hours) {
|
function getDisplayTime(hours = 0) {
|
||||||
let minutes = 0;
|
let minutes = 0;
|
||||||
const pct = hours % 1;
|
const pct = hours % 1;
|
||||||
|
|
||||||
|
@ -49,9 +49,7 @@ const AccessScheduleList: FunctionComponent<IProps> = ({index, DayOfWeek, StartH
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
dangerouslySetInnerHTML={createButtonElement({
|
dangerouslySetInnerHTML={createButtonElement(index)}
|
||||||
index: index
|
|
||||||
})}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import React, { FunctionComponent } from 'react';
|
import React, { FunctionComponent } from 'react';
|
||||||
|
|
||||||
const createButtonElement = ({tag}) => ({
|
const createButtonElement = (tag?: string) => ({
|
||||||
__html: `<button
|
__html: `<button
|
||||||
type='button'
|
type='button'
|
||||||
is='paper-icon-button-light'
|
is='paper-icon-button-light'
|
||||||
|
@ -25,9 +25,7 @@ const BlockedTagList: FunctionComponent<IProps> = ({tag}: IProps) => {
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
dangerouslySetInnerHTML={createButtonElement({
|
dangerouslySetInnerHTML={createButtonElement(tag)}
|
||||||
tag: tag
|
|
||||||
})}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import React, { FunctionComponent } from 'react';
|
import React, { FunctionComponent } from 'react';
|
||||||
import globalize from '../../../scripts/globalize';
|
import globalize from '../../../scripts/globalize';
|
||||||
|
|
||||||
const createButtonElement = ({ type, className, title }) => ({
|
const createButtonElement = ({ type, className, title }: { type?: string, className?: string, title?: string }) => ({
|
||||||
__html: `<button
|
__html: `<button
|
||||||
is="emby-button"
|
is="emby-button"
|
||||||
type="${type}"
|
type="${type}"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import React, { FunctionComponent } from 'react';
|
import React, { FunctionComponent } from 'react';
|
||||||
import globalize from '../../../scripts/globalize';
|
import globalize from '../../../scripts/globalize';
|
||||||
|
|
||||||
const createCheckBoxElement = ({ labelClassName, type, className, title }) => ({
|
const createCheckBoxElement = ({ labelClassName, type, className, title }: { labelClassName?: string, type?: string, className?: string, title?: string }) => ({
|
||||||
__html: `<label class="${labelClassName}">
|
__html: `<label class="${labelClassName}">
|
||||||
<input
|
<input
|
||||||
is="emby-checkbox"
|
is="emby-checkbox"
|
||||||
|
|
|
@ -9,7 +9,7 @@ type IProps = {
|
||||||
checkedAttribute?: string;
|
checkedAttribute?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const createCheckBoxElement = ({className, Name, dataAttributes, AppName, checkedAttribute}) => ({
|
const createCheckBoxElement = ({className, Name, dataAttributes, AppName, checkedAttribute}: {className?: string, Name?: string, dataAttributes?: string, AppName?: string, checkedAttribute?: string}) => ({
|
||||||
__html: `<label>
|
__html: `<label>
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import React, { FunctionComponent } from 'react';
|
import React, { FunctionComponent } from 'react';
|
||||||
import globalize from '../../../scripts/globalize';
|
import globalize from '../../../scripts/globalize';
|
||||||
|
|
||||||
const createInputElement = ({ type, id, label, options }) => ({
|
const createInputElement = ({ type, id, label, options }: { type?: string, id?: string, label?: string, options?: string }) => ({
|
||||||
__html: `<input
|
__html: `<input
|
||||||
is="emby-input"
|
is="emby-input"
|
||||||
type="${type}"
|
type="${type}"
|
||||||
|
|
|
@ -6,7 +6,7 @@ type IProps = {
|
||||||
className?: string;
|
className?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const createLinkElement = ({ className, title }) => ({
|
const createLinkElement = ({ className, title }: IProps) => ({
|
||||||
__html: `<a
|
__html: `<a
|
||||||
is="emby-linkbutton"
|
is="emby-linkbutton"
|
||||||
class="${className}"
|
class="${className}"
|
||||||
|
|
|
@ -5,7 +5,7 @@ type IProps = {
|
||||||
activeTab: string;
|
activeTab: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const createLinkElement = ({ activeTab }) => ({
|
const createLinkElement = (activeTab: string) => ({
|
||||||
__html: `<a href="#"
|
__html: `<a href="#"
|
||||||
is="emby-linkbutton"
|
is="emby-linkbutton"
|
||||||
data-role="button"
|
data-role="button"
|
||||||
|
@ -42,9 +42,7 @@ const SectionTabs: FunctionComponent<IProps> = ({activeTab}: IProps) => {
|
||||||
data-role='controlgroup'
|
data-role='controlgroup'
|
||||||
data-type='horizontal'
|
data-type='horizontal'
|
||||||
className='localnav'
|
className='localnav'
|
||||||
dangerouslySetInnerHTML={createLinkElement({
|
dangerouslySetInnerHTML={createLinkElement(activeTab)}
|
||||||
activeTab: activeTab
|
|
||||||
})}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,7 +7,7 @@ type IProps = {
|
||||||
icon: string,
|
icon: string,
|
||||||
}
|
}
|
||||||
|
|
||||||
const createButtonElement = ({ className, title, icon }) => ({
|
const createButtonElement = ({ className, title, icon }: { className?: string, title: string, icon: string }) => ({
|
||||||
__html: `<button
|
__html: `<button
|
||||||
is="emby-button"
|
is="emby-button"
|
||||||
type="button"
|
type="button"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import React, { FunctionComponent } from 'react';
|
import React, { FunctionComponent } from 'react';
|
||||||
import globalize from '../../../scripts/globalize';
|
import globalize from '../../../scripts/globalize';
|
||||||
|
|
||||||
const createLinkElement = ({ className, title, href }) => ({
|
const createLinkElement = ({ className, title, href }: { className?: string, title?: string, href?: string }) => ({
|
||||||
__html: `<a
|
__html: `<a
|
||||||
is="emby-linkbutton"
|
is="emby-linkbutton"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import React, { FunctionComponent } from 'react';
|
import React, { FunctionComponent } from 'react';
|
||||||
import globalize from '../../../scripts/globalize';
|
import globalize from '../../../scripts/globalize';
|
||||||
|
|
||||||
const createSelectElement = ({ className, label, option }) => ({
|
const createSelectElement = ({ className, label, option }: { className?: string, label: string, option: string[] }) => ({
|
||||||
__html: `<select
|
__html: `<select
|
||||||
class="${className}"
|
class="${className}"
|
||||||
is="emby-select"
|
is="emby-select"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import React, { FunctionComponent } from 'react';
|
import React, { FunctionComponent } from 'react';
|
||||||
import globalize from '../../../scripts/globalize';
|
import globalize from '../../../scripts/globalize';
|
||||||
|
|
||||||
const createSelectElement = ({ className, label, option }) => ({
|
const createSelectElement = ({ className, label, option }: { className?: string, label: string, option: string }) => ({
|
||||||
__html: `<select
|
__html: `<select
|
||||||
class="${className}"
|
class="${className}"
|
||||||
is="emby-select"
|
is="emby-select"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import React, { FunctionComponent } from 'react';
|
import React, { FunctionComponent } from 'react';
|
||||||
import globalize from '../../../scripts/globalize';
|
import globalize from '../../../scripts/globalize';
|
||||||
|
|
||||||
const createSelectElement = ({ className, id, label }) => ({
|
const createSelectElement = ({ className, id, label }: { className?: string, id?: string, label: string }) => ({
|
||||||
__html: `<select
|
__html: `<select
|
||||||
class="${className}"
|
class="${className}"
|
||||||
is="emby-select"
|
is="emby-select"
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
|
import { UserDto } from '@thornbill/jellyfin-sdk/dist/generated-client';
|
||||||
import React, { FunctionComponent } from 'react';
|
import React, { FunctionComponent } from 'react';
|
||||||
import { formatDistanceToNow } from 'date-fns';
|
import { formatDistanceToNow } from 'date-fns';
|
||||||
import { localeWithSuffix } from '../../../scripts/dfnshelper';
|
import { localeWithSuffix } from '../../../scripts/dfnshelper';
|
||||||
import globalize from '../../../scripts/globalize';
|
import globalize from '../../../scripts/globalize';
|
||||||
import cardBuilder from '../../cardbuilder/cardBuilder';
|
import cardBuilder from '../../cardbuilder/cardBuilder';
|
||||||
|
|
||||||
const createLinkElement = ({ user, renderImgUrl }) => ({
|
const createLinkElement = ({ user, renderImgUrl }: { user: UserDto, renderImgUrl: string }) => ({
|
||||||
__html: `<a
|
__html: `<a
|
||||||
is="emby-linkbutton"
|
is="emby-linkbutton"
|
||||||
class="cardContent"
|
class="cardContent"
|
||||||
|
@ -28,7 +29,7 @@ type IProps = {
|
||||||
user?: Record<string, any>;
|
user?: Record<string, any>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const getLastSeenText = (lastActivityDate) => {
|
const getLastSeenText = (lastActivityDate?: string) => {
|
||||||
if (lastActivityDate) {
|
if (lastActivityDate) {
|
||||||
return globalize.translate('LastSeen', formatDistanceToNow(Date.parse(lastActivityDate), localeWithSuffix));
|
return globalize.translate('LastSeen', formatDistanceToNow(Date.parse(lastActivityDate), localeWithSuffix));
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,7 +114,7 @@ const NewUserPage: FunctionComponent = () => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSubmit = (e) => {
|
const onSubmit = (e: Event) => {
|
||||||
loading.show();
|
loading.show();
|
||||||
saveUser();
|
saveUser();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { UserDto } from '@thornbill/jellyfin-sdk/dist/generated-client';
|
||||||
import React, { FunctionComponent, useCallback, useEffect, useState, useRef } from 'react';
|
import React, { FunctionComponent, useCallback, useEffect, useState, useRef } from 'react';
|
||||||
import Dashboard from '../../scripts/clientUtils';
|
import Dashboard from '../../scripts/clientUtils';
|
||||||
import globalize from '../../scripts/globalize';
|
import globalize from '../../scripts/globalize';
|
||||||
|
@ -32,7 +33,7 @@ const UserEditPage: FunctionComponent = () => {
|
||||||
|
|
||||||
const element = useRef(null);
|
const element = useRef(null);
|
||||||
|
|
||||||
const triggerChange = (select) => {
|
const triggerChange = (select: HTMLInputElement) => {
|
||||||
const evt = document.createEvent('HTMLEvents');
|
const evt = document.createEvent('HTMLEvents');
|
||||||
evt.initEvent('change', false, true);
|
evt.initEvent('change', false, true);
|
||||||
select.dispatchEvent(evt);
|
select.dispatchEvent(evt);
|
||||||
|
@ -163,7 +164,15 @@ const UserEditPage: FunctionComponent = () => {
|
||||||
toast(globalize.translate('SettingsSaved'));
|
toast(globalize.translate('SettingsSaved'));
|
||||||
}
|
}
|
||||||
|
|
||||||
const saveUser = (user) => {
|
const saveUser = (user: UserDto) => {
|
||||||
|
if (!user.Id) {
|
||||||
|
throw new Error('Unexpected null user.Id');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!user.Policy) {
|
||||||
|
throw new Error('Unexpected null user.Policy');
|
||||||
|
}
|
||||||
|
|
||||||
user.Name = element?.current?.querySelector('#txtUserName').value;
|
user.Name = element?.current?.querySelector('#txtUserName').value;
|
||||||
user.Policy.IsAdministrator = element?.current?.querySelector('.chkIsAdmin').checked;
|
user.Policy.IsAdministrator = element?.current?.querySelector('.chkIsAdmin').checked;
|
||||||
user.Policy.IsHidden = element?.current?.querySelector('.chkIsHidden').checked;
|
user.Policy.IsHidden = element?.current?.querySelector('.chkIsHidden').checked;
|
||||||
|
@ -200,7 +209,7 @@ const UserEditPage: FunctionComponent = () => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSubmit = (e) => {
|
const onSubmit = (e: Event) => {
|
||||||
loading.show();
|
loading.show();
|
||||||
getUser().then(function (result) {
|
getUser().then(function (result) {
|
||||||
saveUser(result);
|
saveUser(result);
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { UserDto } from '@thornbill/jellyfin-sdk/dist/generated-client';
|
||||||
import React, { FunctionComponent, useCallback, useEffect, useState, useRef } from 'react';
|
import React, { FunctionComponent, useCallback, useEffect, useState, useRef } from 'react';
|
||||||
|
|
||||||
import loading from '../loading/loading';
|
import loading from '../loading/loading';
|
||||||
|
@ -26,7 +27,7 @@ const UserLibraryAccessPage: FunctionComponent = () => {
|
||||||
|
|
||||||
const element = useRef(null);
|
const element = useRef(null);
|
||||||
|
|
||||||
const triggerChange = (select) => {
|
const triggerChange = (select: HTMLInputElement) => {
|
||||||
const evt = document.createEvent('HTMLEvents');
|
const evt = document.createEvent('HTMLEvents');
|
||||||
evt.initEvent('change', false, true);
|
evt.initEvent('change', false, true);
|
||||||
select.dispatchEvent(evt);
|
select.dispatchEvent(evt);
|
||||||
|
@ -131,7 +132,7 @@ const UserLibraryAccessPage: FunctionComponent = () => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
loadData();
|
loadData();
|
||||||
|
|
||||||
const onSubmit = (e) => {
|
const onSubmit = (e: Event) => {
|
||||||
loading.show();
|
loading.show();
|
||||||
const userId = appRouter.param('userId');
|
const userId = appRouter.param('userId');
|
||||||
window.ApiClient.getUser(userId).then(function (result) {
|
window.ApiClient.getUser(userId).then(function (result) {
|
||||||
|
@ -142,7 +143,15 @@ const UserLibraryAccessPage: FunctionComponent = () => {
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
const saveUser = (user) => {
|
const saveUser = (user: UserDto) => {
|
||||||
|
if (!user.Id) {
|
||||||
|
throw new Error('Unexpected null user.Id');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!user.Policy) {
|
||||||
|
throw new Error('Unexpected null user.Policy');
|
||||||
|
}
|
||||||
|
|
||||||
user.Policy.EnableAllFolders = element?.current?.querySelector('.chkEnableAllFolders').checked;
|
user.Policy.EnableAllFolders = element?.current?.querySelector('.chkEnableAllFolders').checked;
|
||||||
user.Policy.EnabledFolders = user.Policy.EnableAllFolders ? [] : Array.prototype.filter.call(element?.current?.querySelectorAll('.chkFolder'), function (c) {
|
user.Policy.EnabledFolders = user.Policy.EnableAllFolders ? [] : Array.prototype.filter.call(element?.current?.querySelectorAll('.chkFolder'), function (c) {
|
||||||
return c.checked;
|
return c.checked;
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { AccessSchedule, UserDto } from '@thornbill/jellyfin-sdk/dist/generated-client';
|
||||||
import React, { FunctionComponent, useCallback, useEffect, useState, useRef } from 'react';
|
import React, { FunctionComponent, useCallback, useEffect, useState, useRef } from 'react';
|
||||||
import globalize from '../../scripts/globalize';
|
import globalize from '../../scripts/globalize';
|
||||||
import LibraryMenu from '../../scripts/libraryMenu';
|
import LibraryMenu from '../../scripts/libraryMenu';
|
||||||
|
@ -108,7 +109,7 @@ const UserParentalControl: FunctionComponent = () => {
|
||||||
for (const btnDeleteTag of blockedTagsElem.querySelectorAll('.btnDeleteTag')) {
|
for (const btnDeleteTag of blockedTagsElem.querySelectorAll('.btnDeleteTag')) {
|
||||||
btnDeleteTag.addEventListener('click', function () {
|
btnDeleteTag.addEventListener('click', function () {
|
||||||
const tag = btnDeleteTag.getAttribute('data-tag');
|
const tag = btnDeleteTag.getAttribute('data-tag');
|
||||||
const newTags = tags.filter(function (t) {
|
const newTags = tags.filter(function (t: string) {
|
||||||
return t != tag;
|
return t != tag;
|
||||||
});
|
});
|
||||||
loadBlockedTags(newTags);
|
loadBlockedTags(newTags);
|
||||||
|
@ -125,7 +126,7 @@ const UserParentalControl: FunctionComponent = () => {
|
||||||
btnDelete.addEventListener('click', function () {
|
btnDelete.addEventListener('click', function () {
|
||||||
const index = parseInt(btnDelete.getAttribute('data-index'));
|
const index = parseInt(btnDelete.getAttribute('data-index'));
|
||||||
schedules.splice(index, 1);
|
schedules.splice(index, 1);
|
||||||
const newindex = schedules.filter(function (i) {
|
const newindex = schedules.filter(function (i: number) {
|
||||||
return i != index;
|
return i != index;
|
||||||
});
|
});
|
||||||
renderAccessSchedule(newindex);
|
renderAccessSchedule(newindex);
|
||||||
|
@ -181,7 +182,15 @@ const UserParentalControl: FunctionComponent = () => {
|
||||||
toast(globalize.translate('SettingsSaved'));
|
toast(globalize.translate('SettingsSaved'));
|
||||||
};
|
};
|
||||||
|
|
||||||
const saveUser = (user) => {
|
const saveUser = (user: UserDto) => {
|
||||||
|
if (!user.Id) {
|
||||||
|
throw new Error('Unexpected null user.Id');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!user.Policy) {
|
||||||
|
throw new Error('Unexpected null user.Policy');
|
||||||
|
}
|
||||||
|
|
||||||
user.Policy.MaxParentalRating = element?.current?.querySelector('.selectMaxParentalRating').value || null;
|
user.Policy.MaxParentalRating = element?.current?.querySelector('.selectMaxParentalRating').value || null;
|
||||||
user.Policy.BlockUnratedItems = Array.prototype.filter.call(element?.current?.querySelectorAll('.chkUnratedItem'), function (i) {
|
user.Policy.BlockUnratedItems = Array.prototype.filter.call(element?.current?.querySelectorAll('.chkUnratedItem'), function (i) {
|
||||||
return i.checked;
|
return i.checked;
|
||||||
|
@ -195,7 +204,7 @@ const UserParentalControl: FunctionComponent = () => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const showSchedulePopup = (schedule, index) => {
|
const showSchedulePopup = (schedule: AccessSchedule, index: number) => {
|
||||||
schedule = schedule || {};
|
schedule = schedule || {};
|
||||||
import('../../components/accessSchedule/accessSchedule').then(({default: accessschedule}) => {
|
import('../../components/accessSchedule/accessSchedule').then(({default: accessschedule}) => {
|
||||||
accessschedule.show({
|
accessschedule.show({
|
||||||
|
@ -244,7 +253,7 @@ const UserParentalControl: FunctionComponent = () => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSubmit = (e) => {
|
const onSubmit = (e: Event) => {
|
||||||
loading.show();
|
loading.show();
|
||||||
const userId = appRouter.param('userId');
|
const userId = appRouter.param('userId');
|
||||||
window.ApiClient.getUser(userId).then(function (result) {
|
window.ApiClient.getUser(userId).then(function (result) {
|
||||||
|
|
|
@ -36,7 +36,7 @@ const UserProfilesPage: FunctionComponent = () => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
loadData();
|
loadData();
|
||||||
|
|
||||||
const showUserMenu = (elem) => {
|
const showUserMenu = (elem: HTMLElement) => {
|
||||||
const card = dom.parentWithClass(elem, 'card');
|
const card = dom.parentWithClass(elem, 'card');
|
||||||
const userId = card.getAttribute('data-userid');
|
const userId = card.getAttribute('data-userid');
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ const UserProfilesPage: FunctionComponent = () => {
|
||||||
actionsheet.show({
|
actionsheet.show({
|
||||||
items: menuItems,
|
items: menuItems,
|
||||||
positionTo: card,
|
positionTo: card,
|
||||||
callback: function (id) {
|
callback: function (id: string) {
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case 'open':
|
case 'open':
|
||||||
Dashboard.navigate('useredit.html?userId=' + userId);
|
Dashboard.navigate('useredit.html?userId=' + userId);
|
||||||
|
@ -89,7 +89,7 @@ const UserProfilesPage: FunctionComponent = () => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteUser = (id) => {
|
const deleteUser = (id: string) => {
|
||||||
const msg = globalize.translate('DeleteUserConfirmation');
|
const msg = globalize.translate('DeleteUserConfirmation');
|
||||||
|
|
||||||
confirm({
|
confirm({
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
import { ApiClient } from 'jellyfin-apiclient';
|
||||||
import React, { FunctionComponent, useEffect, useState } from 'react';
|
import React, { FunctionComponent, useEffect, useState } from 'react';
|
||||||
|
|
||||||
import globalize from '../../scripts/globalize';
|
import globalize from '../../scripts/globalize';
|
||||||
|
@ -53,7 +54,7 @@ const LiveTVSearchResults: FunctionComponent<LiveTVSearchResultsProps> = ({ serv
|
||||||
});
|
});
|
||||||
|
|
||||||
// FIXME: This query does not support Live TV filters
|
// FIXME: This query does not support Live TV filters
|
||||||
const fetchItems = (apiClient, params = {}) => apiClient?.getItems(
|
const fetchItems = (apiClient: ApiClient, params = {}) => apiClient?.getItems(
|
||||||
apiClient?.getCurrentUserId(),
|
apiClient?.getCurrentUserId(),
|
||||||
{
|
{
|
||||||
...getDefaultParameters(),
|
...getDefaultParameters(),
|
||||||
|
|
|
@ -53,8 +53,8 @@ const SearchFields: FunctionComponent<SearchFieldsProps> = ({ onSearch = () => {
|
||||||
};
|
};
|
||||||
}, [debouncedOnSearch]);
|
}, [debouncedOnSearch]);
|
||||||
|
|
||||||
const onAlphaPicked = e => {
|
const onAlphaPicked = (e: Event) => {
|
||||||
const value = e.detail.value;
|
const value = (e as CustomEvent).detail.value;
|
||||||
const searchInput = getSearchInput();
|
const searchInput = getSearchInput();
|
||||||
|
|
||||||
if (value === 'backspace') {
|
if (value === 'backspace') {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
import { ApiClient } from 'jellyfin-apiclient';
|
||||||
import React, { FunctionComponent, useEffect, useState } from 'react';
|
import React, { FunctionComponent, useEffect, useState } from 'react';
|
||||||
|
|
||||||
import globalize from '../../scripts/globalize';
|
import globalize from '../../scripts/globalize';
|
||||||
|
@ -48,7 +49,7 @@ const SearchResults: FunctionComponent<SearchResultsProps> = ({ serverId = windo
|
||||||
IncludeArtists: false
|
IncludeArtists: false
|
||||||
});
|
});
|
||||||
|
|
||||||
const fetchArtists = (apiClient, params = {}) => apiClient?.getArtists(
|
const fetchArtists = (apiClient: ApiClient, params = {}) => apiClient?.getArtists(
|
||||||
apiClient?.getCurrentUserId(),
|
apiClient?.getCurrentUserId(),
|
||||||
{
|
{
|
||||||
...getDefaultParameters(),
|
...getDefaultParameters(),
|
||||||
|
@ -57,7 +58,7 @@ const SearchResults: FunctionComponent<SearchResultsProps> = ({ serverId = windo
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const fetchItems = (apiClient, params = {}) => apiClient?.getItems(
|
const fetchItems = (apiClient: ApiClient, params = {}) => apiClient?.getItems(
|
||||||
apiClient?.getCurrentUserId(),
|
apiClient?.getCurrentUserId(),
|
||||||
{
|
{
|
||||||
...getDefaultParameters(),
|
...getDefaultParameters(),
|
||||||
|
@ -66,7 +67,7 @@ const SearchResults: FunctionComponent<SearchResultsProps> = ({ serverId = windo
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const fetchPeople = (apiClient, params = {}) => apiClient?.getPeople(
|
const fetchPeople = (apiClient: ApiClient, params = {}) => apiClient?.getPeople(
|
||||||
apiClient?.getCurrentUserId(),
|
apiClient?.getCurrentUserId(),
|
||||||
{
|
{
|
||||||
...getDefaultParameters(),
|
...getDefaultParameters(),
|
||||||
|
|
|
@ -9,7 +9,7 @@ import '../../elements/emby-button/emby-button';
|
||||||
// There seems to be some compatibility issues here between
|
// There seems to be some compatibility issues here between
|
||||||
// React and our legacy web components, so we need to inject
|
// React and our legacy web components, so we need to inject
|
||||||
// them as an html string for now =/
|
// them as an html string for now =/
|
||||||
const createSuggestionLink = ({name, href}) => ({
|
const createSuggestionLink = ({ name, href }: { name: string, href: string }) => ({
|
||||||
__html: `<a
|
__html: `<a
|
||||||
is='emby-linkbutton'
|
is='emby-linkbutton'
|
||||||
class='button-link'
|
class='button-link'
|
||||||
|
@ -57,7 +57,7 @@ const SearchSuggestions: FunctionComponent<SearchSuggestionsProps> = ({ serverId
|
||||||
<div
|
<div
|
||||||
key={`suggestion-${item.Id}`}
|
key={`suggestion-${item.Id}`}
|
||||||
dangerouslySetInnerHTML={createSuggestionLink({
|
dangerouslySetInnerHTML={createSuggestionLink({
|
||||||
name: item.Name,
|
name: item.Name || '',
|
||||||
href: appRouter.getRouteUrl(item)
|
href: appRouter.getRouteUrl(item)
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue