Skip to content

Commit

Permalink
feat: fix conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
AbigailDeng authored and AbigailDeng committed Jul 17, 2024
2 parents 1000ab0 + 4e25c19 commit 0b7cf4f
Show file tree
Hide file tree
Showing 17 changed files with 25 additions and 255 deletions.
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ COOKIE_NAME=
SITE_URL=
REDIS_HOST=
REDIS_PASSWORD=
REDIS_PORT=
REDIS_PORT=
NEXT_PUBLIC_SITE_URL=
25 changes: 0 additions & 25 deletions app/admin/page.tsx

This file was deleted.

30 changes: 0 additions & 30 deletions app/api/revalidate/route.ts

This file was deleted.

96 changes: 0 additions & 96 deletions app/api/token/route.ts

This file was deleted.

24 changes: 0 additions & 24 deletions app/node/[id]/page.tsx

This file was deleted.

31 changes: 0 additions & 31 deletions app/redirect/page.tsx

This file was deleted.

4 changes: 3 additions & 1 deletion app/sitemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
if (nodes) {
for (const node of nodes) {
map.push({
url: `${process.env.SITE_URL}${await getPath(node.node_token)}`,
url: `${process.env.NEXT_PUBLIC_SITE_URL}${await getPath(
node.node_token
)}`,
lastModified: new Date(Number(node.obj_edit_time) * 1000),
changeFrequency: "weekly",
priority: 0.5,
Expand Down
26 changes: 1 addition & 25 deletions app/wiki/[...id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ import {
import { PrevNext } from "@/components/prev-next";
import { getNode } from "@/services/get-node";
import { getDocBlocks } from "@/services/get-doc-blocks";
import { revalidateTag } from "next/cache";
import { FormLoading } from "@/components/form-loading";
import { DateModified } from "@/components/date-modified";
import { Admin } from "@/components/admin";
import { NodesData } from "@/services/larkServices";

interface Props {
Expand Down Expand Up @@ -44,22 +41,10 @@ export default async function Document({ params }: Props) {
if (!id) {
redirect("/404");
}
const { data, docx_token, edit_time } = await getData(id!);
const { data, edit_time } = await getData(id!);

const slugger = new GithubSlugger();

async function invalidatePage(formData: FormData) {
"use server";

const id = formData.get("id");
if (typeof id === "string") revalidateTag(id);

const docx_token = formData.get("docx_token");
if (typeof docx_token === "string") revalidateTag(docx_token);

console.log("revalidating", id, docx_token);
}

return (
<main className="flex overflow-x-hidden">
<div className="w-2/3">
Expand All @@ -73,15 +58,6 @@ export default async function Document({ params }: Props) {
))}
<PrevNext />
<DateModified date={new Date(Number(edit_time) * 1000)} />
<Admin>
<form action={invalidatePage}>
<input name="id" type="hidden" value={id} />
<input name="docx_token" type="hidden" value={docx_token} />
<FormLoading className="bg-red-700 text-white rounded-sm p-2 mb-8 inline-block">
invalidate page
</FormLoading>
</form>
</Admin>
</div>
<aside className="w-1/3">
<TableOfContents allItems={data} />
Expand Down
7 changes: 6 additions & 1 deletion components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ export default function Header({ menu }: Props) {
return (
<div className="fixed w-full bg-white z-50 flex px-5 h-[60px]">
<Link href="/" className="mr-8 flex">
<Image src="/aelf-logo.svg" width={115} height={32} alt="logo"></Image>
<Image
src={`${process.env.NEXT_PUBLIC_SITE_URL}/aelf-logo.svg`}
width={115}
height={32}
alt="logo"
></Image>
</Link>
<Menu
className="w-full flex items-center"
Expand Down
11 changes: 1 addition & 10 deletions components/blocks/child-pages.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
"use server";

import { key } from "@/lib/utils";
import { Item } from "./common";
import { getChildNodes } from "@/services/get-child-nodes";
import { getPath } from "@/services/get-path";
import Link from "next/link";

import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/components/ui/card";
import { Card, CardHeader, CardTitle } from "@/components/ui/card";

export interface ChildPages extends Item {
block_type: 42;
Expand Down
7 changes: 6 additions & 1 deletion components/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ export async function Footer() {
<footer className="bg-slate-100">
<div className="container p-8 lg:grid grid-cols-5 gap-4">
<div className="hidden lg:block">
<Image src="/aelf-logo.svg" width={115} height={32} alt="logo" />
<Image
src={`${process.env.NEXT_PUBLIC_SITE_URL}/aelf-logo.svg`}
width={115}
height={32}
alt="logo"
/>
</div>
{Object.keys(footerData).map((category) => (
<div key={category} className="mb-4">
Expand Down
2 changes: 1 addition & 1 deletion components/search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default function Search() {

useEffect(() => {
(async () => {
const res = await fetch(`/api/search`);
const res = await fetch(`${process.env.NEXT_PUBLIC_SITE_URL}/api/search`);
const data = await res.json();

const config = searchConfigSchema.parse(data);
Expand Down
1 change: 0 additions & 1 deletion lib/api.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
"use server";
import { getTenantAccessToken } from "@/services/get-tenant-access-token";
import { backOff } from "exponential-backoff";
import { createRedisInstance } from "./redis";
Expand Down
1 change: 1 addition & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const nextConfig = {
workerThreads: false,
cpus: 1,
},
output: "export",
};

export default nextConfig;
8 changes: 4 additions & 4 deletions scraper/typesense.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"index_name": "docs-cms-three-vercel-app",
"index_name": "aelf-docs-cms-github-pages",
"start_urls": [
"https://docs-cms-three.vercel.app"
"https://aelfproject.github.io/docs-cms"
],
"sitemap_urls": [
"https://docs-cms-three.vercel.app/sitemap.xml"
"https://aelfproject.github.io/docs-cms/sitemap.xml"
],
"selectors": {
"lvl0": "main h1",
Expand All @@ -19,5 +19,5 @@
"custom_settings": {
"separatorsToIndex": "_"
},
"nb_hits": 3348
"nb_hits": 7379
}
2 changes: 0 additions & 2 deletions services/get-search-config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
"use server";

import { getTopLevelNodes } from "./get-top-level-nodes";
import { listTableRecords } from "./list-table-records";
import { listTables } from "./list-tables";
Expand Down
2 changes: 0 additions & 2 deletions services/get-tenant-access-token.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
"use server";

export async function getTenantAccessToken() {
const res = await fetch(
`https://open.larksuite.com/open-apis/auth/v3/tenant_access_token/internal`,
Expand Down

0 comments on commit 0b7cf4f

Please sign in to comment.