Skip to content

Commit

Permalink
Merge pull request #172 from penumbra-zone/layout-groups
Browse files Browse the repository at this point in the history
Update common layout for main content while `/`, (index) uses root layout exclusively + clean up more stylings.
  • Loading branch information
ejmg authored Aug 15, 2024
2 parents d334bc4 + e596400 commit c285f23
Show file tree
Hide file tree
Showing 22 changed files with 101 additions and 84 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ const Page : FC<PageProps> = ({ params }) => {
});

return (
<div className="bg-primary/60 rounded-sm shadow-md">
<div className="flex flex-col gap-5 pt-5 items-center">
<h1 className="sm:text-2xl text-lg font-bold">Block Summary</h1>
<HydrationBoundary state={dehydrate(queryClient)}>
<div className="sm:w-11/12 w-full">
<Block {...{endpoint, queryName, ht }}/>
</div>
</HydrationBoundary>
<div className="flex flex-col gap-8 items-center">
<div className="sm:w-11/12 w-full">
<h1 className="text-lg font-medium">Block Summary</h1>
</div>
<HydrationBoundary state={dehydrate(queryClient)}>
<div className="sm:w-11/12 w-full">
<Block {...{ endpoint, queryName, ht }} />
</div>
</HydrationBoundary>
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ const Page = () => {
});

return (
<div className="bg-primary/60 flex flex-col gap-5 pt-5">
<h1 className="sm:text-2xl font-bold self-center">Recent Blocks</h1>
<div className="flex flex-col gap-8 items-center">
<div className="sm:w-11/12 w-full">
<h1 className="text-lg font-medium">Recent Blocks</h1>
</div>
<HydrationBoundary state={dehydrate(queryClient)}>
<BlocksTable
className="self-center sm:w-2/3 w-full"
className="sm:w-11/12 w-full"
queryName={queryName}
defaultQueryOptions={defaultQueryOptions}
endpoint={endpoint}
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@ const Page : FC<PageProps> = ({ params }) => {
});

return (
<div className="bg-primary/60 flex flex-col gap-5 pt-5 items-center ">
<h1 className="font-medium">IBC Channel</h1>
<div className="flex flex-col gap-8 items-center ">
<div className="sm:w-11/12 w-full">
<h1 className="text-lg font-medium">IBC Channel</h1>
</div>
<HydrationBoundary state={dehydrate(queryClient)}>
<div className="sm:w-11/12 w-full">
{/* TODO: don't forget to remove this extra pb-8 once Channel is cleaned up. */}
<div className="sm:w-11/12 w-full pb-8">
<Channel {...{endpoint, queryName, channelId}}/>
</div>
</HydrationBoundary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ const Page = () => {
});

return (
<div className="bg-primary/60 flex flex-col gap-5 pt-5 items-center">
<h1 className="sm:text-2xl font-bold">IBC Channels</h1>
<div className="flex flex-col gap-8 items-center">
<div className="sm:w-11/12 w-full">
<h1 className="text-lg font-medium">IBC Channels</h1>
</div>
<HydrationBoundary state={dehydrate(queryClient)}>
<ChannelsTable
className="sm:w-11/12 w-full"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ const Page : FC<PageProps> = ({ params }) => {
});

return (
<div className="bg-primary/60 flex flex-col gap-5 pt-5 items-center ">
<h1 className="font-medium">IBC Client</h1>
<div className="flex flex-col gap-8 items-center ">
<div className="sm:w-11/12 w-full">
<h1 className="text-lg font-medium">IBC Client</h1>
</div>
<HydrationBoundary state={dehydrate(queryClient)}>
<div className="sm:w-11/12 w-full">
<div className="sm:w-11/12 w-full pb-8">
<Client {...{endpoint, queryName, clientId}}/>
</div>
</HydrationBoundary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ const Page = () => {
});

