Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unfuck #16

Merged
merged 35 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
4727f75
Style the sample form
Jan 17, 2025
16b471c
Merge pull request #4 from HausDAO/style-sample
skuhlmann Jan 17, 2025
1b9c542
puts in react-hook-form
skuhlmann Jan 17, 2025
ff6ec24
adds in a popover
skuhlmann Jan 17, 2025
4aac069
Merge pull request #5 from HausDAO/sk/form-refactor-1
skuhlmann Jan 17, 2025
dead182
Resolve conflicts with input and text area
Jan 17, 2025
c254d03
Resolve TypeScript errors at the sample route
Jan 17, 2025
b3e742c
Back to bare metal
Jan 17, 2025
92c9fdc
Update headings
Jan 17, 2025
eb399c6
Update labels and errors
Jan 17, 2025
459ea2b
Style select component
Jan 17, 2025
0a3b7bb
Update radio styles
Jan 17, 2025
b43daa6
Style button
Jan 18, 2025
7fa8eb6
Fix error message on select component and tighten up spacing
Jan 18, 2025
8944fe9
Merge pull request #6 from HausDAO/tweaking-styles
earth2travis Jan 18, 2025
6cc22db
clean out double
skuhlmann Jan 18, 2025
1c3ac55
Merge pull request #7 from HausDAO/sk/18012025-form
skuhlmann Jan 22, 2025
e172fa2
adds dao name to list page and create a token balance fetch hook
skuhlmann Jan 22, 2025
b353c6c
adds request shares/loot form
skuhlmann Jan 22, 2025
65b7599
moves buttons out
skuhlmann Jan 22, 2025
175cad0
Merge pull request #8 from HausDAO/sk/22012025-more-form
skuhlmann Jan 22, 2025
5ac43fd
pulls meta fields into a component and uses formcontext hook
skuhlmann Jan 22, 2025
78cff3f
Merge pull request #9 from HausDAO/sk/22012025-more-form
skuhlmann Jan 22, 2025
8775103
Generate manifest, add images, update layout
Jan 22, 2025
a583c03
Update GitHub Actions workflow for Next.js project
Jan 22, 2025
82cd334
Fix ESLint errors
Jan 22, 2025
1ab093d
Update cn import in checkbox component
Jan 22, 2025
93a9c85
Handle DaoHooksContext during static build
Jan 22, 2025
3e84b7d
Configure Node.js runtime for Cloudflare Pages
Jan 22, 2025
9ecb700
switch to @opennextjs/cloudflare for Node.js runtime support
Jan 22, 2025
36758ac
simplify build process for Cloudflare Pages
Jan 22, 2025
877c909
remove output directory from wrangler.toml
Jan 22, 2025
dee9b22
handle Cloudflare Pages file size limits
Jan 22, 2025
4125187
simplify build process and output directory
Jan 22, 2025
d04f93a
Remove .next/cache to avoid large build artifacts in Cloudflare Pages…
Jan 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 35 additions & 35 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
module.exports = {
extends: ["next", "prettier"],
extends: ['next', 'prettier'],
plugins: [
"@typescript-eslint",
"ban",
"import",
"no-restricted-imports",
"react-hooks",
"react",
"simple-import-sort",
'@typescript-eslint',
'ban',
'import',
'no-restricted-imports',
'react-hooks',
'react',
'simple-import-sort',
],
rules: {
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
"@typescript-eslint/no-var-requires": "off",
"@next/next/no-html-link-for-pages": "off",
"@next/next/no-page-custom-font": "off",
eqeqeq: "error",
"import/no-default-export": "off",
"no-console": "off",
"no-duplicate-imports": "error",
"no-implicit-globals": "error",
"react/display-name": "off",
"react/prop-types": "off",
"react/jsx-key": "off",
"react/no-unescaped-entities": "off",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "error",
"simple-import-sort/imports": "off",
"simple-import-sort/exports": "off",
"no-restricted-imports": [
"error",
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/no-var-requires': 'off',
'@next/next/no-html-link-for-pages': 'off',
'@next/next/no-page-custom-font': 'off',
eqeqeq: 'error',
'import/no-default-export': 'off',
'no-console': 'off',
'no-duplicate-imports': 'error',
'no-implicit-globals': 'error',
'react/display-name': 'off',
'react/prop-types': 'off',
'react/jsx-key': 'off',
'react/no-unescaped-entities': 'off',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'error',
'simple-import-sort/imports': 'off',
'simple-import-sort/exports': 'off',
'no-restricted-imports': [
'error',
{
paths: [
{
name: "lodash",
message: "Import [module] from lodash/[module] instead",
name: 'lodash',
message: 'Import [module] from lodash/[module] instead',
},
],
},
],
"valid-typeof": "error",
'valid-typeof': 'error',
},
};
47 changes: 23 additions & 24 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,38 @@ name: Verify
on:
pull_request:
branches: [main]
workflow_call:
secrets:
STACK_DEPLOY_SSH_PRIVATE_KEY:
required: true
DEPOT_PROJECT_ID:
required: true
DOCKERHUB_USER:
required: true
DOCKERHUB_PASSWORD:
required: true

# Cancel in-progress workflows for the same PR or branch/tag

# Cancel in-progress workflows for the same PR
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

# Needs to be a superset of what Verify workflow needs
permissions:
contents: read # Clone repo
id-token: write # Depot OIDC
contents: read

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10
runs-on: depot-ubuntu-latest-arm
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/build

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
dockerhub-user: ${{ secrets.DOCKERHUB_USER }}
dockerhub-password: ${{ secrets.DOCKERHUB_PASSWORD }}
dockerfile: ./Dockerfile
depot: true
depot-project-id: ${{ secrets.DEPOT_PROJECT_ID }}
context: .
platforms: 'linux/arm64'
bun-version: latest

- name: Install dependencies
run: bun install --frozen-lockfile

- name: Build
run: bun run build

# Optionally add linting/testing steps if needed
- name: Lint
run: bun run lint
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,6 @@ Brewfile.lock.json
.eslintcache

# IDE configs
.idea/
.idea/

.next/cache/
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.10.0
20.10.0
Binary file modified bun.lockb
Binary file not shown.
15 changes: 10 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@
"scripts": {
"dev": "next dev",
"build": "next build",
"clean": "rm -rf .next/cache",
"start": "next start",
"lint": "next lint",
"pages:build": "npx @cloudflare/next-on-pages",
"preview": "bun run pages:build && wrangler pages dev",
"deploy": "bun run pages:build && wrangler pages deploy"
"pages:build": "rm -rf .next && next build && rm -rf .next/cache",
"pages:deploy": "npx @cloudflare/next-on-pages deploy .next",
"preview": "bun run pages:build && wrangler pages dev"
},
"dependencies": {
"@farcaster/frame-sdk": "^0.0.16",
"@farcaster/frame-wagmi-connector": "^0.0.14",
"@hookform/resolvers": "^3.10.0",
"@opennextjs/cloudflare": "^0.2.1",
"@radix-ui/react-avatar": "^1.1.1",
"@radix-ui/react-checkbox": "^1.1.3",
Expand All @@ -22,7 +24,7 @@
"@radix-ui/react-popover": "^1.1.4",
"@radix-ui/react-radio-group": "^1.2.2",
"@radix-ui/react-select": "^2.1.4",
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-slot": "^1.1.1",
"@radix-ui/react-tooltip": "^1.1.6",
"@tanstack/react-query": "^5.62.7",
"class-variance-authority": "^0.7.1",
Expand All @@ -41,10 +43,12 @@
"tailwindcss-animate": "^1.0.7",
"vaul": "^1.1.1",
"viem": "^2.22.7",
"wagmi": "^2.14.7"
"wagmi": "^2.14.7",
"zod": "^3.24.1"
},
"devDependencies": {
"@cloudflare/next-on-pages": "^1.13.7",
"@shadcn/ui": "^0.0.4",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
Expand All @@ -59,6 +63,7 @@
"eslint-plugin-simple-import-sort": "^12.1.1",
"postcss": "^8",
"prettier": "3.4.2",
"shadcn-ui": "^0.9.4",
"tailwindcss": "^3.4.1",
"typescript": "^5"
}
Expand Down
20 changes: 10 additions & 10 deletions public/.well-known/farcaster.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"accountAssociation": {
"header": "eyJmaWQiOjg4MzEyNSwidHlwZSI6ImN1c3RvZHkiLCJrZXkiOiIweDgxNWQ0YURjMTMwQzFBNkMzOTNiN0E0QzM2NzE4ZTZkNzE5MTlGMTUifQ",
"payload": "eyJkb21haW4iOiJ6b28uZmFyY2FzdGxlLm5ldCJ9",
"signature": "MHgyYWE4NzFiNjUzY2M3MzdkMTNlZDk3Y2ZkYzNjY2MxZjMxNDMzYzg1OTAyM2I5ZDdlYjhlY2I3MDdmM2Y3MDYxNTViYWNiODY3ODgwNzdmNDBlNmFlOWU5ZGE0Nzk0ZTZiZWQ3NTNhZDQyMTgxOWNhMDU3NTk0YmU2OGMxZmQ5OTFj"
"header": "eyJmaWQiOjg2MjA5MiwidHlwZSI6ImN1c3RvZHkiLCJrZXkiOiIweDg4MjhmNzMzODFDNzE3OUM2MjlEZjAzNzk0RGQ2QTUyRTU2Mjg5MjgifQ",
"payload": "eyJkb21haW4iOiJwcm9wb3NhbHMuZmFyY2FzdGxlLm5ldCJ9",
"signature": "MHgxN2JmN2Y3ZTA4ZmE4NDNjYTFjZTM0OWE3Y2U1NmEyN2JhMTAyOTk1OGMxYTEyYzQyMzk1ZDBjN2E2ODU4NDlkMGM1ZGFhMjMzZTIyNmM4Zjg4ZDE4YWU0Y2Q4ZGRlMzRjODZjNWU4MDQwYzQ4ODlhNjc0NWVjZDlmMjc3NDA1MzFj"
},
"frame": {
"version": "1",
"name": "Farcastle Proposals",
"iconUrl": "https://zoo.farcastle.net/icon.png",
"homeUrl": "https://zoo.farcastle.net",
"imageUrl": "https://zoo.farcastle.net/image.png",
"buttonTitle": "Create Proposals",
"splashImageUrl": "https://zoo.farcastle.net/splash.png",
"name": "Proposals",
"iconUrl": "https://proposals.farcastle.net/icon.png",
"homeUrl": "https://proposals.farcastle.net",
"imageUrl": "https://proposals.farcastle.net/image.png",
"buttonTitle": "Make Proposal",
"splashImageUrl": "https://proposals.farcastle.net/splash.png",
"splashBackgroundColor": "#341A34",
"webhookUrl": "https://zoo.farcastle.net/api/webhook"
"webhookUrl": "https://proposals.farcastle.net/api/webhook"
}
}
Binary file modified public/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
112 changes: 52 additions & 60 deletions src/app/dao/[chainid]/[daoid]/[proposaltype]/proposal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,14 @@ import { Button } from "@/components/ui/button";
import { prepareTX } from "@/lib/tx-prepper/tx-prepper";
import { getExplorerUrl, getWagmiChainObj } from "@/lib/constants";
import { useParams } from "next/navigation";
import {
FORM_CONFIGS,
FormConfig,
FormValues,
validFormId,
} from "@/lib/form-configs";
import { ValidNetwork } from "@/lib/tx-prepper/prepper-types";
import { FORM_CONFIGS, FormConfig, validFormId } from "@/lib/form-configs";
import { ArbitraryState, ValidNetwork } from "@/lib/tx-prepper/prepper-types";
import { useFrameSDK } from "@/providers/FramesSDKProvider";
import { useDaoRecord } from "@/providers/DaoRecordProvider";
import { WaitForReceipt } from "@/lib/types";
import { proposalCastUrl } from "@/lib/formatters";
import { FormSwitcher } from "@/components/app/FormSwitcher";
import { Card } from "@/components/ui/card";
// import { FormSwitcher } from "@/forms/FormSwitcher";

