Compare commits

..

No commits in common. "60ce765193eb17e1986cd5bb02ceb6379995d833" and "77018ef252b442804caeeb03873bb1cd6608f5e7" have entirely different histories.

2 changed files with 2 additions and 14 deletions

View File

@ -8,7 +8,6 @@
import ExtraEntryInfo from "../components/ExtraEntryInfo"; import ExtraEntryInfo from "../components/ExtraEntryInfo";
import classNames from "classnames"; import classNames from "classnames";
import { Types as T, InlinePs } from "@lingdocs/ps-react"; import { Types as T, InlinePs } from "@lingdocs/ps-react";
import playStorageAudio from "./PlayStorageAudio";
function Entry({ function Entry({
entry, entry,
@ -21,12 +20,6 @@ function Entry({
nonClickable?: boolean; nonClickable?: boolean;
isolateEntry?: (ts: number) => void; isolateEntry?: (ts: number) => void;
}) { }) {
function handlePlayStorageAudio(
e: React.MouseEvent<HTMLElement, MouseEvent>
) {
e.stopPropagation();
playStorageAudio(entry.ts, () => null);
}
return ( return (
<div <div
className={classNames("entry", { clickable: !nonClickable })} className={classNames("entry", { clickable: !nonClickable })}
@ -41,12 +34,7 @@ function Entry({
</strong> </strong>
{` `} {` `}
<em>{entry.c}</em> <em>{entry.c}</em>
{entry.a && !nonClickable && ( {entry.a && !nonClickable && <i className="ml-2 fas fa-volume-down" />}
<i
onClick={handlePlayStorageAudio}
className="clickable ml-2 fas fa-volume-down"
/>
)}
</div> </div>
<ExtraEntryInfo entry={entry} textOptions={textOptions} /> <ExtraEntryInfo entry={entry} textOptions={textOptions} />
<div className="entry-definition">{entry.e}</div> <div className="entry-definition">{entry.e}</div>

View File

@ -1,6 +1,6 @@
export default function playStorageAudio(ts: number, callback: () => void) { export default function playStorageAudio(ts: number, callback: () => void) {
if (!ts) return; if (!ts) return;
let audio = new Audio(`https://storage.lingdocs.com/audio/${ts}.mp3`); let audio = new Audio(`https://storage.lingdocs.com/${ts}.mp3`);
audio.addEventListener("ended", () => { audio.addEventListener("ended", () => {
callback(); callback();
audio.remove(); audio.remove();