From 96ebe71cb6b3289ff648af5a7bfd7953f25478bb Mon Sep 17 00:00:00 2001 From: Dunemask Date: Sun, 5 Sep 2021 16:32:27 -0600 Subject: [PATCH] Added link copying abilities and touch support for the context menu --- src/stash/StashContextMenu.jsx | 10 +++++++++- src/stash/Stashbar.jsx | 8 +++++++- src/stash/stashbar/StashbarMenu.jsx | 2 +- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/stash/StashContextMenu.jsx b/src/stash/StashContextMenu.jsx index b53e737..b4ade79 100644 --- a/src/stash/StashContextMenu.jsx +++ b/src/stash/StashContextMenu.jsx @@ -96,7 +96,15 @@ export default class StashContextMenu extends React.Component { }); this.props.fileBoxesChanged(fileBoxes); } - shareClick() {} + shareClick() { + const fileBoxes = this.props.fileBoxes; + const selectedBoxes = this.props.getSelectedBoxes(); + if (selectedBoxes.length !== 1) + return toast.error("Only one file can be selected!"); + const url = `${window.location.origin}${process.env.PUBLIC_URL}${downloadUrl}?target=${selectedBoxes[0]}`; + navigator.clipboard.writeText(url); + toast.success("Link successfully copied!"); + } styleCalc() { const estimatedHeight = 180; //px diff --git a/src/stash/Stashbar.jsx b/src/stash/Stashbar.jsx index f43dce1..8d421a1 100644 --- a/src/stash/Stashbar.jsx +++ b/src/stash/Stashbar.jsx @@ -24,7 +24,13 @@ class Stashbar extends React.Component { setSearchMode={this.setSearchMode.bind(this)} /> ); - else return ; + else + return ( + + ); } render() { diff --git a/src/stash/stashbar/StashbarMenu.jsx b/src/stash/stashbar/StashbarMenu.jsx index 3231840..af2fabf 100644 --- a/src/stash/stashbar/StashbarMenu.jsx +++ b/src/stash/stashbar/StashbarMenu.jsx @@ -11,7 +11,7 @@ class StashbarMenu extends React.Component { render() { return (
- +