Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "root",
"private": true,
"packageManager": "[email protected]",
"workspaces": [
"website"
],
Expand Down
8 changes: 0 additions & 8 deletions website/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@ import type { Options as ChangelogOptions } from "@nullbot/docusaurus-plugin-cha
import type * as Preset from "@nullbot/docusaurus-preset-nonepress";
import { themes } from "prism-react-renderer";

// By default, we use Docusaurus Faster
// DOCUSAURUS_SLOWER=true is useful for benchmarking faster against slower
// hyperfine --prepare 'yarn clear:website' --runs 3 'DOCUSAURUS_SLOWER=true yarn build:website:fast' 'yarn build:website:fast'
const isSlower = process.env.DOCUSAURUS_SLOWER === "true";
if (isSlower) {
console.log("🐢 Using slower Docusaurus build");
}

// color mode config
const colorMode: Preset.ThemeConfig["colorMode"] = {
defaultMode: "light",
Expand Down
23 changes: 12 additions & 11 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,38 @@
"docusaurus": "docusaurus",
"start": "docusaurus start --host 0.0.0.0 --port 3000",
"build": "docusaurus build",
"build:fast": "cross-env BUILD_FAST=true yarn build",
"build:fast:rsdoctor": "cross-env BUILD_FAST=true RSDOCTOR=true yarn build",
"build:fast:profile": "cross-env BUILD_FAST=true node --cpu-prof --cpu-prof-dir .cpu-prof ./node_modules/.bin/docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
"clear": "docusaurus clear",
"serve": "docusaurus serve",
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"typecheck": "tsc"
"typecheck": "tsc",
"prettier": "prettier --config ../.prettierrc --write ."
},
"dependencies": {
"@docusaurus/core": "^3.6.2",
"@docusaurus/core": "^3.7.0",
"@mdx-js/react": "^3.0.0",
"@nullbot/docusaurus-plugin-changelog": "^3.0.0",
"@nullbot/docusaurus-preset-nonepress": "^3.0.0",
"@swc/core": "^1.7.26",
"clsx": "^2.0.0",
"copy-text-to-clipboard": "^3.2.0",
"prism-react-renderer": "^2.3.0",
"raw-loader": "^4.0.2",
"react": "^18.0.0",
"react": "^19.0.0",
"react-color": "^2.19.3",
"react-dom": "^18.0.0",
"react-use-pagination": "^2.0.1",
"swc-loader": "^0.2.6"
"react-dom": "^19.0.0",
"react-use-pagination": "^2.0.1"
},
"devDependencies": {
"@docusaurus/faster": "^3.6.2",
"@docusaurus/module-type-aliases": "^3.6.2",
"@docusaurus/faster": "^3.7.0",
"@docusaurus/module-type-aliases": "^3.7.0",
"@nullbot/docusaurus-tsconfig": "^3.0.0",
"@types/react-color": "^3.0.10",
"asciinema-player": "^3.5.0",
"typescript": "~5.5.2"
"typescript": "~5.7.2"
},
"browserslist": {
"production": [
Expand Down
2 changes: 1 addition & 1 deletion website/src/components/Asciinema/container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export type Props = {
export default function AsciinemaContainer({
url,
options = {},
}: Props): JSX.Element {
}: Props): React.ReactNode {
const ref = useRef<HTMLDivElement>(null);

useEffect(() => {
Expand Down
6 changes: 3 additions & 3 deletions website/src/components/Asciinema/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React from "react";

import "asciinema-player/dist/bundle/asciinema-player.css";
import BrowserOnly from "@docusaurus/BrowserOnly";
import "asciinema-player/dist/bundle/asciinema-player.css";

import "./styles.css";
import type { Props } from "./container";
import "./styles.css";

export type { Props } from "./container";

export default function Asciinema(props: Props): JSX.Element {
export default function Asciinema(props: Props): React.ReactNode {
return (
<BrowserOnly
fallback={
Expand Down
2 changes: 1 addition & 1 deletion website/src/components/Form/Adapter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";

import { Form } from ".";

export default function AdapterForm(): JSX.Element {
export default function AdapterForm(): React.ReactNode {
const formItems = [
{
name: "基本信息",
Expand Down
2 changes: 1 addition & 1 deletion website/src/components/Form/Bot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";

import { Form } from ".";

export default function BotForm(): JSX.Element {
export default function BotForm(): React.ReactNode {
const formItems = [
{
name: "基本信息",
Expand Down
2 changes: 1 addition & 1 deletion website/src/components/Form/Items/Tag/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export type Props = {
export default function TagFormItem({
allowTags,
onTagUpdate,
}: Props): JSX.Element {
}: Props): React.ReactNode {
const [tags, setTags] = useState<TagType[]>([]);
const [label, setLabel] = useState<TagType["label"]>("");
const [color, setColor] = useState<TagType["color"]>("#ea5252");
Expand Down
2 changes: 1 addition & 1 deletion website/src/components/Form/Plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";

import { Form } from ".";

export default function PluginForm(): JSX.Element {
export default function PluginForm(): React.ReactNode {
const formItems = [
{
name: "包信息",
Expand Down
4 changes: 2 additions & 2 deletions website/src/components/Form/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function Form({
children,
formItems,
handleSubmit,
}: Props): JSX.Element {
}: Props): React.ReactNode {
const [currentStep, setCurrentStep] = useState<number>(0);
const [result, setResult] = useState<Record<string, string>>({});
const [allowTags, setAllowTags] = useState<TagType[]>([]);
Expand Down Expand Up @@ -125,7 +125,7 @@ export function FormItem({
allowTags: TagType[];
result: Record<string, string>;
setResult: (key: string, value: string) => void;
}): JSX.Element {
}): React.ReactNode {
return (
<>
<label className="label">
Expand Down
8 changes: 4 additions & 4 deletions website/src/components/Home/Feature.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function HomeFeature({
description,
annotaion,
children,
}: Feature): JSX.Element {
}: Feature): React.ReactNode {
return (
<div className="flex flex-col items-center justify-center p-4">
<p className="text-sm text-base-content/70 font-medium tracking-wide uppercase">
Expand All @@ -32,7 +32,7 @@ export function HomeFeature({
);
}

function HomeFeatureSingleColumn(props: Feature): JSX.Element {
function HomeFeatureSingleColumn(props: Feature): React.ReactNode {
return (
<div className="grid grid-cols-1 px-4 py-8 md:px-16 mx-auto">
<HomeFeature {...props} />
Expand All @@ -46,7 +46,7 @@ function HomeFeatureDoubleColumn({
}: {
features: [Feature, Feature];
children?: [React.ReactNode, React.ReactNode];
}): JSX.Element {
}): React.ReactNode {
const [children1, children2] = children ?? [];

return (
Expand All @@ -57,7 +57,7 @@ function HomeFeatureDoubleColumn({
);
}

function HomeFeatures(): JSX.Element {
function HomeFeatures(): React.ReactNode {
return (
<>
<HomeFeatureSingleColumn
Expand Down
4 changes: 2 additions & 2 deletions website/src/components/Home/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import copy from "copy-text-to-clipboard";
import IconCopy from "@theme/Icon/Copy";
import IconSuccess from "@theme/Icon/Success";

function HomeHeroInstallButton(): JSX.Element {
function HomeHeroInstallButton(): React.ReactNode {
const code = "pipx run nb-cli create";

const [isCopied, setIsCopied] = useState(false);
Expand All @@ -37,7 +37,7 @@ function HomeHeroInstallButton(): JSX.Element {
);
}

function HomeHero(): JSX.Element {
function HomeHero(): React.ReactNode {
const {
siteConfig: { tagline },
} = useDocusaurusContext();
Expand Down
4 changes: 2 additions & 2 deletions website/src/components/Home/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from "react";

import "./styles.css";
import HomeFeatures from "./Feature";
import HomeHero from "./Hero";
import "./styles.css";

export default function HomeContent(): JSX.Element {
export default function HomeContent(): React.ReactNode {
return (
<div className="home-container">
<HomeHero />
Expand Down
6 changes: 3 additions & 3 deletions website/src/components/Messenger/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import useBaseUrl from "@docusaurus/useBaseUrl";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { useNonepressThemeConfig } from "@nullbot/docusaurus-theme-nonepress/client";

import "./styles.css";
import ThemedImage from "@theme/ThemedImage";
import "./styles.css";

export type Message = {
msg: string;
Expand All @@ -19,7 +19,7 @@ function MessageBox({
msg,
position = "left",
monospace = false,
}: Message): JSX.Element {
}: Message): React.ReactNode {
const {
navbar: { logo },
} = useNonepressThemeConfig();
Expand Down Expand Up @@ -63,7 +63,7 @@ export default function Messenger({
msgs = [],
}: {
msgs?: Message[];
}): JSX.Element {
}): React.ReactNode {
return (
<div className="messenger-container">
<header className="messenger-title">
Expand Down
2 changes: 1 addition & 1 deletion website/src/components/Modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function Modal({
useCustomTitle,
backdropExit,
title,
}: Props): JSX.Element {
}: Props): React.ReactNode {
const [transitionClass, setTransitionClass] = useState<string>("");

const onFadeIn = () => setTransitionClass("fade-in");
Expand Down
2 changes: 1 addition & 1 deletion website/src/components/Paginate/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default function Paginate({
setPage,
previousEnabled,
nextEnabled,
}: Props): JSX.Element {
}: Props): React.ReactNode {
// const [containerElement, setContainerElement] = useState<HTMLElement | null>(
// null
// );
Expand Down
4 changes: 2 additions & 2 deletions website/src/components/Resource/Card/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import clsx from "clsx";
import Link from "@docusaurus/Link";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";

import "./styles.css";
import Tag from "@/components/Resource/Tag";
import ValidStatus from "@/components/Resource/ValidStatus";
import type { Resource } from "@/libs/store";
import "./styles.css";

export type Props = {
resource: Resource;
Expand All @@ -24,7 +24,7 @@ export default function ResourceCard({
onTagClick,
onAuthorClick,
className,
}: Props): JSX.Element {
}: Props): React.ReactNode {
const isGithub = /^https:\/\/fanyv88.com:443\/https\/github.com\/[^/]+\/[^/]+/.test(
resource.homepage
);
Expand Down
66 changes: 42 additions & 24 deletions website/src/components/Resource/DetailCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ export default function ResourceDetailCard({ resource }: Props) {
}
};

const getPluginStatusUpdatedTime = (resource: Resource) => {
switch (resource.resourceType) {
case "plugin":
return new Date(resource.time).toLocaleString();
default:
return null;
}
};

const fetchPypiProject = (projectName: string) =>
fetch(`https://pypi.org/pypi/${projectName}/json`)
.then((response) => response.json())
Expand Down Expand Up @@ -99,8 +108,9 @@ export default function ResourceDetailCard({ resource }: Props) {

const projectLink = getProjectLink(resource) || "无";
const moduleName = getModuleName(resource) || "无";
const homepageLink = getHomepageLink(resource) || undefined;
const pypiProjectLink = getPypiProjectLink(resource) || undefined;
const homepageLink = getHomepageLink(resource);
const pypiProjectLink = getPypiProjectLink(resource);
const updatedTime = getPluginStatusUpdatedTime(resource);

return (
<>
Expand Down Expand Up @@ -183,31 +193,39 @@ export default function ResourceDetailCard({ resource }: Props) {
{(pypiData && pypiData.info.version) || "无"}
</div>

<div className="detail-card-meta-item">
<FontAwesomeIcon fixedWidth icon={["fas", "fingerprint"]} />{" "}
<a
href={homepageLink}
target="_blank"
rel="noreferrer"
className={homepageLink && "hover:underline hover:text-primary"}
>
{moduleName}
</a>
</div>
{homepageLink && (
<div className="detail-card-meta-item">
<FontAwesomeIcon fixedWidth icon={["fas", "fingerprint"]} />{" "}
<a
href={homepageLink}
target="_blank"
rel="noreferrer"
className="detail-card-meta-item-link"
>
{moduleName}
</a>
</div>
)}

{pypiProjectLink && (
<div className="detail-card-meta-item">
<FontAwesomeIcon fixedWidth icon={["fas", "cubes"]} />{" "}
<a
href={pypiProjectLink}
target="_blank"
rel="noreferrer"
className="detail-card-meta-item-link"
>
{projectLink}
</a>
</div>
)}

<div className="detail-card-meta-item">
<FontAwesomeIcon fixedWidth icon={["fas", "cubes"]} />{" "}
<a
href={pypiProjectLink}
target="_blank"
rel="noreferrer"
className={
pypiProjectLink && "hover:underline hover:text-primary"
}
>
{projectLink}
</a>
<FontAwesomeIcon fixedWidth icon={["fas", "clock-rotate-left"]} />{" "}
{updatedTime}
</div>

<div className="detail-card-actions">
<ValidStatus
resource={resource}
Expand Down
Loading
Loading