expose word id copy tag for all
This commit is contained in:
parent
10b9bf8888
commit
685b85bd48
|
@ -53,11 +53,18 @@ function IsolatedEntry({ state, dictionary, isolateEntry }: {
|
||||||
const [comment, setComment] = useState<string>("");
|
const [comment, setComment] = useState<string>("");
|
||||||
const [editSubmitted, setEditSubmitted] = useState<boolean>(false);
|
const [editSubmitted, setEditSubmitted] = useState<boolean>(false);
|
||||||
const [showingDeleteWarning, setShowingDeleteWarning] = useState<boolean>(false);
|
const [showingDeleteWarning, setShowingDeleteWarning] = useState<boolean>(false);
|
||||||
|
const [showClipped, setShowClipped] = useState<string>("");
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setEditing(false);
|
setEditing(false);
|
||||||
setComment("");
|
setComment("");
|
||||||
setEditSubmitted(false);
|
setEditSubmitted(false);
|
||||||
}, [state]);
|
}, [state]);
|
||||||
|
function flashClippedMessage(m: string) {
|
||||||
|
setShowClipped(m);
|
||||||
|
setTimeout(() => {
|
||||||
|
setShowClipped("");
|
||||||
|
}, 1250);
|
||||||
|
}
|
||||||
const wordlistWord = state.wordlist.find((w) => w.entry.ts === state.isolatedEntry?.ts);
|
const wordlistWord = state.wordlist.find((w) => w.entry.ts === state.isolatedEntry?.ts);
|
||||||
const textOptions = getTextOptions(state);
|
const textOptions = getTextOptions(state);
|
||||||
function submitEdit() {
|
function submitEdit() {
|
||||||
|
@ -128,6 +135,16 @@ function IsolatedEntry({ state, dictionary, isolateEntry }: {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function handleClipId() {
|
||||||
|
if (!entry) return
|
||||||
|
navigator.clipboard.writeText(entry.ts.toString());
|
||||||
|
flashClippedMessage("word id copied to clipboard");
|
||||||
|
}
|
||||||
|
function handleClipEntry() {
|
||||||
|
if (!entry) return
|
||||||
|
navigator.clipboard.writeText(JSON.stringify(entry));
|
||||||
|
flashClippedMessage("entry data copied to clipboard");
|
||||||
|
}
|
||||||
return <div className="wide-width-limiter">
|
return <div className="wide-width-limiter">
|
||||||
<Helmet>
|
<Helmet>
|
||||||
<title>{entry.p} - LingDocs Pashto Dictionary</title>
|
<title>{entry.p} - LingDocs Pashto Dictionary</title>
|
||||||
|
@ -149,11 +166,11 @@ function IsolatedEntry({ state, dictionary, isolateEntry }: {
|
||||||
>
|
>
|
||||||
<i className={`fas fa-${exploded ? "compress" : "expand"}-alt`} />
|
<i className={`fas fa-${exploded ? "compress" : "expand"}-alt`} />
|
||||||
</div>
|
</div>
|
||||||
|
<div className="clickable mr-3" onClick={handleClipId}>
|
||||||
|
<i className="fas fa-tag"></i>
|
||||||
|
</div>
|
||||||
{state.user && state.user.level === "editor" && <>
|
{state.user && state.user.level === "editor" && <>
|
||||||
<div className="clickable mr-3" onClick={() => navigator.clipboard.writeText(entry.ts.toString())}>
|
<div className="clickable mr-3" onClick={handleClipEntry}>
|
||||||
<i className="fas fa-tag"></i>
|
|
||||||
</div>
|
|
||||||
<div className="clickable mr-3" onClick={() => navigator.clipboard.writeText(JSON.stringify(entry))}>
|
|
||||||
<i className="fas fa-code"></i>
|
<i className="fas fa-code"></i>
|
||||||
</div>
|
</div>
|
||||||
<Link to={`/edit?id=${entry.ts}`} className="plain-link">
|
<Link to={`/edit?id=${entry.ts}`} className="plain-link">
|
||||||
|
@ -251,6 +268,15 @@ function IsolatedEntry({ state, dictionary, isolateEntry }: {
|
||||||
{isVerbEntry && <div className="pb-4">
|
{isVerbEntry && <div className="pb-4">
|
||||||
<DisplayVPExplorer entry={entry} complement={complement} />
|
<DisplayVPExplorer entry={entry} complement={complement} />
|
||||||
</div>}
|
</div>}
|
||||||
|
{showClipped && <div className="alert alert-primary text-center" role="alert" style={{
|
||||||
|
position: "fixed",
|
||||||
|
top: "30%",
|
||||||
|
left: "50%",
|
||||||
|
transform: "translate(-50%, -50%)",
|
||||||
|
zIndex: 9999999999999,
|
||||||
|
}}>
|
||||||
|
{showClipped}
|
||||||
|
</div>}
|
||||||
|
|
||||||
{!!(relatedEntries && relatedEntries.length) ? <>
|
{!!(relatedEntries && relatedEntries.length) ? <>
|
||||||
<h4 style={{ marginTop: isVerbEntry ? "10rem" : "5rem" }}>Related Words</h4>
|
<h4 style={{ marginTop: isVerbEntry ? "10rem" : "5rem" }}>Related Words</h4>
|
||||||
|
|
Loading…
Reference in New Issue