Improve game news page

This commit is contained in:
Gamebrary 2022-09-21 16:46:29 -07:00
parent 62c0f1a610
commit 2a88b3ab07
14 changed files with 130 additions and 409 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View file

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="162" height="24" viewBox="0 0 162 24" version="1.1">
<!-- Generator: Sketch 48.2 (47327) - http://www.bohemiancoding.com/sketch -->
<title>PCGN_NavLogo</title>
<desc>Created with Sketch.</desc>
<defs>
<polygon id="path-1" points="0.6371 0 23.7161 0 23.7161 23.9997 0.6371 23.9997"/>
<polygon id="path-3" points="37.8812 0 0.0002 0 0.0002 23.9999 37.8812 23.9999 37.8812 0"/>
</defs>
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" transform="translate(-79.000000, -19.000000)">
<g transform="translate(79.000000, 19.000000)">
<g id="Page-1">
<polygon id="Fill-1" fill="#333333" points="157.3587 0.4929 157.3587 8.0699 151.4597 0.4929 147.7537 0.4929 147.7537 14.8279 151.6847 14.8279 151.6847 6.9649 157.8297 14.8279 161.2897 14.8279 161.2897 0.4929"/>
<g id="Group-16">
<path d="M139.3042,23.9342 C144.1702,23.9342 147.0962,21.6662 147.0962,17.7532 L147.0962,17.6872 C147.0962,14.0052 144.3672,12.7562 139.8302,11.6382 C138.0222,11.1782 137.6272,10.9482 137.6272,10.5862 L137.6272,10.5212 C137.6272,10.1592 137.9562,9.9612 138.6792,9.9612 C140.1922,9.9612 142.4932,10.5862 144.4002,11.6382 L146.7672,7.2002 C144.5972,5.8842 141.6712,5.1282 138.7122,5.1282 C134.0432,5.1282 130.8872,7.3312 130.8872,11.2772 L130.8872,11.3422 C130.8872,15.0572 133.6822,16.2742 138.2192,17.3922 C140.0272,17.8522 140.3562,18.0822 140.3562,18.4442 L140.3562,18.5102 C140.3562,18.9372 139.9942,19.1012 139.2712,19.1012 C137.2332,19.1012 134.8002,18.4442 132.6302,17.0962 L130.0992,21.3372 C132.6632,23.0462 135.8192,23.9342 139.3042,23.9342" id="Fill-2" fill="#f65002"/>
<path d="M118.7378,12.986 C118.9678,11.342 119.8558,10.291 121.1048,10.291 C122.4198,10.291 123.4398,11.277 123.6038,12.986 L118.7378,12.986 Z M130.4088,15.025 C130.4088,9.567 127.4498,5.129 121.0718,5.129 C115.6798,5.129 111.8338,9.206 111.8338,14.565 L111.8338,14.63 C111.8338,20.219 115.8118,23.934 121.6958,23.934 C125.5758,23.934 128.1078,22.324 129.8828,20.022 L125.8718,16.833 C124.6888,18.049 123.5708,18.673 122.2228,18.673 C120.6118,18.673 119.3628,17.852 118.8368,16.274 L130.3768,16.274 C130.4088,15.88 130.4088,15.42 130.4088,15.025 Z" id="Fill-4" fill="#f65002"/>
<path d="M80.3706,23.5075 L87.8336,23.5075 L87.8336,14.0055 C87.8336,12.4935 88.8196,11.6385 89.9046,11.6385 C90.9896,11.6385 91.8776,12.4935 91.8776,14.0055 L91.8776,23.5075 L99.3406,23.5075 L99.3406,14.0055 C99.3406,12.4935 100.3266,11.6385 101.4116,11.6385 C102.4956,11.6385 103.3846,12.4935 103.3846,14.0055 L103.3846,23.5075 L110.8476,23.5075 L110.8476,11.6715 C110.8476,7.6275 108.4806,5.1285 104.6336,5.1285 C101.8716,5.1285 100.0636,6.3785 98.5516,8.0875 C97.5646,6.1815 95.6906,5.1285 93.2586,5.1285 C90.7926,5.1285 88.9836,6.4775 87.8336,7.9555 L87.8336,5.5565 L80.3706,5.5565 L80.3706,23.5075 Z" id="Fill-6" fill="#f65002"/>
<path d="M71.8604,16.8659 C71.8604,18.5759 70.8744,19.6279 69.5584,19.6279 C68.6054,19.6279 67.8494,18.9369 67.8494,17.8859 L67.8494,17.8189 C67.8494,16.7009 68.6714,15.8139 70.1504,15.8139 C70.7754,15.8139 71.4324,15.9449 71.8604,16.1099 L71.8604,16.8659 Z M77.3504,7.5949 C75.7724,6.0159 73.4054,5.2609 69.7564,5.2609 C66.6324,5.2609 64.2654,5.7859 62.1934,6.5759 L63.5094,11.5399 C65.0874,10.9149 66.6324,10.5209 68.4734,10.5209 C70.7754,10.5209 71.7944,11.4739 71.7944,13.1179 L71.7944,13.4139 C71.0054,13.0849 69.0654,12.7569 67.5534,12.7569 C63.3774,12.7569 60.7144,14.7619 60.7144,18.3449 L60.7144,18.4109 C60.7144,21.9619 63.1474,23.9339 66.5994,23.9339 C68.8354,23.9339 70.5124,23.0469 71.7614,21.6989 L71.7614,23.5079 L79.2244,23.5079 L79.2244,13.2819 C79.2244,10.6849 78.6984,8.9419 77.3504,7.5949 Z" id="Fill-8" fill="#f65002"/>
<g id="Group-12" transform="translate(36.000000, 0.000000)">
<mask id="mask-2" fill="white">
<use xlink:href="#path-1"/>
</mask>
<g id="Clip-11"/>
<path d="M13.5571,23.9997 C17.7321,23.9997 21.2181,22.5867 23.7161,20.5487 L23.7161,9.8957 L12.5711,9.8957 L12.5711,14.8277 L16.5161,14.8277 L16.5161,17.1287 C15.9241,17.4577 15.2011,17.6547 13.8861,17.6547 C10.6641,17.6547 8.3951,15.4197 8.3951,12.1647 L8.3951,12.0987 C8.3951,8.9757 10.5651,6.6747 13.5571,6.6747 C15.4641,6.6747 17.1411,7.3967 18.6531,8.6797 L22.9601,3.4847 C20.4611,1.3147 17.2721,-0.0003 13.3281,-0.0003 C6.0611,-0.0003 0.6371,5.1287 0.6371,11.9997 L0.6371,12.0657 C0.6371,19.1997 6.3901,23.9997 13.5571,23.9997" id="Fill-10" fill="#f65002" mask="url(#mask-2)"/>
</g>
<g id="Group-15">
<mask id="mask-4" fill="white">
<use xlink:href="#path-3"/>
</mask>
<g id="Clip-14"/>
<path d="M13.0522,9.2389 C13.0522,10.8829 11.7372,11.7699 9.7642,11.7699 L7.6932,11.7699 L7.6932,6.6409 L9.7972,6.6409 C11.8352,6.6409 13.0522,7.4959 13.0522,9.1729 L13.0522,9.2389 Z M34.2692,14.4449 C33.3372,16.0199 32.1382,17.0959 30.0752,17.0959 C27.5442,17.0959 25.7682,14.9919 25.7682,11.9999 L25.7682,11.9339 C25.7682,9.1729 27.4782,6.9039 30.0752,6.9039 C32.1792,6.9039 33.3952,8.0539 34.2502,9.6979 C34.7122,6.9359 35.9972,4.5099 37.8802,2.6319 C35.9472,0.9999 33.3942,-0.0001 30.1742,-0.0001 C25.8502,-0.0001 22.1282,2.0329 19.9602,5.2509 C18.5422,2.0829 15.0162,0.4929 10.3562,0.4929 L0.0002,0.4929 L0.0002,23.5079 L7.6932,23.5079 L7.6932,17.2599 L10.1922,17.2599 C13.5722,17.2599 16.3612,16.3789 18.2082,14.6849 C19.3812,20.3489 24.3172,23.9999 29.8782,23.9999 C33.3982,23.9999 35.9702,22.9389 37.8812,21.3289 C36.0212,19.4889 34.7462,17.1279 34.2692,14.4449 Z" id="Fill-13" fill="#f65002" mask="url(#mask-4)"/>
</g>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

View file

@ -0,0 +1 @@
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M11.981 0C5.72 0 .581 2.231.02 5.081l6.675 1.257c.544-.17 1.162-.244 1.8-.244l3.131-1.875c-.037-.469.244-.956.881-1.35.9-.581 2.307-.9 3.732-.9a8.582 8.582 0 0 1 2.812.412c2.1.713 2.569 2.082 1.069 3.057-.956.618-2.494.937-4.013.9l-4.125 1.48c-.037.3-.243.582-.637.845-1.106.712-3.263.88-4.8.356-.675-.225-1.125-.563-1.313-.9L.47 7.2c.431.675 1.125 1.294 2.025 1.838C.938 9.938 0 11.062 0 12.28c0 1.2.9 2.307 2.419 3.206C.9 16.37 0 17.476 0 18.675 0 21.619 5.363 24 12 24c6.619 0 12-2.381 12-5.325 0-1.2-.9-2.306-2.419-3.188C23.1 14.588 24 13.482 24 12.282c0-1.219-.938-2.362-2.512-3.262 1.556-.956 2.493-2.138 2.493-3.413 0-3.093-5.381-5.606-12-5.606zm4.275 2.663c-.975.018-1.912.225-2.512.618-1.031.675-.713 1.594.712 2.082 1.425.487 3.394.337 4.425-.338 1.032-.675.713-1.594-.712-2.062a6.376 6.376 0 0 0-1.913-.282zm.057.318c1.387 0 2.493.525 2.493 1.163 0 .637-1.106 1.162-2.493 1.162-1.388 0-2.494-.525-2.494-1.162 0-.638 1.106-1.163 2.494-1.163zM8.493 6.45c-.3.019-.58.038-.862.075l1.707.319a2.03.94 0 1 1-1.52 1.744l-1.668-.32c.188.17.45.32.806.45 1.2.413 2.888.282 3.75-.28.863-.563.6-1.35-.6-1.744-.487-.169-1.068-.244-1.612-.244zm11.944 3.113v1.743c0 2.063-3.787 3.732-8.437 3.732-4.669 0-8.437-1.67-8.437-3.732V9.581c2.156.994 5.137 1.613 8.418 1.613 3.3 0 6.3-.619 8.475-1.631zm0 6.487v1.65c0 2.063-3.787 3.731-8.437 3.731-4.669 0-8.437-1.668-8.437-3.731v-1.65c2.175.956 5.137 1.538 8.437 1.538s6.281-.582 8.438-1.538z"/></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="59" width="227"><path d="M0 993.362v59h227v-59z" style="fill:#c4242b;fill-opacity:1;fill-rule:evenodd;stroke:#000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:0" transform="translate(0 -993.362)"/><path d="M28.835 1037.832c-.374-.42-.822-1.444-1.7-3.885l-9.163-22.46c-.182-.665-.163-.86.111-1.164.285-.314.678-.363 2.88-.36 2.129 0 2.626.064 3.017.365l6.957 17.698c.223.64.476 1.164.562 1.164.293 0 1.563-2.689 1.563-2.689l5.93-15.67c.017-.64.885-.872 3.24-.87 1.283 0 2.532.057 2.774.122.51.137.764.634.492.964-.103.125-.37.729-.594 1.341l-6.916 17.165-3.057 7.515c-.334 1.113-.664 1.231-3.451 1.231-2.073 0-2.258-.033-2.645-.467zM68.683 1038.311c-1.94-.27-4.528-1.485-6.354-2.981-2.39-1.958-3.834-4.167-4.739-7.252-.67-2.285-.672-5.852-.003-7.896 1.183-3.617 3.168-6.385 5.795-8.083 1.462-.945 2.935-1.661 3.754-1.826.39-.078 1.118-.295 1.62-.481 1.126-.42 5.92-.46 7.185-.06.446.14 1.311.382 1.924.538 1.479.376 4.411 1.944 4.905 2.623.246.337.174 1.084-.12 1.257-.152.089-.81.8-1.462 1.579-.651.779-1.279 1.487-1.394 1.574-.31.234-1.346-.011-1.819-.43-.228-.202-.96-.634-1.629-.959-1.165-.566-1.33-.59-4.048-.59-2.747 0-2.869.018-3.948.593-1.532.818-3.033 2.386-3.806 3.977-.787 1.62-1.05 4.137-.663 6.357.644 3.695 3.667 6.355 7.81 6.87 1.72.213 5.131-.61 6.022-1.455.524-.497.556-.63.556-2.3 0-1.195-.082-1.825-.253-1.935-.139-.09-1.528-.21-3.087-.265l-2.834-.101-.058-2.125c-.038-1.379.028-2.285.186-2.581l.244-.456H78c5.263 0 5.552.02 5.937.404.386.386.405.675.405 5.945 0 5.324-.016 5.56-.426 6.08-.432.55-3.09 2.145-3.09 2.145l-.516.28c-.206.111-.775.42-1.332.591-.557.172-1.306.581-1.923.65-.5.362-6.389.59-8.372.313zM99.271 1038.08c-.301-.175-.354-.52-.354-2.335 0-2.08.176-2.842.73-3.17.147-.087 1.354-1.043 2.683-2.126 1.33-1.082 3.451-2.802 4.715-3.82 4.614-3.722 5.71-4.959 6.057-6.839.265-1.432-.058-3.058-.73-3.68-.693-.643-1.057-.816-2.072-.984-2.07-.343-3.684.331-5.743 2.4-.854.858-.987.924-1.483.735-.904-.344-3.3-2.435-3.403-2.97-.058-.303.069-.695.336-1.036.72-.924 2.418-2.486 3.06-2.817.334-.172.748-.437.921-.587.173-.151 1.108-.505 2.078-.786 4.002-1.16 8.26-.406 11.012 1.948 1.342 1.148 2.365 3.443 2.603 5.84.145 1.457-.62 4.234-1.541 5.595-.78 1.152-4.093 4.434-4.901 4.855-.547.483-1.107.863-1.686 1.243-.215.194-.912.749-1.55 1.234-1.08.821-1.88 1.88-1.618 2.143.063.062 2.585.113 5.606.113 4.002 0 5.559.066 5.736.243.333.333.333 4.444 0 4.777-.317.317-19.913.34-20.456.024zM146.69 1038.118c-.501-.138-.507-.165-.607-2.899-.056-1.517-.177-2.834-.27-2.926-.092-.092-3.19-.214-6.882-.27l-6.714-.1-.544-1.519c-.85-2.37-.855-2.352 1.482-5.142 1.128-1.347 2.198-2.587 2.378-2.756.18-.17.874-.944 1.541-1.721.668-.777 1.32-1.504 1.45-1.615.129-.112 1.04-1.16 2.025-2.33.984-1.17 1.971-2.317 2.194-2.548.884-.919 3.046-3.385 3.198-3.648.379-.654 1.312-.887 3.552-.887 1.833 0 2.236.055 2.338.32.067.176.132 3.842.143 8.148.01 4.305.083 8.055.16 8.333.133.48.226.51 1.751.563 2.007.07 2.124.197 2.097 2.26-.033 2.515-.039 2.523-1.84 2.651-.847.061-1.686.231-1.864.38-.266.22-.324.728-.324 2.835 0 1.726-.08 2.646-.243 2.81-.265.264-4.118.311-5.02.061zm-.804-11.472c.108-.285.197-1.965.197-3.732 0-2.98-.165-4.253-.552-4.25-.086.002-.36.298-.608.659-.249.36-.71.93-1.025 1.264a83.385 83.385 0 0 0-1.822 2.06c-.687.798-1.575 1.8-1.975 2.226-.4.426-.814.995-.923 1.265-.392.977-.233 1.027 3.26 1.027h3.25l.198-.519zM177.457 993.362h4.909l-17.706 59h-5.162zM191.245 1038.02c-.26-.315-.157-.61.791-2.251.322-.557.776-1.377 1.01-1.822.235-.445.69-1.265 1.013-1.822a57.71 57.71 0 0 0 1.009-1.822c.232-.445.694-1.265 1.026-1.822.332-.556.747-1.285.921-1.62.175-.333.583-1.062.907-1.619.324-.556.78-1.376 1.015-1.821a78.4 78.4 0 0 1 .962-1.755c3.046-5.372 3.293-5.868 3.055-6.154-.199-.24-1.298-.29-6.35-.29-4.48 0-6.173-.065-6.35-.243-.306-.304-.333-4.07-.034-4.628.202-.38.524-.392 9.726-.392 8.26 0 9.599.042 10.133.318l.616.319-.083 1.959c-.086 2.045-.193 2.368-1.591 4.793-.321.556-.771 1.376-1 1.822-.23.445-.67 1.265-.98 1.821-.308.557-1.005 1.832-1.548 2.834a514.82 514.82 0 0 1-1.545 2.834c-.308.557-.75 1.377-.984 1.822a70.66 70.66 0 0 1-1.002 1.822 56.048 56.048 0 0 0-.993 1.822c-.228.445-.873 1.63-1.432 2.632a379.92 379.92 0 0 0-1.417 2.553c-.491.903-.852.989-4.163.989-1.86 0-2.538-.07-2.712-.279z" style="opacity:1;fill:#fff;fill-opacity:1;stroke:#e1e2e6;stroke-width:.20242915;stroke-opacity:0" transform="translate(0 -993.362)"/></svg>

After

Width:  |  Height:  |  Size: 4.3 KiB

View file

@ -50,6 +50,23 @@ export const LINKS_CATEGORIES = {
18: { id: 'discord', svg: true },
};
export const NEWS_SOURCES = {
eurogamer: { img: 'eurogamer.png', url: 'https://www.eurogamer.net/', name: 'Eurogamer' },
vg247: { img: 'vg247.svg', url: 'https://www.vg247.com/', name: 'VG247' },
rps: { img: 'rps.svg', url: 'https://www.rockpapershotgun.com/', name: 'Rock Paper Shotgun' },
rockpapershotgun: { img: 'rps.svg', url: 'https://www.rockpapershotgun.com/', name: 'Rock Paper Shotgun' },
pcgamer: { img: 'pcgamer.png', url: 'https://www.pcgamer.com/', name: 'PC Gamer' },
pressakeycom: { img: 'pressakey.png', url: 'https://pressakey.com/', name: 'Pressakey.com' },
pcgamesn: { img: 'pcgamesn.svg', url: 'https://www.pcgamesn.com/', name: 'PCGamesN' },
steamcommunityannouncements: { img: 'steam.png', url: 'https://steamcommunity.com/', name: 'Steam' },
shacknews: { img: 'shacknews.png', url: 'https://www.shacknews.com/', name: 'Shacknews' },
steamdb: { img: 'steamdb.svg', url: 'https://steamdb.info/', name: 'Steam' },
gamemagru: { img: 'gamemagru.png', url: 'https://gamemag.ru/', name: 'GameMAG' },
steamrelease: { img: 'steam.png', url: 'https://store.steampowered.com/', name: 'Steam' },
steamannounce: { img: 'steam.png', url: 'https://store.steampowered.com/', name: 'Steam' },
gamingonlinux: { img: 'gamingonlinux.svg', url: 'https://www.gamingonlinux.com/', name: 'GamingOnLinux' },
};
export const GENRE_ICONS = {
2: 'fa-solid fa-computer-mouse',
4: 'fa-solid fa-hand-fist',

View file

@ -1,3 +1,5 @@
<!-- TODO: find out all possible news sources and add constant entries -->
<!-- TODO: make game cover sticky -->
<template lang="html">
<section>
<b-container>
@ -17,7 +19,7 @@
<b-spinner v-if="loading" class="spinner-centered" />
<div v-else-if="!articles.length">
<div v-else-if="!gameNews.length">
no news found
</div>
@ -29,67 +31,64 @@
</b-col>
<b-col cols="12" sm="8">
<!-- <pre>{{ articles }}</pre> -->
<b-card
v-for="article in articles"
v-for="article in gameNews"
class="mb-3"
:key="article.id"
>
<strong>{{ article.title }}</strong>
<p class="text-muted small">By {{ article.author }} | {{ article.date }}</p>
<div class="d-flex align-items-start justify-content-between">
<aside>
<p class="mb-0"><strong>{{ article.title }}</strong></p>
<small v-if="article.author" class="text-muted mr-1">By {{ article.author }} |</small>
<small class="text-muted">{{ article.date }}</small>
</aside>
<div v-html="parseBBCode(article.contents)" />
<a
v-if="article.source.url"
:href="article.source.url"
:title="article.source.name"
target="blank"
class="mb-2 ml-2"
>
<b-img
class="news-source-logo"
:src="`/logos/news-sources/${article.source.img}`"
/>
</a>
</div>
feedlabel
<pre>{{ article.feedlabel }}</pre>
feedname
<pre>{{ article.feedname }}</pre>
<div class="game-news" v-html="article.contents" />
<!-- TODO: restore tags? -->
<!-- <b-badge v-for="tag in article.tags" :key="tag">{{ tag }}</b-badge> -->
<!-- <div class="mb-0 w-100" v-html="$options.marked(article.contents)" /> -->
</b-card>
</b-col>
</b-row>
<!-- <b-row class="game-news" v-else>
<b-col cols="6">
<router-link :to="{ name: 'game', params: { id: game.id, slug: game.slug }}" class="float-right">
<b-img :src="gameCoverUrl" fluid rounded />
</router-link>
</b-col>
<b-col cols="6">
</b-col>
</b-row> -->
</b-container>
</section>
</template>
<script>
import { mapState } from 'vuex';
import { marked } from 'marked';
import { mapGetters, mapState } from 'vuex';
import { getGameCoverUrl } from '@/utils';
import bbobHTML from '@bbob/html'
import presetHTML5 from '@bbob/preset-html5'
import { NEWS_SOURCES } from '@/constants/platforms';
export default {
marked,
data() {
return {
loading: false,
articles: [],
};
},
computed: {
...mapState(['game']),
...mapGetters(['gameNews']),
gameCoverUrl() {
return getGameCoverUrl(this.game);
},
// TODO: put in getter
steamAppId() {
const steamData = this.game?.websites?.find(({ category }) => category === 13);
const steamUrl = steamData?.url;
@ -103,14 +102,10 @@ export default {
},
methods: {
parseBBCode(contents) {
return bbobHTML(contents, presetHTML5())
},
async loadNews() {
this.loading = true;
this.articles = await this.$store.dispatch('LOAD_STEAM_GAME_NEWS', this.steamAppId);
await this.$store.dispatch('LOAD_STEAM_GAME_NEWS', this.steamAppId);
this.loading = false;
},
@ -121,9 +116,21 @@ export default {
<style lang="scss" rel="stylesheet/scss">
.game-news {
img {
width: 100%;
height: auto;
margin-bottom: 1rem;
max-width: 100%;
border-radius: 4px;
display: flex;
}
iframe {
max-width: 100%;
}
}
.news-source-logo {
width: 60px;
height: auto;
max-width: 100%;
}
</style>

View file

@ -1,5 +1,9 @@
import { AGE_RATING_SYSTEMS } from '@/constants';
import { PLATFORM_CATEGORIES, EXCLUDED_PLATFORMS, PLATFORM_OVERRIDES } from '@/constants/platforms';
import { NEWS_SOURCES } from '@/constants';
import slugify from 'slugify'
import bbobHTML from '@bbob/html'
import presetHTML5 from '@bbob/preset-html5'
import orderby from 'lodash.orderby';
export default {
@ -30,6 +34,31 @@ export default {
return formattedPlatforms;
},
gameNews: (state) => {
const gameNews = state.game?.news.map((article) => {
const feedSlug = slugify(article?.feedname, {
replacement: '',
lower: true,
strict: true,
});
// TODO: fix broken images from rockpapershotgun
return {
title: article.title,
id: article.gid,
url: article.url,
author: article?.author || null,
date: new Date(article.date * 1000).toLocaleDateString("en-US", { dateStyle: 'short' }),
contents: bbobHTML(article.contents, presetHTML5()),
source: NEWS_SOURCES?.[feedSlug] || `MISING: ${article?.feedname} | ${feedSlug}`,
tags: article.tags,
};
});
return gameNews;
},
platforms: (state) => {
const platforms = state.platforms
.filter(({ id }) => !EXCLUDED_PLATFORMS.includes(id))