2020-07-16 04:36:29 +03:00
|
|
|
import * as React from "react";
|
2020-09-05 02:15:29 +03:00
|
|
|
import * as SVG from "~/common/svg";
|
2020-11-28 07:39:01 +03:00
|
|
|
import * as Events from "~/common/custom-events";
|
2020-07-16 04:36:29 +03:00
|
|
|
|
2020-11-30 08:24:22 +03:00
|
|
|
import { css } from "@emotion/react";
|
2021-01-21 10:02:35 +03:00
|
|
|
import { TabGroup, PrimaryTabGroup, SecondaryTabGroup } from "~/components/core/TabGroup";
|
2020-09-14 08:22:19 +03:00
|
|
|
import { ButtonSecondary } from "~/components/system/components/Buttons";
|
2020-11-11 04:44:21 +03:00
|
|
|
import { FileTypeGroup } from "~/components/core/FileTypeIcon";
|
2020-07-16 04:36:29 +03:00
|
|
|
|
|
|
|
import ScenePage from "~/components/core/ScenePage";
|
2020-08-22 07:25:34 +03:00
|
|
|
import ScenePageHeader from "~/components/core/ScenePageHeader";
|
2020-10-02 02:44:22 +03:00
|
|
|
import SlatePreviewBlocks from "~/components/core/SlatePreviewBlock";
|
2020-09-01 07:44:56 +03:00
|
|
|
import CircleButtonGray from "~/components/core/CircleButtonGray";
|
2020-09-02 03:15:56 +03:00
|
|
|
import EmptyState from "~/components/core/EmptyState";
|
2020-07-16 04:36:29 +03:00
|
|
|
|
2020-07-27 06:20:34 +03:00
|
|
|
// TODO(jim): Slates design.
|
2020-07-16 04:36:29 +03:00
|
|
|
export default class SceneSlates extends React.Component {
|
2020-09-01 07:44:56 +03:00
|
|
|
_handleAdd = () => {
|
2020-09-04 01:42:08 +03:00
|
|
|
this.props.onAction({
|
2020-09-01 07:44:56 +03:00
|
|
|
name: "Create slate",
|
|
|
|
type: "SIDEBAR",
|
|
|
|
value: "SIDEBAR_CREATE_SLATE",
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2020-09-14 08:22:19 +03:00
|
|
|
_handleSearch = () => {
|
2020-11-28 07:39:01 +03:00
|
|
|
Events.dispatchCustomEvent({
|
2020-11-10 00:20:38 +03:00
|
|
|
name: "show-search",
|
|
|
|
detail: {},
|
2020-09-14 08:22:19 +03:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2020-07-16 04:36:29 +03:00
|
|
|
render() {
|
2020-09-03 02:24:10 +03:00
|
|
|
let subscriptions = this.props.viewer.subscriptions
|
|
|
|
.filter((each) => {
|
|
|
|
return !!each.target_slate_id;
|
|
|
|
})
|
2020-10-02 02:44:22 +03:00
|
|
|
.map((relation) => relation.slate);
|
2020-09-03 02:24:10 +03:00
|
|
|
|
2020-07-27 11:33:39 +03:00
|
|
|
return (
|
|
|
|
<ScenePage>
|
2020-09-01 07:44:56 +03:00
|
|
|
<ScenePageHeader
|
2020-12-18 00:49:39 +03:00
|
|
|
title={
|
2021-01-21 10:02:35 +03:00
|
|
|
this.props.mobile ? (
|
|
|
|
<TabGroup
|
|
|
|
tabs={[
|
|
|
|
{ title: "Files", value: "NAV_DATA" },
|
|
|
|
{ title: "Slates", value: "NAV_SLATES" },
|
|
|
|
{ title: "Activity", value: "NAV_ACTIVITY" },
|
|
|
|
]}
|
|
|
|
value={1}
|
|
|
|
onAction={this.props.onAction}
|
|
|
|
onChange={(value) => this.setState({ tab: value })}
|
|
|
|
style={{ marginTop: 0, marginBottom: 32 }}
|
|
|
|
itemStyle={{ margin: "0px 12px" }}
|
|
|
|
/>
|
|
|
|
) : (
|
|
|
|
<PrimaryTabGroup
|
|
|
|
tabs={[
|
|
|
|
{ title: "Files", value: "NAV_DATA" },
|
|
|
|
{ title: "Slates", value: "NAV_SLATES" },
|
|
|
|
{ title: "Activity", value: "NAV_ACTIVITY" },
|
|
|
|
]}
|
|
|
|
value={1}
|
|
|
|
onAction={this.props.onAction}
|
|
|
|
/>
|
|
|
|
)
|
2020-12-18 00:49:39 +03:00
|
|
|
}
|
|
|
|
actions={
|
2020-12-20 06:25:28 +03:00
|
|
|
<div style={{ display: "flex", alignItems: "center", marginBottom: 24 }}>
|
|
|
|
<CircleButtonGray onClick={this._handleAdd} style={{ marginRight: 16 }}>
|
|
|
|
<SVG.Plus height="16px" />
|
|
|
|
</CircleButtonGray>
|
|
|
|
<SecondaryTabGroup
|
|
|
|
tabs={[
|
|
|
|
{ title: "My Slates", value: "NAV_SLATES" },
|
|
|
|
{ title: "Following", value: "NAV_SLATES_FOLLOWING" },
|
|
|
|
]}
|
|
|
|
value={this.props.tab}
|
|
|
|
onAction={this.props.onAction}
|
|
|
|
style={{ margin: 0 }}
|
|
|
|
/>
|
|
|
|
</div>
|
2020-12-18 00:49:39 +03:00
|
|
|
}
|
|
|
|
/>
|
|
|
|
{/* <ScenePageHeader
|
2020-09-01 07:44:56 +03:00
|
|
|
title="Slates"
|
|
|
|
actions={
|
2020-12-18 05:59:41 +03:00
|
|
|
this.props.tab === 0 ? (
|
2020-10-31 02:12:20 +03:00
|
|
|
<CircleButtonGray onClick={this._handleAdd} style={{ marginLeft: 12 }}>
|
2020-09-01 07:44:56 +03:00
|
|
|
<SVG.Plus height="16px" />
|
|
|
|
</CircleButtonGray>
|
|
|
|
) : null
|
|
|
|
}
|
2020-12-18 00:49:39 +03:00
|
|
|
/> */}
|
2020-09-03 09:00:02 +03:00
|
|
|
|
2020-12-18 05:59:41 +03:00
|
|
|
{this.props.tab === 0 ? (
|
2020-09-08 01:16:02 +03:00
|
|
|
this.props.viewer.slates && this.props.viewer.slates.length ? (
|
2020-10-02 02:44:22 +03:00
|
|
|
<SlatePreviewBlocks
|
2020-10-05 00:30:28 +03:00
|
|
|
isOwner
|
2020-10-02 02:44:22 +03:00
|
|
|
slates={this.props.viewer.slates}
|
|
|
|
username={this.props.viewer.username}
|
|
|
|
onAction={this.props.onAction}
|
|
|
|
/>
|
2020-09-08 01:16:02 +03:00
|
|
|
) : (
|
2020-09-14 08:22:19 +03:00
|
|
|
<EmptyState>
|
2020-11-11 04:44:21 +03:00
|
|
|
<FileTypeGroup />
|
2020-09-14 08:22:19 +03:00
|
|
|
<div style={{ marginTop: 24 }}>
|
2020-10-31 02:12:20 +03:00
|
|
|
Use slates to create mood boards, share files, and organize research.
|
2020-09-14 08:22:19 +03:00
|
|
|
</div>
|
2020-10-31 02:12:20 +03:00
|
|
|
<ButtonSecondary onClick={this._handleAdd} style={{ marginTop: 32 }}>
|
2020-09-14 08:22:19 +03:00
|
|
|
Create slate
|
|
|
|
</ButtonSecondary>
|
2020-09-08 01:16:02 +03:00
|
|
|
</EmptyState>
|
|
|
|
)
|
|
|
|
) : null}
|
2020-11-08 05:32:17 +03:00
|
|
|
|
2020-12-18 05:59:41 +03:00
|
|
|
{this.props.tab === 1 ? (
|
2020-09-14 23:42:52 +03:00
|
|
|
subscriptions && subscriptions.length ? (
|
2020-10-02 02:44:22 +03:00
|
|
|
<SlatePreviewBlocks
|
|
|
|
slates={subscriptions}
|
|
|
|
username={null}
|
|
|
|
onAction={this.props.onAction}
|
|
|
|
/>
|
2020-09-08 01:16:02 +03:00
|
|
|
) : (
|
2020-09-14 08:22:19 +03:00
|
|
|
<EmptyState>
|
|
|
|
You can follow any public slates on the network.
|
2020-10-31 02:12:20 +03:00
|
|
|
<ButtonSecondary onClick={this._handleSearch} style={{ marginTop: 32 }}>
|
2020-09-14 08:22:19 +03:00
|
|
|
Browse slates
|
|
|
|
</ButtonSecondary>
|
2020-09-08 01:16:02 +03:00
|
|
|
</EmptyState>
|
|
|
|
)
|
|
|
|
) : null}
|
2020-07-27 11:33:39 +03:00
|
|
|
</ScenePage>
|
|
|
|
);
|
2020-07-16 04:36:29 +03:00
|
|
|
}
|
|
|
|
}
|