Skip to content

Commit

Permalink
fix: updated code, with dnd not working
Browse files Browse the repository at this point in the history
  • Loading branch information
malmen237 committed Sep 12, 2024
1 parent c60a478 commit 230837f
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/app/production/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,7 @@ export default function ProductionConfiguration({ params }: PageProps) {
<StartProductionButton
refreshProduction={refreshProduction}
production={productionSetup}
sources={sources}
disabled={!selectedPreset ? true : false}
/>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/components/dragElement/DragItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useDrag, useDrop } from 'react-dnd';
import { SourceReference } from '../../interfaces/Source';
import { ObjectId } from 'mongodb';
import { Production } from '../../interfaces/production';
import { ISource } from '../../hooks/useDragableItems';

interface IDrag {
id: ObjectId | string;
Expand Down
10 changes: 7 additions & 3 deletions src/components/sourceCards/SourceCards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,17 @@ export default function SourceCards({
const [items, moveItem] = useDragableItems(productionSetup.sources);
const [selectingText, setSelectingText] = useState(false);
if (!items) return null;
const sourceReferences = items.filter(
(item): item is SourceReference => item.type !== 'ingest_source'
);
const isISource = (source: SourceReference | ISource): source is ISource => {
return 'src' in source;
};

const sourceReferences = items.filter(
// (item): item is SourceReference => item.type !== 'ingest_source'
(item) =>
(item as SourceReference).type === 'html' ||
(item as SourceReference).type === 'mediaplayer'
);

const gridItems = items.map((source) => {
const id = source._id ? source._id : '';
const isSource = isISource(source);
Expand Down
5 changes: 5 additions & 0 deletions src/components/startProduction/StartProductionButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,18 @@ import { usePutProduction } from '../../hooks/productions';
import toast from 'react-hot-toast';
import { useDeleteMonitoring } from '../../hooks/monitoring';
import { useMultiviewPresets } from '../../hooks/multiviewPreset';
import { SourceWithId } from '../../interfaces/Source';

type StartProductionButtonProps = {
production: Production | undefined;
sources: Map<string, SourceWithId>;
disabled: boolean;
refreshProduction: () => void;
};

export function StartProductionButton({
production,
sources,
disabled,
refreshProduction
}: StartProductionButtonProps) {
Expand All @@ -45,6 +48,8 @@ export function StartProductionButton({

const onClick = () => {
if (!production) return;
console.log('sources', sources);
console.log('production', production);
const hasUndefinedPipeline = production.production_settings.pipelines.some(
(p) => !p.pipeline_name
);
Expand Down
1 change: 1 addition & 0 deletions src/hooks/pipelines.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export function usePipeline(
setLoading(true);
getPipeline(id)
.then((pipeline) => {
console.log('pipeline', pipeline);
setPipeline(pipeline);
})
.catch((error) => {
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useDragableItems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function useDragableItems(
video_stream: source.video_stream,
audio_stream: source.audio_stream,
status: source.status,
type: source.type,
media_element: source.media_element,
tags: source.tags,
name: source.name
};
Expand All @@ -49,7 +49,7 @@ export function useDragableItems(
_id: refId,
status: source.status,
name: source.name,
type: source.type,
media_element: source.media_element,
tags: source.tags,
ingest_name: source.ingest_name,
ingest_source_name: source.ingest_source_name,
Expand Down
4 changes: 2 additions & 2 deletions src/interfaces/Source.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ObjectId, WithId } from 'mongodb';
export type SourceType = 'camera' | 'graphics' | 'microphone';
export type MediaElement = 'camera' | 'graphics' | 'microphone';
export type SourceStatus = 'ready' | 'new' | 'gone' | 'purge';
export type Type = 'ingest_source' | 'html' | 'mediaplayer';
export type VideoStream = {
Expand All @@ -20,7 +20,7 @@ export interface Source {
_id?: ObjectId | string;
status: SourceStatus;
name: string;
type: SourceType;
media_element: MediaElement;
tags: {
location: string;
[key: string]: string | undefined;
Expand Down

0 comments on commit 230837f

Please sign in to comment.