Skip to content

Commit 0f9e24c

Browse files
LibreBlocks Updated
1 parent 662dac2 commit 0f9e24c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+3206
-2579
lines changed

.env

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
NEXT_PUBLIC_LIBRE_API=https://dashboard-api.libre.org
22
NEXT_PUBLIC_MAINNET_API=https://lb.libre.org
33
NEXT_PUBLIC_TESTNET_API=https://testnet.libre.org
4-
NEXT_PUBLIC_PROVIDER_NAME=Libre
4+
NEXT_PUBLIC_PROVIDERBY=Libre
5+
NEXT_PUBLIC_PROVIDER_LOGO=/images/provider.png
6+
NEXT_PUBLIC_PROVIDER_LINK=https://libre.org/
7+

public/icons/icon-search.svg

+3
Loading

public/images/libre-white.svg

+3
Loading

public/images/libre.svg

+9-6
Loading

public/images/logo.svg

+9-45
Loading

public/images/provider.png

664 Bytes
Loading

src/api-urls.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
const API_URLS = [
22
{
3-
key: "mainnet",
4-
label: "Mainnet",
3+
key: 'mainnet',
4+
label: 'Mainnet',
55
url: process.env.NEXT_PUBLIC_MAINNET_API,
66
default: true,
77
},
88
{
9-
key: "testnet",
10-
label: "Testnet",
9+
key: 'testnet',
10+
label: 'Testnet',
1111
url: process.env.NEXT_PUBLIC_TESTNET_API,
1212
},
1313
];

src/app/address/[searchTerm]/page.tsx

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import ViewAddress from '@/views/address';
2+
3+
export default function PageAddressDetail() {
4+
return <ViewAddress />;
5+
}

src/app/block/[id]/page.tsx

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import ViewBlock from '@/views/block';
2+
3+
export default function PageBlock() {
4+
return (
5+
<>
6+
<ViewBlock />
7+
{/* <pre>{JSON.stringify(data, null, 2)}</pre> */}
8+
</>
9+
);
10+
}

src/pages/blockchain.tsx renamed to src/app/blockchain/page.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import CoinInfo from '../views/home/coin-info';
2-
import MiniCards from '../views/home/mini-cards';
3-
import PriceChart from '../views/home/price-chart';
1+
import MiniCards from '@/views/home/mini-cards';
42

