2020-08-31 21:19:46 +03:00
|
|
|
import * as React from "react";
|
|
|
|
import * as Constants from "~/common/constants";
|
2020-09-27 23:11:04 +03:00
|
|
|
import * as Strings from "~/common/strings";
|
2020-08-31 21:19:46 +03:00
|
|
|
|
|
|
|
import { css } from "@emotion/react";
|
2020-09-03 00:08:32 +03:00
|
|
|
import { ProcessedText } from "~/components/system/components/Typography";
|
2020-08-31 21:19:46 +03:00
|
|
|
|
2020-10-02 02:44:22 +03:00
|
|
|
import SlatePreviewBlocks from "~/components/core/SlatePreviewBlock";
|
2020-08-31 21:19:46 +03:00
|
|
|
|
|
|
|
const STYLES_PROFILE = css`
|
|
|
|
text-align: center;
|
|
|
|
width: 100%;
|
|
|
|
margin-top: 16px;
|
|
|
|
`;
|
|
|
|
|
|
|
|
const STYLES_PROFILE_IMAGE = css`
|
2020-09-10 06:28:48 +03:00
|
|
|
background-color: ${Constants.system.foreground};
|
2020-08-31 21:19:46 +03:00
|
|
|
background-size: cover;
|
|
|
|
background-position: 50% 50%;
|
2020-09-05 04:40:23 +03:00
|
|
|
width: 152px;
|
|
|
|
height: 152px;
|
|
|
|
border-radius: 4px;
|
2020-08-31 21:19:46 +03:00
|
|
|
margin: 0 auto;
|
|
|
|
padding: 0;
|
|
|
|
`;
|
|
|
|
|
|
|
|
const STYLES_NAME = css`
|
|
|
|
font-size: ${Constants.typescale.lvl3};
|
2020-09-04 07:16:19 +03:00
|
|
|
font-family: ${Constants.font.medium};
|
2020-09-03 00:08:32 +03:00
|
|
|
width: 100%;
|
|
|
|
max-width: 420px;
|
|
|
|
margin: 0 auto;
|
|
|
|
padding: 0 24px 0 24px;
|
2020-09-06 07:32:39 +03:00
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
2020-09-03 00:08:32 +03:00
|
|
|
`;
|
|
|
|
|
|
|
|
const STYLES_DESCRIPTION = css`
|
|
|
|
font-size: ${Constants.typescale.lvl1};
|
|
|
|
width: 100%;
|
2020-09-06 07:32:39 +03:00
|
|
|
max-width: 800px;
|
2020-09-03 00:08:32 +03:00
|
|
|
margin: 0 auto;
|
|
|
|
padding: 0 24px 0 24px;
|
2020-09-06 07:32:39 +03:00
|
|
|
word-wrap: break-word;
|
2020-08-31 21:19:46 +03:00
|
|
|
`;
|
|
|
|
|
|
|
|
const STYLES_LINK = css`
|
|
|
|
color: ${Constants.system.black};
|
|
|
|
text-decoration: none;
|
|
|
|
`;
|
|
|
|
|
|
|
|
export default class Profile extends React.Component {
|
|
|
|
render() {
|
|
|
|
let data = this.props.creator ? this.props.creator : this.props.data;
|
|
|
|
return (
|
|
|
|
<div css={STYLES_PROFILE}>
|
|
|
|
<div
|
|
|
|
css={STYLES_PROFILE_IMAGE}
|
|
|
|
style={{ backgroundImage: `url('${data.data.photo}')` }}
|
|
|
|
/>
|
2020-09-03 00:08:32 +03:00
|
|
|
<br />
|
2020-09-27 23:11:04 +03:00
|
|
|
<div css={STYLES_NAME}>{Strings.getPresentationName(data)}</div>
|
2020-09-03 00:08:32 +03:00
|
|
|
<br />
|
|
|
|
{data.data.body ? (
|
|
|
|
<React.Fragment>
|
|
|
|
<div css={STYLES_DESCRIPTION}>
|
|
|
|
<ProcessedText text={data.data.body} />
|
|
|
|
</div>
|
|
|
|
<br />
|
|
|
|
</React.Fragment>
|
|
|
|
) : null}
|
|
|
|
<br />
|
2020-08-31 21:19:46 +03:00
|
|
|
{this.props.buttons}
|
|
|
|
<br />
|
2020-09-08 01:16:02 +03:00
|
|
|
{data.slates && data.slates.length ? (
|
2020-10-02 02:44:22 +03:00
|
|
|
<SlatePreviewBlocks
|
2020-10-05 00:30:28 +03:00
|
|
|
isOwner={this.props.isOwner}
|
2020-10-02 02:44:22 +03:00
|
|
|
external={this.props.onAction ? false : true}
|
|
|
|
slates={data.slates}
|
|
|
|
username={data.username}
|
|
|
|
onAction={this.props.onAction}
|
|
|
|
/>
|
|
|
|
) : null}
|
|
|
|
{/* <div>
|
2020-09-08 01:16:02 +03:00
|
|
|
{data.slates.map((slate) => {
|
|
|
|
if (this.props.onAction) {
|
2020-08-31 21:19:46 +03:00
|
|
|
return (
|
2020-09-08 01:16:02 +03:00
|
|
|
<div
|
2020-09-05 07:06:36 +03:00
|
|
|
key={slate.id}
|
2020-09-08 01:16:02 +03:00
|
|
|
onClick={() =>
|
|
|
|
this.props.onAction({
|
|
|
|
type: "NAVIGATE",
|
|
|
|
value: this.props.sceneId,
|
|
|
|
scene: "PUBLIC_SLATE",
|
|
|
|
data: slate,
|
|
|
|
})
|
|
|
|
}
|
2020-08-31 21:19:46 +03:00
|
|
|
>
|
2020-09-08 01:16:02 +03:00
|
|
|
<SlatePreviewBlock
|
|
|
|
slate={slate}
|
|
|
|
username={data.username}
|
2020-10-05 00:30:28 +03:00
|
|
|
isOwner={this.props.isOwner}
|
2020-09-08 01:16:02 +03:00
|
|
|
/>
|
|
|
|
</div>
|
2020-08-31 21:19:46 +03:00
|
|
|
);
|
2020-09-08 01:16:02 +03:00
|
|
|
}
|
|
|
|
return (
|
|
|
|
<a
|
|
|
|
key={slate.id}
|
|
|
|
href={`/${data.username}/${slate.slatename}`}
|
|
|
|
css={STYLES_LINK}
|
|
|
|
>
|
|
|
|
<SlatePreviewBlock external slate={slate} />
|
|
|
|
</a>
|
|
|
|
);
|
|
|
|
})}
|
2020-10-02 02:44:22 +03:00
|
|
|
</div> */}
|
2020-08-31 21:19:46 +03:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|