Skip to content

Commit b9e5548

Browse files
committed
add iframe
1 parent 117e306 commit b9e5548

File tree

14 files changed

+172
-2
lines changed

14 files changed

+172
-2
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI
1+
name: Build
22

33
on: [push, pull_request]
44

.github/workflows/pages.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Pages
2+
3+
on:
4+
workflow_run:
5+
workflows: ['Build']
6+
branches: [main]
7+
types:
8+
- completed
9+
10+
# Allow this job to clone the repo and create a page deployment
11+
permissions:
12+
contents: read
13+
pages: write
14+
id-token: write
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout your repository using git
21+
uses: actions/checkout@v3
22+
- name: Install, build, and upload your site
23+
uses: withastro/action@v1
24+
# with:
25+
# path: . # The root location of your Astro project inside the repository. (optional)
26+
# node-version: 18 # The specific version of Node that should be used to build your site. Defaults to 18. (optional)
27+
# package-manager: pnpm@latest # The Node package manager that should be used to install dependencies and build your site. Automatically detected based on your lockfile. (optional)
28+
29+
deploy:
30+
needs: build
31+
runs-on: ubuntu-latest
32+
environment:
33+
name: github-pages
34+
url: ${{ steps.deployment.outputs.page_url }}
35+
steps:
36+
- name: Deploy to GitHub Pages
37+
id: deployment
38+
uses: actions/deploy-pages@v1

iframe/astro.config.mjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { defineConfig } from 'astro/config'
2+
import clubs from '@devprotocol/clubs-core'
3+
import vue from '@astrojs/vue'
4+
import svelte from '@astrojs/svelte'
5+
import tailwind from '@astrojs/tailwind'
6+
7+
export default defineConfig({
8+
integrations: [clubs(), vue(), svelte(), tailwind()],
9+
base: '/clubs-plugin-web3auth',
10+
})

iframe/config.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { encode } from '@devprotocol/clubs-core'
2+
3+
export default () =>
4+
encode({
5+
name: 'Debug',
6+
twitterHandle: '@debug',
7+
description: '',
8+
url: '',
9+
propertyAddress: '',
10+
chainId: 137,
11+
rpcUrl: 'https://polygon-rpc.com/',
12+
adminRolePoints: 50,
13+
plugins: [
14+
{
15+
id: 'devprotocol:clubs:plugin:web3auth',
16+
options: [],
17+
},
18+
{
19+
id: 'theme',
20+
},
21+
],
22+
})

iframe/env.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/// <reference types="astro/client" />
2+
3+
declare module '*.astro' {
4+
import type { AstroComponentFactory } from 'astro/dist/runtime/server'
5+
export default InstanceType<AstroComponentFactory>
6+
}

iframe/plugins.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import thisPlugin from '../src/index'
2+
import theme from './src/theme'
3+
4+
export default [thisPlugin, theme]

iframe/src/env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="astro/client" />

iframe/src/pages/[...page].astro

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
import type { InferGetStaticPropsType } from 'astro'
3+
import {
4+
type ClubsFunctionPageFactoryResult,
5+
pageFactory,
6+
} from '@devprotocol/clubs-core'
7+
import config from '../../config'
8+
import plugins from '../../plugins'
9+
10+
type Options = {
11+
config: typeof config
12+
plugins: typeof plugins
13+
}
14+
15+
export const { getStaticPaths } = pageFactory({
16+
config,
17+
plugins,
18+
} satisfies Options) as ClubsFunctionPageFactoryResult<Options>
19+
20+
type Props = InferGetStaticPropsType<typeof getStaticPaths>
21+
22+
const Layout = Astro.props.layout
23+
const Content = Astro.props.component
24+
---
25+
26+
<Layout>
27+
<Content {...Astro.props} />
28+
</Layout>

iframe/src/theme/Default.astro

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width" />
6+
</head>
7+
8+
<body>
9+
<slot />
10+
</body>
11+
</html>

iframe/src/theme/index.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import {
2+
type ClubsFunctionGetLayout,
3+
type ClubsFunctionThemePlugin,
4+
type ClubsThemePluginMeta,
5+
ClubsPluginCategory,
6+
} from '@devprotocol/clubs-core'
7+
import { default as Default } from './Default.astro'
8+
9+
export const getLayout = (async () => ({
10+
layout: Default,
11+
})) satisfies ClubsFunctionGetLayout
12+
13+
export const meta = {
14+
id: 'theme',
15+
displayName: 'Theme',
16+
category: ClubsPluginCategory.Theme,
17+
theme: {
18+
previewImage: 'https://dummyimage.com/600x400/000/fff',
19+
},
20+
} satisfies ClubsThemePluginMeta
21+
22+
export default {
23+
getLayout,
24+
meta,
25+
} satisfies ClubsFunctionThemePlugin

0 commit comments

Comments
 (0)