From f25f25d310f35df89376ab161d41965244c347d9 Mon Sep 17 00:00:00 2001 From: Dyllon Gunawardhana Date: Wed, 4 Oct 2023 17:17:31 +0800 Subject: [PATCH] web: disable blog endpoints temporarily until image cdn is back online (#127) * web: disabled blog endpoints temporarily until image cdn is back online * web: disable blog ssg * remove blog and events routes --- .github/workflows/cd-production.yml | 7 +- .../web/features/home/components/HomeHero.tsx | 4 +- apps/web/pages/blog/[slug].tsx | 75 ------------------- apps/web/pages/blog/author/[name].tsx | 53 ------------- apps/web/pages/blog/index.tsx | 26 ------- apps/web/pages/events.tsx | 39 ---------- 6 files changed, 5 insertions(+), 199 deletions(-) delete mode 100644 apps/web/pages/blog/[slug].tsx delete mode 100644 apps/web/pages/blog/author/[name].tsx delete mode 100644 apps/web/pages/blog/index.tsx delete mode 100644 apps/web/pages/events.tsx diff --git a/.github/workflows/cd-production.yml b/.github/workflows/cd-production.yml index afd0b551..f96c5deb 100644 --- a/.github/workflows/cd-production.yml +++ b/.github/workflows/cd-production.yml @@ -55,7 +55,7 @@ jobs: ghcr.io/${{ github.repository_owner }}/website/merch:latest deploy-to-production: - name: Deploy To Production + name: Deploy To Production Server runs-on: ubuntu-22.04 needs: - build-cms @@ -85,8 +85,7 @@ jobs: name: Build Web next.js app runs-on: ubuntu-22.04 needs: - - build-cms - - build-merch + - deploy-to-production steps: - name: Checkout repo uses: actions/checkout@v3 @@ -147,7 +146,7 @@ jobs: run: npm install --global vercel@latest - name: Pull Vercel Environment Information - run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} + run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} - name: Copy Build Artifacts to .vercel dir run: vercel build --token=${{ secrets.VERCEL_TOKEN }} diff --git a/apps/web/features/home/components/HomeHero.tsx b/apps/web/features/home/components/HomeHero.tsx index b23e57fd..22b5a3c5 100644 --- a/apps/web/features/home/components/HomeHero.tsx +++ b/apps/web/features/home/components/HomeHero.tsx @@ -114,7 +114,7 @@ export const HomeHero = () => { color="transparent" paddingY={["0px", "0px", "0px", "24px"]} > - + {/**/} { > 10+ events yearly - + {/**/} { - return ( - - - - {props.title} - - - by {props.author?.node?.name} - {' '}/ {getDisplayDate(new Date(props.date))} - - {/* Image needed as it is the primary image of the blog (it is also used as the thumbnail) */} - {props.featuredImage && ( - - {props.featuredImage.node.link} - - )} - - - - - ); -}; - -export default BlogPost; - -// this function gets called at build time -export const getStaticProps: GetStaticProps = async ({ - params, -}: GetStaticPropsContext) => { - const data = await getBlogPost(params?.slug as string); - - return { - props: data, - revalidate: 10, - } as GetStaticPropsResult; -}; - -// this function gets called at build time -export const getStaticPaths: GetStaticPaths = async () => { - const data = await getAllBlogPostsSlugs(); - - return { - paths: data.edges.map((edge) => `/blog/${edge.node.slug}`), - fallback: true, - } as GetStaticPathsResult; -}; diff --git a/apps/web/pages/blog/author/[name].tsx b/apps/web/pages/blog/author/[name].tsx deleted file mode 100644 index f568039f..00000000 --- a/apps/web/pages/blog/author/[name].tsx +++ /dev/null @@ -1,53 +0,0 @@ -import { - GetStaticPaths, - GetStaticPathsResult, - GetStaticProps, - GetStaticPropsContext, - GetStaticPropsResult -} from "next"; -import { - BlogFilterEnum, - BlogGridDisplay, - BlogGridDisplayProps, - getAllBlogPosts, - getAllBlogPostsSlugs -} from "@/features/blogs"; - -interface AuthorBlogsProps { - posts: BlogGridDisplayProps["posts"]; -} - -const AuthorBlogs = ({ posts }: AuthorBlogsProps) => { - return ( - - ); -} - -export default AuthorBlogs; - -// this function gets called at build time -export const getStaticProps: GetStaticProps = async ({ - params, -}: GetStaticPropsContext) => { - // With Filtering - const posts = await getAllBlogPosts( - { key: params?.name as string, category: BlogFilterEnum.AUTHOR }) - - return { - props: { - posts: posts - }, - revalidate: 10, - } as GetStaticPropsResult; -} - -// this function gets called at build time -// this defines a list of paths to be statically generated. -export const getStaticPaths: GetStaticPaths = async () => { - const data = await getAllBlogPostsSlugs(); - - return { - paths: data.edges.map((edge) => `/blog/author/${edge.node.author ? edge.node.author.node.name : 'no-author'}`), - fallback: true, - } as GetStaticPathsResult; -} diff --git a/apps/web/pages/blog/index.tsx b/apps/web/pages/blog/index.tsx deleted file mode 100644 index cee33d42..00000000 --- a/apps/web/pages/blog/index.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { GetStaticProps, GetStaticPropsResult } from "next"; -import { BlogGridDisplay, BlogGridDisplayProps, getAllBlogPosts } from "@/features/blogs"; - -export interface BlogProps { - posts: BlogGridDisplayProps["posts"]; -} - -const Blog = ({ posts }: BlogProps) => { - return ( - - ); -}; - -export default Blog; - -// This function gets called at build time -export const getStaticProps: GetStaticProps = async (_context) => { - const posts = await getAllBlogPosts(); - - return { - props: { - posts: posts - }, - revalidate: 10, - } as GetStaticPropsResult; -}; diff --git a/apps/web/pages/events.tsx b/apps/web/pages/events.tsx deleted file mode 100644 index ae681d9b..00000000 --- a/apps/web/pages/events.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import { VStack, Heading } from "@chakra-ui/react"; -import { GetStaticProps, GetStaticPropsResult } from "next"; -import { Hero } from "ui"; -import { BlogCardsDisplay, BlogCardsDisplayProps, getAllBlogPosts } from "@/features/blogs"; - -interface EventsProps { - posts: BlogCardsDisplayProps["posts"]; -} - -const Events = ({ posts }: EventsProps) => { - return ( - <> - - - {/* Blog Cards */} - - Recent/Ongoing Events - - - - ); -}; - -export default Events; - -// This function gets called at build time -export const getStaticProps: GetStaticProps = async (_context) => { - const posts = await getAllBlogPosts(); - - return { - props: { - posts: posts - }, - revalidate: 10, - } as GetStaticPropsResult; -};