Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ module.exports = {
// must not contain sensitive data.
clientConfigKeys: [
'appName',
'amoCDN',
'apiHost',
'apiPath',
'cookieName',
Expand Down
12 changes: 6 additions & 6 deletions src/disco/components/Addon.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ export default class Addon extends React.Component {
headerURL: PropTypes.string,
heading: PropTypes.string.isRequired,
id: PropTypes.string.isRequired,
imageURL: PropTypes.string,
name: PropTypes.string.isRequired,
slug: PropTypes.string.isRequired,
subHeading: PropTypes.string,
status: PropTypes.oneOf(validInstallStates).isRequired,
subHeading: PropTypes.string,
textcolor: PropTypes.string,
type: PropTypes.oneOf(validAddonTypes).isRequired,
themeAction: PropTypes.func,
themeURL: PropTypes.string,
type: PropTypes.oneOf(validAddonTypes).isRequired,
}

static defaultProps = {
Expand All @@ -56,17 +58,15 @@ export default class Addon extends React.Component {
}

getLogo() {
const { id } = this.props;
const imageURL = `https://addons-dev-cdn.allizom.org/user-media/addon_icons/0/${id}-64.png?modified=1388632826`;
const { imageURL } = this.props;
if (this.props.type === EXTENSION_TYPE) {
return <div className="logo"><img src={imageURL} alt="" /></div>;
}
return null;
}

getThemeImage() {
const { id, name } = this.props;
const themeURL = `https://addons-dev-cdn.allizom.org/user-media/addons/${id}/preview_large.jpg?1239806327`;
const { name, themeURL } = this.props;
if (this.props.type === THEME_TYPE) {
return (<a href="#" className="theme-image"
data-browsertheme={this.getBrowserThemeData()}
Expand Down
15 changes: 11 additions & 4 deletions src/disco/fakeData.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
import config from 'config';

const amoCDN = config.get('amoCDN');
const amoHost = config.get('apiHost');

export default {
results: [{
editorial_description: 'Hover over the image to preview',
Expand All @@ -7,19 +12,21 @@ export default {
slug: 'japanese-tattoo',
sub_heading: null,
type: 'Theme',
url: 'https://addons-dev.allizom.org/en-US/firefox/addon/japanese-tattoo/',
headerURL: 'https://addons-dev-cdn.allizom.org/user-media/addons/18781/personare.jpg?1239806327',
footerURL: 'https://addons-dev-cdn.allizom.org/user-media/addons/18781/persona2re.jpg?1239806327',
url: `${amoHost}/en-US/firefox/addon/japanese-tattoo/`,
themeURL: `${amoCDN}/user-media/addons/18781/preview_large.jpg?1239806327`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these names be like themeUrl? I'm assuming the API will return them as theme_url and camelcase will make that themeUrl.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made it consistent with the other keys. We may as well adapt it to the data all in one go.

headerURL: `${amoCDN}/user-media/addons/18781/personare.jpg?1239806327`,
footerURL: `${amoCDN}/user-media/addons/18781/persona2re.jpg?1239806327`,
textcolor: '#000000',
accentcolor: '#ffffff',
}, {
editorial_description: '<em>&ldquo;This add-on is amazing.&rdquo;</em> — Someone',
heading: 'Something something',
sub_heading: 'with NoScript',
id: 722,
imageURL: `${amoCDN}/user-media/addon_icons/0/722-64.png?modified=1388632826`,
name: 'NoScript Security Suite',
slug: 'noscript',
type: 'Extension',
url: 'https://addons-dev.allizom.org/en-US/firefox/addon/noscript/',
url: `${amoHost}/en-US/firefox/addon/noscript/`,
}],
};