2020-06-19 06:57:57 +03:00
|
|
|
import * as React from "react";
|
2021-02-06 03:09:45 +03:00
|
|
|
import * as Constants from "~/common/constants";
|
2021-09-24 20:18:05 +03:00
|
|
|
import * as Styles from "~/common/styles";
|
2020-04-09 00:29:13 +03:00
|
|
|
|
2021-02-06 03:09:45 +03:00
|
|
|
import { css } from "@emotion/react";
|
2021-01-17 04:53:02 +03:00
|
|
|
import { GlobalCarousel } from "~/components/system/components/GlobalCarousel";
|
2021-11-29 20:39:41 +03:00
|
|
|
import { FileTypeGroup } from "~/components/core/FileTypeIcon";
|
2021-05-17 06:23:46 +03:00
|
|
|
|
2020-06-19 06:57:57 +03:00
|
|
|
import ScenePage from "~/components/core/ScenePage";
|
2021-05-17 06:23:46 +03:00
|
|
|
import WebsitePrototypeWrapper from "~/components/core/WebsitePrototypeWrapper";
|
2021-11-29 20:39:41 +03:00
|
|
|
import DataView from "~/components/core/DataView";
|
|
|
|
import EmptyState from "~/components/core/EmptyState";
|
2020-09-08 00:45:58 +03:00
|
|
|
|
2021-08-24 19:02:11 +03:00
|
|
|
const STYLES_SCENE_PAGE = css`
|
2021-09-24 20:18:05 +03:00
|
|
|
padding: 0px;
|
2021-08-24 19:02:11 +03:00
|
|
|
@media (max-width: ${Constants.sizes.mobile}px) {
|
2021-09-24 20:18:05 +03:00
|
|
|
padding: 0px;
|
2021-08-24 19:02:11 +03:00
|
|
|
}
|
2021-02-26 13:43:17 +03:00
|
|
|
`;
|
|
|
|
|
2021-12-09 00:22:57 +03:00
|
|
|
const STYLES_DATAVIEW_WRAPPER = (theme) => css`
|
2021-10-28 19:15:22 +03:00
|
|
|
width: 100%;
|
2021-12-09 00:22:57 +03:00
|
|
|
min-height: calc(100vh - ${theme.sizes.filterNavbar}px) - ${theme.sizes.header}px;
|
|
|
|
padding: 20px 20px 44px;
|
2021-10-28 19:15:22 +03:00
|
|
|
@media (max-width: ${theme.sizes.mobile}px) {
|
2021-12-09 00:22:57 +03:00
|
|
|
padding: 16px 16px 44px;
|
2021-10-28 19:15:22 +03:00
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2021-09-24 20:18:05 +03:00
|
|
|
export default function SceneFilesFolder({ viewer, page, onAction, isMobile }) {
|
|
|
|
const [index, setIndex] = React.useState(-1);
|
2021-02-26 00:28:14 +03:00
|
|
|
|
2021-09-24 20:18:05 +03:00
|
|
|
let objects = viewer.library;
|
|
|
|
// const tab = page.params?.tab || "grid";
|
2021-02-26 13:43:17 +03:00
|
|
|
|
2021-09-24 20:18:05 +03:00
|
|
|
return (
|
|
|
|
<WebsitePrototypeWrapper
|
|
|
|
title={`${page.pageTitle} • Slate`}
|
|
|
|
url={`${Constants.hostname}${page.pathname}`}
|
|
|
|
>
|
|
|
|
<ScenePage css={STYLES_SCENE_PAGE}>
|
|
|
|
<GlobalCarousel
|
|
|
|
viewer={viewer}
|
|
|
|
objects={objects}
|
|
|
|
onAction={onAction}
|
|
|
|
isMobile={isMobile}
|
|
|
|
params={page.params}
|
|
|
|
isOwner={true}
|
|
|
|
index={index}
|
|
|
|
onChange={(index) => setIndex(index)}
|
|
|
|
/>
|
2021-12-09 00:22:57 +03:00
|
|
|
<div css={STYLES_DATAVIEW_WRAPPER}>
|
2021-11-29 20:39:41 +03:00
|
|
|
{objects.length ? (
|
|
|
|
<DataView
|
|
|
|
key="scene-files-folder"
|
|
|
|
isOwner={true}
|
|
|
|
items={objects}
|
|
|
|
onAction={onAction}
|
|
|
|
viewer={viewer}
|
|
|
|
page={page}
|
|
|
|
view="grid"
|
|
|
|
/>
|
|
|
|
) : (
|
|
|
|
<EmptyState>
|
|
|
|
<FileTypeGroup />
|
|
|
|
<div style={{ marginTop: 24 }}>Drag and drop files into Slate to upload</div>
|
|
|
|
</EmptyState>
|
|
|
|
)}
|
|
|
|
</div>
|
2021-09-24 20:18:05 +03:00
|
|
|
</ScenePage>
|
|
|
|
</WebsitePrototypeWrapper>
|
|
|
|
);
|
2020-04-09 00:29:13 +03:00
|
|
|
}
|