Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix: type issues on Authors

Jonathan Summers-Muirc6af4e685e9e
diff --git a/www/components/Blog/BlogListItem.tsx b/www/components/Blog/BlogListItem.tsx
index 536463a9ffb..909f4059443 100644
--- a/www/components/Blog/BlogListItem.tsx
+++ b/www/components/Blog/BlogListItem.tsx
@@ -1,6 +1,7 @@
import authors from 'lib/authors.json'
import Image from 'next/image'
import React from 'react'
+import Author from '~/types/author'
import PostTypes from '~/types/post'
interface Props {
@@ -8,18 +9,17 @@ interface Props {
}
const BlogListItem = ({ post }: Props) => {
- // @ts-ignore
- const authorArray = post.author && post.author.split(',')
-
+ const authorArray: string[] | undefined = post.author ? post.author.split(',') : []
const author = []
- for (let i = 0; i < authorArray.length; i++) {
- author.push(
- // @ts-ignore
- authors.find((authors: string) => {
- // @ts-ignore
- return authors.author_id === authorArray[i]
- })
- )
+
+ if (authorArray) {
+ for (let i = 0; i < authorArray.length; i++) {
+ author.push(
+ authors.find((authors: Author) => {
+ return authors.author_id === authorArray[i]
+ })
+ )
+ }
}
return (
diff --git a/www/components/CaseStudies/index.tsx b/www/components/CaseStudies/index.tsx
index f3862997eee..5093d3ecc36 100644
--- a/www/components/CaseStudies/index.tsx
+++ b/www/components/CaseStudies/index.tsx
@@ -33,25 +33,8 @@ const CaseStudies = () => {
url: caseStudy.url.replace('/blog/', ''),
}}
/>
- /* <a href={caseStudy.url} key={idx}>
- <Card
- key={`caseStudy_${idx}`}
- hoverable
- cover={
- <img src={`${basePath}/${caseStudy.imgUrl}`} className="object-cover h-64" />
- }
- className="bg-scale-400"
- >
- <div>
- <p className="p">Project example</p>
- <h4 className="h5">{caseStudy.title}</h4>
- </div>
- <p className="p">{caseStudy.description}</p>
- </Card>
- </a> */
))}
</div>
- {/* <Benchmark /> */}
</SectionContainer>
)
}
diff --git a/www/types/author.ts b/www/types/author.ts
index 4d9892b3415..1433a84b3f8 100644
--- a/www/types/author.ts
+++ b/www/types/author.ts
@@ -1,6 +1,9 @@
type Author = {
- name: string
- picture: string
+ author_id: string
+ author: string
+ position: string
+ author_url: string
+ author_image_url: string
}
export default Author
diff --git a/www/types/post.ts b/www/types/post.ts
index 753055028b8..05630758e1e 100644
--- a/www/types/post.ts
+++ b/www/types/post.ts
@@ -6,7 +6,7 @@ type PostTypes = {
title: string
date?: string
coverImage?: string
- author?: Author
+ author?: string
excerpt?: string
ogImage?: {
url: string