Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Bug 53333 - Client.Files. Fixed opening media files from upload… #426

Merged
merged 2 commits into from
Oct 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import styled from "styled-components";
import styled, { css } from "styled-components";
import Tooltip from "@appserver/components/tooltip";
import Row from "@appserver/components/row";
import Text from "@appserver/components/text";
Expand Down Expand Up @@ -66,6 +66,14 @@ const StyledFileRow = styled(Row)`
.__react_component_tooltip.place-bottom::after {
border-bottom: 6px solid #f8f7bf !important;
}

.upload-panel_file-row-link {
${(props) =>
!props.isMediaActive &&
css`
cursor: default;
`}
}
`;

const FileRow = (props) => {
Expand All @@ -84,6 +92,7 @@ const FileRow = (props) => {
isPersonal,
setMediaViewerData,
setUploadPanelVisible,
isMediaActive,
} = props;

const onCancelCurrentUpload = (e) => {
Expand All @@ -96,7 +105,7 @@ const FileRow = (props) => {
};

const onMediaClick = (id) => {
console.log("id", id);
if (!isMediaActive) return;
const item = { visible: true, id: id };
setMediaViewerData(item);
setUploadPanelVisible(false);
Expand All @@ -115,13 +124,15 @@ const FileRow = (props) => {
element={
<img className={item.error && "img_error"} src={fileIcon} alt="" />
}
isMediaActive={isMediaActive}
>
<>
{item.fileId ? (
isMedia ? (
<Link
className="upload-panel_file-row-link"
fontWeight="600"
color={item.error && "#A3A9AE"}
color={item.error || !isMediaActive ? "#A3A9AE" : ""}
truncate
onClick={() => onMediaClick(item.fileId)}
>
Expand Down Expand Up @@ -211,10 +222,7 @@ const FileRow = (props) => {
};

export default inject(
(
{ auth, filesStore, formatsStore, uploadDataStore, mediaViewerDataStore },
{ item }
) => {
({ auth, formatsStore, uploadDataStore, mediaViewerDataStore }, { item }) => {
let ext;
let name;
let splitted;
Expand All @@ -237,8 +245,12 @@ export default inject(
cancelCurrentFileConversion,
setUploadPanelVisible,
} = uploadDataStore;
const { playlist, setMediaViewerData } = mediaViewerDataStore;
const { loadingFile: file } = primaryProgressDataStore;
const isMedia = mediaViewersFormatsStore.isMediaOrImage(ext);
const isMediaActive =
playlist.findIndex((el) => el.fileId === item.fileId) !== -1;

const fileIcon = iconFormatsStore.getIconSrc(ext, 24);

const loadingFile = !file || !file.uniqueId ? null : file;
Expand All @@ -248,8 +260,6 @@ export default inject(
? loadingFile.percent
: null;

const { setMediaViewerData } = mediaViewerDataStore;

return {
isPersonal: personal,
currentFileUploadProgress,
Expand All @@ -259,6 +269,7 @@ export default inject(
ext,
name,
loadingFile,
isMediaActive,

cancelCurrentUpload,
cancelCurrentFileConversion,
Expand Down
4 changes: 2 additions & 2 deletions products/ASC.Files/Client/src/store/MediaViewerDataStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ class MediaViewerDataStore {

get playlist() {
const { isMediaOrImage } = this.formatsStore.mediaViewersFormatsStore;
const { files, folders } = this.filesStore;
const { files } = this.filesStore;

const filesList = [...files, ...folders];
const filesList = [...files];
const playlist = [];
let id = 0;

Expand Down