Skip to content

Commit

Permalink
overview tab
Browse files Browse the repository at this point in the history
  • Loading branch information
noahlitvin committed Nov 1, 2024
1 parent c1e5653 commit fe89587
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export const CannonfileExplorer: FC<{ pkg: ApiPackage }> = ({ pkg }) => {
</div>

<div
className={`container mx-auto max-w-4xl py-14 ${
className={`container mx-auto max-w-5xl py-14 ${
displayMode === 2 ? 'block' : 'hidden'
}`}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { useQueryIpfsDataParsed } from '@/hooks/ipfs';
import { DeploymentInfo } from '@usecannon/builder';

import PageLoading from '@/components/PageLoading';
import PackageAccordionHelper from '@/features/Packages/PackageAccordionHelper';
import { usePackageNameTagVariantUrlParams } from '@/hooks/routing/usePackageNameTagVariantUrlParams';
import { usePackageByRef } from '@/hooks/api/usePackage';

Expand Down Expand Up @@ -88,19 +87,20 @@ function TagVariantLayout({ children }: { children: ReactNode }) {
</div>
</div>

<PackageAccordionHelper
name={name}
tag={tag}
chainId={chainId}
preset={preset}
/>

{/* Package Tabs */}
<div className="flex gap-8 items-center max-w-full overflow-x-auto overflow-y-hidden">
<NavLink
isActive={pathname == '/packages/[name]/[tag]/[variant]'}
href={`/packages/${packagesQuery.data.name}/${params.tag}/${params.variant}`}
isSmall
>
Overview
</NavLink>
<NavLink
isActive={pathname.startsWith(
'/packages/[name]/[tag]/[variant]/deployment'
)}
href={`/packages/${packagesQuery.data.name}/${params.tag}/${params.variant}/deployment`}
isSmall
>
Deployment
</NavLink>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import dynamic from 'next/dynamic';
import { useRouter } from 'next/router';

import TagVariantLayout from '../_layout';
import { ReactElement } from 'react';

const DeploymentTab = dynamic(
async () => {
return import('@/features/Packages/Tabs/DeploymentTab');
},
{
ssr: false,
}
);

export default function Deployment() {
const params = useRouter().query;
return (
<>
<DeploymentTab
name={decodeURIComponent(params.name as string)}
tag={decodeURIComponent(params.tag as string)}
variant={decodeURIComponent(params.variant as string)}
/>
</>
);
}

Deployment.getLayout = function getLayout(page: ReactElement) {
return <TagVariantLayout>{page}</TagVariantLayout>;
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import dynamic from 'next/dynamic';
import { useRouter } from 'next/router';
import { NextSeo } from 'next-seo';
import defaultSEO from '@/constants/defaultSeo';
Expand All @@ -7,15 +6,8 @@ import { PackageReference } from '@usecannon/builder';
import TagVariantLayout from './_layout';
import { ReactElement } from 'react';
import { useCannonChains } from '@/providers/CannonProvidersProvider';

const DeploymentTab = dynamic(
async () => {
return import('@/features/Packages/Tabs/DeploymentTab');
},
{
ssr: false,
}
);
import PackageAccordionHelper from '@/features/Packages/PackageAccordionHelper';
import { usePackageNameTagVariantUrlParams } from '@/hooks/routing/usePackageNameTagVariantUrlParams';

function generateMetadata({
params,
Expand Down Expand Up @@ -53,10 +45,13 @@ function generateMetadata({
return metadata;
}

export default function Deployment() {
const params = useRouter().query;
export default function Overview() {
const { query: params } = useRouter();
const { getChainById } = useCannonChains();
const metadata = generateMetadata({ params: params as any, getChainById });

const { name, tag, chainId, preset } = usePackageNameTagVariantUrlParams();

return (
<>
<NextSeo
Expand All @@ -69,15 +64,20 @@ export default function Deployment() {
description: metadata.description,
}}
/>
<DeploymentTab
name={decodeURIComponent(params.name as string)}
tag={decodeURIComponent(params.tag as string)}
variant={decodeURIComponent(params.variant as string)}
/>
<div className="flex flex-col w-full">
<div className="container mx-auto max-w-5xl">
<PackageAccordionHelper
name={name}
tag={tag}
chainId={chainId}
preset={preset}
/>
</div>
</div>
</>
);
}

Deployment.getLayout = function getLayout(page: ReactElement) {
Overview.getLayout = function getLayout(page: ReactElement) {
return <TagVariantLayout>{page}</TagVariantLayout>;
};

0 comments on commit fe89587

Please sign in to comment.