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