touchup
This commit is contained in:
parent
eb9ffc5c6f
commit
6c729972ca
|
@ -16,19 +16,19 @@ function Entry({
|
||||||
textOptions,
|
textOptions,
|
||||||
nonClickable,
|
nonClickable,
|
||||||
isolateEntry,
|
isolateEntry,
|
||||||
user,
|
admin,
|
||||||
}: {
|
}: {
|
||||||
entry: T.DictionaryEntry;
|
entry: T.DictionaryEntry;
|
||||||
textOptions: T.TextOptions;
|
textOptions: T.TextOptions;
|
||||||
nonClickable?: boolean;
|
nonClickable?: boolean;
|
||||||
isolateEntry?: (ts: number) => void;
|
isolateEntry?: (ts: number) => void;
|
||||||
user: LingdocsUser | undefined;
|
admin: boolean;
|
||||||
}) {
|
}) {
|
||||||
function handlePlayStorageAudio(
|
function handlePlayStorageAudio(
|
||||||
e: React.MouseEvent<HTMLElement, MouseEvent>
|
e: React.MouseEvent<HTMLElement, MouseEvent>
|
||||||
) {
|
) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
playStorageAudio(entry.ts, entry.p, user, () => null);
|
playStorageAudio(entry.ts, entry.p, admin, () => null);
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import ReactGA from "react-ga4";
|
import ReactGA from "react-ga4";
|
||||||
import { LingdocsUser } from "../types/account-types";
|
|
||||||
|
|
||||||
export function getAudioPath(ts: number): string {
|
export function getAudioPath(ts: number): string {
|
||||||
return `https://storage.lingdocs.com/audio/${ts}.mp3`;
|
return `https://storage.lingdocs.com/audio/${ts}.mp3`;
|
||||||
|
@ -8,11 +7,11 @@ export function getAudioPath(ts: number): string {
|
||||||
export default function playStorageAudio(
|
export default function playStorageAudio(
|
||||||
ts: number,
|
ts: number,
|
||||||
p: string,
|
p: string,
|
||||||
user: LingdocsUser | undefined,
|
admin: boolean,
|
||||||
callback: () => void
|
callback: () => void
|
||||||
) {
|
) {
|
||||||
if (!ts) return;
|
if (!ts) return;
|
||||||
if (user && !user.admin) {
|
if (!admin) {
|
||||||
ReactGA.event({
|
ReactGA.event({
|
||||||
category: "sounds",
|
category: "sounds",
|
||||||
action: `quick play ${p} - ${ts}`,
|
action: `quick play ${p} - ${ts}`,
|
||||||
|
|
|
@ -233,7 +233,7 @@ function EntryEditor({
|
||||||
</Helmet>
|
</Helmet>
|
||||||
{isolatedEntry && (
|
{isolatedEntry && (
|
||||||
<Entry
|
<Entry
|
||||||
user={user}
|
admin={!!user?.admin}
|
||||||
nonClickable
|
nonClickable
|
||||||
entry={isolatedEntry}
|
entry={isolatedEntry}
|
||||||
textOptions={textOptions}
|
textOptions={textOptions}
|
||||||
|
|
|
@ -164,7 +164,7 @@ function IsolatedEntry({
|
||||||
<dl className="row mb-1">
|
<dl className="row mb-1">
|
||||||
<div className="col-8">
|
<div className="col-8">
|
||||||
<Entry
|
<Entry
|
||||||
user={state.user}
|
admin={!!state.user?.admin}
|
||||||
nonClickable
|
nonClickable
|
||||||
entry={exploded ? explodeEntry(entry) : entry}
|
entry={exploded ? explodeEntry(entry) : entry}
|
||||||
textOptions={textOptions}
|
textOptions={textOptions}
|
||||||
|
|
|
@ -72,6 +72,7 @@ function Results({
|
||||||
setSuggestionState("received");
|
setSuggestionState("received");
|
||||||
}
|
}
|
||||||
const inflectionResults = state.inflectionSearchResults;
|
const inflectionResults = state.inflectionSearchResults;
|
||||||
|
const admin = !!state.user?.admin;
|
||||||
return (
|
return (
|
||||||
<div className="width-limiter">
|
<div className="width-limiter">
|
||||||
{!relatedResults && (
|
{!relatedResults && (
|
||||||
|
@ -143,7 +144,7 @@ function Results({
|
||||||
entry={p.entry}
|
entry={p.entry}
|
||||||
textOptions={textOptions}
|
textOptions={textOptions}
|
||||||
isolateEntry={isolateEntry}
|
isolateEntry={isolateEntry}
|
||||||
user={state.user}
|
admin={admin}
|
||||||
/>
|
/>
|
||||||
<div className="mb-3 ml-2">
|
<div className="mb-3 ml-2">
|
||||||
{p.forms.map((form, i) => (
|
{p.forms.map((form, i) => (
|
||||||
|
@ -170,7 +171,7 @@ function Results({
|
||||||
entry={entry}
|
entry={entry}
|
||||||
textOptions={textOptions}
|
textOptions={textOptions}
|
||||||
isolateEntry={isolateEntry}
|
isolateEntry={isolateEntry}
|
||||||
user={state.user}
|
admin={admin}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</dl>
|
</dl>
|
||||||
|
|
|
@ -50,7 +50,7 @@ function ReviewTask({
|
||||||
<div>New Entry Suggestion</div>
|
<div>New Entry Suggestion</div>
|
||||||
)}
|
)}
|
||||||
<Entry
|
<Entry
|
||||||
user={undefined}
|
admin={false}
|
||||||
textOptions={textOptions}
|
textOptions={textOptions}
|
||||||
entry={reviewTask.entry}
|
entry={reviewTask.entry}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -118,6 +118,7 @@ function Wordlist({
|
||||||
};
|
};
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
}, []);
|
}, []);
|
||||||
|
const admin = !!user?.admin;
|
||||||
// TODO put the account url in an imported constant
|
// TODO put the account url in an imported constant
|
||||||
function handleIncomingMessage(event: MessageEvent<any>) {
|
function handleIncomingMessage(event: MessageEvent<any>) {
|
||||||
if (
|
if (
|
||||||
|
@ -199,7 +200,7 @@ function Wordlist({
|
||||||
return (
|
return (
|
||||||
<div className="mb-4">
|
<div className="mb-4">
|
||||||
<Entry
|
<Entry
|
||||||
user={user}
|
admin={admin}
|
||||||
entry={word.entry}
|
entry={word.entry}
|
||||||
textOptions={textOptions}
|
textOptions={textOptions}
|
||||||
isolateEntry={() => handleWordClickBrowse(word._id)}
|
isolateEntry={() => handleWordClickBrowse(word._id)}
|
||||||
|
|
Loading…
Reference in New Issue