mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Fix tags and schedule edit for parental control
This commit is contained in:
parent
568b5f607f
commit
956f9bf7e4
4 changed files with 69 additions and 80 deletions
|
@ -1,4 +1,4 @@
|
|||
import React, { FunctionComponent } from 'react';
|
||||
import React, { FunctionComponent, useCallback } from 'react';
|
||||
import datetime from '../../../scripts/datetime';
|
||||
import globalize from '../../../lib/globalize';
|
||||
import IconButtonElement from '../../../elements/IconButtonElement';
|
||||
|
@ -8,6 +8,7 @@ type AccessScheduleListProps = {
|
|||
DayOfWeek?: string;
|
||||
StartHour?: number ;
|
||||
EndHour?: number;
|
||||
removeScheduleCallback?: (index: number) => void;
|
||||
};
|
||||
|
||||
function getDisplayTime(hours = 0) {
|
||||
|
@ -21,7 +22,10 @@ function getDisplayTime(hours = 0) {
|
|||
return datetime.getDisplayTime(new Date(2000, 1, 1, hours, minutes, 0, 0));
|
||||
}
|
||||
|
||||
const AccessScheduleList: FunctionComponent<AccessScheduleListProps> = ({ index, DayOfWeek, StartHour, EndHour }: AccessScheduleListProps) => {
|
||||
const AccessScheduleList: FunctionComponent<AccessScheduleListProps> = ({ index, DayOfWeek, StartHour, EndHour, removeScheduleCallback }: AccessScheduleListProps) => {
|
||||
const onClick = useCallback(() => {
|
||||
index !== undefined && removeScheduleCallback !== undefined && removeScheduleCallback(index);
|
||||
}, [index, removeScheduleCallback]);
|
||||
return (
|
||||
<div
|
||||
className='liSchedule listItem'
|
||||
|
@ -43,6 +47,7 @@ const AccessScheduleList: FunctionComponent<AccessScheduleListProps> = ({ index,
|
|||
title='Delete'
|
||||
icon='delete'
|
||||
dataIndex={index}
|
||||
onClick={onClick}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
import React, { FunctionComponent } from 'react';
|
||||
import React, { FunctionComponent, useCallback } from 'react';
|
||||
import IconButtonElement from '../../../elements/IconButtonElement';
|
||||
|
||||
type IProps = {
|
||||
tag?: string,
|
||||
tagType?: string;
|
||||
removeTagCallback?: (tag: string) => void;
|
||||
};
|
||||
|
||||
const TagList: FunctionComponent<IProps> = ({ tag, tagType }: IProps) => {
|
||||
const TagList: FunctionComponent<IProps> = ({ tag, tagType, removeTagCallback }: IProps) => {
|
||||
const onClick = useCallback(() => {
|
||||
tag !== undefined && removeTagCallback !== undefined && removeTagCallback(tag);
|
||||
}, [tag, removeTagCallback]);
|
||||
return (
|
||||
<div className='paperList'>
|
||||
<div className='listItem'>
|
||||
|
@ -21,6 +25,7 @@ const TagList: FunctionComponent<IProps> = ({ tag, tagType }: IProps) => {
|
|||
title='Delete'
|
||||
icon='delete'
|
||||
dataTag={tag}
|
||||
onClick={onClick}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue