mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Add headings to app template
This commit is contained in:
parent
2faae587f2
commit
e72029d2de
2 changed files with 52 additions and 12 deletions
94
src/pages/app/[...appPath].astro
Normal file
94
src/pages/app/[...appPath].astro
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
---
|
||||
// Full Astro Component Syntax:
|
||||
// https://docs.astro.build/core-concepts/astro-components/
|
||||
|
||||
import axios from 'axios'
|
||||
|
||||
import Layout from '../../layouts/default.astro'
|
||||
import Listing from '../../components/default-listing.astro'
|
||||
|
||||
import { makeLastUpdatedFriendly } from '~/helpers/parse-date'
|
||||
import { getAppEndpoint } from '~/helpers/app-derived.js'
|
||||
|
||||
import LinkButton from '~/components/link-button.vue'
|
||||
import VideoRow from '~/components/video/row.vue'
|
||||
|
||||
// import appList from '~/static/app-list.json'
|
||||
|
||||
// export async function getStaticPaths () {
|
||||
// return appList.map(app => {
|
||||
|
||||
// // console.log('app.slug', app.slug )
|
||||
|
||||
// return {
|
||||
// params: {
|
||||
// slug: app.slug
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
|
||||
|
||||
// const {
|
||||
// appPath
|
||||
// } = Astro.params
|
||||
|
||||
|
||||
// Parse the request url
|
||||
const requestUrl = new URL( Astro.request.url )
|
||||
|
||||
// Get type and slug from the request path
|
||||
// so that we don't have extra parts for
|
||||
// urls like /:type/:slug/benchmarks
|
||||
const [ , pathType, pathSlug ] = requestUrl.pathname.split('/')
|
||||
|
||||
// Create an empty API URL
|
||||
const apiUrl = new URL( import.meta.env.PUBLIC_API_DOMAIN )
|
||||
|
||||
// Use request path parts to set api url path
|
||||
apiUrl.pathname = `/api/${ pathType }/${ pathSlug }.json`
|
||||
|
||||
|
||||
// Astro Request reference
|
||||
// https://docs.astro.build/en/reference/api-reference/#astrorequests
|
||||
|
||||
console.log('Astro.params', Astro.params )
|
||||
console.log('apiUrl', apiUrl )
|
||||
console.log('Astro.request.url', Astro.request.url )
|
||||
console.log('Astro.site.pathname', Astro.site.pathname )
|
||||
// console.log('Astro.request', Astro.request )
|
||||
|
||||
const appListing = await axios.get( apiUrl.toString() )
|
||||
.then( response => {
|
||||
// console.log( 'response', response )
|
||||
return response.data
|
||||
})
|
||||
|
||||
// const {
|
||||
// head,
|
||||
// entry
|
||||
// } = Astro.props
|
||||
|
||||
const app = {}
|
||||
|
||||
const hasMultipleAliases = false
|
||||
const appDeviceSupport = []
|
||||
const hasRelatedVideos = false
|
||||
const relatedVideosRowHtml = []
|
||||
const hasBundleIdentifiers = false
|
||||
const lastUpdatedFriendly = null
|
||||
|
||||
---
|
||||
<Layout
|
||||
headTitle={ `${ appListing.name } | Does It ARM` }
|
||||
headDescription={ 'Test' }
|
||||
>
|
||||
|
||||
<Listing
|
||||
listing={ appListing }
|
||||
/>
|
||||
<!-- <div>
|
||||
{ JSON.stringify( appListing ) }
|
||||
</div> -->
|
||||
|
||||
</Layout>
|
||||
Loading…
Add table
Add a link
Reference in a new issue