mirror of
https://github.com/filecoin-project/slate.git
synced 2024-11-09 20:28:29 +03:00
slate: fixes for collections
This commit is contained in:
parent
eed0860638
commit
f858697b13
@ -60,8 +60,6 @@ export default class SidebarAddFileToBucket extends React.Component {
|
||||
};
|
||||
|
||||
render() {
|
||||
console.log(this.props);
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<System.P style={{ fontFamily: Constants.font.semiBold }}>
|
||||
|
@ -299,6 +299,7 @@ export const TableContent = ({
|
||||
);
|
||||
});
|
||||
case "SLATE_PUBLIC_TEXT_TAG":
|
||||
console.log(text);
|
||||
return !text ? (
|
||||
<span css={STYLES_TABLE_TAG}>Private</span>
|
||||
) : (
|
||||
@ -306,7 +307,7 @@ export const TableContent = ({
|
||||
css={STYLES_TABLE_TAG}
|
||||
style={{ background: Constants.system.green }}
|
||||
>
|
||||
{text}
|
||||
Public
|
||||
</span>
|
||||
);
|
||||
case "TEXT_TAG":
|
||||
|
@ -62,7 +62,7 @@ export default async (req, res) => {
|
||||
id: req.body.data.id,
|
||||
ownerId: user.id,
|
||||
name: req.body.data.name,
|
||||
url: req.body.data.ipfs,
|
||||
url: `https://hub.textile.io${req.body.data.ipfs}`,
|
||||
},
|
||||
...slate.data.objects,
|
||||
],
|
||||
|
@ -23,27 +23,22 @@ export default async (req, res) => {
|
||||
});
|
||||
|
||||
if (!user) {
|
||||
return res
|
||||
.status(404)
|
||||
.json({
|
||||
decorator: "SERVER_FIND_USER_CREATE_SLATE_USER_NOT_FOUND",
|
||||
error: true,
|
||||
});
|
||||
return res.status(404).json({
|
||||
decorator: "SERVER_FIND_USER_CREATE_SLATE_USER_NOT_FOUND",
|
||||
error: true,
|
||||
});
|
||||
}
|
||||
|
||||
if (user.error) {
|
||||
return res
|
||||
.status(500)
|
||||
.json({
|
||||
decorator: "SERVER_FIND_USER_CREATE_SLATE_USER_NOT_FOUND",
|
||||
error: true,
|
||||
});
|
||||
return res.status(500).json({
|
||||
decorator: "SERVER_FIND_USER_CREATE_SLATE_USER_NOT_FOUND",
|
||||
error: true,
|
||||
});
|
||||
}
|
||||
|
||||
const slatename = Strings.createSlug(req.body.data.name);
|
||||
|
||||
const found = await Data.getSlateByName({ slatename });
|
||||
console.log(found);
|
||||
|
||||
if (found) {
|
||||
return res
|
||||
@ -54,6 +49,7 @@ export default async (req, res) => {
|
||||
const slate = await Data.createSlate({
|
||||
slatename,
|
||||
data: {
|
||||
public: true,
|
||||
ownerId: id,
|
||||
name: req.body.data.name,
|
||||
objects: [],
|
||||
|
@ -90,14 +90,16 @@ export default class ApplicationPage extends React.Component {
|
||||
const json = await response.json();
|
||||
|
||||
if (!json && json.data) {
|
||||
this.setState({ fileLoading: false });
|
||||
this.setState({ sidebar: null, fileLoading: false });
|
||||
return;
|
||||
}
|
||||
|
||||
if (!json.data) {
|
||||
this.setState({ fileLoading: false });
|
||||
this.setState({ sidebar: null, fileLoading: false });
|
||||
return;
|
||||
}
|
||||
|
||||
if (slate) {
|
||||
if (json && slate) {
|
||||
const addResponse = await fetch(`/api/slates/add-url`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
|
@ -16,7 +16,7 @@ const STYLES_FLEX = css`
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex-direction: column;
|
||||
height: calc(100vh - ${Constants.sizes.header}px);
|
||||
height: calc(100vh - ${Constants.sizes.header}px - 48px);
|
||||
`;
|
||||
|
||||
const STYLES_TOP = css`
|
||||
@ -119,7 +119,7 @@ export default class SceneFile extends React.Component {
|
||||
const file = this.props.data;
|
||||
|
||||
const fileName = `${file.name}`;
|
||||
const fileURL = `https://hub.textile.io${file.ipfs ? file.ipfs : file.url}`;
|
||||
const fileURL = file.url ? file.url : `https://hub.textile.io${file.ipfs}`;
|
||||
|
||||
return (
|
||||
<div css={STYLES_FLEX}>
|
||||
|
@ -35,7 +35,9 @@ export default class SceneFilesFolder extends React.Component {
|
||||
await this.props.onRehydrate();
|
||||
}
|
||||
|
||||
this._interval = window.setTimeout(this.loop, POLLING_INTERVAL);
|
||||
if (this._interval) {
|
||||
this._interval = window.setTimeout(this.loop, POLLING_INTERVAL);
|
||||
}
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
|
@ -72,12 +72,10 @@ export default class SceneHome extends React.Component {
|
||||
rows: this.props.viewer.slates.map((each) => {
|
||||
return {
|
||||
...each,
|
||||
url: each.data.public
|
||||
? `https://slate.host/@${this.props.viewer.username}/${
|
||||
each.slatename
|
||||
}`
|
||||
: null,
|
||||
public: false,
|
||||
url: `https://slate.host/@${this.props.viewer.username}/${
|
||||
each.slatename
|
||||
}`,
|
||||
public: each.data.public,
|
||||
};
|
||||
}),
|
||||
};
|
||||
|
@ -39,7 +39,7 @@ export default class SceneSlate extends React.Component {
|
||||
<ScenePage>
|
||||
<System.H1>{this.props.data.slatename}</System.H1>
|
||||
<Section
|
||||
title="Slates"
|
||||
title="Images"
|
||||
buttons={slateButtons}
|
||||
onAction={this.props.onAction}
|
||||
>
|
||||
|
@ -25,12 +25,10 @@ export default class SceneSlates extends React.Component {
|
||||
rows: this.props.viewer.slates.map((each) => {
|
||||
return {
|
||||
...each,
|
||||
url: each.data.public
|
||||
? `https://slate.host/@${this.props.viewer.username}/${
|
||||
each.slatename
|
||||
}`
|
||||
: null,
|
||||
public: false,
|
||||
url: `https://slate.host/@${this.props.viewer.username}/${
|
||||
each.slatename
|
||||
}`,
|
||||
public: each.data.public,
|
||||
};
|
||||
}),
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user