slate/scenes/SceneSlates.js

63 lines
1.6 KiB
JavaScript
Raw Normal View History

import * as React from "react";
import * as System from "~/components/system";
import { css } from "@emotion/react";
import ScenePage from "~/components/core/ScenePage";
2020-07-27 11:33:39 +03:00
import Section from "~/components/core/Section";
// TODO(jim): Slates design.
export default class SceneSlates extends React.Component {
render() {
2020-07-27 11:33:39 +03:00
// TODO(jim): Refactor later.
const slates = {
columns: [
2020-07-27 12:50:25 +03:00
{ key: "id", id: "id", name: "ID" },
{
key: "slatename",
name: "Slate Name",
width: "228px",
type: "SLATE_LINK",
},
{ key: "url", name: "URL", width: "268px", type: "NEW_WINDOW" },
2020-07-27 11:33:39 +03:00
{
key: "public",
name: "Public",
type: "SLATE_PUBLIC_TEXT_TAG",
width: "188px",
},
],
rows: this.props.viewer.slates.map((each) => {
return {
...each,
2020-07-27 12:50:25 +03:00
url: `/@${this.props.viewer.username}/${each.slatename}`,
2020-07-27 12:10:12 +03:00
public: each.data.public,
2020-07-27 11:33:39 +03:00
};
}),
};
// TODO(jim): Refactor later.
const slateButtons = [
{ name: "Create slate", type: "SIDEBAR", value: "SIDEBAR_CREATE_SLATE" },
];
return (
<ScenePage>
<System.H1>Slates</System.H1>
<Section
title="Slates"
buttons={slateButtons}
onAction={this.props.onAction}
>
<System.Table
data={slates}
name="slate"
onAction={this.props.onAction}
onNavigateTo={this.props.onNavigateTo}
/>
</Section>
</ScenePage>
);
}
}