Skip to content

Commit 1350b6a

Browse files
authored
Merge pull request #42 from js-template/ci-test
dynamic page commensted out, its not working
2 parents 88540ac + 4e33ed1 commit 1350b6a

File tree

5 files changed

+115
-113
lines changed

5 files changed

+115
-113
lines changed

.github/workflows/ci.yml

Lines changed: 58 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,58 @@
1-
# name: Padma CI
2-
3-
# on:
4-
# push:
5-
# branches:
6-
# - dev # Adjust according to your branch
7-
# pull_request:
8-
# branches:
9-
# - dev # Adjust according to your branch
10-
11-
# jobs:
12-
# build:
13-
# runs-on: ubuntu-latest
14-
# steps:
15-
# - name: Checkout Code
16-
# uses: actions/checkout@v2
17-
18-
# - name: Setup Node.js
19-
# uses: actions/setup-node@v2
20-
# with:
21-
# node-version: "20"
22-
23-
# - name: Install pnpm
24-
# run: |
25-
# npm install -g pnpm
26-
27-
# - name: Install Dependencies
28-
# run: pnpm install
29-
30-
# - name: Build Backend
31-
# run: pnpm -F @padma/backend build
32-
33-
# - name: Install Blank Theme
34-
# run: pnpm -F @padma/blank-theme build
35-
36-
# - name: Build Frontend
37-
# run: pnpm -F @padma/frontend build
38-
# env:
39-
# NEXTAUTH_URL: ${{ secrets.NEXTAUTH_URL }} # Your Vercel URL
40-
# NEXT_PUBLIC_BASE_URL: ${{ secrets.NEXT_PUBLIC_BASE_URL }} # Localhost or staging URL
41-
# NEXT_PUBLIC_GOOGLE_MAPS_API_KEY: ${{ secrets.NEXT_PUBLIC_GOOGLE_MAPS_API_KEY }} # Google Maps API key
42-
# NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY: ${{ secrets.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY }} # Stripe API key
43-
# STRAPI_AUTH_TOKEN: ${{ secrets.STRAPI_AUTH_TOKEN }} # Strapi auth token
44-
# STRAPI_ENDPOINT: ${{ secrets.STRAPI_ENDPOINT }} # Strapi production URL
45-
46-
# - name: Deploy Backend
47-
# run: |
48-
# echo "Deploying backend..."
49-
# # Add your backend deployment commands here
50-
# env:
51-
# # Add environment variables needed for deployment
52-
# NODE_ENV: development
53-
# # Add other necessary secrets here
54-
55-
# - name: Deploy Frontend
56-
# run: |
57-
# echo "Deploying frontend..."
58-
# # Add your frontend deployment commands here
59-
# env:
60-
# NODE_ENV: development
61-
# # Add other necessary secrets here
1+
name: Padma CI
2+
3+
on:
4+
push:
5+
branches:
6+
- dev # Adjust according to your branch
7+
pull_request:
8+
branches:
9+
- dev # Adjust according to your branch
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout Code
16+
uses: actions/checkout@v2
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v2
20+
with:
21+
node-version: "20"
22+
23+
- name: Install pnpm
24+
run: |
25+
npm install -g pnpm
26+
27+
- name: Install Dependencies
28+
run: pnpm install
29+
30+
- name: Install Blank Theme
31+
run: pnpm -F @padma/blank-theme build
32+
33+
- name: Build Frontend
34+
run: pnpm -F @padma/frontend build
35+
env:
36+
NEXTAUTH_URL: ${{ secrets.NEXTAUTH_URL }} # Your Vercel URL
37+
NEXT_PUBLIC_BASE_URL: ${{ secrets.NEXT_PUBLIC_BASE_URL }} # Localhost or staging URL
38+
NEXT_PUBLIC_GOOGLE_MAPS_API_KEY: ${{ secrets.NEXT_PUBLIC_GOOGLE_MAPS_API_KEY }} # Google Maps API key
39+
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY: ${{ secrets.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY }} # Stripe API key
40+
STRAPI_AUTH_TOKEN: ${{ secrets.STRAPI_AUTH_TOKEN }} # Strapi auth token
41+
STRAPI_ENDPOINT: ${{ secrets.STRAPI_ENDPOINT }} # Strapi production URL
42+
43+
# - name: Deploy Backend
44+
# run: |
45+
# echo "Deploying backend..."
46+
# # Add your backend deployment commands here
47+
# env:
48+
# # Add environment variables needed for deployment
49+
# NODE_ENV: development
50+
# Add other necessary secrets here
51+
52+
- name: Deploy Frontend
53+
run: |
54+
echo "Deploying frontend..."
55+
# Add your frontend deployment commands here
56+
env:
57+
NODE_ENV: development
58+
# Add other necessary secrets here

