Skip to content

Commit

Permalink
Remove dead code in video header
Browse files Browse the repository at this point in the history
Removes code that would display presenters in the video title in the
cutting view. Displaying presenters has been removed from the backend
for quite some time now and no one seems to have minded, so I think
this can just go.

Also resolves opencast#887 while I'm at it.

(Contains opencast#892)
  • Loading branch information
Arnei committed Nov 18, 2022
1 parent 8de3979 commit 0e46573
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/cssStyles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export const titleStyle = css(({
overflow: 'hidden',
whiteSpace: "nowrap",
textOverflow: 'ellipsis',
maxWidth: '500px',
maxWidth: '100%',
}))

/**
Expand Down
14 changes: 2 additions & 12 deletions src/main/Video.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { faPlay, faPause, faToggleOn, faToggleOff, faGears} from "@fortawesome/f
import { useSelector, useDispatch } from 'react-redux';
import {
selectIsPlaying, selectCurrentlyAt, selectCurrentlyAtInSeconds, setIsPlaying,
fetchVideoInformation, selectVideoURL, selectVideoCount, selectDurationInSeconds, selectTitle, selectPresenters,
fetchVideoInformation, selectVideoURL, selectVideoCount, selectDurationInSeconds, selectTitle,
setPreviewTriggered, selectPreviewTriggered, selectIsPlayPreview, setIsPlayPreview, setAspectRatio, selectAspectRatio, selectDuration, setClickTriggered, selectClickTriggered, setCurrentlyAt
} from '../redux/videoSlice'

Expand Down Expand Up @@ -657,22 +657,12 @@ const TimeDisplay: React.FC<{
*/
const VideoHeader: React.FC<{}> = () => {

const { t } = useTranslation();

const title = useSelector(selectTitle)
const metadataTitle = useSelector(selectTitleFromEpisodeDc)
const presenters = useSelector(selectPresenters)

let presenter_header;
if (presenters && presenters.length) {
presenter_header = <div css={titleStyle} title={t("video.presenter-tooltip")}>by {presenters.join(", ")}</div>
}
return (
<div css={{fontSize: '16px'}}>
<div css={[titleStyle, titleStyleBold]} title={t("video.title-tooltip")}>
<div css={[titleStyle, titleStyleBold]}>
{metadataTitle ? metadataTitle : title}
</div>
{presenter_header}
</div>
);
}
Expand Down
3 changes: 1 addition & 2 deletions src/redux/__tests__/videoSlice.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import reducer, { initialState, setIsPlaying, selectIsPlaying, setCurrentlyAt,
selectCurrentlyAt, selectActiveSegmentIndex, selectPreviewTriggered,
selectDuration, video, cut, selectSegments, markAsDeletedOrAlive, mergeRight,
fetchVideoInformation, selectVideoURL, selectTitle, selectPresenters,
fetchVideoInformation, selectVideoURL, selectTitle,
selectTracks, selectWorkflows } from '../videoSlice'
import cloneDeep from 'lodash/cloneDeep';
import { httpRequestState } from '../../types';
Expand Down Expand Up @@ -332,7 +332,6 @@ describe('Video reducer', () => {
expect(selectVideoURL(rootState)).toMatchObject(videoURLs);
expect(selectDuration(rootState)).toEqual(dur);
expect(selectTitle(rootState)).toEqual(title);
expect(selectPresenters(rootState)).toEqual([]);
expect(selectTracks(rootState)).toMatchObject(tracks);
expect(selectWorkflows(rootState)).toMatchObject(workflows);
})
Expand Down
2 changes: 0 additions & 2 deletions src/redux/videoSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ const videoSlice = createSlice({
state.captions = action.payload.subtitles ? state.captions = action.payload.subtitles : []
state.duration = action.payload.duration
state.title = action.payload.title
state.presenters = []
state.segments = parseSegments(action.payload.segments, action.payload.duration)
state.workflows = action.payload.workflows.sort((n1: { displayOrder: number; },n2: { displayOrder: number; }) => {
return n1.displayOrder - n2.displayOrder;
Expand Down Expand Up @@ -386,7 +385,6 @@ export const selectVideoCount = (state: { videoState: { videoCount: video["video
export const selectDuration = (state: { videoState: { duration: video["duration"] } }) => state.videoState.duration
export const selectDurationInSeconds = (state: { videoState: { duration: video["duration"] } }) => state.videoState.duration / 1000
export const selectTitle = (state: { videoState: { title: video["title"] } }) => state.videoState.title
export const selectPresenters = (state: { videoState: { presenters: video["presenters"] } }) => state.videoState.presenters
export const selectTracks = (state: { videoState: { tracks: video["tracks"] } }) => state.videoState.tracks
export const selectWorkflows = (state: { videoState: { workflows: video["workflows"] } }) => state.videoState.workflows
export const selectAspectRatio = (state: { videoState: { aspectRatios: video["aspectRatios"] } }) =>
Expand Down

0 comments on commit 0e46573

Please sign in to comment.