Skip to content

Commit

Permalink
Some big fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
SenexCrenshaw committed Jul 11, 2023
1 parent 00b98fb commit 4e8468d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ public ReadDirectoryLogosRequestHandler(IMemoryCache memoryCache)

public async Task Handle(ReadDirectoryLogosRequest command, CancellationToken cancellationToken)
{
if (!Directory.Exists(Constants.TVLogoDirectory))
{
return;
}

Setting setting = FileUtil.GetSetting();
DirectoryInfo dirInfo = new(Constants.TVLogoDirectory);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const PlayListDataSelectorPicker = (props: PlayListDataSelectorPickerProps) => {
return;
}

if (props.videoStream?.childVideoStreams !== undefined) {
if (props.videoStream?.childVideoStreams !== undefined && props.videoStream.childVideoStreams.length > 0) {
const newStreams = [...props.videoStream.childVideoStreams];

const dsIds = newStreams.map((sgvs) => sgvs.id);
Expand Down
1 change: 0 additions & 1 deletion streammasterwebui/src/components/VideoStreamPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import { Button } from 'primereact/button';

import { InputNumber } from 'primereact/inputnumber';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ import { getTopToolOptions } from '../../common/common';

const DataSelectorPicker = <T extends DataTableValue,>(props: DataSelectorPickerProps<T>) => {

const [selection, setSelection] = React.useState<T[]>([] as T[]);
const [selection, setSelection] = React.useState<T[] | undefined>(undefined);

const [previousSelection, setPreviousSelection] = React.useState<T[]>([] as T[]);


const [sourceDataSource, setSourceDataSource] = React.useState<T[] | undefined>(undefined);
const [targetDataSource, setTargetDataSource] = React.useState<T[] | undefined>(undefined);

React.useEffect(() => {
Expand All @@ -24,6 +27,9 @@ const DataSelectorPicker = <T extends DataTableValue,>(props: DataSelectorPicker
}, [props.sourceDataSource, props.targetDataSource]);

const onSelectionChange = React.useCallback((value: T[], isUndo?: boolean) => {
if (!selection)
return;

setPreviousSelection(selection);

if (value instanceof Array) {
Expand All @@ -45,7 +51,7 @@ const DataSelectorPicker = <T extends DataTableValue,>(props: DataSelectorPicker
}, [props, selection]);


React.useMemo(() => {
React.useEffect(() => {
if (props?.selection === undefined) {
return;
}
Expand All @@ -61,11 +67,11 @@ const DataSelectorPicker = <T extends DataTableValue,>(props: DataSelectorPicker

}, [props.selection]);

console.log('props.sourceDataSource:', props.sourceDataSource);

React.useEffect(() => {

const dataSource = React.useMemo((): T[] | undefined => {

if (!props.sourceDataSource || selection.length === 0) {
if (!props.sourceDataSource || !selection || selection.length === 0) {
return;
}

Expand All @@ -78,10 +84,11 @@ const DataSelectorPicker = <T extends DataTableValue,>(props: DataSelectorPicker
});

const test = props.sourceDataSource.filter((obj) => !idsToMoveToTop.includes(obj.id));
setSourceDataSource(test);
console.log('test:', test)

return test;

}, [props.sourceDataSource, selection]);
}, [props, selection]);

const targetRightHeaderTemplate = React.useMemo(() => {
if (props.targetHeaderTemplate && props.showUndo !== true) {
Expand Down Expand Up @@ -120,7 +127,7 @@ const DataSelectorPicker = <T extends DataTableValue,>(props: DataSelectorPicker
<div className='col-6'>
<DataSelector
columns={props.sourceColumns}
dataSource={dataSource}
dataSource={sourceDataSource}
enableState={props.sourceEnableState}
headerLeftTemplate={props.sourceHeaderPrefixTemplate}
headerRightTemplate={props.sourceHeaderTemplate}
Expand Down

0 comments on commit 4e8468d

Please sign in to comment.