apps/site/src/app/(public)/[slug]/[item]/page.tsx

Lines changed: 53 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -190,48 +190,56 @@ export default async function DynamicPages({ params }: Props) {
190190
}
191191

192192
// *** Return a list of `params` to populate the [slug] dynamic segment
193-
export async function generateStaticParams() {
194-
// ?? Fetch the permalink structure from Strapi
195-
const { data } = await find("api/permalink", {
196-
populate: "*",
197-
publicationState: "live",
198-
locale: ["en"]
199-
})
200-
201-
// ?? Get the singlePages from the permalink data
202-
const singlePages = data?.data?.attributes?.singlePage
203-
204-
// ?? If no singlePages are found, return an empty array
205-
let params: Array<{ slug: string; item: string }> = []
206-
207-
// ?? Loop through all singlePages and fetch the collectionModel data
208-
await Promise.all(
209-
singlePages?.map(async (page: { slug: string; collectionModel: string; singelModel: string }) => {
210-
// ?? Get the collectionModel API data
211-
const { data: collectionData } = await find(page.collectionModel, {
212-
fields: ["slug"],
213-
filters: {
214-
slug: {
215-
$ne: null
216-
}
217-
},
218-
publicationState: "live",
219-
locale: ["en"]
220-
})
221-
222-
// ?? Store all slugs in the params array
223-
const mappedSlugs = collectionData?.data?.map((single: any) => ({
224-
slug: page.slug,
225-
item: single?.attributes?.slug
226-
}))
227-
228-
params = params.concat(mappedSlugs)
229-
})
230-
)
231-
232-
// ?? Return the params array
233-
return params?.map((post: { slug: string; item: string }) => ({
234-
slug: post.slug,
235-
item: post.item
236-
}))
237-
}
193+
// export async function generateStaticParams() {
194+
// // ?? Fetch the permalink structure from Strapi
195+
// const { data } = await find("api/permalink", {
196+
// populate: "*",
197+
// publicationState: "live",
198+
// locale: ["en"]
199+
// })
200+
201+
// console.log("data from search params", data)
202+
203+
// // ?? Get the singlePages from the permalink data
204+
// const singlePages = data?.data?.attributes?.singlePage || []
205+
206+
// console.log("singlePages", singlePages)
207+
208+
// // ?? If no singlePages are found, return an empty array
209+
// let params: Array<{ slug: string; item: string }> = []
210+
211+
// // ?? Loop through all singlePages and fetch the collectionModel data
212+
// await Promise.all(
213+
// singlePages?.map(async (page: { slug: string; collectionModel: string; singelModel: string }) => {
214+
// // ?? Get the collectionModel API data
215+
// const { data: collectionData, error: collectionError } = await find(page.collectionModel, {
216+
// fields: ["slug"],
217+
// filters: {
218+
// slug: {
219+
// $ne: null
220+
// }
221+
// },
222+
// publicationState: "live",
223+
// locale: ["en"]
224+
// })
225+
226+
// console.log("collectionData", collectionData, "collectionError", collectionError)
227+
228+
// // ?? Store all slugs in the params array
229+
// const mappedSlugs = collectionData?.data?.map((single: any) => ({
230+
// slug: page.slug,
231+
// item: single?.attributes?.slug
232+
// }))
233+
234+
// params = params.concat(mappedSlugs)
235+
// })
236+
// )
237+
238+
// console.log("params", params)
239+
240+
// // ?? Return the params array
241+
// return params?.map((post: { slug: string; item: string }) => ({
242+
// slug: post?.slug,
243+
// item: post?.item
244+
// }))
245+
// }

packages/blank-theme/src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// components.ts
22

3-
import PlaceholderComponent from "./utils/placeholder"
3+
import { PlaceholderComponent } from "./utils/placeholder"
44
export * from "./blocks/header"
55
export * from "./blocks/footer"
66

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
// PlaceholderComponent.tsx
2-
import React from "react"
1+
"use server"
32

4-
const PlaceholderComponent: React.FC = () => {
3+
export const PlaceholderComponent = () => {
54
return <div>This component is not yet available.</div>
65
}
7-
8-
export default PlaceholderComponent

packages/blank-theme/tsconfig.tsbuildinfo

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)