53
export default function PageBlockchain() {
64
return (

src/app/favicon.ico

1.12 KB
Binary file not shown.

src/app/generate/page.tsx

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import PubkeyGenerator from '@/views/generate';
2+
3+
export default function PagePubkeyGenerator() {
4+
return <PubkeyGenerator />;
5+
}

src/app/layout.tsx

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { Inter as FontSans } from 'next/font/google';
2+
import '@/styles/globals.css';
3+
import clsx from 'clsx';
4+
import Header from '@/components/header';
5+
import Footer from '@/components/footer';
6+
import GlobalQueryProvider from '@/components/providers/global';
7+
import GlobalComponents from '@/components/global-components';
8+
import Announcement from '@/components/announcement';
9+
10+
const fontSans = FontSans({
11+
subsets: ['latin'],
12+
variable: '--font-inter',
13+
display: 'swap',
14+
});
15+
16+
/** @type {import("next").Metadata} */
17+
export const metadata = {
18+
title: {
19+
default: 'Libre Blockchain Explorer',
20+
template: '%s | Libre Blockchain Explorer',
21+
},
22+
description:
23+
'Explore transactions, blocks, account for the Libre Blockchain.',
24+
};
25+
26+
export default function RootLayout({
27+
children,
28+
}: {
29+
children: React.ReactNode;
30+
}) {
31+
return (
32+
<html lang='en' className={clsx(fontSans.variable)}>
33+
<body className='min-h-screen text-shade-900 antialiased'>
34+
<GlobalComponents />
35+
<Announcement />
36+
37+
<GlobalQueryProvider>
38+
<Header />
39+
<main>{children}</main>
40+
<Footer />
41+
</GlobalQueryProvider>
42+
</body>
43+
</html>
44+
);
45+
}
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
import ViewHome from '@/views/home';
2-
3-
import Seo from '@/components/seo';
4-
5-
export default function PageIndex() {
6-
return (
7-
<>
8-
<Seo title='Libre Blockchain Explorer' />
9-
<ViewHome />
10-
</>
11-
);
12-
}
1+
import ViewHome from '@/views/home';
2+
3+
export default function PageIndex() {
4+
return (
5+
<>
6+
<ViewHome />
7+
</>
8+
);
9+
}

src/app/tokens/page.tsx

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import ViewTokens from '@/views/tokens';
2+
3+
export default function PageTokens() {
4+
return (
5+
<>
6+
<ViewTokens />
7+
{/* <pre>{JSON.stringify(producersData, null, 2)}</pre> */}
8+
</>
9+
);
10+
}

src/app/tx/[id]/page.tsx

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import ViewTx from '@/views/tx';
2+
3+
export default function PageTx() {
4+
return (
5+
<>
6+
<ViewTx />
7+
{/* <pre>{JSON.stringify(data, null, 2)}</pre> */}
8+
</>
9+
);
10+
}

src/app/validators/page.tsx

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import ViewValidators from '@/views/validators';
2+
3+
export default function PageValidators() {
4+
return (
5+
<>
6+
<ViewValidators />
7+
{/* <pre>{JSON.stringify(producersData, null, 2)}</pre> */}
8+
</>
9+
);
10+
}

src/components/announcement.tsx

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export default function Announcement() {
2+
return (
3+
<div className='announcement-bar'>
4+
<p className='announcement-message '>
5+
Libre Blocks is currently in beta. Please try it out and{' '}
6+
<a href='mailto:[email protected]'>share your feedback with us.</a>
7+
</p>
8+
<button className='close-button' aria-label='Close'>
9+
<span aria-hidden='true'>&times;</span>
10+
</button>
11+
</div>
12+
);
13+
}

src/components/button/button.tsx

+44-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,51 @@
1-
import { Button, ButtonProps } from '@mui/material';
1+
'use client';
2+
3+
import * as React from 'react';
4+
import { Button as MaterialButton } from '@mui/material';
25
import { styled } from '@mui/material/styles';
6+
import { Slot } from '@radix-ui/react-slot';
37

4-
export const StyledButton = styled(Button)<ButtonProps>(() => ({
5-
color: '#fff',
6-
'&:hover': {
7-
backgroundColor: 'rgb(255 255 255 / .15)',
8+
import { tv, type VariantProps } from 'tailwind-variants';
9+
import clsx from 'clsx';
10+
11+
const buttonVariants = tv({
12+
base: 'inline-flex items-center justify-center align-middle whitespace-nowrap font-semibold transition',
13+
variants: {
14+
variant: {
15+
primary: 'bg-primary text-white hover:bg-opacity-80',
16+
},
17+
size: {
18+
md: 'h-10 text-sm px-4 rounded-lg',
19+
},
820
},
9-
}));
21+
defaultVariants: {
22+
variant: 'primary',
23+
size: 'md',
24+
},
25+
});
26+
27+
export interface ButtonProps
28+
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
29+
VariantProps<typeof buttonVariants> {
30+
asChild?: boolean;
31+
}
32+
33+
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
34+
({ className, variant, size, asChild = false, ...props }, ref) => {
35+
const Comp = asChild ? Slot : 'button';
36+
return (
37+
<Comp
38+
className={clsx(buttonVariants({ variant, size }), className)}
39+
ref={ref}
40+
{...props}
41+
/>
42+
);
43+
}
44+
);
1045

11-
export const StyledLinkButton = styled(Button)<ButtonProps>(() => ({
46+
export default Button;
47+
48+
export const StyledLinkButton = styled(MaterialButton)<ButtonProps>(() => ({
1249
color: '#fff',
1350
textTransform: 'none',
1451
fontFamily: 'var(--font-inter)',
@@ -18,5 +55,3 @@ export const StyledLinkButton = styled(Button)<ButtonProps>(() => ({
1855
backgroundColor: 'rgb(255 255 255 / .15)',
1956
},
2057
}));
21-
22-
export default StyledButton;

src/components/button/icon-button.tsx

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1+
'use client';
2+
13
import { IconButton, IconButtonProps } from '@mui/material';
24
import { styled } from '@mui/material/styles';
35

4-
export const StyledIconButton = styled(IconButton)<IconButtonProps>(() => ({
5-
color: '#fff',
6-
'&:hover': {
7-
backgroundColor: 'rgb(255 255 255 / .15)',
8-
},
9-
}));
6+
export const StyledIconButton = styled(IconButton)<IconButtonProps>(() => ({}));

src/components/custom-pagination.tsx

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
'use client';
2+
3+
import usePagination from '@mui/material/usePagination';
4+
import clsx from 'clsx';
5+
import { ChevronLeft, ChevronRight } from 'lucide-react';
6+
7+
type Props = {
8+
onPageChange: (value: number | ((prevVar: number) => number)) => void;
9+
dataLength: number;
10+
rowsPerPage: number;
11+
};
12+
13+
const PaginationItem = ({
14+
children,
15+
selected,
16+
dots = false,
17+
...rest
18+
}: {
19+
children: React.ReactNode;
20+
selected?: boolean;
21+
dots?: boolean;
22+
}) => {
23+
return (
24+
<div className='p-1'>
25+
<button
26+
type='button'
27+
className={clsx(
28+
'flex h-9 min-w-[36px] items-center justify-center rounded px-3',
29+
{
30+
'bg-primary text-white hover:bg-primary/80': selected && !dots,
31+
'bg-shade-100 text-shade-500 hover:bg-shade-200':
32+
!selected && !dots,
33+
'cursor-default bg-shade-100': dots,
34+
}
35+
)}
36+
{...rest}
37+
>
38+
{children}
39+
</button>
40+
</div>
41+
);
42+
};
43+
44+
export default function CustomPagination({
45+
onPageChange,
46+
dataLength,
47+
rowsPerPage,
48+
}: Props) {
49+
const { items: paginationItems } = usePagination({
50+
count: Math.ceil(dataLength / rowsPerPage),
51+
onChange(_event, page) {
52+
onPageChange(page - 1);
53+
},
54+
});
55+
56+
return (
57+
<div className='mt-2 flex flex-wrap items-center justify-center py-4'>
58+
{paginationItems.map(({ page, type, selected, ...item }, index) => {
59+
let children = null;
60+
61+
if (type === 'start-ellipsis' || type === 'end-ellipsis') {
62+
children = (
63+
<PaginationItem key={index} dots>
64+
65+
</PaginationItem>
66+
);
67+
} else if (type === 'page') {
68+
children = (
69+
<PaginationItem key={index} selected={selected} {...item}>
70+
{page}
71+
</PaginationItem>
72+
);
73+
} else if (type === 'previous') {
74+
children = (
75+
<div className='p-1' key={index}>
76+
<button
77+
type='button'
78+
className='flex h-9 items-center px-3 disabled:text-shade-400'
79+
{...item}
80+
>
81+
<ChevronLeft className='h-5 w-5' />
82+
</button>
83+
</div>
84+
);
85+
} else if (type === 'next') {
86+
children = (
87+
<div className='p-1' key={index}>
88+
<button
89+
type='button'
90+
className='flex h-9 items-center px-3 disabled:text-shade-400'
91+
{...item}
92+
>
93+
<ChevronRight className='h-5 w-5' />
94+
</button>
95+
</div>
96+
);
97+
}
98+
99+
return children;
100+
})}
101+
</div>
102+
);
103+
}

0 commit comments

Comments
 (0)