Skip to content

Commit 2b91430

Browse files
authored
Merge pull request #1525 from ssvlabs/pre-stage
Pre-Stage to Stage
2 parents 4c767f5 + 3351e43 commit 2b91430

27 files changed

+549
-216
lines changed

scripts/pr-automation/index.cjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,10 @@ async function addReviewers(owner, repo, prNumber) {
123123
{
124124
reviewers: [
125125
"IlyaVi",
126+
"sumbat-ssvlabs",
127+
"Chris-ssvlabs",
126128
"axelrod-blox",
127129
"nir-ssvlabs",
128-
"sumbat-ssvlabs",
129130
"stefan-ssv-labs",
130131
],
131132
},

src/api/cluster.ts

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
import { endpoint } from "@/api";
22
import { api } from "@/lib/api-client";
3+
import {
4+
validatorsSearchParamsSerializer,
5+
type ValidatorsSearchSchema,
6+
} from "@/lib/search-parsers/validators-search-parsers";
37
import { formatClusterData, getDefaultClusterData } from "@/lib/utils/cluster";
48
import { mapBeaconChainStatus } from "@/lib/utils/validator-status-mapping";
59
import type {
610
GetClusterResponse,
711
GetPaginatedClustersResponse,
8-
PaginatedValidatorsResponse,
12+
PaginatedSearchValidatorsResponse,
913
} from "@/types/api";
1014
import type { Address } from "abitype";
1115

@@ -56,27 +60,17 @@ export const getPaginatedAccountClusters = ({
5660
}));
5761
};
5862

59-
export type GetPaginatedClusterValidators = {
60-
hash: string;
61-
page?: number;
62-
perPage?: number;
63-
};
63+
export type GetPaginatedClusterValidators = Partial<ValidatorsSearchSchema>;
64+
65+
export const getPaginatedClusterValidators = (
66+
params: GetPaginatedClusterValidators,
67+
) => {
68+
const searchParams = validatorsSearchParamsSerializer(params);
69+
console.log("searchParams:", searchParams);
6470

65-
export const getPaginatedClusterValidators = ({
66-
hash,
67-
page = 1,
68-
perPage = 10,
69-
}: GetPaginatedClusterValidators) => {
7071
return api
71-
.get<PaginatedValidatorsResponse>(
72-
endpoint(
73-
"clusters/hash",
74-
hash,
75-
`?${new URLSearchParams({
76-
page: page.toString(),
77-
perPage: perPage.toString(),
78-
}).toString()}`,
79-
),
72+
.get<PaginatedSearchValidatorsResponse>(
73+
endpoint("validators", `?${searchParams}`),
8074
)
8175
.then((response) => ({
8276
...response,
@@ -88,10 +82,6 @@ export const getPaginatedClusterValidators = ({
8882
isValid: validator.is_valid,
8983
}),
9084
})),
91-
pagination: {
92-
...response.pagination,
93-
page: response.pagination.page || 1,
94-
pages: response.pagination.pages || 1,
95-
},
85+
pagination: response.pagination,
9686
}));
9787
};

src/api/validators.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { endpoint } from "@/api";
22
import { api } from "@/lib/api-client";
3+
import type { ValidatorStatusFilterKey } from "@/lib/search-parsers/validators-search-parsers";
34
import { add0x } from "@/lib/utils/strings";
45
import type { Address } from "abitype";
56

@@ -51,6 +52,15 @@ export const getIsRegisteredValidator = async (publicKey: string) => {
5152
);
5253
};
5354

