Fix NodeTable

This commit is contained in:
Yana
2025-02-27 14:15:49 +02:00
parent 795934df83
commit 3fbd3f9c33
4 changed files with 39 additions and 34 deletions
@@ -1,4 +1,4 @@
import BlogArticlesCards from "@/components/blogs/BlogArticleCards";
// import BlogArticlesCards from "@/components/blogs/BlogArticleCards";
import { ContentLayout } from "@/components/contentLayout/ContentLayout";
import SectionHeading from "@/components/headings/SectionHeading";
import ExplorerButtonGroup from "@/components/toggleButton/ToggleButton";
@@ -44,12 +44,12 @@ export default async function Account({
Start [setting up your node](https://nym.com/docs) today!
</Markdown>
</Typography>
<Grid container columnSpacing={5} rowSpacing={5}>
{/* <Grid container columnSpacing={5} rowSpacing={5}>
<Grid size={12}>
<SectionHeading title="Onboarding" />
</Grid>
<BlogArticlesCards ids={[1]} />
</Grid>
</Grid> */}
</ContentLayout>
);
} catch (error) {
+1 -1
View File
@@ -60,7 +60,7 @@ export default async function Home() {
<Grid size={12}>
<SectionHeading title="Onboarding" />
</Grid>
<BlogArticlesCards ids={[1]} />
<BlogArticlesCards ids={[1, 2]} />
</Grid>
</ContentLayout>
);
@@ -162,6 +162,33 @@ const NodeTable = ({ nodes }: { nodes: MappedNymNodes }) => {
const columns: MRT_ColumnDef<MappedNymNode>[] = useMemo(
() => [
{
id: "Favorite",
enableColumnFilter: false,
header: "Favorite",
accessorKey: "Favorite",
size: 50,
Header: (
<Stack direction="row" alignItems="center">
<ColumnHeading>Fav</ColumnHeading>
</Stack>
),
sortingFn: (a, b) => {
const aIsFavorite = favorites.includes(a.original.owner);
const bIsFavorite = favorites.includes(b.original.owner);
if (aIsFavorite && !bIsFavorite) {
return -1;
}
if (!aIsFavorite && bIsFavorite) {
return 1;
}
return 0;
},
Cell: ({ row }) => <Favorite address={row.original.owner} />,
},
{
id: "name",
header: "",
@@ -213,7 +240,7 @@ const NodeTable = ({ nodes }: { nodes: MappedNymNodes }) => {
id: "location",
header: "Location",
accessorKey: "countryName",
size: 160,
size: 140,
Header: <ColumnHeading>Location</ColumnHeading>,
Cell: ({ row }) =>
row.original.countryCode && row.original.countryName ? (
@@ -231,6 +258,8 @@ const NodeTable = ({ nodes }: { nodes: MappedNymNodes }) => {
id: "stakeSaturation",
header: "Stake saturation",
accessorKey: "stakeSaturation",
size: 120,
Header: <ColumnHeading>Saturation</ColumnHeading>,
Cell: ({ row }) => (
<Typography variant="body4">
@@ -272,32 +301,6 @@ const NodeTable = ({ nodes }: { nodes: MappedNymNodes }) => {
),
enableSorting: false,
},
{
id: "Favorite",
enableColumnFilter: false,
header: "Favorite",
accessorKey: "Favorite",
size: 50,
Header: (
<Stack direction="row" alignItems="center">
<ColumnHeading>Fav</ColumnHeading>
</Stack>
),
sortingFn: (a, b) => {
const aIsFavorite = favorites.includes(a.original.owner);
const bIsFavorite = favorites.includes(b.original.owner);
if (aIsFavorite && !bIsFavorite) {
return -1;
}
if (!aIsFavorite && bIsFavorite) {
return 1;
}
return 0;
},
Cell: ({ row }) => <Favorite address={row.original.owner} />,
},
],
[isWalletConnected, handleOnSelectStake, favorites],
);
@@ -324,7 +327,7 @@ const NodeTable = ({ nodes }: { nodes: MappedNymNodes }) => {
shape: "circular",
},
initialState: {
columnPinning: isMobile ? {} : { right: ["Action", "Favorite"] }, // No pinning on mobile
columnPinning: isMobile ? {} : { right: ["Action"] }, // No pinning on mobile
},
muiColumnActionsButtonProps: {
sx: {
@@ -343,6 +346,7 @@ const NodeTable = ({ nodes }: { nodes: MappedNymNodes }) => {
muiTableHeadCellProps: {
sx: {
alignItems: "center",
paddingRight: 0,
},
},
@@ -351,6 +355,7 @@ const NodeTable = ({ nodes }: { nodes: MappedNymNodes }) => {
border: "none",
whiteSpace: "unset", // Allow text wrapping in body cells
wordBreak: "break-word", // Ensure long text breaks correctly
paddingRight: 0,
},
},
muiTableBodyRowProps: ({ row }) => ({
+2 -2
View File
@@ -8,8 +8,8 @@
"date": "Mon Jan 05 2025 10:26:09 GMT+0000 (Greenwich Mean Time)",
"readingTime": 5
},
"icon": "/icons/gateway.svg",
"image": "/images/placeholder.webp",
"icon": "/icons/stake-card.svg",
"image": "/images/stake-article.webp",
"overview": {
"content": [
{