-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: refactor project server side code, abandon nextjs server si…
…de rendering
- Loading branch information
Showing
45 changed files
with
1,654 additions
and
743 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,7 +1,7 @@ | ||
export const dynamic = "force-dynamic"; | ||
|
||
import { PublicEnv } from "@/types/env"; | ||
|
||
export const dynamic = "force-dynamic"; | ||
|
||
export async function GET() { | ||
return Response.json(PublicEnv.parse(process.env)); | ||
} |
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,10 @@ | ||
import { Env } from "@/types/env"; | ||
import getArchivedTerms from "@/lib/notes/getArchivedTerms"; | ||
|
||
export const dynamic = "force-dynamic"; | ||
|
||
export async function GET() { | ||
const currentTerm = Env.parse(process.env).CURRENT_TERM; | ||
const archivedTerms = getArchivedTerms().map((term) => term.name); | ||
return Response.json([currentTerm, ...archivedTerms]); | ||
} |
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,52 +1,13 @@ | ||
"use client"; | ||
|
||
import Tabs from "./components/Tabs/Tabs"; | ||
import Table from "./components/Table/Table"; | ||
import Chips from "./components/Chips/Chips"; | ||
import Filter from "./components/Filter/Filter"; | ||
import Message from "@/components/Message/Message"; | ||
import Searchbar from "./components/Searchbar/Searchbar"; | ||
import AreaCharts from "./components/AreaCharts/AreaCharts"; | ||
import Pagination from "./components/Pagination/Pagination"; | ||
|
||
import timeInterval from "@/lib/utils/timeInterval"; | ||
import { useViewContext } from "@/contexts/View/ViewProvider"; | ||
import Body from "./components/Body/Body"; | ||
import Header from "./components/Header/Header"; | ||
|
||
export default function Client() { | ||
const { activeTab, archives, lastSynchronized } = useViewContext(); | ||
|
||
if (archives.length === 0) { | ||
return ( | ||
<main className="flex flex-col items-center justify-center"> | ||
<Message message="还没有人提交值班笔记,快去提交一个吧" icon="people" /> | ||
</main> | ||
); | ||
} | ||
|
||
return ( | ||
<main className="py-5 md:py-10 flex flex-col gap-6"> | ||
<div className="flex flex-row justify-between items-center"> | ||
{archives.length > 1 && <Filter />} | ||
<Tabs /> | ||
</div> | ||
|
||
<div className="flex-1 flex flex-col gap-4"> | ||
{activeTab === "table" && ( | ||
<> | ||
<Searchbar /> | ||
<Table /> | ||
<Pagination /> | ||
</> | ||
)} | ||
{activeTab === "chart" && ( | ||
<> | ||
<Chips /> | ||
<AreaCharts /> | ||
</> | ||
)} | ||
</div> | ||
|
||
<p className="mx-auto text-xs text-gray-600">数据库上次同步于{timeInterval(lastSynchronized)}</p> | ||
<Header /> | ||
<Body /> | ||
</main> | ||
); | ||
} |
Oops, something went wrong.