forked from CaliCastle/cali.so
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/comments
# Conflicts: # components/PostPortableText.tsx
- Loading branch information
Showing
23 changed files
with
1,238 additions
and
1,240 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,30 @@ | ||
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). | ||
## 我的个人网站 | ||
|
||
## Getting Started | ||
目前还在开发中,可以通过 [https://cali.so/](https://cali.so/) 访问。 | ||
|
||
First, run the development server: | ||
需要其他服务商的环境变量才能正常运行,所以如果你想要在本地运行,需要自己配置。 | ||
|
||
```bash | ||
npm run dev | ||
# or | ||
yarn dev | ||
``` | ||
|
||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. | ||
|
||
You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file. | ||
|
||
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`. | ||
### 技术栈 | ||
|
||
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages. | ||
- [Next.js](https://nextjs.org/) | ||
- [React](https://reactjs.org/) | ||
- [TypeScript](https://www.typescriptlang.org/) | ||
- [Tailwind CSS](https://tailwindcss.com/) | ||
- [Framer Motion](https://www.framer.com/motion/) | ||
- [Radix UI](https://www.radix-ui.com/) | ||
- [Sanity](https://www.sanity.io/) | ||
|
||
## Learn More | ||
### 本地开发 | ||
|
||
To learn more about Next.js, take a look at the following resources: | ||
|
||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. | ||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. | ||
|
||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! | ||
```bash | ||
# 安装依赖 | ||
pnpm install | ||
|
||
## Deploy on Vercel | ||
# 启动开发服务器 | ||
pnpm dev | ||
|
||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. | ||
# 构建 | ||
pnpm build | ||
``` | ||
|
||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. | ||
通过 [Vercel](https://vercel.com/) 一键部署。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -123,6 +123,7 @@ export function Headline() { | |
aria-label="我的 Telegram" | ||
platform="telegram" | ||
/> | ||
<SocialLink href="/feed.xml" platform="rss" aria-label="RSS 订阅" /> | ||
<SocialLink | ||
href="mailto:[email protected]" | ||
aria-label="我的邮箱" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,19 @@ | ||
import { Feed } from 'feed' | ||
import RSS from 'rss' | ||
|
||
import { seo } from '~/lib/seo' | ||
import { getLatestBlogPosts } from '~/sanity/queries' | ||
|
||
export const revalidate = 60 * 60 * 12 // 12 hours | ||
export const revalidate = 60 * 60 // 1 hour | ||
|
||
export async function GET() { | ||
const feed = new Feed({ | ||
const feed = new RSS({ | ||
title: seo.title, | ||
description: seo.description, | ||
id: seo.url.href, | ||
link: seo.url.href, | ||
site_url: seo.url.href, | ||
feed_url: `${seo.url.href}feed.xml`, | ||
language: 'zh-CN', | ||
image: `${seo.url.href}opengraph-image.png`, | ||
favicon: `${seo.url.href}icon.png`, | ||
copyright: '版权所有 2023, Cali Castle', | ||
image_url: `${seo.url.href}opengraph-image.png`, | ||
generator: 'PHP 9.0', | ||
author: { | ||
name: 'Cali Castle', | ||
email: '[email protected]', | ||
link: seo.url.href, | ||
}, | ||
}) | ||
|
||
const data = await getLatestBlogPosts(999) | ||
|
@@ -29,19 +22,21 @@ export async function GET() { | |
} | ||
|
||
data.forEach((post) => { | ||
feed.addItem({ | ||
feed.item({ | ||
title: post.title, | ||
id: post._id, | ||
link: `${seo.url.href}blog/${post.slug}`, | ||
guid: post._id, | ||
url: `${seo.url.href}blog/${post.slug}`, | ||
description: post.description, | ||
date: new Date(post.publishedAt), | ||
image: post.mainImage.asset.url, | ||
enclosure: { | ||
url: post.mainImage.asset.url, | ||
}, | ||
}) | ||
}) | ||
|
||
return new Response(feed.rss2(), { | ||
return new Response(feed.xml(), { | ||
headers: { | ||
'content-type': 'application/xml; charset=utf-8', | ||
'content-type': 'application/xml', | ||
}, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import cors from 'edge-cors' | ||
import { NextResponse } from 'next/server' | ||
import { getTweet } from 'react-tweet/api' | ||
|
||
type RouteSegment = { params: { id: string } } | ||
|
||
export async function GET(req: Request, { params }: RouteSegment) { | ||
try { | ||
const tweet = await getTweet(params.id) | ||
return cors( | ||
req, | ||
NextResponse.json({ data: tweet ?? null }, { status: tweet ? 200 : 404 }) | ||
) | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
} catch (error: any) { | ||
return cors( | ||
req, | ||
NextResponse.json( | ||
{ error: error.message ?? 'Bad request.' }, | ||
{ status: 400 } | ||
) | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
import { type Component, type ReactNode } from 'react' | ||
|
||
type ReactJSXElementConstructor<Props> = | ||
| ((props: Props) => ReactNode | Promise<ReactNode>) | ||
| (new (props: Props) => Component<Props, any>) | ||
|
||
declare global { | ||
namespace React.JSX { | ||
type ElementType = string | ReactJSXElementConstructor<any> | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { type IconProps } from '~/assets' | ||
|
||
export function AtomIcon(props: IconProps = {}) { | ||
return ( | ||
<svg | ||
width="1em" | ||
height="1em" | ||
viewBox="0 0 24 24" | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg" | ||
{...props} | ||
> | ||
<path | ||
d="M11 12C11 11.4477 11.4477 11 12 11C12.5523 11 13 11.4477 13 12C13 12.5523 12.5523 13 12 13C11.4477 13 11 12.5523 11 12Z" | ||
stroke="currentColor" | ||
strokeWidth="2" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
/> | ||
<path | ||
d="M15.8685 8.1315C20.3552 12.6182 22.2604 17.9873 20.1238 20.1238C17.9873 22.2604 12.6182 20.3552 8.1315 15.8685C3.64482 11.3818 1.73964 6.01266 3.87615 3.87615C6.01266 1.73964 11.3818 3.64482 15.8685 8.1315Z" | ||
stroke="currentColor" | ||
strokeWidth="2" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
/> | ||
<path | ||
d="M8.13151 8.1315C3.64483 12.6182 1.73965 17.9873 3.87616 20.1238C6.01267 22.2604 11.3818 20.3552 15.8685 15.8685C20.3552 11.3818 22.2604 6.01266 20.1239 3.87615C17.9873 1.73964 12.6182 3.64482 8.13151 8.1315Z" | ||
stroke="currentColor" | ||
strokeWidth="2" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
/> | ||
</svg> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.