diff options
| author | rxliuli <rxliuli@gmail.com> | 2025-11-04 05:03:50 +0800 |
|---|---|---|
| committer | rxliuli <rxliuli@gmail.com> | 2025-11-04 05:03:50 +0800 |
| commit | bce557cc2dc767628bed6aac87301a1be7c5431b (patch) | |
| tree | b51a051228d01fe3306cd7626d4a96768aadb944 /node_modules/@jet-app/app-store/tmp/src/common/charts/charts-hub.js | |
init commit
Diffstat (limited to 'node_modules/@jet-app/app-store/tmp/src/common/charts/charts-hub.js')
| -rw-r--r-- | node_modules/@jet-app/app-store/tmp/src/common/charts/charts-hub.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/node_modules/@jet-app/app-store/tmp/src/common/charts/charts-hub.js b/node_modules/@jet-app/app-store/tmp/src/common/charts/charts-hub.js new file mode 100644 index 0000000..7c2da09 --- /dev/null +++ b/node_modules/@jet-app/app-store/tmp/src/common/charts/charts-hub.js @@ -0,0 +1,39 @@ +import { ChartsHubChart, ChartsHubPage, FlowAction } from "../../api/models"; +import { makeChartsPageIntent } from "../../api/intents/charts-page-intent"; +import { makeChartsPageURL } from "./charts-page-url"; +import { getLocale } from "../locale"; +import { getPlatform } from "../preview-platform"; +function seeAllActionForChart(objectGraph, chart) { + const selectedChart = chart.segments[chart.initialSegmentIndex].chart; + const seeAllAction = new FlowAction("topCharts"); + const destinationIntent = makeChartsPageIntent({ + ...getLocale(objectGraph), + ...getPlatform(objectGraph), + genreId: chart.genreId, + chart: selectedChart, + }); + seeAllAction.destination = destinationIntent; + seeAllAction.pageUrl = makeChartsPageURL(objectGraph, destinationIntent); + return seeAllAction; +} +/** + * Create a {@linkcode TopChart} from a {@linkcode TopChartsPage} without any of the + * page-level properties defined + */ +function topChartFromPage(objectGraph, page, title) { + const chart = new ChartsHubChart(page.genreId, page.ageBandId, title, page.segments, page.categoriesButtonTitle, page.categories); + chart.initialSegmentIndex = page.initialSegmentIndex; + chart.seeAllAction = seeAllActionForChart(objectGraph, chart); + return chart; +} +/** + * Render a {@linkcode ChartsHubPage} from constituent {@linkcode TopChartsPage}s + */ +export function renderChartsHub(objectGraph, appsPage, gamesPage) { + const appsCharts = topChartFromPage(objectGraph, appsPage, objectGraph.loc.string("TopCharts.Hub.Apps.Title")); + const gamesCharts = topChartFromPage(objectGraph, gamesPage, objectGraph.loc.string("TopCharts.Hub.Games.Title")); + const hubPage = new ChartsHubPage([appsCharts, gamesCharts]); + hubPage.title = objectGraph.loc.string("TopCharts.Hub.Title"); + return hubPage; +} +//# sourceMappingURL=charts-hub.js.map
\ No newline at end of file |
