-
Notifications
You must be signed in to change notification settings - Fork 3
feat: updatable terms & conditions #201
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
base: main
Are you sure you want to change the base?
Changes from all commits
1b688c9
23ac02e
ae0f932
5d255a1
3a369b7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -19,6 +19,7 @@ | |||||
| "storybook": "storybook dev -p 6006", | ||||||
| "build-storybook": "storybook build", | ||||||
| "test": "test-storybook", | ||||||
| "test:unit": "vitest run", | ||||||
| "coverage": "test-storybook --coverage", | ||||||
| "chromatic": "npx chromatic" | ||||||
| }, | ||||||
|
|
@@ -63,11 +64,13 @@ | |||||
| "async-mutex": "^0.5.0", | ||||||
| "blockstore-core": "^5.0.2", | ||||||
| "buffer": "^6.0.3", | ||||||
| "canonify": "^2.1.1", | ||||||
| "class-variance-authority": "^0.7.0", | ||||||
| "clsx": "^2.1.1", | ||||||
| "date-fns": "^3.6.0", | ||||||
| "lucide-react": "^0.475.0", | ||||||
| "lute-connect": "^1.4.1", | ||||||
| "marked": "^17.0.3", | ||||||
|
||||||
| "marked": "^17.0.3", | |
| "marked": "^16.0.0", |
Copilot
AI
Mar 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vitest@^4 declares Node >= 20 in its engines, but this repo supports Node 18 (docs + CI matrix). That means npm run test:unit won’t work on Node 18 and may cause install warnings/failures depending on npm settings. Consider pinning a Node-18-compatible Vitest version or updating the project’s Node support policy.
| "vitest": "^4.0.18", | |
| "vitest": "^3.0.0", |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,8 +5,8 @@ import { cn } from "@/functions"; | |
| import { XGovProposerStatusPill } from "../XGovProposerStatusPill/XGovProposerStatusPill"; | ||
| import { XGovStatusPill } from "../XGovStatusPill/XGovStatusPill"; | ||
| import { useState } from "react"; | ||
| import termsAndConditionsString from "./TermsAndConditionsText.md?raw"; | ||
| import { TermsAndConditionsModal } from "@/recipes"; | ||
| import { useTerms } from "@/hooks"; | ||
| import { TestnetDispenserBanner } from "../TestnetDispenserBanner/TestnetDispenserBanner"; | ||
| import { BecomeProposerModal } from "../BecomeProposerModal/BecomeProposerModal"; | ||
| import { BecomeXGovModal } from "../BecomeXGovModal/BecomeXGovModal"; | ||
|
|
@@ -59,6 +59,7 @@ export function ProfileCard({ | |
| className = "", | ||
| }: ProfileCardProps) { | ||
| const delegates = useXGovDelegates(address); | ||
| const terms = useTerms(); | ||
| const [showBecomeXGovModal, setShowBecomeXGovModal] = useState(false); | ||
| const [showBecomeProposerModal, setShowBecomeProposerModal] = useState(false); | ||
| const [showBecomeProposerTermsModal, setShowBecomeProposerTermsModal] = useState(false); | ||
|
|
@@ -219,7 +220,7 @@ export function ProfileCard({ | |
| </span> | ||
| </> | ||
| } | ||
| terms={termsAndConditionsString} | ||
| terms={terms.data?.content ?? ""} | ||
| isOpen={showBecomeProposerTermsModal} | ||
| onClose={() => setShowBecomeProposerTermsModal(false)} | ||
|
Comment on lines
+223
to
225
|
||
| onAccept={() => { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -12,11 +12,11 @@ import { Button } from "@/components/ui/button"; | |||||
| import { CheckIcon, ChevronLeftIcon, ChevronRightIcon } from "lucide-react"; | ||||||
| import { cn } from "@/functions"; | ||||||
| import { TermsAndConditionsModal } from "@/recipes"; | ||||||
| import termsAndConditionsString from "../ProfileCard/TermsAndConditionsText.md?raw"; | ||||||
| import { BecomeProposerModal } from "../BecomeProposerModal/BecomeProposerModal"; | ||||||
| import { BecomeXGovModal } from "../BecomeXGovModal/BecomeXGovModal"; | ||||||
| import type { TransactionStateInfo } from "@/api/types/transaction_state"; | ||||||
| import { CheckCircleIcon } from "../icons/CheckCircleIcon"; | ||||||
| import { useTerms } from "@/hooks"; | ||||||
|
|
||||||
| export interface TutorialDialogProps { | ||||||
| isOpen: boolean; | ||||||
|
|
@@ -110,6 +110,7 @@ export function TutorialDialog({ | |||||
| isXGov = false, | ||||||
| isProposer = false | ||||||
| }: TutorialDialogProps) { | ||||||
| const terms = useTerms(); | ||||||
| const [currentStep, setCurrentStep] = useState(0); | ||||||
| const [showBecomeXGovModal, setShowBecomeXGovModal] = useState(false); | ||||||
| const [showBecomeProposerModal, setShowBecomeProposerModal] = useState(false); | ||||||
|
|
@@ -448,7 +449,7 @@ export function TutorialDialog({ | |||||
| </div> | ||||||
| </> | ||||||
| } | ||||||
| terms={termsAndConditionsString} | ||||||
| terms={terms.data?.content ?? ""} | ||||||
| isOpen={showBecomeProposerTermsModal} | ||||||
|
||||||
| isOpen={showBecomeProposerTermsModal} | |
| isOpen={showBecomeProposerTermsModal && !!terms.data?.content} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,15 @@ | ||
| /// <reference path="../.astro/types.d.ts" /> | ||
| /// <reference types="astro/client" /> | ||
|
|
||
| type R2Bucket = import("@cloudflare/workers-types").R2Bucket; | ||
|
|
||
| declare namespace App { | ||
| interface Locals { | ||
| runtime?: { | ||
| env: { | ||
| BUCKET?: R2Bucket; | ||
| [key: string]: unknown; | ||
| }; | ||
| }; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import { useQuery } from "@tanstack/react-query"; | ||
|
|
||
| interface TermsData { | ||
| content: string; | ||
| source: "r2" | "static"; | ||
| version: number; | ||
| } | ||
|
|
||
| async function fetchTerms(): Promise<TermsData> { | ||
| const res = await fetch("/api/terms"); | ||
| if (!res.ok) { | ||
| throw new Error("Failed to fetch terms"); | ||
| } | ||
| return res.json(); | ||
| } | ||
|
|
||
| export function useTerms() { | ||
| return useQuery({ | ||
| queryKey: ["terms"], | ||
| queryFn: fetchTerms, | ||
| staleTime: 5 * 60 * 1000, | ||
| }); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
canonifyis added as a dependency but isn’t referenced anywhere in the repo. Please remove it to avoid unnecessary supply-chain surface area (or use it if canonical JSON is actually required).Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct,
package-lock.jsonwill need updated also.