Skip to content

Commit

Permalink
review suggestions from #11006 that weren't picked up before merge (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
eviljeff committed Nov 9, 2021
1 parent 0553a75 commit cc36fe3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
15 changes: 4 additions & 11 deletions src/amo/components/HomepageShelves/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
ADDON_TYPE_STATIC_THEME,
INSTALL_SOURCE_FEATURED,
INSTALL_SOURCE_FEATURED_COLLECTION,
INSTALL_SOURCE_TAG_SHELF,
INSTALL_SOURCE_TAG_SHELF_PREFIX,
LANDING_PAGE_EXTENSION_COUNT,
LANDING_PAGE_THEME_COUNT,
} from 'amo/constants';
Expand Down Expand Up @@ -67,14 +67,7 @@ export const HomepageShelvesBase = (props: InternalProps): React.Node => {
);
} else {
shelvesContent = shelves.map((shelf) => {
const {
addons,
addonType,
endpoint,
footer,
title,
url: api_url,
} = shelf;
const { addons, addonType, endpoint, footer, title, url: apiUrl } = shelf;
const shelfKey = title.replace(/\s/g, '-');

const footerText = footer.text
Expand All @@ -90,8 +83,8 @@ export const HomepageShelvesBase = (props: InternalProps): React.Node => {
break;

case HOMESHELVES_ENDPOINT_RANDOM_TAG:
addonInstallSource = `${INSTALL_SOURCE_TAG_SHELF}${getTagFromUrl(
api_url,
addonInstallSource = `${INSTALL_SOURCE_TAG_SHELF_PREFIX}${getTagFromUrl(
apiUrl,
)}`;
break;

Expand Down
2 changes: 1 addition & 1 deletion src/amo/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export const INSTALL_SOURCE_MOST_POPULAR = 'mostpopular';
export const INSTALL_SOURCE_SEARCH = 'search';
export const INSTALL_SOURCE_TOP_RATED = 'rating';
export const INSTALL_SOURCE_TRENDING = 'hotness';
export const INSTALL_SOURCE_TAG_SHELF = 'tag-shelf-';
export const INSTALL_SOURCE_TAG_SHELF_PREFIX = 'tag-shelf-';

// View Contexts that aren't an addonType
export const VIEW_CONTEXT_HOME = 'VIEW_CONTEXT_HOME';
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/amo/components/TestHomepageShelves.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
ADDON_TYPE_STATIC_THEME,
INSTALL_SOURCE_FEATURED_COLLECTION,
INSTALL_SOURCE_FEATURED,
INSTALL_SOURCE_TAG_SHELF,
INSTALL_SOURCE_TAG_SHELF_PREFIX,
} from 'amo/constants';
import { createInternalShelf } from 'amo/reducers/home';
import {
Expand Down Expand Up @@ -159,7 +159,7 @@ describe(__filename, () => {

expect(root.find(LandingAddonsCard)).toHaveProp(
'addonInstallSource',
`${INSTALL_SOURCE_TAG_SHELF}${tagName}`,
`${INSTALL_SOURCE_TAG_SHELF_PREFIX}${tagName}`,
);
});

Expand Down

0 comments on commit cc36fe3

Please sign in to comment.