const getPropidFromReceipt = (receipt: WaitForReceipt): number | null => {
Expand All @@ -48,8 +44,6 @@ export default function Proposal() {

const [propid, setPropid] = useState<number | null>(null);
const [formConfig, setFormConfig] = useState<FormConfig | null>(null);
const [formValues, setFormValues] = useState<FormValues>({});
const [validValues, setValidValues] = useState<boolean>(false);

const {
writeContract,
Expand Down Expand Up @@ -87,16 +81,14 @@ export default function Proposal() {
sdk.actions.openUrl(`${getExplorerUrl(daochain)}/tx/${hash}`);
}, [hash, daochain]);

const handleSend = async () => {
console.log("formValues", formValues);

const handleSend = async (values: ArbitraryState) => {
if (!formConfig) return;

const wholeState = {
formValues: {
...formValues,
recipient: address,
...values,
},
senderAddress: address,
chainId: daochain,
safeId: daosafe,
daoId: daoid,
Expand Down Expand Up @@ -130,55 +122,55 @@ export default function Proposal() {
if (!formConfig) return null;

const validChain = chainId === daochainid;
const disableSubmit =
!isConnected ||
isSendTxPending ||
!validChain ||
isConfirming ||
!!hash ||
!validValues;
const txLoading = isSendTxPending || isConfirming;

return (
<>
<FormSwitcher
formid={formConfig.id}
isConfirmed={isConfirmed}
formValues={formValues}
validValues={validValues}
setFormValues={setFormValues}
setValidValues={setValidValues}
/>

<div className="flex flex-col gap-2">
<Button onClick={handleSend} disabled={disableSubmit}>
{txLoading
? "Loading"
: formConfig.submitButtonText || "Create Proposal"}
</Button>
{isSendTxError && renderError(sendTxError)}

{!isConnected && (
<>
<Button onClick={() => connect({ connector: connector })}>
Connect
</Button>
</>
)}

{isConnected && !validChain && (
<Button
onClick={() =>
switchChain({ chainId: getWagmiChainObj(daochain).id })
}
>
Switch to {getWagmiChainObj(daochain).name}
</Button>
)}

{propid && <Button onClick={openProposalCastUrl}>Cast Proposal</Button>}

{hash && <Button onClick={openUrl}>View Tx on Block Explorer</Button>}
<div className="w-full h-full space-y-4 pb-4 px-4">
<Card className="flex flex-col items-center px-4 pt-4 pb-8 rounded-none">
<div className="text-muted font-display text-2xl uppercase mb-4">
{formConfig.title}
</div>

<div className="w-full space-y-4">
<FormSwitcher
formConfig={formConfig}
confirmed={isConfirmed}
loading={isSendTxPending || isConfirming}
invalidConnection={!isConnected || !validChain}
handleSubmit={handleSend}
/>
</div>

<div className="flex flex-col gap-2 w-full space-y-4 pb-4 px-4 mt-3">
{isSendTxError && renderError(sendTxError)}

{!isConnected && (
<>
<Button onClick={() => connect({ connector: connector })}>
Connect
</Button>
</>
)}

{isConnected && !validChain && (
<Button
onClick={() =>
switchChain({ chainId: getWagmiChainObj(daochain).id })
}
>
Switch to {getWagmiChainObj(daochain).name}
</Button>
)}

{propid && (
<Button onClick={openProposalCastUrl}>Cast Proposal</Button>
)}

{hash && (
<Button onClick={openUrl}>View Tx on Block Explorer</Button>
)}
</div>
</Card>
</div>
</>
);
Expand Down
Loading