Skip to content
Snippets Groups Projects
Commit 2a8a5636 authored by Greg Fodor's avatar Greg Fodor
Browse files

Use new attribution format

parent 55f91337
No related branches found
No related tags found
No related merge requests found
......@@ -95,6 +95,12 @@
:local(.attribution) {
font-size: 1.0em;
white-space: wrap;
a {
font-size: 0.8em;
color: black;
pointer-events: auto;
}
}
:local(.screenshot) {
......
......@@ -20,7 +20,7 @@ class SceneUI extends Component {
sceneId: PropTypes.string,
sceneName: PropTypes.string,
sceneDescription: PropTypes.string,
sceneAttribution: PropTypes.string,
sceneAttributions: PropTypes.object,
sceneScreenshotURL: PropTypes.string
};
......@@ -73,6 +73,47 @@ class SceneUI extends Component {
tweetText
)}`;
let attributions;
const toAttributionSpan = a => {
if (a.url) {
const source = a.url.indexOf("sketchfab.com")
? "on Sketchfab"
: a.url.indexOf("poly.google.com")
? "on Google Poly"
: "";
return (
<span key={a.url}>
<a href={a.url} target="_blank" rel="noopener noreferrer">
{a.name} by {a.author} {source}
</a>&nbsp;
</span>
);
} else {
return (
<span key={`${a.name} ${a.author}`}>
{a.name} by {a.author}&nbsp;
</span>
);
}
};
if (this.props.sceneAttributions) {
if (!this.props.sceneAttributions.extras) {
attributions = (
<span>
<span>by {this.props.sceneAttributions.creator}</span>&nbsp;
<br />
{this.props.sceneAttributions.content && this.props.sceneAttributions.content.map(toAttributionSpan)}
</span>
);
} else {
// Legacy
attributions = <span>{this.props.sceneAttributions.extras}</span>;
}
}
return (
<IntlProvider locale={lang} messages={messages}>
<div className={styles.ui}>
......@@ -106,7 +147,7 @@ class SceneUI extends Component {
</div>
<div className={styles.info}>
<div className={styles.name}>{this.props.sceneName}</div>
<div className={styles.attribution}>{this.props.sceneAttribution}</div>
<div className={styles.attribution}>{attributions}</div>
</div>
<div className={styles.spoke}>
<div className={styles.madeWith}>made with</div>
......
......@@ -102,7 +102,7 @@ const onReady = async () => {
remountUI({
sceneName: sceneInfo.name,
sceneDescription: sceneInfo.description,
sceneAttribution: sceneInfo.attribution,
sceneAttributions: sceneInfo.attributions,
sceneScreenshotURL: sceneInfo.screenshot_url
});
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment