Enable fallback source url

This commit is contained in:
Sam Carlton 2022-06-11 11:58:58 -05:00
parent bb29e97f06
commit 55543dd7b1

View file

@ -12,6 +12,18 @@ const details = ensureListingDetails(listing)
const hasReports = Array.isArray( details.api.reports ) && details.api.reports.length > 0 const hasReports = Array.isArray( details.api.reports ) && details.api.reports.length > 0
const defaultSourceUrl = 'https://applesilicongames.com/'
function getSourceUrl ( report ) {
// Try to get the source url from the report first
if ( report['Source'].includes('https://') ) {
return report['Source']
}
// Otherwise, fall back to the default source url
return defaultSourceUrl
}
--- ---
{ hasReports && ( { hasReports && (
@ -38,19 +50,20 @@ const hasReports = Array.isArray( details.api.reports ) && details.api.reports.l
> >
🖥 { report['Resolution'] } 🖥 { report['Resolution'] }
</p> </p>
report['Settings'].length !== 0 { report['Settings'].length !== 0 && (
<p class="mt-1 text-sm leading-5"> <p class="mt-1 text-sm leading-5">
⚙️ { report['Settings'] } ⚙️ { report['Settings'] }
</p> </p>
)}
</div> </div>
</div> </div>
{ report['Source'].includes('https://') && (
<div class="border-t border-gray-200"> <div class="border-t border-gray-200">
<div class="-mt-px flex"> <div class="-mt-px flex">
<div class="w-0 flex-1 flex border-r border-gray-200"> <div class="w-0 flex-1 flex border-r border-gray-200">
<a <a
href={ report['Source'] } href={ getSourceUrl( report ) }
class="relative -mr-px w-0 flex-1 inline-flex items-center justify-center py-4 text-sm leading-5 font-bold border border-transparent rounded-bl-lg hover:text-gray-500 focus:outline-none focus:shadow-outline-blue focus:border-blue-300 focus:z-10 transition ease-in-out duration-150" class="relative -mr-px w-0 flex-1 inline-flex items-center justify-center py-4 text-sm leading-5 font-bold border border-transparent rounded-bl-lg hover:text-gray-500 focus:outline-none focus:shadow-outline-blue focus:border-blue-300 focus:z-10 transition ease-in-out duration-150"
> >
<!-- Heroicon name: mail --> <!-- Heroicon name: mail -->
@ -68,7 +81,6 @@ const hasReports = Array.isArray( details.api.reports ) && details.api.reports.l
</div> </div>
</div> </div>
</div> </div>
)}
</li> </li>
))} ))}