-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e70031d
commit ab638e0
Showing
29 changed files
with
4,559 additions
and
4,686 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1,73 @@ | ||
import { fetchMetadata } from "frames.js/next"; | ||
import { Metadata } from "next"; | ||
import WebappFrame from "@/app/_components/WebappFrame"; | ||
import fs from "fs"; | ||
import path from "path"; | ||
import { fetchMetadata } from 'frames.js/next'; | ||
import { Metadata } from 'next'; | ||
import WebappFrame from '@/app/_components/WebappFrame'; | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
|
||
interface generateMetadataProps { | ||
params: { | ||
projectName: string; | ||
strategyName: string; | ||
deployment: string; | ||
}; | ||
params: { | ||
projectName: string; | ||
strategyName: string; | ||
deployment: string; | ||
}; | ||
} | ||
|
||
export async function generateMetadata({ | ||
params, | ||
}: generateMetadataProps): Promise<Metadata> { | ||
// get all dirs in the project name and find the one that ends with the project name | ||
const allDirs = fs.readdirSync( | ||
path.join(process.cwd(), "public", "_strategies", params.projectName) | ||
); | ||
export async function generateMetadata({ params }: generateMetadataProps): Promise<Metadata> { | ||
// get all dirs in the project name and find the one that ends with the project name | ||
const allDirs = fs.readdirSync( | ||
path.join(process.cwd(), 'public', '_strategies', params.projectName) | ||
); | ||
|
||
const strategyDir = allDirs.find((dir) => dir.endsWith(params.strategyName)); | ||
const strategyDir = allDirs.find((dir) => dir.endsWith(params.strategyName)); | ||
|
||
if (!strategyDir) { | ||
throw new Error( | ||
`No directory found for strategy: ${params.strategyName} in project: ${params.projectName}` | ||
); | ||
} | ||
return { | ||
other: { | ||
...(await fetchMetadata( | ||
new URL( | ||
`/frames/${params.projectName}/${params.strategyName}/${params.deployment}`, | ||
process.env.VERCEL_URL | ||
? `https://${process.env.VERCEL_URL}` | ||
: "http://localhost:3000" | ||
) | ||
)), | ||
}, | ||
}; | ||
if (!strategyDir) { | ||
throw new Error( | ||
`No directory found for strategy: ${params.strategyName} in project: ${params.projectName}` | ||
); | ||
} | ||
return { | ||
other: { | ||
...(await fetchMetadata( | ||
new URL( | ||
`/frames/${params.projectName}/${params.strategyName}/${params.deployment}`, | ||
process.env.VERCEL_URL ? `https://${process.env.VERCEL_URL}` : 'http://localhost:3000' | ||
) | ||
)) | ||
} | ||
}; | ||
} | ||
|
||
interface homeProps { | ||
params: { | ||
projectName: string; | ||
strategyName: string; | ||
deployment: string; | ||
}; | ||
params: { | ||
projectName: string; | ||
strategyName: string; | ||
deployment: string; | ||
}; | ||
} | ||
|
||
export default async function Home({ params }: homeProps) { | ||
// get all dirs in the project name and find the one that ends with the project name | ||
const allDirs = fs.readdirSync( | ||
path.join(process.cwd(), "public", "_strategies", params.projectName) | ||
); | ||
// get all dirs in the project name and find the one that ends with the project name | ||
const allDirs = fs.readdirSync( | ||
path.join(process.cwd(), 'public', '_strategies', params.projectName) | ||
); | ||
|
||
const strategyDir = allDirs.find((dir) => dir.endsWith(params.strategyName)); | ||
const strategyDir = allDirs.find((dir) => dir.endsWith(params.strategyName)); | ||
|
||
if (!strategyDir) { | ||
throw new Error( | ||
`No directory found for strategy: ${params.strategyName} in project: ${params.projectName}` | ||
); | ||
} | ||
if (!strategyDir) { | ||
throw new Error( | ||
`No directory found for strategy: ${params.strategyName} in project: ${params.projectName}` | ||
); | ||
} | ||
|
||
const filePath = path.join( | ||
process.cwd(), | ||
"public", | ||
"_strategies", | ||
params.projectName, | ||
strategyDir, | ||
`${params.strategyName}.rain` | ||
); | ||
const dotrainText = fs.readFileSync(filePath, "utf8"); | ||
const filePath = path.join( | ||
process.cwd(), | ||
'public', | ||
'_strategies', | ||
params.projectName, | ||
strategyDir, | ||
`${params.strategyName}.rain` | ||
); | ||
const dotrainText = fs.readFileSync(filePath, 'utf8'); | ||
|
||
return ( | ||
<WebappFrame | ||
dotrainText={dotrainText} | ||
deploymentOption={params.deployment} | ||
/> | ||
); | ||
return <WebappFrame dotrainText={dotrainText} deploymentOption={params.deployment} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,46 @@ | ||
import { fetchMetadata } from "frames.js/next"; | ||
import { Metadata } from "next"; | ||
import WebappFrame from "../../_components/WebappFrame"; | ||
import fs from "fs"; | ||
import path from "path"; | ||
import { fetchMetadata } from 'frames.js/next'; | ||
import { Metadata } from 'next'; | ||
import WebappFrame from '../../_components/WebappFrame'; | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
|
||
interface generateMetadataProps { | ||
params: { | ||
projectName: string; | ||
strategyName: string; | ||
}; | ||
params: { | ||
projectName: string; | ||
strategyName: string; | ||
}; | ||
} | ||
|
||
export async function generateMetadata({ | ||
params, | ||
}: generateMetadataProps): Promise<Metadata> { | ||
return { | ||
other: { | ||
...(await fetchMetadata( | ||
new URL( | ||
`/frames/${params.projectName}/${params.strategyName}`, | ||
process.env.VERCEL_URL | ||
? `https://${process.env.VERCEL_URL}` | ||
: "http://localhost:3000" | ||
) | ||
)), | ||
}, | ||
}; | ||
export async function generateMetadata({ params }: generateMetadataProps): Promise<Metadata> { | ||
return { | ||
other: { | ||
...(await fetchMetadata( | ||
new URL( | ||
`/frames/${params.projectName}/${params.strategyName}`, | ||
process.env.VERCEL_URL ? `https://${process.env.VERCEL_URL}` : 'http://localhost:3000' | ||
) | ||
)) | ||
} | ||
}; | ||
} | ||
|
||
interface homeProps { | ||
params: { | ||
projectName: string; | ||
strategyName: string; | ||
}; | ||
params: { | ||
projectName: string; | ||
strategyName: string; | ||
}; | ||
} | ||
|
||
export default async function Home({ params }: homeProps) { | ||
const filePath = path.join( | ||
process.cwd(), | ||
"public", | ||
"_strategies", | ||
params.projectName, | ||
params.strategyName, | ||
`${params.strategyName}.rain` | ||
); | ||
const dotrainText = fs.readFileSync(filePath, "utf8"); | ||
const filePath = path.join( | ||
process.cwd(), | ||
'public', | ||
'_strategies', | ||
params.projectName, | ||
params.strategyName, | ||
`${params.strategyName}.rain` | ||
); | ||
const dotrainText = fs.readFileSync(filePath, 'utf8'); | ||
|
||
return <WebappFrame dotrainText={dotrainText} deploymentOption={null} />; | ||
return <WebappFrame dotrainText={dotrainText} deploymentOption={null} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.