Skip to content

Commit 703c9fe

Browse files
committed
type fixes
1 parent b4913cb commit 703c9fe

28 files changed

+155
-217
lines changed

Diff for: app/about/page.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import { NotionRenderer } from 'react-notion';
22
import notion from '@/lib';
33
import { convertToPost } from '@/functions/convertToPost';
44
import TopScrollButton from '@/components/TopScrollButton';
5-
import { aboutPageId } from "@/site";
5+
import { siteData } from "@/site";
66

77
export default async function AboutPage({
88
searchParams,
99
}: {
1010
searchParams: { [key: string]: string };
1111
}) {
12-
const pageid = aboutPageId
12+
const pageid = siteData.aboutPageId
1313

1414
// Fetching blockMap
1515
const response = await fetch(`https://notion-api.splitbee.io/v1/page/${pageid}`, {

Diff for: app/articles/[slug]/page.tsx

+13-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ import TopScrollButton from "../../../components/TopScrollButton";
88
import Container from '@/components/Container';
99
import ArticleList from '@/components/ArticleList';
1010
import { getAllPosts } from "@/functions/getAllPosts";
11-
import { Article } from "@/layouts/types";
11+
import { Article } from "@/lib/types";
1212
import getLocalizedDate from '@/app/utils/getLocalizedDate';
1313
import { getTagFilteredPosts } from "@/functions/articleFilteredPosts";
14+
import SocialshareButtons from "@/components/SocialshareButtons";
15+
16+
1417

1518
export default async function Page({
1619
searchParams,
@@ -36,7 +39,7 @@ export default async function Page({
3639

3740
return (
3841
<div className="space-y-5 max-w-7xl m-auto min-h-screen">
39-
<img className="object-cover w-full h-52 rounded-[20px] aspect-video" src={postDetails.coverImage} />
42+
<img className="object-cover w-full h-52 lg:rounded-[20px] aspect-video" src={postDetails.coverImage} />
4043

4144
<div>
4245
<div className="text-center space-y-5 text-sm mx-auto mt-3">
@@ -50,9 +53,17 @@ export default async function Page({
5053
<div className="font-semibold">
5154
{postDetails.author}
5255
</div>
56+
<SocialshareButtons
57+
shareUrl={`http://localhost:3000/${postDetails.slug}?id=${postDetails.id}`}
58+
title={postDetails.title}
59+
/>
5360
</div>
61+
62+
63+
5464
</div>
5565

66+
5667
<div className="max-w-4xl px-6 mx-auto mb-24 space-y-8 md:px-8 pt-4 border-t mt-4">
5768
<NotionRenderer blockMap={blockMap} />
5869

Diff for: app/articles/page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { getAllPosts } from "@/functions/getAllPosts";
2-
import { Article } from "@/layouts/types";
2+
import { Article } from "@/lib/types";
33
import Search from "../../components/Search";
44
import { calculateTagFrequency } from "@/functions/getAllTags";
55

Diff for: app/page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { getAllPosts } from "@/functions/getAllPosts";
2-
import { Article } from "@/layouts/types";
2+
import { Article } from "@/lib/types";
33
import { postsPerPage } from "@/site";
44
import Feed from "@/components/Feed";
55
import HeroSection from "../components/HeroSection";

Diff for: app/search/page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { getAllPosts } from "@/functions/getAllPosts";
2-
import { Article } from "@/layouts/types";
2+
import { Article } from "@/lib/types";
33
import Search from "../../components/Search";
44
import { calculateTagFrequency } from "@/functions/getAllTags";
55

Diff for: app/tag/[slug]/page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Search from "@/components/Search";
22
import { getAllPosts } from "@/functions/getAllPosts";
33
import { calculateTagFrequency } from "@/functions/getAllTags";
44
import { getTagFilteredPosts } from "@/functions/tagFilteredPosts";
5-
import { Article } from "@/layouts/types";
5+
import { Article } from "@/lib/types";
66

77
export default async function Page({ params }: { params: { slug: string } }) {
88
const { slug } = params;

Diff for: app/utils/filterArticles.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Article } from "@/layouts/types";
1+
import { Article } from "@/lib/types";
22

33
export function filterArticles(articles: Article[], selectedTag: string | null): Article[] {
44
return articles

Diff for: components/ArticleCard.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Article } from '@/layouts/types';
1+
import { Article } from '@/lib/types';
22
import slugify from 'slugify';
33
import getLocalizedDate from '../app/utils/getLocalizedDate';
44

Diff for: components/ArticleList.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Article } from '@/layouts/types';
1+
import { Article } from '@/lib/types';
22
import ArticleCard from './ArticleCard';
33

44
type Props = {

Diff for: components/Feed.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Article } from '../layouts/types';
1+
import { Article } from '../lib/types';
22
import ArticleCard from './ArticleCard';
33

44
type Props = {

Diff for: components/HeroHeader.tsx

-25
This file was deleted.

Diff for: components/Pagination.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Button } from "@/components/button";
2-
import { PaginationProps } from "@/layouts/types";
2+
import { PaginationProps } from "@/lib/types";
33
import Link from "next/link";
44

55
const Pagination: React.FC<PaginationProps> = ({ currentPage, totalPages }) => {

Diff for: components/Search.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use client";
22

33
import { Input } from "@/components/input";
4-
import { Article, TagFrequencyMap } from "@/layouts/types";
4+
import { Article, TagFrequencyMap } from "@/lib/types";
55
import { useState } from "react";
66
import Tags from "./Tags";
77
import { useParams } from "next/navigation";

Diff for: components/SocialshareButtons.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,19 @@ const SocialshareButtons = ({
2121
return (
2222
<div className="space-x-3">
2323
<FacebookShareButton url={shareUrl}>
24-
<FacebookIcon size={32} round />
24+
<FacebookIcon size={25} round />
2525
</FacebookShareButton>
2626

2727
<TwitterShareButton url={shareUrl} title={title}>
28-
<XIcon size={32} round />
28+
<XIcon size={25} round />
2929
</TwitterShareButton>
3030

3131
<TelegramShareButton url={shareUrl} title={title}>
32-
<TelegramIcon size={32} round />
32+
<TelegramIcon size={25} round />
3333
</TelegramShareButton>
3434

3535
<WhatsappShareButton url={shareUrl} title={title}>
36-
<WhatsappIcon size={32} round />
36+
<WhatsappIcon size={25} round />
3737
</WhatsappShareButton>
3838
</div>
3939
);

Diff for: components/Tags.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Button } from "@/components/button";
2-
import { TagFrequencyMap } from "@/layouts/types";
2+
import { TagFrequencyMap } from "@/lib/types";
33
import Link from "next/link";
44
import { useParams } from "next/navigation";
55

Diff for: functions/articleFilteredPosts.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import notion from "@/lib";
2-
import { Article } from "@/layouts/types";
2+
import { Article } from "@/lib/types";
33
import { convertToPost } from "./convertToPost";
44

55
export const getTagFilteredPosts = async ({

Diff for: functions/convertToPost.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Article } from "@/layouts/types";
1+
import { Article } from "@/lib/types";
22

33
export const convertToPost = (item: any): Article => ({
44
id: item.id,

Diff for: functions/getAllPosts.ts

+16-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,27 @@
11
import notion from "@/lib";
2-
import { Article } from "@/layouts/types";
2+
import { Article } from "@/lib/types";
33
import { convertToPost } from "./convertToPost";
44

55
export const getAllPosts = async (): Promise<Article[]> => {
66
const databaseId = process.env.NOTION_DATABASE_ID!;
77
const response = await notion.databases.query({
88
database_id: databaseId,
99
filter: {
10-
property: "status",
11-
select: {
12-
equals: "Published",
13-
},
10+
and: [
11+
{
12+
property: "status",
13+
select: {
14+
equals: "Published",
15+
},
16+
},
17+
{
18+
property: "type",
19+
select: {
20+
equals: "Post",
21+
},
22+
},
23+
// Add more conditions if needed
24+
],
1425
},
1526
sorts: [
1627
{

Diff for: functions/getAllTags.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Article, TagFrequencyMap } from "@/layouts/types";
1+
import { Article, TagFrequencyMap } from "@/lib/types";
22

33
export const calculateTagFrequency = async ({
44
publishedPosts,

Diff for: functions/getTagPosts.ts

+46-42
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,51 @@
1-
// Import necessary libraries and components
2-
import notion from "@/lib";
3-
import { Article } from "@/layouts/types";
4-
import { convertToPost } from "./convertToPost";
1+
// // Import necessary libraries and components
2+
// import notion from "@/lib";
3+
// import { Article } from "@/lib/types";
4+
// import { convertToPost } from "./convertToPost";
55

6-
export const getPublishedPostsByTag = async (tags?: string[]): Promise<Article[]> => {
7-
const databaseId = process.env.NOTION_DATABASE_ID!;
6+
// export const getPublishedPostsByTag = async (tags?: string[]): Promise<Article[]> => {
7+
// const databaseId = process.env.NOTION_DATABASE_ID!;
88

9-
// Create filter based on whether tags are provided
10-
const filter = tags
11-
? [
12-
{
13-
property: "status",
14-
select: {
15-
equals: "Published",
16-
},
17-
},
18-
{
19-
property: "tags", // Assuming tags is the property name in your database
20-
multi_select: {
21-
contains_all: tags,
22-
},
23-
},
24-
]
25-
: {
26-
property: "status",
27-
select: {
28-
equals: "Published",
29-
},
30-
};
9+
// // Create filter based on whether tags are provided
10+
// const filter = {
11+
// and: [
12+
// {
13+
// property: "status",
14+
// select: {
15+
// equals: "Published",
16+
// },
17+
// },
18+
// {
19+
// property: "type",
20+
// select: {
21+
// equals: "Post",
22+
// },
23+
// },
24+
// {
25+
// property: "tags", // Assuming "tags" is the property name in your database
26+
// multi_select: {
27+
// contains_all: tags,
28+
// },
29+
// },
30+
// ]
31+
// };
3132

32-
const response = await notion.databases.query({
33-
database_id: databaseId,
34-
sorts: [
35-
{
36-
property: "date",
37-
direction: "ascending",
38-
},
39-
],
40-
});
33+
// const response = await notion.databases.query({
34+
// database_id: databaseId,
35+
// filter: {
36+
// or: [filter], // Wrap filter inside an array if needed
37+
// },
38+
// sorts: [
39+
// {
40+
// property: "date",
41+
// direction: "ascending",
42+
// },
43+
// ],
44+
// });
4145

42-
const getPublishedPostsByTag: Article[] = response.results.map((e) =>
43-
convertToPost(e)
44-
);
46+
// const getPublishedPostsByTag: Article[] = response.results.map((e) =>
47+
// convertToPost(e)
48+
// );
4549

46-
return getPublishedPostsByTag;
47-
};
50+
// return getPublishedPostsByTag;
51+
// };

Diff for: functions/tagFilteredPosts.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import notion from "@/lib";
2-
import { Article } from "@/layouts/types";
2+
import { Article } from "@/lib/types";
33
import { convertToPost } from "./convertToPost";
44

55
export const getTagFilteredPosts = async ({

Diff for: layouts/Footer.tsx

-17
This file was deleted.

Diff for: layouts/Layout.tsx

-32
This file was deleted.

0 commit comments

Comments
 (0)