return (
<div className="bg-primary/60 flex flex-col gap-5 pt-5 items-center">
<h1 className="sm:text-2xl font-bold">IBC Clients</h1>
<div className="flex flex-col gap-8 items-center">
<div className="sm:w-11/12 w-full">
<h1 className="text-lg font-medium">IBC Clients</h1>
</div>
<HydrationBoundary state={dehydrate(queryClient)}>
<ClientsTable
className="sm:w-11/12 w-full"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ const Page : FC<PageProps> = ({ params }) => {
});

return (
<div className="bg-primary/60 flex flex-col gap-5 pt-5 items-center ">
<h1 className="font-medium">IBC Connection</h1>
<div className="flex flex-col gap-8 items-center">
<div className="sm:w-11/12 w-full">
<h1 className="text-lg font-medium">IBC Connection</h1>
</div>
<HydrationBoundary state={dehydrate(queryClient)}>
<div className="sm:w-11/12 w-full">
<div className="sm:w-11/12 w-full pb-8">
<Connection {...{endpoint, queryName, connectionId}}/>
</div>
</HydrationBoundary>
Expand Down
File renamed without changes.
11 changes: 11 additions & 0 deletions apps/web/src/app/(main)/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export default function MainLayout({
children, // will be a page or nested layout
}: {
children: React.ReactNode
}) {
return (
<div className="bg-primary/60 pt-8 rounded-lg border">
{children}
</div>
);
}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ const Page : FC<PageProps> = ({ params }) => {
});

return (
<div className="bg-primary/60 flex flex-col gap-5 pt-5 items-center ">
<h1 className="font-medium">Transaction Summary</h1>
<div className="flex flex-col gap-8 items-center ">
<div className="sm:w-11/12 w-full">
<h1 className="text-lg font-medium">Transaction Summary</h1>
</div>
<HydrationBoundary state={dehydrate(queryClient)}>
<div className="sm:w-11/12 w-full">
<Transaction {...{endpoint, queryName, hash}}/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ const Page = () => {
});