55+
export const getValidatorsStatusCounts = async (clusterHash: string) => {
56+
return await api
57+
.get<{
58+
cluster: string;
59+
data: Record<ValidatorStatusFilterKey, number>;
60+
}>(endpoint(`validators/statusCount?clusterHash=${add0x(clusterHash)}`))
61+
.then((response) => response.data);
62+
};
63+
5464
export const getAllValidators = async (clusterHash: string | Address) => {
5565
return await api.get<{ type: string; data: string[] }>(
5666
endpoint("validators/validatorsByClusterHash", add0x(clusterHash)),

src/app/layouts/dashboard/dashboard.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { Navbar } from "@/app/layouts/dashboard/navbar";
21
import { NavbarDVT } from "@/app/layouts/dashboard/navbar-dvt";
32
import { AssetWithdrawalModal } from "@/components/modals/bapp/asset-withdrawal-modal";
43
import { AssetsDepositModal } from "@/components/modals/bapp/assets-deposit-modal";
@@ -9,7 +8,6 @@ import { TransactionModal } from "@/components/ui/transaction-modal";
98
import { useAccount } from "@/hooks/account/use-account";
109
import { useAccountState } from "@/hooks/account/use-account-state.ts";
1110
import { useMaintenance } from "@/hooks/app/use-maintenance";
12-
import { useAppVersion } from "@/hooks/temp-delete-after-merge/use-app-version";
1311
import { useBlockNavigationOnPendingTx } from "@/hooks/use-block-navigation-on-pending-tx";
1412
import { useIdentify } from "@/lib/analytics/mixpanel/useIdentify";
1513
import { useTrackPageViews } from "@/lib/analytics/mixpanel/useTrackPageViews";
@@ -33,7 +31,6 @@ export const DashboardLayout: FC<ComponentPropsWithRef<"div">> = ({
3331

3432
const { isMaintenancePage } = useMaintenance();
3533
const { isLoadingClusters, isLoadingOperators } = useAccountState();
36-
const app = useAppVersion();
3734
if (isMaintenancePage) {
3835
return <Navigate to="/maintenance" replace />;
3936
}
@@ -66,11 +63,7 @@ export const DashboardLayout: FC<ComponentPropsWithRef<"div">> = ({
6663
exit={{ opacity: 0 }}
6764
key="content"
6865
>
69-
{app.isDvtOnly ? (
70-
<NavbarDVT className="px-5" />
71-
) : (
72-
<Navbar className="px-5" />
73-
)}
66+
<NavbarDVT className="px-5" />
7467
<main className={cn(className, "flex-1 overflow-auto")}>
7568
{children}
7669
</main>

src/app/routes/dashboard/clusters/cluster/bulk.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { useBulkActionContext } from "@/guard/bulk-action-guard";
2222
import { Link } from "react-router-dom";
2323
import { NavigateBackBtn } from "@/components/ui/navigate-back-btn";
2424
import { ValidatorStatusBadge } from "@/components/cluster/validator-status-badge.tsx";
25+
import { ValidatorsSearchAndFilters } from "@/components/cluster/validators-search-and-filters";
2526
import { useParams } from "react-router";
2627
import type { Validator } from "@/types/api.ts";
2728

@@ -55,8 +56,8 @@ export const Bulk: FC<{ type: "remove" | "exit" }> = ({ type }) => {
5556
// TODO: fetch validators to get status
5657
return (
5758
<Container variant="vertical" size="lg" className="py-6 h-full">
58-
<NavigateBackBtn to={`/clusters/${clusterHash}`} />
59-
<Card className="w-full flex-1">
59+
<NavigateBackBtn to={`/clusters/${clusterHash}`} persistSearch />
60+
<Card className="w-full flex-1 flex flex-col gap-4">
6061
<div className="flex justify-between">
6162
<Text variant="headline4">
6263
{type === "remove"
@@ -67,6 +68,7 @@ export const Bulk: FC<{ type: "remove" | "exit" }> = ({ type }) => {
6768
{selectedPublicKeys.length} of {totalValidators} selected
6869
</Badge>
6970
</div>
71+
<ValidatorsSearchAndFilters />
7072
<VirtualizedInfinityTable
7173
gridTemplateColumns="40px 220px minmax(200px, auto) 120px"
7274
query={infiniteQuery}

src/app/routes/dashboard/clusters/cluster/cluster.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ export const Cluster: FC = () => {
150150
</Button>
151151
</Tooltip>
152152
</div>
153+
153154
<ClusterValidatorsList className="min-h-96" />
154155
</Card>
155156
</div>

src/app/routes/root-redirection.tsx

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ import { Navigate } from "react-router";
44
import { cn } from "@/lib/utils/tw.ts";
55
import { SsvLoader } from "@/components/ui/ssv-loader.tsx";
66
import { motion } from "framer-motion";
7-
import { useAppVersion } from "@/hooks/temp-delete-after-merge/use-app-version";
87

9-
const REDIRECT_EXCLUSIONS = ["/", "/connect", "/compliance"];
108
export const Redirector = () => {
119
const { isLoadingClusters, isLoadingOperators, hasClusters, hasOperators } =
1210
useAccountState();
@@ -17,8 +15,6 @@ export const Redirector = () => {
1715
const landedOnClusterPage = landingPage.startsWith("/clusters");
1816
const landedOnOperatorsPage = landingPage.startsWith("/operators");
1917

20-
const app = useAppVersion();
21-
2218
if (isLoadingClusters)
2319
return (
2420
<motion.div
@@ -54,12 +50,5 @@ export const Redirector = () => {
5450
if (landedOnOperatorsPage && hasOperators)
5551
return <Navigate to={landingPage} replace />;
5652

57-
if (app.isDvtOnly) {
58-
return <Navigate to="/join" replace />;
59-
}
60-
61-
if (!REDIRECT_EXCLUSIONS.includes(landingPage))
62-
return <Navigate to={landingPage} replace />;
63-
64-
return <Navigate to="/account/my-delegations" />;
53+
return <Navigate to="/join" replace />;
6554
};

src/app/routes/router.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { proxy, useSnapshot } from "valtio";
77

88
import { Compliance } from "@/app/routes/compliance";
99
import { Maintenance } from "@/app/routes/maintenance";
10-
import { accountRoutes } from "@/app/routes/router/route-definitions/account-routes.tsx";
1110
import type { RouteObject } from "react-router-dom";
1211
import { createBrowserRouter, Outlet } from "react-router-dom";
1312
import { NotFound } from "./not-found";
@@ -36,7 +35,6 @@ const routes = [
3635
element: <FeeRecipientAddress />,
3736
},
3837
joinRoutes,
39-
accountRoutes,
4038
clustersRoutes,
4139
operatorsRoutes,
4240
],

0 commit comments

Comments
 (0)