Skip to content

Commit

Permalink
Remove showing GDevelop templates first + increase visibility (#6031)
Browse files Browse the repository at this point in the history
Do not show in changelog
  • Loading branch information
ClementPasteau authored Dec 7, 2023
1 parent 7b72d4e commit f4f9256
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 40 deletions.
4 changes: 2 additions & 2 deletions newIDE/app/src/AssetStore/ExampleStore/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ export const ExampleStore = ({

for (let i = 0; i < exampleShortHeaderItems.length; ++i) {
searchItems.push(exampleShortHeaderItems[i]);
if (i % 3 === 2 && privateGameTemplateItems.length > 0) {
const nextPrivateGameTemplateIndex = Math.floor(i / 3);
if (i % 2 === 1 && privateGameTemplateItems.length > 0) {
const nextPrivateGameTemplateIndex = Math.floor(i / 2);
if (nextPrivateGameTemplateIndex < privateGameTemplateItems.length)
searchItems.push(
privateGameTemplateItems[nextPrivateGameTemplateIndex]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,43 +128,35 @@ export const getExampleAndTemplateItemsForCarousel = ({
const allItems: Array<CarouselThumbnail> = [];
const privateGameTemplateItems = [
...(privateGameTemplateListingDatas
? privateGameTemplateListingDatas
.sort((a, b) => {
if (a.isSellerGDevelop && b.isSellerGDevelop) return 0;
// Show the ones sold by GDevelop first.
if (a.isSellerGDevelop) return -1;
if (b.isSellerGDevelop) return 1;
return 0;
})
.map(privateGameTemplateListingData => {
const isTemplateOwned =
!!authenticatedUser.receivedGameTemplates &&
!!authenticatedUser.receivedGameTemplates.find(
receivedGameTemplate =>
receivedGameTemplate.id === privateGameTemplateListingData.id
? privateGameTemplateListingDatas.map(privateGameTemplateListingData => {
const isTemplateOwned =
!!authenticatedUser.receivedGameTemplates &&
!!authenticatedUser.receivedGameTemplates.find(
receivedGameTemplate =>
receivedGameTemplate.id === privateGameTemplateListingData.id
);
return {
id: privateGameTemplateListingData.id,
title: privateGameTemplateListingData.name,
thumbnailUrl: privateGameTemplateListingData.thumbnailUrls[0],
onClick: () => {
sendGameTemplateInformationOpened({
gameTemplateName: privateGameTemplateListingData.name,
gameTemplateId: privateGameTemplateListingData.id,
source: 'homepage',
});
onSelectPrivateGameTemplateListingData(
privateGameTemplateListingData
);
return {
id: privateGameTemplateListingData.id,
title: privateGameTemplateListingData.name,
thumbnailUrl: privateGameTemplateListingData.thumbnailUrls[0],
onClick: () => {
sendGameTemplateInformationOpened({
gameTemplateName: privateGameTemplateListingData.name,
gameTemplateId: privateGameTemplateListingData.id,
source: 'homepage',
});
onSelectPrivateGameTemplateListingData(
privateGameTemplateListingData
);
},
overlayText: getProductPriceOrOwnedLabel({
i18n,
productListingData: privateGameTemplateListingData,
owned: isTemplateOwned,
}),
overlayTextPosition: 'topLeft',
};
})
},
overlayText: getProductPriceOrOwnedLabel({
i18n,
productListingData: privateGameTemplateListingData,
owned: isTemplateOwned,
}),
overlayTextPosition: 'topLeft',
};
})
: []),
];

Expand All @@ -183,8 +175,8 @@ export const getExampleAndTemplateItemsForCarousel = ({

for (let i = 0; i < exampleShortHeaderItems.length; ++i) {
allItems.push(exampleShortHeaderItems[i]);
if (i % 3 === 2 && privateGameTemplateItems.length > 0) {
const nextPrivateGameTemplateIndex = Math.floor(i / 3);
if (i % 2 === 1 && privateGameTemplateItems.length > 0) {
const nextPrivateGameTemplateIndex = Math.floor(i / 2);
if (nextPrivateGameTemplateIndex < privateGameTemplateItems.length)
allItems.push(privateGameTemplateItems[nextPrivateGameTemplateIndex]);
}
Expand Down

0 comments on commit f4f9256

Please sign in to comment.