Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into more-small-screen-r…
Browse files Browse the repository at this point in the history
…esponsiveness
  • Loading branch information
Arnei committed Nov 1, 2023
2 parents 6e6ec05 + 6757d7e commit 2f1baf8
Show file tree
Hide file tree
Showing 15 changed files with 77 additions and 10 deletions.
5 changes: 2 additions & 3 deletions src/cssStyles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -439,10 +439,9 @@ export const spinningStyle = css({
})}`,
})

export const customIconStyle = (theme: Theme) => css(({
export const customIconStyle = css(({
maxWidth: '16px',
height: 'auto',
color: theme.text,
height: 'auto'
}))

export const videosStyle = (theme: Theme) => css(({
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/cs-CZ.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@
"createSubtitleDropdown-label": "Pick a language",
"backButton": "Back",
"backButton-tooltip": "Return to subtitle selection",
"downloadButton-title": "Download",
"downloadButton-tooltip": "Download subtitle as vtt file",
"editTitle": "Subtitle Editor - {{title}}",
"editTitle-loading": "Loading",
"generic": "Generic",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/de-DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@
"createSubtitleDropdown-label": "Wähle eine Sprache",
"backButton": "Zurück",
"backButton-tooltip": "Zurück zur Untertitelauswahl",
"downloadButton-title": "Herunterladen",
"downloadButton-tooltip": "Untertitel als VTT-Datei herunterladen",
"editTitle": "Untertitel-Editor - {{title}}",
"editTitle-loading": "Lädt",
"generic": "Unspezifiziert",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/el-GR.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@
"createSubtitleDropdown-label": "Επιλέξτε μια γλώσσα",
"backButton": "Επιστροφή",
"backButton-tooltip": "Επιστροφή στην επιλογή υποτίτλων",
"downloadButton-title": "Κατεβάστε",
"downloadButton-tooltip": "Download subtitle as vtt file",
"editTitle": "Επεξεργαστής υποτίτλων - {{title}}",
"editTitle-loading": "Φόρτωση",
"generic": "Γενικά",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@
"createSubtitleDropdown-label": "Pick a language",
"backButton": "Back",
"backButton-tooltip": "Return to subtitle selection",
"downloadButton-title": "Download",
"downloadButton-tooltip": "Download subtitle as vtt file",
"editTitle": "Subtitle Editor - {{title}}",
"editTitle-loading": "Loading",
"generic": "Generic",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/es-ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@
"createSubtitleDropdown-label": "Seleccione un idioma",
"backButton": "Atras",
"backButton-tooltip": "Volver a la selección de subtítulos",
"downloadButton-title": "Descargar",
"downloadButton-tooltip": "Download subtitle as vtt file",
"editTitle": "Editor de subtítulos - {{title}}",
"editTitle-loading": "Cargando",
"generic": "Generico",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@
"createSubtitleDropdown-label": "Pick a language",
"backButton": "Back",
"backButton-tooltip": "Return to subtitle selection",
"downloadButton-title": "Download",
"downloadButton-tooltip": "Download subtitle as vtt file",
"editTitle": "Subtitle Editor - {{title}}",
"editTitle-loading": "Loading",
"generic": "Generic",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/nl-NL.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@
"createSubtitleDropdown-label": "Pick a language",
"backButton": "Back",
"backButton-tooltip": "Return to subtitle selection",
"downloadButton-title": "Download",
"downloadButton-tooltip": "Download subtitle as vtt file",
"editTitle": "Subtitle Editor - {{title}}",
"editTitle-loading": "Loading",
"generic": "Generic",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@
"createSubtitleDropdown-label": "Pick a language",
"backButton": "Back",
"backButton-tooltip": "Return to subtitle selection",
"downloadButton-title": "Download",
"downloadButton-tooltip": "Download subtitle as vtt file",
"editTitle": "Subtitle Editor - {{title}}",
"editTitle-loading": "Loading",
"generic": "Generic",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@
"createSubtitleDropdown-label": "Pick a language",
"backButton": "Back",
"backButton-tooltip": "Return to subtitle selection",
"downloadButton-title": "Download",
"downloadButton-tooltip": "Download subtitle as vtt file",
"editTitle": "Subtitle Editor - {{title}}",
"editTitle-loading": "Loading",
"generic": "Generic",
Expand Down
2 changes: 1 addition & 1 deletion src/main/CuttingActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ const MarkAsDeletedButton : React.FC<markAsDeleteButtonInterface> = ({actionHand
actionHandler(action)
} }}
>
{isCurrentSegmentAlive ? <LuTrash /> : <TrashRestore css={customIconStyle(theme)} /> }
{isCurrentSegmentAlive ? <LuTrash /> : <TrashRestore css={customIconStyle} /> }
<span css={undisplay(BREAKPOINTS.medium)}>{isCurrentSegmentAlive ? t('cuttingActions.delete-button') : t("cuttingActions.restore-button")}</span>
</div>
</ThemedTooltip>
Expand Down
47 changes: 44 additions & 3 deletions src/main/SubtitleEditor.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect, useState } from "react";
import { css } from "@emotion/react";
import { basicButtonStyle, flexGapReplacementStyle } from "../cssStyles";
import { LuChevronLeft} from "react-icons/lu";
import { LuChevronLeft, LuDownload} from "react-icons/lu";
import {
selectSubtitlesFromOpencastById,
} from '../redux/videoSlice'
Expand All @@ -17,7 +17,7 @@ import SubtitleVideoArea from "./SubtitleVideoArea";
import SubtitleTimeline from "./SubtitleTimeline";
import { useTranslation } from "react-i18next";
import { useTheme } from "../themes";
import { parseSubtitle } from "../util/utilityFunctions";
import { parseSubtitle, serializeSubtitle } from "../util/utilityFunctions";
import { ThemedTooltip } from "./Tooltip";
import { titleStyle, titleStyleBold } from "../cssStyles";
import { generateButtonTitle } from "./SubtitleSelect";
Expand Down Expand Up @@ -109,7 +109,7 @@ const SubtitleEditor : React.FC = () => {
<div css={[titleStyle(theme), titleStyleBold(theme)]}>
{t("subtitles.editTitle", {title: getTitle()})}
</div>
<div css={{width: '50px'}}></div>
<DownloadButton/>
</div>
<div css={subAreaStyle}>
<SubtitleListEditor />
Expand All @@ -128,6 +128,47 @@ const SubtitleEditor : React.FC = () => {
);
}

const DownloadButton: React.FC = () => {

const subtitle = useSelector(selectSelectedSubtitleById);

const downloadSubtitles = () => {

const vttFile = new Blob([serializeSubtitle(subtitle.cues)], {type: 'text/vtt'});

const vttFileLink = window.URL.createObjectURL(vttFile);
const vttHyperLink = document.createElement('a');
vttHyperLink.setAttribute('href', vttFileLink);

const vttFileName = generateButtonTitle(subtitle.tags, t).trimEnd();
vttHyperLink.setAttribute('download', `${vttFileName}.vtt`);
vttHyperLink.click();
}

const { t } = useTranslation();
const theme = useTheme();
const style = css({
fontSize: '16px',
height: '10px',
padding: '16px',
justifyContent: 'space-around',
boxShadow: `${theme.boxShadow}`,
background: `${theme.element_bg}`,
});

return (
<ThemedTooltip title={t("subtitles.downloadButton-tooltip")}>
<div css={[basicButtonStyle(theme), style]}
role="button"
onClick={() => downloadSubtitles()}
>
<LuDownload css={{fontSize: '16px'}}/>
<span>{t("subtitles.downloadButton-title")}</span>
</div>
</ThemedTooltip>
);
}


/**
* Takes you to a different page
Expand Down
2 changes: 1 addition & 1 deletion src/main/TrackSelection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ const SelectButton : React.FC<selectButtonInterface> = ({handler, text, Icon, to
aria-label={tooltip}
onClick={clickHandler}
onKeyDown={keyHandler} >
<Icon css={customIconStyle(theme)}/>
<Icon css={customIconStyle}/>
<div>{ text }</div>
</div>
</ThemedTooltip>
Expand Down
7 changes: 6 additions & 1 deletion src/redux/workflowPostAndProcessSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ export const postVideoInformationWithWorkflow = createAsyncThunk('video/postVide
}

const response = await client.post(`${settings.opencast.url}/editor/${settings.id}/edit.json`,
{ segments: convertSegments(argument.segments), tracks: argument.tracks, workflows: argument.workflow }
{
segments: convertSegments(argument.segments),
tracks: argument.tracks,
subtitles: argument.subtitles,
workflows: argument.workflow
}
)
return response
})
Expand Down
6 changes: 5 additions & 1 deletion src/redux/workflowPostSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ export const postVideoInformation = createAsyncThunk('video/postVideoInformation
}

const response = await client.post(`${settings.opencast.url}/editor/${settings.id}/edit.json`,
{ segments: convertSegments(argument.segments), tracks: argument.tracks, subtitles: argument.subtitles }
{
segments: convertSegments(argument.segments),
tracks: argument.tracks,
subtitles: argument.subtitles
}
)
return response
})
Expand Down

0 comments on commit 2f1baf8

Please sign in to comment.