return (
<div className="bg-primary/60 flex flex-col gap-5 pt-5 items-center">
<h1 className="sm:text-2xl font-bold">Recent Transactions</h1>
<div className="flex flex-col gap-8 items-center">
<div className="sm:w-11/12 w-full">
<h1 className="text-lg font-medium">Recent Transactions</h1>
</div>
<HydrationBoundary state={dehydrate(queryClient)}>
<TransactionsTable
className="sm:w-11/12 w-full"
Expand Down
28 changes: 0 additions & 28 deletions apps/web/src/app/ibc/page.tsx

This file was deleted.

65 changes: 41 additions & 24 deletions apps/web/src/components/Block/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,48 @@ export const Block : FC<BlockProps> = ({ endpoint, queryName, ht }) => {
const { created_at, tx_hashes, events } = data;

return (
<div>
<div className="flex flex-wrap justify-between sm:p-5 p-2 sm:gap-y-10 gap-y-5 w-full">
<div className="flex flex-wrap justify-start w-full">
<p className="sm:w-1/6 w-full font-semibold">Block Height</p>
<pre className="sm:w-0 w-full">{ht}</pre>
</div>
<div className="flex flex-wrap justify-start w-full">
<p className="w-1/6 font-semibold">Timestamp</p>
<pre className="sm:w-0 w-full">{created_at}</pre>
</div>
<div className="flex justify-start flex-wrap w-full">
<p className="sm:w-1/6 w-full font-bold">Transactions</p>
{/* eslint-disable-next-line @typescript-eslint/naming-convention */}
{tx_hashes.length !== 0 ? tx_hashes.map((hash, i) => (
<Link href={`/transaction/${hash}`} key={i}><pre className="underline sm:max-w-full max-w-[200px] overflow-hidden overflow-ellipsis sm:text-base">{hash}</pre></Link>
)) : <p className="sm:w-0 w-full overflow-hidden text-ellipsis">None</p>}
</div>
<div className="flex justify-start flex-wrap w-full gap-y-5">
<p className="font-bold text-base">Block Event Attributes</p>
{events.length !== 0 ? events.map(({ type, attributes }, i) => (
<div key={i} className="flex flex-col sm:items-start items-center w-full gap-y-1">
<ABCIEventsTable className="sm:w-2/3 w-full" type={type} attributes={attributes}/>
<div className="flex flex-wrap justify-between sm:gap-y-10 gap-y-5 w-full">
<div className="flex flex-wrap justify-start w-full">
<p className="sm:w-1/6 w-full font-semibold">Block Height</p>
<pre className="sm:w-0 w-full">{ht}</pre>
</div>
<div className="flex flex-wrap justify-start w-full">
<p className="w-1/6 font-semibold">Timestamp</p>
<pre className="sm:w-0 w-full">{created_at}</pre>
</div>
<div className="flex justify-start flex-wrap w-full">
<p className="sm:w-1/6 w-full font-bold">Transactions</p>
{/* eslint-disable-next-line @typescript-eslint/naming-convention */}
{tx_hashes.length !== 0 ? (
tx_hashes.map((hash, i) => (
<Link href={`/transaction/${hash}`} key={i}>
<pre className="underline sm:max-w-full max-w-[200px] overflow-hidden overflow-ellipsis sm:text-base">
{hash}
</pre>
</Link>
))
) : (
<p className="sm:w-0 w-full overflow-hidden text-ellipsis">None</p>
)}
</div>
<div className="flex justify-start flex-wrap w-full gap-y-5">
<p className="font-bold text-base">Block Event Attributes</p>
{events.length !== 0 ? (
events.map(({ type, attributes }, i) => (
<div
key={i}
className="flex flex-col sm:items-start items-center w-full gap-y-1"
>
<ABCIEventsTable
className="sm:w-2/3 w-full"
type={type}
attributes={attributes}
/>
</div>
)) : <p>None</p>}
</div>
))
) : (
<p>None</p>
)}
</div>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/Transaction/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const Transaction : FC<TransactionProps> = ({ endpoint, queryName, hash }

const [ txResult, penumbraTx ] = data;
return (
<div className="flex flex-wrap justify-between sm:p-5 p-2 sm:gap-y-10 gap-y-5 w-full">
<div className="flex flex-wrap justify-between sm:gap-y-10 gap-y-5 w-full">
<div className="flex flex-wrap justify-start w-full">
<p className="sm:w-1/6 w-full sm:text-lg font-semibold">Hash</p>
{/* TODO: this width on smaller screens is pretty arbitrary and there's a few instances of this now through the codebase. revisit and implement as consistent tailwind variables. */}
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/ibc/Channel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const Channel : FC<ChannelProps> = ({ endpoint, queryName, channelId }) =
});

return (
<div className="flex flex-col justify-start p-5 gap-y-5 w-full">
<div className="flex flex-col justify-start gap-y-5 w-full">
<div className="flex flex-wrap justify-start w-full">
<p className="sm:w-1/6 w-full font-semibold">Channel ID</p>
<pre className="sm:w-0 w-full">{channelId}</pre>
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/ibc/Client/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const Client : FC<ClientProps> = ({ endpoint, queryName, clientId }) => {
// const header = events.find(({ key }) => key === "header")?.value ?? "NONE";

return (
<div className="flex flex-col justify-start p-5 gap-y-5 w-full">
<div className="flex flex-col justify-start gap-y-5 w-full">
<div className="flex flex-wrap justify-start w-full">
<p className="sm:w-1/6 w-full font-semibold">Client ID</p>
<pre className="sm:w-0 w-full">{client_id}</pre>
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/ibc/Connection/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const Connection : FC<ConnectionProps> = ({ endpoint, queryName, connecti
const { connection_id, client_id, channel_ids } = data.at(0) ?? { connection_id: "", client_id: "", channel_ids: [] };

return (
<div className="flex flex-col justify-start p-5 gap-y-5 w-full">
<div className="flex flex-col justify-start gap-y-5 w-full">
<div className="flex flex-wrap justify-start w-full">
<p className="sm:w-1/6 w-full font-semibold">Connection ID</p>
<pre className="sm:w-0 w-full">{connection_id}</pre>
Expand Down

0 comments on commit c285f23

Please sign in to comment.