mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-09-12 13:29:47 +00:00
fix availability issue and restore open in folder
This commit is contained in:
parent
47aec4efcf
commit
2746627fb1
7 changed files with 43 additions and 10 deletions
|
@ -4,6 +4,11 @@ import { selectFetchingAvailability } from "selectors/availability";
|
||||||
|
|
||||||
export function doFetchAvailability(uri) {
|
export function doFetchAvailability(uri) {
|
||||||
return function(dispatch, getState) {
|
return function(dispatch, getState) {
|
||||||
|
/*
|
||||||
|
this is disabled atm - Jeremy
|
||||||
|
*/
|
||||||
|
return;
|
||||||
|
|
||||||
const state = getState();
|
const state = getState();
|
||||||
const alreadyFetching = !!selectFetchingAvailability(state)[uri];
|
const alreadyFetching = !!selectFetchingAvailability(state)[uri];
|
||||||
|
|
||||||
|
|
|
@ -71,18 +71,18 @@ export function doFileList() {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function doOpenFileInShell(fileInfo) {
|
export function doOpenFileInShell(path) {
|
||||||
return function(dispatch, getState) {
|
return function(dispatch, getState) {
|
||||||
const success = shell.openItem(fileInfo.download_path);
|
const success = shell.openItem(path);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
dispatch(doOpenFileInFolder(fileInfo));
|
dispatch(doOpenFileInFolder(path));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function doOpenFileInFolder(fileInfo) {
|
export function doOpenFileInFolder(path) {
|
||||||
return function(dispatch, getState) {
|
return function(dispatch, getState) {
|
||||||
shell.showItemInFolder(fileInfo.download_path);
|
shell.showItemInFolder(path);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,11 +6,18 @@ import {
|
||||||
makeSelectMetadataForUri,
|
makeSelectMetadataForUri,
|
||||||
} from "selectors/claims";
|
} from "selectors/claims";
|
||||||
import FileDetails from "./view";
|
import FileDetails from "./view";
|
||||||
|
import { doOpenFileInFolder } from "actions/file_info";
|
||||||
|
import { makeSelectFileInfoForUri } from "selectors/file_info";
|
||||||
|
|
||||||
const select = (state, props) => ({
|
const select = (state, props) => ({
|
||||||
claim: makeSelectClaimForUri(props.uri)(state),
|
claim: makeSelectClaimForUri(props.uri)(state),
|
||||||
contentType: makeSelectContentTypeForUri(props.uri)(state),
|
contentType: makeSelectContentTypeForUri(props.uri)(state),
|
||||||
|
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
||||||
metadata: makeSelectMetadataForUri(props.uri)(state),
|
metadata: makeSelectMetadataForUri(props.uri)(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(select, null)(FileDetails);
|
const perform = dispatch => ({
|
||||||
|
openFolder: path => dispatch(doOpenFileInFolder(path)),
|
||||||
|
});
|
||||||
|
|
||||||
|
export default connect(select, perform)(FileDetails);
|
||||||
|
|
|
@ -5,9 +5,18 @@ import FileActions from "component/fileActions";
|
||||||
import Link from "component/link";
|
import Link from "component/link";
|
||||||
import DateTime from "component/dateTime";
|
import DateTime from "component/dateTime";
|
||||||
|
|
||||||
|
const path = require("path");
|
||||||
|
|
||||||
class FileDetails extends React.PureComponent {
|
class FileDetails extends React.PureComponent {
|
||||||
render() {
|
render() {
|
||||||
const { claim, contentType, metadata, uri } = this.props;
|
const {
|
||||||
|
claim,
|
||||||
|
contentType,
|
||||||
|
fileInfo,
|
||||||
|
metadata,
|
||||||
|
openFolder,
|
||||||
|
uri,
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
if (!claim || !metadata) {
|
if (!claim || !metadata) {
|
||||||
return (
|
return (
|
||||||
|
@ -20,6 +29,9 @@ class FileDetails extends React.PureComponent {
|
||||||
const { description, language, license } = metadata;
|
const { description, language, license } = metadata;
|
||||||
const { height } = claim;
|
const { height } = claim;
|
||||||
const mediaType = lbry.getMediaType(contentType);
|
const mediaType = lbry.getMediaType(contentType);
|
||||||
|
const directory = fileInfo && fileInfo.download_path
|
||||||
|
? path.dirname(fileInfo.download_path)
|
||||||
|
: null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
@ -47,6 +59,15 @@ class FileDetails extends React.PureComponent {
|
||||||
<tr>
|
<tr>
|
||||||
<td>{__("License")}</td><td>{license}</td>
|
<td>{__("License")}</td><td>{license}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
{directory &&
|
||||||
|
<tr>
|
||||||
|
<td>{__("Downloaded to")}</td>
|
||||||
|
<td>
|
||||||
|
<Link onClick={() => openFolder(directory)}>
|
||||||
|
{directory}
|
||||||
|
</Link>
|
||||||
|
</td>
|
||||||
|
</tr>}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<p>
|
<p>
|
||||||
|
|
|
@ -10,7 +10,6 @@ import { doFetchAvailability } from "actions/availability";
|
||||||
import { doOpenFileInShell } from "actions/file_info";
|
import { doOpenFileInShell } from "actions/file_info";
|
||||||
import { doPurchaseUri, doStartDownload } from "actions/content";
|
import { doPurchaseUri, doStartDownload } from "actions/content";
|
||||||
import FileDownloadLink from "./view";
|
import FileDownloadLink from "./view";
|
||||||
import * as modals from "constants/modal_types";
|
|
||||||
|
|
||||||
const select = (state, props) => ({
|
const select = (state, props) => ({
|
||||||
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
||||||
|
@ -22,7 +21,7 @@ const select = (state, props) => ({
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
checkAvailability: uri => dispatch(doFetchAvailability(uri)),
|
checkAvailability: uri => dispatch(doFetchAvailability(uri)),
|
||||||
openInShell: fileInfo => dispatch(doOpenFileInShell(fileInfo)),
|
openInShell: path => dispatch(doOpenFileInShell(path)),
|
||||||
purchaseUri: uri => dispatch(doPurchaseUri(uri)),
|
purchaseUri: uri => dispatch(doPurchaseUri(uri)),
|
||||||
restartDownload: (uri, outpoint) => dispatch(doStartDownload(uri, outpoint)),
|
restartDownload: (uri, outpoint) => dispatch(doStartDownload(uri, outpoint)),
|
||||||
});
|
});
|
||||||
|
|
|
@ -92,7 +92,7 @@ class FileDownloadLink extends React.PureComponent {
|
||||||
label={__("Open")}
|
label={__("Open")}
|
||||||
button="text"
|
button="text"
|
||||||
icon="icon-external-link-square"
|
icon="icon-external-link-square"
|
||||||
onClick={() => openInShell(fileInfo)}
|
onClick={() => openInShell(fileInfo.download_path)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ class ShowPage extends React.PureComponent {
|
||||||
message={__("Loading magic decentralized data...")}
|
message={__("Loading magic decentralized data...")}
|
||||||
/>}
|
/>}
|
||||||
{claim === null &&
|
{claim === null &&
|
||||||
|
!isResolvingUri &&
|
||||||
<span className="empty">
|
<span className="empty">
|
||||||
{__("There's nothing at this location.")}
|
{__("There's nothing at this location.")}
|
||||||
</span>}
|
</span>}
|
||||||
|
|
Loading…
Add table
Reference in a new issue