Skip to content

Commit

Permalink
Merge pull request #16 from HausDAO/dev
Browse files Browse the repository at this point in the history
Unfuck
  • Loading branch information
earth2travis authored Jan 29, 2025
2 parents d980f3d + d04f93a commit 036098c
Show file tree
Hide file tree
Showing 50 changed files with 1,527 additions and 668 deletions.
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

0 comments on commit 036098c

Please sign in to comment.