Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the style for translation length warnings #228

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions app/src/pages/edit/Row.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,17 @@
.actions {
display: flex;
flex-wrap: wrap;
align-items: center;
align-items: last baseline;
gap: 20px;
}

.playWarningWrapper {
display: flex;
flex-direction: column;
align-items: center;
gap: 15px;
}

.edit {
box-sizing: content-box;
width: 50vw;
Expand All @@ -41,7 +48,13 @@

.warning {
border-style: dashed;
background: var(--error-light);
border-color: var(--error);
border-width: 2px;
}

.warningTriangle {
marginLeft: '8px';
color: var(--error);
}

.legacy {
Expand Down
70 changes: 36 additions & 34 deletions app/src/pages/edit/Row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
FaStop,
FaThumbsUp,
} from "react-icons/fa6";
import { FaExclamationTriangle } from 'react-icons/fa';
import { Link, useParams } from "react-router-dom";
import classNames from "classnames";
import { useAtom, useAtomValue } from "jotai";
Expand Down Expand Up @@ -108,30 +109,39 @@ function Row({ index, entries }: Props) {
<span>{edited ? 1 : reviews + Number(upvoted)}</span>
</button>

{start && end && (
<button
className={classes.action}
onClick={() => {
const header = document.querySelector("header")!;

if (getPlaying) {
stopVideo();
header.style.height = "";
} else {
// Add a little breathing room at the end
playSegment(start, end + 0.5);

/** expand header */
const expand = innerHeight / 3;
if (parseFloat(window.getComputedStyle(header).height) < expand)
header.style.height = expand + "px";
}
}}
data-tooltip={`Play video at this timestamp<br/>(${formatTime(start)} - ${formatTime(end)})`}
>
{getPlaying ? <FaStop /> : <FaPlay />}
</button>
)}
<div className={classes.playWarningWrapper}>
{translationWarning && (
<FaExclamationTriangle
className={classes.warningTriangle}
data-tooltip="This translation may be too long to fit in the time slot"
/>
)}

{start && end && (
<button
className={classes.action}
onClick={() => {
const header = document.querySelector("header")!;

if (getPlaying) {
stopVideo();
header.style.height = "";
} else {
// Add a little breathing room at the end
playSegment(start, end + 0.5);

/** expand header */
const expand = innerHeight / 3;
if (parseFloat(window.getComputedStyle(header).height) < expand)
header.style.height = expand + "px";
}
}}
data-tooltip={`Play video at this timestamp<br/>(${formatTime(start)} - ${formatTime(end)})`}
>
{getPlaying ? <FaStop /> : <FaPlay />}
</button>
)}
</div>
</div>

{/* translation edit textbox */}
Expand All @@ -142,11 +152,7 @@ function Row({ index, entries }: Props) {
)}
value={currentTranslation}
onChange={(value) => setEntry({ currentTranslation: value })}
data-tooltip={
translationWarning
? "This translation is starting to become too long to fit in the time slot"
: "Edit translated text"
}
data-tooltip={"Edit translated text"}
/>

{/* original english textbox */}
Expand All @@ -157,11 +163,7 @@ function Row({ index, entries }: Props) {
)}
value={entry.currentOriginal}
onChange={(value) => setEntry({ currentOriginal: value })}
data-tooltip={
translationWarning
? "This text is starting to become too long to fit in the time slot"
: "Original English text. If you see a significant problem, click to edit."
}
data-tooltip={"Original English text. If you see a significant problem, click to edit."}
/>

{/* secondary actions */}
Expand Down