Skip to content

Commit b110bbc

Browse files
feat(xc-admin-frontend): instructions summary in proposal page + improve ui in proposal row + refactor the code (#1478)
* refactor: move proposals to a folder * refactor: use @images instead of relative paths * refactor: split proposals into multiple files * refactor: add type for proposal status * refactor: add eslint and fix errors * refactor: fix eslint errors * refactor: fix eslint * refactor: fix prettier * refactor: remove any * refactor: Proposals.tsx * feat: add basic instructions summary * feat: add unknown instruction * fix: revert package-lock.json * fix: update package-lock.json * fix: pre-commit * fix: ts error * fix: remove message buffer dependency * fix: revert back the cluster default * feat: add support for different types of instructions * feat: add transaction index to proposal row * feat: improve the proposal row ui * fix: display bigint properly (#1499) --------- Co-authored-by: guibescos <[email protected]>
1 parent d05df50 commit b110bbc

29 files changed

+1232
-659
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
node_modules
2+
tailwind.config.js
3+
next.config.js
Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
11
{
2-
"extends": "next/core-web-vitals"
2+
"extends": [
3+
"plugin:@typescript-eslint/recommended",
4+
"next/core-web-vitals",
5+
"prettier"
6+
],
7+
"rules": {
8+
"@typescript-eslint/no-explicit-any": "warn",
9+
"@typescript-eslint/no-unused-vars": [
10+
"error",
11+
{ "argsIgnorePattern": "^_" }
12+
]
13+
}
314
}

governance/xc_admin/packages/xc_admin_frontend/components/ClusterSwitch.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { Menu, Transition } from '@headlessui/react'
22
import { useRouter } from 'next/router'
33
import { Fragment, useCallback, useContext, useEffect } from 'react'
44
import { ClusterContext, DEFAULT_CLUSTER } from '../contexts/ClusterContext'
5-
import Arrow from '../images/icons/down.inline.svg'
5+
import Arrow from '@images/icons/down.inline.svg'
6+
import { PythCluster } from '@pythnetwork/client'
67

78
const ClusterSwitch = ({ light }: { light?: boolean | null }) => {
89
const router = useRouter()
@@ -27,8 +28,8 @@ const ClusterSwitch = ({ light }: { light?: boolean | null }) => {
2728
)
2829

2930
useEffect(() => {
30-
router.query && router.query.cluster
31-
? setCluster(router.query.cluster)
31+
router?.query?.cluster
32+
? setCluster(router.query.cluster as PythCluster)
3233
: setCluster(DEFAULT_CLUSTER)
3334
}, [setCluster, router])
3435

governance/xc_admin/packages/xc_admin_frontend/components/PermissionDepermissionKey.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { PythOracle } from '@pythnetwork/client/lib/anchor'
44
import * as Label from '@radix-ui/react-label'
55
import { useWallet } from '@solana/wallet-adapter-react'
66
import { WalletModalButton } from '@solana/wallet-adapter-react-ui'
7-
import { Cluster, PublicKey, TransactionInstruction } from '@solana/web3.js'
7+
import { PublicKey, TransactionInstruction } from '@solana/web3.js'
88
import SquadsMesh from '@sqds/mesh'
99
import axios from 'axios'
1010
import { Fragment, useContext, useEffect, useState } from 'react'
@@ -15,12 +15,11 @@ import {
1515
isRemoteCluster,
1616
mapKey,
1717
PRICE_FEED_MULTISIG,
18-
WORMHOLE_ADDRESS,
1918
} from 'xc_admin_common'
2019
import { ClusterContext } from '../contexts/ClusterContext'
2120
import { usePythContext } from '../contexts/PythContext'
2221
import { ProductRawConfig } from '../hooks/usePyth'
23-
import Arrow from '../images/icons/down.inline.svg'
22+
import Arrow from '@images/icons/down.inline.svg'
2423
import { capitalizeFirstLetter } from '../utils/capitalizeFirstLetter'
2524
import Spinner from './common/Spinner'
2625
import CloseIcon from './icons/CloseIcon'
@@ -83,8 +82,6 @@ const PermissionDepermissionKey = ({
8382
1
8483
)
8584
const isRemote: boolean = isRemoteCluster(cluster)
86-
const multisigCluster: Cluster | 'localnet' = getMultisigCluster(cluster)
87-
const wormholeAddress = WORMHOLE_ADDRESS[multisigCluster]
8885
const fundingAccount = isRemote
8986
? mapKey(multisigAuthority)
9087
: multisigAuthority

governance/xc_admin/packages/xc_admin_frontend/components/ProposalStatusFilter.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ import { useRouter } from 'next/router'
33
import { Fragment, useCallback, useContext, useEffect } from 'react'
44
import {
55
DEFAULT_STATUS_FILTER,
6+
type ProposalStatusFilter,
67
StatusFilterContext,
78
} from '../contexts/StatusFilterContext'
8-
import Arrow from '../images/icons/down.inline.svg'
9+
import Arrow from '@images/icons/down.inline.svg'
910

1011
const ProposalStatusFilter = () => {
1112
const router = useRouter()
@@ -31,11 +32,11 @@ const ProposalStatusFilter = () => {
3132

3233
useEffect(() => {
3334
router.query && router.query.status
34-
? setStatusFilter(router.query.status as string)
35+
? setStatusFilter(router.query.status as ProposalStatusFilter)
3536
: setStatusFilter(DEFAULT_STATUS_FILTER)
3637
}, [setStatusFilter, router])
3738

38-
const statuses = [
39+
const statuses: ProposalStatusFilter[] = [
3940
'all',
4041
'active',
4142
'executed',

governance/xc_admin/packages/xc_admin_frontend/components/common/CopyText.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import copy from 'copy-to-clipboard'
2-
import CopyIcon from '../../images/icons/copy.inline.svg'
2+
import CopyIcon from '@images/icons/copy.inline.svg'
33

44
const CopyText: React.FC<{
55
text: string

governance/xc_admin/packages/xc_admin_frontend/components/common/SocialLinks.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import Link from 'next/link'
2-
import Discord from '../../images/icons/discord.inline.svg'
3-
import Github from '../../images/icons/github.inline.svg'
4-
import LinkedIn from '../../images/icons/linkedin.inline.svg'
5-
import Telegram from '../../images/icons/telegram.inline.svg'
6-
import Twitter from '../../images/icons/twitter.inline.svg'
7-
import Youtube from '../../images/icons/youtube.inline.svg'
2+
import Discord from '@images/icons/discord.inline.svg'
3+
import Github from '@images/icons/github.inline.svg'
4+
import LinkedIn from '@images/icons/linkedin.inline.svg'
5+
import Telegram from '@images/icons/telegram.inline.svg'
6+
import Twitter from '@images/icons/twitter.inline.svg'
7+
import Youtube from '@images/icons/youtube.inline.svg'
88

99
const SocialLinks = () => {
1010
return (

governance/xc_admin/packages/xc_admin_frontend/components/layout/Header.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Link from 'next/link'
33
import { useRouter } from 'next/router'
44
import { useContext, useEffect, useState } from 'react'
55
import { ClusterContext, DEFAULT_CLUSTER } from '../../contexts/ClusterContext'
6-
import Pyth from '../../images/logomark.inline.svg'
6+
import Pyth from '@images/logomark.inline.svg'
77
import MobileMenu from './MobileMenu'
88

99
const WalletMultiButtonDynamic = dynamic(
@@ -156,7 +156,7 @@ const Header = () => {
156156
</div>
157157
</div>
158158
</header>
159-
<MobileMenu headerState={headerState} setHeaderState={setHeaderState} />
159+
<MobileMenu headerState={headerState} />
160160
</>
161161
)
162162
}

governance/xc_admin/packages/xc_admin_frontend/components/layout/Layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Header from './Header'
44

55
const Layout = ({ children }: { children: React.ReactNode }) => {
66
return (
7-
<div className="flex flex-col min-h-screen relative overflow-hidden">
7+
<div className="relative flex min-h-screen flex-col overflow-hidden">
88
<Header />
99
<main className="flex-grow">{children}</main>
1010
<Footer />

governance/xc_admin/packages/xc_admin_frontend/components/layout/MobileMenu.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@ import { useContext, useEffect, useRef } from 'react'
66
import { ClusterContext, DEFAULT_CLUSTER } from '../../contexts/ClusterContext'
77
import { BurgerState } from './Header'
88

9-
import orb from '../../images/burger.png'
9+
import orb from '@images/burger.png'
1010

1111
interface MenuProps {
1212
headerState: BurgerState
13-
setHeaderState: Function
1413
}
1514

16-
const MobileMenu = ({ headerState, setHeaderState }: MenuProps) => {
17-
let burgerMenu = useRef(null)
15+
const MobileMenu = ({ headerState }: MenuProps) => {
16+
const burgerMenu = useRef(null)
1817
const router = useRouter()
1918
const { cluster } = useContext(ClusterContext)
2019

0 commit comments

Comments
 (0)