mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-20 03:35:51 +00:00
Merge pull request #3317 from XRPLF/update-amendment-tracker
Add ETA badge to amendment tracking components
This commit is contained in:
@@ -151,6 +151,7 @@ amendment.table.name: 名前
|
|||||||
amendment.table.introduced: 登場
|
amendment.table.introduced: 登場
|
||||||
amendment.table.status: ステータス
|
amendment.table.status: ステータス
|
||||||
amendment.status.enabled: 有効
|
amendment.status.enabled: 有効
|
||||||
|
amendment.status.eta: 予定
|
||||||
amendment.status.openForVoting: 投票中
|
amendment.status.openForVoting: 投票中
|
||||||
|
|
||||||
# index.page.tsx
|
# index.page.tsx
|
||||||
|
|||||||
@@ -229,6 +229,7 @@ type Amendment = {
|
|||||||
consensus?: string;
|
consensus?: string;
|
||||||
date?: string;
|
date?: string;
|
||||||
id: string;
|
id: string;
|
||||||
|
eta?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type AmendmentsResponse = {
|
type AmendmentsResponse = {
|
||||||
@@ -260,6 +261,7 @@ export function AmendmentsTable() {
|
|||||||
.sort((a: Amendment, b: Amendment) => {
|
.sort((a: Amendment, b: Amendment) => {
|
||||||
// Sort by status priority (lower number = higher priority)
|
// Sort by status priority (lower number = higher priority)
|
||||||
const getStatusPriority = (amendment: Amendment): number => {
|
const getStatusPriority = (amendment: Amendment): number => {
|
||||||
|
if (amendment.eta) return 0; // Expected
|
||||||
if (amendment.consensus) return 1; // Open for Voting
|
if (amendment.consensus) return 1; // Open for Voting
|
||||||
if (amendment.tx_hash) return 2; // Enabled
|
if (amendment.tx_hash) return 2; // Enabled
|
||||||
};
|
};
|
||||||
@@ -349,6 +351,7 @@ function AmendmentBadge(props: { amendment: Amendment }) {
|
|||||||
|
|
||||||
const enabledLabel = translate("amendment.status.enabled", "Enabled");
|
const enabledLabel = translate("amendment.status.enabled", "Enabled");
|
||||||
const votingLabel = translate("amendment.status.openForVoting", "Open for Voting");
|
const votingLabel = translate("amendment.status.openForVoting", "Open for Voting");
|
||||||
|
const etaLabel = translate("amendment.status.eta", "Expected");
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
const amendment = props.amendment;
|
const amendment = props.amendment;
|
||||||
@@ -360,13 +363,20 @@ function AmendmentBadge(props: { amendment: Amendment }) {
|
|||||||
setColor('green');
|
setColor('green');
|
||||||
setHref(`https://livenet.xrpl.org/transactions/${amendment.tx_hash}`);
|
setHref(`https://livenet.xrpl.org/transactions/${amendment.tx_hash}`);
|
||||||
}
|
}
|
||||||
|
// Check if expected activation is provided (has eta field)
|
||||||
|
else if (amendment.eta) {
|
||||||
|
let etaDate = new Date(amendment.eta).toISOString().split('T')[0];
|
||||||
|
setStatus(`${etaLabel}: ${etaDate}`);
|
||||||
|
setColor('blue');
|
||||||
|
setHref(undefined);
|
||||||
|
}
|
||||||
// Check if amendment is currently being voted on (has consensus field)
|
// Check if amendment is currently being voted on (has consensus field)
|
||||||
else if (amendment.consensus) {
|
else if (amendment.consensus) {
|
||||||
setStatus(`${votingLabel}: ${amendment.consensus}`);
|
setStatus(`${votingLabel}: ${amendment.consensus}`);
|
||||||
setColor('80d0e0');
|
setColor('80d0e0');
|
||||||
setHref(undefined); // No link for voting amendments
|
setHref(undefined); // No link for voting amendments
|
||||||
}
|
}
|
||||||
}, [props.amendment, enabledLabel, votingLabel]);
|
}, [props.amendment, enabledLabel, etaLabel, votingLabel]);
|
||||||
|
|
||||||
// Split the status at the colon to create two-color badge
|
// Split the status at the colon to create two-color badge
|
||||||
const parts = status.split(':');
|
const parts = status.split(':');
|
||||||
|
|||||||
Reference in New Issue
Block a user