Added link copying abilities and touch support for the context menu

This commit is contained in:
Dunemask 2021-09-05 16:32:27 -06:00
parent 3e75c2a12c
commit 96ebe71cb6
3 changed files with 17 additions and 3 deletions

View file

@ -96,7 +96,15 @@ export default class StashContextMenu extends React.Component {
}); });
this.props.fileBoxesChanged(fileBoxes); 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() { styleCalc() {
const estimatedHeight = 180; //px const estimatedHeight = 180; //px

View file

@ -24,7 +24,13 @@ class Stashbar extends React.Component {
setSearchMode={this.setSearchMode.bind(this)} setSearchMode={this.setSearchMode.bind(this)}
/> />
); );
else return <StashbarMenu setSearchMode={this.setSearchMode.bind(this)} />; else
return (
<StashbarMenu
contextMenu={this.props.contextMenu}
setSearchMode={this.setSearchMode.bind(this)}
/>
);
} }
render() { render() {

View file

@ -11,7 +11,7 @@ class StashbarMenu extends React.Component {
render() { render() {
return ( return (
<div className="stashbar-menu"> <div className="stashbar-menu">
<span className="stashbar-action"> <span className="stashbar-action" onClick={this.props.contextMenu}>
<FontAwesomeIcon icon={faBars} /> <FontAwesomeIcon icon={faBars} />
</span> </span>
<span className="stashbar-action"> <span className="stashbar-action">