carousel refresh and home video

This commit is contained in:
Martina 2020-09-07 21:04:24 -07:00
parent ce57e30a49
commit 6aa698ae00
3 changed files with 60 additions and 4 deletions

View File

@ -120,6 +120,12 @@ export default class DataView extends React.Component {
await this._handleUpdate();
}
componentDidUpdate = (prevProps) => {
if (prevProps.items !== this.props.items) {
this._handleUpdate();
}
};
_handleUpdate = async () => {
// NOTE(jim): Hack to handle some race conditions.
await delay(200);
@ -266,6 +272,14 @@ export default class DataView extends React.Component {
text: "Copy CID",
onClick: (e) => this._handleCopy(e, cid),
},
{
text: "Copy Link",
onClick: (e) =>
this._handleCopy(
e,
`https://${cid}.ipfs.slate.textile.io`
),
},
{
text: "Delete",
onClick: (e) => {

View File

@ -14,6 +14,25 @@ const STYLES_NUMBER = css`
font-weight: 400;
`;
const STYLES_VIDEO_BIG = css`
display: block;
background-color: ${Constants.system.moonstone};
padding: 0;
outline: 0;
margin: 48px auto 88px auto;
border-radius: 4px;
width: 100%;
box-shadow: 0px 10px 50px 20px rgba(0, 0, 0, 0.1);
@media (max-width: ${Constants.sizes.tablet}px) {
margin: 32px auto 64px auto;
}
@media (max-width: ${Constants.sizes.mobile}px) {
margin: 24px auto 48px auto;
}
`;
export default class SceneHome extends React.Component {
render() {
// TODO(jim): Refactor later.
@ -91,7 +110,9 @@ export default class SceneHome extends React.Component {
return (
<ScenePage>
<ScenePageHeader title="Home">
Welcome back! Here is your data.
{this.props.viewer.library[0]
? "Welcome back! Here is your data."
: "Welcome to Slate! Here's how to get started."}
</ScenePageHeader>
{this.props.viewer.library[0] ? (
@ -115,7 +136,24 @@ export default class SceneHome extends React.Component {
onRehydrate={this.props.onRehydrate}
/>
</div>
) : null}
) : (
<video
css={STYLES_VIDEO_BIG}
autoPlay
loop
muted
src="https://bafybeienjmql6lbtsaz3ycon3ttliohcl7qbquwvny43lhcodky54z65cy.ipfs.slate.textile.io"
type="video/m4v"
playsInline
style={{
backgroundImage: `url('https://bafybeienjmql6lbtsaz3ycon3ttliohcl7qbquwvny43lhcodky54z65cy.ipfs.slate.textile.io')`,
borderRadius: `4px`,
width: `100%`,
boxShadow: `0px 10px 50px 20px rgba(0, 0, 0, 0.1)`,
backgroundSize: `cover`,
}}
/>
)}
</ScenePage>
);
}

View File

@ -322,12 +322,16 @@ export default class SceneSlate extends React.Component {
detail: { index },
});
_handleAdd = () => {
return this.props.onAction({
_handleAdd = async () => {
await this.props.onAction({
type: "SIDEBAR",
value: "SIDEBAR_ADD_FILE_TO_BUCKET",
data: this.props.current,
});
this._handleUpdateCarousel({
objects: this.props.current.data.objects,
editing: this.state.editing,
});
};
_handleShowSettings = () => {