2020-07-27 06:20:34 +03:00
|
|
|
import * as React from "react";
|
|
|
|
import * as System from "~/components/system";
|
2020-08-03 02:29:11 +03:00
|
|
|
import * as Actions from "~/common/actions";
|
2021-05-17 07:12:58 +03:00
|
|
|
import * as Validations from "~/common/validations";
|
2020-08-07 09:33:44 +03:00
|
|
|
import * as Constants from "~/common/constants";
|
2020-09-05 02:15:29 +03:00
|
|
|
import * as SVG from "~/common/svg";
|
2020-09-14 03:34:58 +03:00
|
|
|
import * as Strings from "~/common/strings";
|
2021-07-13 03:06:45 +03:00
|
|
|
import * as Utilities from "~/common/utilities";
|
2021-03-03 11:48:59 +03:00
|
|
|
import * as UserBehaviors from "~/common/user-behaviors";
|
2020-11-28 07:39:01 +03:00
|
|
|
import * as Events from "~/common/custom-events";
|
2021-08-18 10:27:53 +03:00
|
|
|
import * as Styles from "~/common/styles";
|
2021-09-15 21:39:36 +03:00
|
|
|
import * as Upload from "~/components/core/Upload";
|
2020-07-27 06:20:34 +03:00
|
|
|
|
2021-05-06 03:08:14 +03:00
|
|
|
import { Link } from "~/components/core/Link";
|
2020-12-20 05:19:32 +03:00
|
|
|
import { LoaderSpinner } from "~/components/system/components/Loaders";
|
2020-11-30 08:24:22 +03:00
|
|
|
import { css } from "@emotion/react";
|
2020-11-11 04:44:21 +03:00
|
|
|
import { FileTypeGroup } from "~/components/core/FileTypeIcon";
|
2020-12-11 05:59:17 +03:00
|
|
|
import { ButtonPrimary, ButtonSecondary } from "~/components/system/components/Buttons";
|
2021-02-05 12:25:47 +03:00
|
|
|
import { GlobalCarousel } from "~/components/system/components/GlobalCarousel";
|
2020-07-27 06:20:34 +03:00
|
|
|
|
2021-05-17 06:23:46 +03:00
|
|
|
import WebsitePrototypeWrapper from "~/components/core/WebsitePrototypeWrapper";
|
2020-11-26 02:19:02 +03:00
|
|
|
import ProcessedText from "~/components/core/ProcessedText";
|
2020-07-27 06:20:34 +03:00
|
|
|
import ScenePage from "~/components/core/ScenePage";
|
2020-08-22 07:25:34 +03:00
|
|
|
import ScenePageHeader from "~/components/core/ScenePageHeader";
|
2021-09-18 03:09:10 +03:00
|
|
|
import SquareButtonGray from "~/components/core/SquareButtonGray";
|
2020-09-14 08:22:19 +03:00
|
|
|
import EmptyState from "~/components/core/EmptyState";
|
2021-08-12 19:41:58 +03:00
|
|
|
import DataView from "~/components/core/DataView";
|
2020-09-04 01:42:08 +03:00
|
|
|
|
2020-12-20 05:19:32 +03:00
|
|
|
const STYLES_LOADER = css`
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
height: 90vh;
|
|
|
|
width: 100%;
|
|
|
|
`;
|
|
|
|
|
2020-11-17 06:17:56 +03:00
|
|
|
const STYLES_COPY_INPUT = css`
|
|
|
|
pointer-events: none;
|
|
|
|
position: absolute;
|
|
|
|
opacity: 0;
|
|
|
|
`;
|
|
|
|
|
2020-08-31 21:19:46 +03:00
|
|
|
const STYLES_USERNAME = css`
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
|
|
:hover {
|
2021-07-07 22:14:51 +03:00
|
|
|
color: ${Constants.system.blue};
|
2020-08-31 21:19:46 +03:00
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2020-10-01 03:41:53 +03:00
|
|
|
const STYLES_MOBILE_HIDDEN = css`
|
|
|
|
@media (max-width: ${Constants.sizes.mobile}px) {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
const STYLES_MOBILE_ONLY = css`
|
|
|
|
@media (min-width: ${Constants.sizes.mobile}px) {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2021-08-18 10:27:53 +03:00
|
|
|
const STYLES_SECURITY_LOCK_WRAPPER = (theme) => css`
|
|
|
|
background-color: ${theme.semantic.bgDark};
|
|
|
|
border-radius: 4px;
|
|
|
|
padding: 8px;
|
|
|
|
color: ${theme.semantic.textGrayLight};
|
|
|
|
`;
|
|
|
|
|
2021-12-01 20:42:48 +03:00
|
|
|
const STYLES_EMPTY_STATE_WRAPPER = (theme) => css`
|
|
|
|
// NOTE(amine): 100vh - headers' height - Dataviewer's bottom padding
|
|
|
|
height: calc(100vh - ${theme.sizes.filterNavbar + theme.sizes.header}px - 44px);
|
2021-12-07 20:48:42 +03:00
|
|
|
margin: 20px;
|
2021-12-01 20:42:48 +03:00
|
|
|
@media (max-width: ${theme.sizes.mobile}px) {
|
2021-12-07 20:48:42 +03:00
|
|
|
margin: 0px;
|
|
|
|
height: calc(100vh - ${theme.sizes.header}px - 44px);
|
2021-12-01 20:42:48 +03:00
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
const STYLES_EMPTY_STATE_DEMO = (theme) => css`
|
|
|
|
margin-top: 36px;
|
|
|
|
@media (max-width: ${theme.sizes.mobile}px) {
|
|
|
|
margin-top: 65px;
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
const STYLES_UPLOAD_BUTTON = (theme) => css`
|
|
|
|
${Styles.CONTAINER_CENTERED};
|
|
|
|
display: inline-flex;
|
|
|
|
background-color: ${theme.semantic.bgGrayLight};
|
|
|
|
border-radius: 8px;
|
|
|
|
width: 24px;
|
|
|
|
height: 24px;
|
|
|
|
pointer-events: auto;
|
|
|
|
box-shadow: ${theme.shadow.lightSmall};
|
|
|
|
`;
|
|
|
|
|
2020-12-20 05:19:32 +03:00
|
|
|
export default class SceneSlate extends React.Component {
|
|
|
|
state = {
|
2021-03-07 23:53:54 +03:00
|
|
|
loading: true,
|
2020-12-20 05:19:32 +03:00
|
|
|
notFound: false,
|
2021-02-03 07:40:24 +03:00
|
|
|
accessDenied: false,
|
2020-12-20 05:19:32 +03:00
|
|
|
};
|
2020-11-06 07:46:24 +03:00
|
|
|
|
2021-05-06 03:08:14 +03:00
|
|
|
// componentDidMount = async () => {
|
|
|
|
// if (this.props.data) {
|
|
|
|
// this.openCarouselToItem();
|
|
|
|
// }
|
|
|
|
// };
|
|
|
|
|
|
|
|
// componentDidUpdate = async (prevProps) => {
|
|
|
|
// // if (!this.props.data?.objects && !this.state.notFound) {
|
|
|
|
// // await this.fetchSlate();
|
|
|
|
// // } else
|
|
|
|
// if (this.props.data !== prevProps.data || this.props.page.params !== prevProps.page.params) {
|
|
|
|
// this.openCarouselToItem();
|
|
|
|
// }
|
|
|
|
// };
|
|
|
|
|
|
|
|
// fetchSlate = async () => {
|
|
|
|
// const { username, slatename, slateId } = this.props.page;
|
|
|
|
|
|
|
|
// if (!this.props.data && (!username || !slatename)) {
|
|
|
|
// this.setState({ notFound: true });
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
|
|
|
|
// let id = slateId || this.props.data?.id;
|
|
|
|
|
|
|
|
// //NOTE(martina): look for the slate in the user's slates
|
|
|
|
// let slate;
|
|
|
|
// if (this.props.viewer) {
|
|
|
|
// if (id) {
|
|
|
|
// for (let s of this.props.viewer.slates) {
|
|
|
|
// if (id && id === s.id) {
|
|
|
|
// slate = s;
|
|
|
|
// break;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// } else if (slatename && username === this.props.viewer.username) {
|
|
|
|
// for (let s of this.props.viewer.slates) {
|
|
|
|
// if (username && slatename === s.slatename) {
|
|
|
|
// slate = s;
|
|
|
|
// break;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// if (!slate) {
|
|
|
|
// Events.dispatchMessage({
|
|
|
|
// message: "We're having trouble fetching that slate right now.",
|
|
|
|
// });
|
|
|
|
// this.setState({ notFound: true });
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (slate) {
|
|
|
|
// window.history.replaceState(
|
|
|
|
// { ...window.history.state, data: slate },
|
|
|
|
// "Slate",
|
|
|
|
// `/${this.props.viewer.username}/${slate.slatename}`
|
|
|
|
// );
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (!slate) {
|
|
|
|
// let query;
|
|
|
|
// if (username && slatename) {
|
|
|
|
// query = { username, slatename };
|
|
|
|
// } else if (id) {
|
|
|
|
// query = { id };
|
|
|
|
// }
|
|
|
|
// let response;
|
|
|
|
// if (query) {
|
|
|
|
// response = await Actions.getSerializedSlate(query);
|
|
|
|
// }
|
|
|
|
// if (response?.decorator == "SLATE_PRIVATE_ACCESS_DENIED") {
|
|
|
|
// this.setState({ accessDenied: true, loading: false });
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
// if (Events.hasError(response)) {
|
|
|
|
// this.setState({ notFound: true, loading: false });
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
// slate = response.slate;
|
|
|
|
// window.history.replaceState(
|
|
|
|
// { ...window.history.state, data: slate },
|
|
|
|
// "Slate",
|
|
|
|
// `/${slate.user.username}/${slate.slatename}`
|
|
|
|
// );
|
|
|
|
// }
|
|
|
|
// this.props.onUpdateData(slate, () => {
|
|
|
|
// this.setState({ loading: false });
|
|
|
|
// this.openCarouselToItem();
|
|
|
|
// });
|
|
|
|
// };
|
|
|
|
|
|
|
|
// openCarouselToItem = () => {
|
|
|
|
// if (!this.props.data?.objects?.length || !this.props.page?.params) {
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
// let objects = this.props.data.objects;
|
|
|
|
|
|
|
|
// const { cid, fileId, index } = this.props.page.params;
|
|
|
|
|
|
|
|
// if (Strings.isEmpty(cid) && Strings.isEmpty(fileId) && typeof index === "undefined") {
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
|
|
|
|
// let foundIndex = -1;
|
|
|
|
// if (index) {
|
|
|
|
// foundIndex = index;
|
|
|
|
// } else if (cid) {
|
|
|
|
// foundIndex = objects.findIndex((object) => object.cid === cid);
|
|
|
|
// } else if (fileId) {
|
|
|
|
// foundIndex = objects.findIndex((object) => object.id === fileId);
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (typeof foundIndex !== "undefined" && foundIndex !== -1) {
|
|
|
|
// Events.dispatchCustomEvent({
|
|
|
|
// name: "slate-global-open-carousel",
|
|
|
|
// detail: { index: foundIndex },
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
// };
|
2020-12-20 05:19:32 +03:00
|
|
|
|
|
|
|
render() {
|
2021-05-17 06:23:46 +03:00
|
|
|
const slate = this.props.data;
|
|
|
|
if (!slate) {
|
2020-12-20 05:19:32 +03:00
|
|
|
return (
|
2021-05-17 06:23:46 +03:00
|
|
|
<WebsitePrototypeWrapper
|
|
|
|
title={`${this.props.page.pageTitle} • Slate`}
|
|
|
|
url={`${Constants.hostname}${this.props.page.pathname}`}
|
|
|
|
>
|
|
|
|
<ScenePage>
|
2021-12-14 21:06:12 +03:00
|
|
|
<div css={Styles.PAGE_EMPTY_STATE_WRAPPER}>
|
2021-12-11 00:26:41 +03:00
|
|
|
<EmptyState>
|
|
|
|
<SVG.Layers height="24px" style={{ marginBottom: 24 }} />
|
|
|
|
<div>We were unable to locate that collection</div>
|
|
|
|
</EmptyState>
|
|
|
|
</div>
|
2021-05-17 06:23:46 +03:00
|
|
|
</ScenePage>
|
|
|
|
</WebsitePrototypeWrapper>
|
2020-12-20 05:19:32 +03:00
|
|
|
);
|
2021-05-06 03:08:14 +03:00
|
|
|
} else {
|
2021-05-17 07:12:58 +03:00
|
|
|
let title, description, file, image;
|
2021-08-29 03:29:17 +03:00
|
|
|
let name = slate.name;
|
2021-12-14 00:27:03 +03:00
|
|
|
if (this.props.page.params?.id) {
|
|
|
|
file = slate.objects.find((file) => file.id === this.props.page.params.id);
|
2021-05-17 06:23:46 +03:00
|
|
|
}
|
|
|
|
if (file) {
|
2021-08-29 03:29:17 +03:00
|
|
|
title = `${file.name || file.filename}`;
|
2021-08-29 04:36:48 +03:00
|
|
|
description = file.body
|
|
|
|
? file.body
|
2021-05-17 06:23:46 +03:00
|
|
|
: `View ${title}, a file in the collection ${name} on Slate`;
|
2021-07-13 03:06:45 +03:00
|
|
|
image = Utilities.getImageUrlIfExists(file, Constants.linkPreviewSizeLimit);
|
2021-05-17 06:23:46 +03:00
|
|
|
} else {
|
2021-08-29 04:36:48 +03:00
|
|
|
if (slate.body) {
|
|
|
|
description = `${name}. ${slate.body}`;
|
2021-05-17 06:23:46 +03:00
|
|
|
} else {
|
|
|
|
description = `View the collection ${name} on Slate`;
|
|
|
|
}
|
|
|
|
title = `${name} • Slate`;
|
2021-11-17 00:20:29 +03:00
|
|
|
image = Utilities.getImageUrlIfExists(slate.coverImage);
|
2021-11-13 00:53:31 +03:00
|
|
|
// const objects = slate.objects;
|
|
|
|
// if (!image && objects) {
|
|
|
|
// for (let i = 0; i < objects.length; i++) {
|
|
|
|
// if (
|
|
|
|
// objects[i].type &&
|
|
|
|
// Validations.isPreviewableImage(objects[i].type) &&
|
|
|
|
// objects[i].size &&
|
|
|
|
// objects[i].size < Constants.linkPreviewSizeLimit
|
|
|
|
// ) {
|
|
|
|
// image = Strings.getURLfromCID(objects[i].cid);
|
|
|
|
// break;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
2021-05-17 06:23:46 +03:00
|
|
|
}
|
2021-05-17 07:12:58 +03:00
|
|
|
|
2021-05-17 06:23:46 +03:00
|
|
|
return (
|
|
|
|
<WebsitePrototypeWrapper
|
|
|
|
description={description}
|
|
|
|
title={title}
|
|
|
|
url={`${Constants.hostname}${this.props.page.pathname}`}
|
2021-05-17 07:12:58 +03:00
|
|
|
image={image}
|
2021-05-17 06:23:46 +03:00
|
|
|
>
|
|
|
|
<SlatePage {...this.props} key={slate.id} data={slate} />
|
|
|
|
</WebsitePrototypeWrapper>
|
|
|
|
);
|
2020-12-20 05:19:32 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-29 19:48:46 +03:00
|
|
|
const STYLES_RESET_SCENE_PAGE_PADDING = css`
|
|
|
|
padding: 0px;
|
|
|
|
@media (max-width: ${Constants.sizes.mobile}px) {
|
|
|
|
padding: 0px;
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2020-12-20 05:19:32 +03:00
|
|
|
class SlatePage extends React.Component {
|
2020-11-17 06:17:56 +03:00
|
|
|
_copy = null;
|
2020-09-03 09:00:02 +03:00
|
|
|
_timeout = null;
|
|
|
|
_remoteLock = false;
|
|
|
|
|
2020-08-03 02:29:11 +03:00
|
|
|
state = {
|
2021-05-06 03:08:14 +03:00
|
|
|
...(this.props.data, this.props.viewer),
|
2020-10-05 00:30:28 +03:00
|
|
|
editing: false,
|
2021-05-06 03:08:14 +03:00
|
|
|
isSubscribed: this.props.viewer
|
|
|
|
? this.props.viewer.subscriptions.some((subscription) => {
|
|
|
|
return subscription.id === this.props.data.id;
|
|
|
|
})
|
|
|
|
: false,
|
2021-07-17 01:51:01 +03:00
|
|
|
index: -1,
|
2020-08-03 02:29:11 +03:00
|
|
|
};
|
|
|
|
|
2021-02-19 16:22:04 +03:00
|
|
|
componentDidMount() {
|
2021-12-14 01:17:21 +03:00
|
|
|
let id = this.props.page?.params?.id;
|
2021-03-01 07:17:41 +03:00
|
|
|
|
2021-03-05 07:13:19 +03:00
|
|
|
/* NOTE(daniel): If user was redirected to this page, the cid of the slate object will exist in the page props.
|
2021-03-01 07:17:41 +03:00
|
|
|
We'll use the cid to open the global carousel */
|
2021-12-14 00:27:03 +03:00
|
|
|
if (Strings.isEmpty(id)) {
|
2021-03-01 07:17:41 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-12-14 00:27:03 +03:00
|
|
|
const index = this.props.data.objects.findIndex((object) => object.id === id);
|
2021-05-06 03:08:14 +03:00
|
|
|
// if (index !== -1) {
|
|
|
|
// Events.dispatchCustomEvent({
|
|
|
|
// name: "slate-global-open-carousel",
|
|
|
|
// detail: { index },
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
if (index === -1) {
|
2021-03-01 07:17:41 +03:00
|
|
|
Events.dispatchCustomEvent({
|
|
|
|
name: "create-alert",
|
|
|
|
detail: {
|
|
|
|
alert: {
|
|
|
|
message:
|
|
|
|
"The requested file could not be found. It may have been removed from the slate or deleted",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
2021-02-19 16:22:04 +03:00
|
|
|
}
|
|
|
|
|
2020-12-22 04:20:24 +03:00
|
|
|
componentDidUpdate(prevProps) {
|
2021-05-06 03:08:14 +03:00
|
|
|
if (this.props.viewer && this.props.viewer.subscriptions !== prevProps.viewer.subscriptions) {
|
2020-12-22 04:20:24 +03:00
|
|
|
this.setState({
|
2021-03-07 23:53:54 +03:00
|
|
|
isSubscribed: this.props.viewer.subscriptions.some((subscription) => {
|
2021-05-06 03:08:14 +03:00
|
|
|
return subscription.id === this.props.data.id;
|
2021-03-07 23:53:54 +03:00
|
|
|
}),
|
2020-09-03 09:00:02 +03:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-07 23:53:54 +03:00
|
|
|
_handleSubscribe = () => {
|
2021-05-06 03:08:14 +03:00
|
|
|
if (!this.props.viewer) {
|
|
|
|
Events.dispatchCustomEvent({ name: "slate-global-open-cta", detail: {} });
|
|
|
|
return;
|
|
|
|
}
|
2021-03-07 23:53:54 +03:00
|
|
|
this.setState({ isSubscribed: !this.state.isSubscribed }, () => {
|
|
|
|
Actions.createSubscription({
|
2021-05-06 03:08:14 +03:00
|
|
|
slateId: this.props.data.id,
|
2021-03-07 23:53:54 +03:00
|
|
|
});
|
2020-09-03 02:17:31 +03:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2021-11-13 00:53:31 +03:00
|
|
|
// _handleSavePreview = async (preview) => {
|
|
|
|
// if (!this.props.viewer) {
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
// let updateObject = { id: this.props.data.id, data: { preview } };
|
|
|
|
|
|
|
|
// let slates = this.props.viewer.slates;
|
|
|
|
// let slateId = this.props.data.id;
|
|
|
|
// for (let slate of slates) {
|
|
|
|
// if (slate.id === slateId) {
|
|
|
|
// slate.preview = preview;
|
|
|
|
// break;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// this.props.onAction({ type: "UPDATE_VIEWER", viewer: { slates } });
|
2021-03-07 23:53:54 +03:00
|
|
|
|
2021-11-13 00:53:31 +03:00
|
|
|
// const response = await Actions.updateSlate(updateObject);
|
2021-03-07 23:53:54 +03:00
|
|
|
|
2021-11-13 00:53:31 +03:00
|
|
|
// Events.hasError(response);
|
|
|
|
// };
|
2021-03-07 23:53:54 +03:00
|
|
|
|
2021-05-06 03:08:14 +03:00
|
|
|
// _handleSelect = (index) =>
|
|
|
|
// Events.dispatchCustomEvent({
|
|
|
|
// name: "slate-global-open-carousel",
|
|
|
|
// detail: { index },
|
|
|
|
// });
|
2020-07-27 11:33:39 +03:00
|
|
|
|
2020-08-09 11:08:46 +03:00
|
|
|
_handleShowSettings = () => {
|
|
|
|
return this.props.onAction({
|
|
|
|
type: "SIDEBAR",
|
|
|
|
value: "SIDEBAR_SINGLE_SLATE_SETTINGS",
|
2021-05-06 03:08:14 +03:00
|
|
|
data: this.props.data,
|
2020-08-09 11:08:46 +03:00
|
|
|
});
|
|
|
|
};
|
2020-07-27 11:33:39 +03:00
|
|
|
|
2020-11-17 06:17:56 +03:00
|
|
|
_handleCopy = (e, value) => {
|
|
|
|
e.stopPropagation();
|
|
|
|
e.preventDefault();
|
|
|
|
this.setState({ copyValue: value, copying: true }, () => {
|
|
|
|
this._copy.select();
|
|
|
|
document.execCommand("copy");
|
|
|
|
});
|
|
|
|
setTimeout(() => {
|
|
|
|
this.setState({ copying: false });
|
|
|
|
}, 1000);
|
|
|
|
};
|
|
|
|
|
2021-03-07 23:53:54 +03:00
|
|
|
_handleDownload = () => {
|
2021-05-06 03:08:14 +03:00
|
|
|
if (!this.props.viewer) {
|
|
|
|
Events.dispatchCustomEvent({ name: "slate-global-open-cta", detail: {} });
|
|
|
|
return;
|
|
|
|
}
|
2021-08-29 03:29:17 +03:00
|
|
|
const slateName = this.props.data.slatename;
|
2021-05-06 03:08:14 +03:00
|
|
|
const slateFiles = this.props.data.objects;
|
2021-03-05 10:32:08 +03:00
|
|
|
UserBehaviors.compressAndDownloadFiles({
|
|
|
|
files: slateFiles,
|
|
|
|
name: `${slateName}.zip`,
|
|
|
|
});
|
2021-03-03 11:48:59 +03:00
|
|
|
};
|
|
|
|
|
2020-08-09 11:08:46 +03:00
|
|
|
render() {
|
2021-12-01 00:46:00 +03:00
|
|
|
const { owner: user, name, objects, body, isPublic, ownerId } = this.props.data;
|
2021-09-02 01:26:25 +03:00
|
|
|
const isOwner = this.props.viewer ? ownerId === this.props.viewer.id : false;
|
2020-09-08 01:47:54 +03:00
|
|
|
|
2020-07-27 11:33:39 +03:00
|
|
|
return (
|
2021-12-08 01:51:11 +03:00
|
|
|
<ScenePage css={STYLES_RESET_SCENE_PAGE_PADDING}>
|
|
|
|
{/* {this.props.external ? (
|
2021-11-29 19:48:46 +03:00
|
|
|
<ScenePageHeader
|
|
|
|
wide
|
|
|
|
title={
|
|
|
|
user && !isOwner ? (
|
|
|
|
<span>
|
|
|
|
<Link href={`/$/user/${user.id}`} onAction={this.props.onAction}>
|
|
|
|
<span css={STYLES_USERNAME}>{user.username}</span>{" "}
|
|
|
|
</Link>
|
|
|
|
/ {name}
|
|
|
|
</span>
|
|
|
|
) : (
|
|
|
|
<div css={Styles.HORIZONTAL_CONTAINER_CENTERED}>
|
|
|
|
<span>{name}</span>
|
|
|
|
{isOwner && !isPublic && (
|
|
|
|
<div css={STYLES_SECURITY_LOCK_WRAPPER} style={{ marginLeft: 16 }}>
|
|
|
|
<SVG.SecurityLock height="16px" style={{ display: "block" }} />
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
>
|
|
|
|
{body}
|
|
|
|
</ScenePageHeader>
|
2021-12-08 01:51:11 +03:00
|
|
|
) : null} */}
|
2020-09-14 11:21:06 +03:00
|
|
|
{objects && objects.length ? (
|
2021-02-05 12:25:47 +03:00
|
|
|
<>
|
|
|
|
<GlobalCarousel
|
|
|
|
viewer={this.props.viewer}
|
|
|
|
objects={objects}
|
2021-05-06 03:08:14 +03:00
|
|
|
data={this.props.data}
|
2021-02-05 12:25:47 +03:00
|
|
|
onAction={this.props.onAction}
|
2021-03-07 23:53:54 +03:00
|
|
|
isMobile={this.props.isMobile}
|
2021-05-06 03:08:14 +03:00
|
|
|
params={this.props.page.params}
|
2020-12-15 04:50:20 +03:00
|
|
|
isOwner={isOwner}
|
2021-02-05 12:25:47 +03:00
|
|
|
external={this.props.external}
|
2021-07-17 01:51:01 +03:00
|
|
|
index={this.state.index}
|
|
|
|
onChange={(index) => this.setState({ index })}
|
2020-09-14 08:22:19 +03:00
|
|
|
/>
|
2021-12-11 00:26:41 +03:00
|
|
|
<div css={Styles.PAGE_CONTENT_WRAPPER}>
|
2021-08-12 19:41:58 +03:00
|
|
|
<DataView
|
|
|
|
key="scene-files-folder"
|
|
|
|
type="collection"
|
|
|
|
collection={this.props.data}
|
|
|
|
onAction={this.props.onAction}
|
|
|
|
viewer={this.props.viewer}
|
2020-10-05 00:30:28 +03:00
|
|
|
items={objects}
|
2021-08-12 19:41:58 +03:00
|
|
|
view={"grid"}
|
|
|
|
isOwner={isOwner}
|
|
|
|
page={this.props.page}
|
2022-01-03 15:00:00 +03:00
|
|
|
isMobile={this.props.isMobile}
|
2020-10-05 00:30:28 +03:00
|
|
|
/>
|
2021-08-12 19:41:58 +03:00
|
|
|
</div>
|
2021-02-05 12:25:47 +03:00
|
|
|
</>
|
2020-12-15 04:50:20 +03:00
|
|
|
) : isOwner ? (
|
2021-12-14 21:06:12 +03:00
|
|
|
<div css={Styles.PAGE_EMPTY_STATE_WRAPPER}>
|
2020-09-14 08:22:19 +03:00
|
|
|
<EmptyState>
|
2020-11-11 04:44:21 +03:00
|
|
|
<FileTypeGroup />
|
2021-12-01 20:42:48 +03:00
|
|
|
<div css={STYLES_EMPTY_STATE_DEMO}>
|
2022-01-19 22:45:29 +03:00
|
|
|
<System.H5 as="p" color="textBlack" style={{ textAlign: "center" }}>
|
2021-12-01 20:42:48 +03:00
|
|
|
Use
|
|
|
|
<span
|
|
|
|
css={STYLES_UPLOAD_BUTTON}
|
|
|
|
style={{ marginLeft: 8, marginRight: 8, position: "relative", top: 2 }}
|
|
|
|
>
|
|
|
|
<SVG.Plus height="16px" />
|
|
|
|
</span>
|
|
|
|
on the top right corner <br />
|
|
|
|
</System.H5>
|
2022-01-19 22:45:29 +03:00
|
|
|
<System.H5 as="p" color="textBlack" style={{ marginTop: 4, textAlign: "center" }}>
|
2021-12-07 20:48:42 +03:00
|
|
|
or drop files {this.props.isMobile ? <span> on desktop</span> : null} to add them
|
|
|
|
to this collection
|
2021-12-01 20:42:48 +03:00
|
|
|
</System.H5>
|
2021-04-23 08:18:46 +03:00
|
|
|
</div>
|
2020-09-14 08:22:19 +03:00
|
|
|
</EmptyState>
|
|
|
|
</div>
|
2020-10-05 00:30:28 +03:00
|
|
|
) : (
|
2022-01-31 17:46:58 +03:00
|
|
|
<div css={Styles.PAGE_EMPTY_STATE_WRAPPER}>
|
|
|
|
<EmptyState>There's nothing here :)</EmptyState>
|
|
|
|
</div>
|
2020-10-05 00:30:28 +03:00
|
|
|
)}
|
2020-11-17 06:17:56 +03:00
|
|
|
<input
|
|
|
|
ref={(c) => {
|
|
|
|
this._copy = c;
|
|
|
|
}}
|
|
|
|
readOnly
|
|
|
|
value={this.state.copyValue}
|
|
|
|
css={STYLES_COPY_INPUT}
|
|
|
|
/>
|
2020-07-27 11:33:39 +03:00
|
|
|
</ScenePage>
|
|
|
|
);
|
2020-07-27 06:20:34 +03:00
|
|
|
}
|
|
|
|
}
|