Skip to content

Commit

Permalink
Merge pull request #905 from Arnei/remove-dead-code-in-video-header
Browse files Browse the repository at this point in the history
Remove dead code in video header
  • Loading branch information
lkiesow authored Mar 31, 2023
2 parents ff05558 + c5579b3 commit bebe42b
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/cssStyles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export const titleStyle = css(({
overflow: 'hidden',
whiteSpace: "nowrap",
textOverflow: 'ellipsis',
maxWidth: '500px',
maxWidth: '100%',
}))

/**
Expand Down
10 changes: 5 additions & 5 deletions src/main/SubtitleSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,12 @@ const SubtitleAddButton: React.FC<{languages: {subFlavor: string, title: string}
>
</Select>
</ThemeProvider>
{/* "By default disabled elements like <button> do not trigger user interactions
* so a Tooltip will not activate on normal events like hover. To accommodate

{/* "By default disabled elements like <button> do not trigger user interactions
* so a Tooltip will not activate on normal events like hover. To accommodate
* disabled elements, add a simple wrapper element, such as a span."
* see: https://mui.com/material-ui/react-tooltip/#disabled-elements */}
<ThemedTooltip title={t("subtitles.createSubtitleButton-createButton-tooltip")}>
<ThemedTooltip title={t("subtitles.createSubtitleButton-createButton-tooltip")}>
<span>
<button css={[basicButtonStyle(theme), createButtonStyle, { width:"100%" } ]}
type="submit"
Expand All @@ -241,7 +241,7 @@ const SubtitleAddButton: React.FC<{languages: {subFlavor: string, title: string}
</button>
</span>
</ThemedTooltip>

</form>
)}
/>
Expand Down
14 changes: 7 additions & 7 deletions src/main/SubtitleVideoArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,13 @@ const VideoSelectDropdown : React.FC<{
handleSubmit(event)
}} css={subtitleAddFormStyle}>

<ThemeProvider theme={subtitleSelectStyle(theme)}>
<Select
label={t("subtitleVideoArea.selectVideoLabel") ?? undefined}
name={dropdownName}
data={selectData()}
/>
</ThemeProvider>
<ThemeProvider theme={subtitleSelectStyle(theme)}>
<Select
label={t("subtitleVideoArea.selectVideoLabel") ?? undefined}
name={dropdownName}
data={selectData()}
/>
</ThemeProvider>

<OnChange name={dropdownName}>
{(value, previous) => {
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 @@ -673,22 +673,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 @@ -334,7 +334,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 @@ -203,7 +203,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 @@ -371,7 +370,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 bebe42b

Please sign in to comment.