Skip to content

Commit

Permalink
Merge pull request #1063 from near/jh/blog-auth-edits
Browse files Browse the repository at this point in the history
feat: implement unique urls and new auth for blog posts
  • Loading branch information
jackson-harris-iii authored Mar 13, 2024
2 parents 1bc8a78 + 3ea9011 commit 6d3a9e6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/data/bos-components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { NetworkId } from '@/utils/types';
type NetworkComponents = {
applicationsPage: string;
blog: string;
blogPost: string;
bosDirectory: string;
componentSummary: string;
componentsPage: string;
Expand Down Expand Up @@ -72,6 +73,7 @@ export const componentsByNetworkId = ((): Record<NetworkId, NetworkComponents |
testnet: {
applicationsPage: `${testnetTLA}/widget/AppLibrary.IndexPage`,
blog: `${testnetTLA}/widget/Blog/Feed`,
blogPost: `${testnetTLA}/widget/BlogPostPage`,
bosDirectory: 'one.testnet/widget/BOSDirectory',
componentSummary: `${testnetTLA}/widget/ComponentSummary`,
componentsPage: `${testnetTLA}/widget/ComponentsPage`,
Expand Down Expand Up @@ -134,6 +136,7 @@ export const componentsByNetworkId = ((): Record<NetworkId, NetworkComponents |
mainnet: {
applicationsPage: 'nearcatalog.near/widget/Index',
blog: 'near/widget/Blog.Feed',
blogPost: 'near/widget/BlogPostPage',
bosDirectory: 'onboarder.near/widget/BOSDirectory',
componentSummary: 'near/widget/ComponentSummary',
componentsPage: 'near/widget/ComponentsPage',
Expand Down
25 changes: 24 additions & 1 deletion src/pages/bosblog/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,33 @@
import { ComponentWrapperPage } from '@/components/near-org/ComponentWrapperPage';
import { useBosComponents } from '@/hooks/useBosComponents';
import { useDefaultLayout } from '@/hooks/useLayout';
import { useSignInRedirect } from '@/hooks/useSignInRedirect';
import type { NextPageWithLayout } from '@/utils/types';
import { useRouter } from 'next/router';

const Blog: NextPageWithLayout = () => {
const components = useBosComponents();
const { requestAuthentication } = useSignInRedirect();
const router = useRouter();
const accountId = router.query.accountId;
const blockHeight = router.query.blockHeight;

if (accountId && blockHeight) {
return (
<ComponentWrapperPage
src={components.blogPost}
meta={{
title: 'NEAR | Blog Post',
description: 'The latest on the Near Ecosystem',
}}
componentProps={{
requestAuthentication,
accountId,
blockHeight,
}}
/>
);
}
return (
<ComponentWrapperPage
src={components.blog}
Expand All @@ -13,7 +36,7 @@ const Blog: NextPageWithLayout = () => {
description: 'The latest on the Near Ecosystem',
}}
componentProps={{
blogPostIds: [75675],
requestAuthentication,
}}
/>
);
Expand Down

0 comments on commit 6d3a9e6

Please sign in to comment.