diff --git a/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx b/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx index 8a84de9b45d..c6766addfc0 100644 --- a/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx +++ b/packages/commonwealth/server/farcaster/frames/contest/contestCard.tsx @@ -87,7 +87,10 @@ export const contestCard = frames(async (ctx) => { lineHeight: '1.2', }} > - Submit entries by replying below until {endTime.toLocaleString()} + Submit entries by replying below until{' '} + {endTime.toLocaleString(undefined, { + timeZoneName: 'longGeneric', + })}

)} @@ -121,11 +124,11 @@ export const contestCard = frames(async (ctx) => { Leaderboard , , , - ], - }; -}); diff --git a/packages/commonwealth/server/farcaster/frames/contest/index.ts b/packages/commonwealth/server/farcaster/frames/contest/index.ts index 0ecf4d434d2..5f46f4c17a9 100644 --- a/packages/commonwealth/server/farcaster/frames/contest/index.ts +++ b/packages/commonwealth/server/farcaster/frames/contest/index.ts @@ -1,4 +1,4 @@ import { contestCard } from './contestCard'; -import { contestPrizes } from './contestPrizes'; +import { votingRules } from './votingRules'; -export { contestCard, contestPrizes }; +export { contestCard, votingRules }; diff --git a/packages/commonwealth/server/farcaster/frames/contest/votingRules.tsx b/packages/commonwealth/server/farcaster/frames/contest/votingRules.tsx new file mode 100644 index 00000000000..85377919bfd --- /dev/null +++ b/packages/commonwealth/server/farcaster/frames/contest/votingRules.tsx @@ -0,0 +1,81 @@ +import { query } from '@hicommonwealth/core'; +import { Contest } from '@hicommonwealth/model'; +import { Button } from 'frames.js/express'; +import React from 'react'; +import { frames } from '../../config'; +import { FrameLayout } from '../../utils'; + +export const votingRules = frames(async (ctx) => { + const contest_address = ctx.url.pathname.split('/')[1]; + + const contestManager = await query(Contest.GetContest(), { + actor: { user: { email: '' } }, + payload: { contest_address, with_chain_node: true }, + }); + + if (!contestManager) { + return { + title: 'Contest not found', + image: ( + +

Try to run the contest again.

+
+ ), + }; + } + + return { + title: 'Voting Rules', + image: ( + +
+ +
+
+ ), + buttons: [ + , + ], + }; +}); diff --git a/packages/commonwealth/server/farcaster/router.tsx b/packages/commonwealth/server/farcaster/router.tsx index 6cb81f5eaa1..bc3cba32e67 100644 --- a/packages/commonwealth/server/farcaster/router.tsx +++ b/packages/commonwealth/server/farcaster/router.tsx @@ -1,11 +1,11 @@ import express from 'express'; -import { contestCard, contestPrizes } from './frames/contest'; +import { contestCard, votingRules } from './frames/contest'; const farcasterRouter = express.Router(); // WARNING: do not change these paths because cloudflare may route to it farcasterRouter.get('/:contest_address/contestCard', contestCard); farcasterRouter.post('/:contest_address/contestCard', contestCard); -farcasterRouter.post('/:contest_address/contestPrizes', contestPrizes); +farcasterRouter.post('/:contest_address/votingRules', votingRules); export default farcasterRouter;