Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop-astro-nacos' into deve…
Browse files Browse the repository at this point in the history
…lop-astro-nacos
  • Loading branch information
Tinie13 committed Jun 21, 2024
2 parents 3d259bf + 1db51ef commit ea73fb7
Show file tree
Hide file tree
Showing 742 changed files with 38,245 additions and 877 deletions.
2 changes: 1 addition & 1 deletion astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default defineConfig({
trailingSlash: "always",
integrations: [
starlight({
title: "Nacos",
title: "Nacos 官网",
favicon: "/favicon.ico",
head: [],
expressiveCode: {
Expand Down
1 change: 1 addition & 0 deletions global.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// global.d.ts 文件中
interface Window {
gUid: string;
CNPilot?: any;
}

// 或者
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/check": "^0.3.1",
"@astrojs/preact": "^3.1.2",
"@astrojs/starlight": "^0.15.0",
"@astrojs/starlight-tailwind": "^2.0.1",
Expand All @@ -19,7 +18,7 @@
"@docsearch/js": "^3.5.2",
"@serverless-cd/goat-ui": "^0.0.27-beta.3",
"@tailwindcss/nesting": "^0.0.0-insiders.565cd3e",
"astro": "^4.0.6",
"astro": "^4.9.1",
"date-fns": "^2.30.0",
"dotenv": "^16.3.1",
"lodash.clonedeep": "^4.5.0",
Expand All @@ -34,6 +33,7 @@
"remark": "^15.0.1",
"remark-html": "^16.0.1",
"sharp": "^0.32.5",
"swr": "^1.3.0",
"typescript": "^5.3.2",
"unist-util-visit": "^5.0.0",
"web-animations-js": "^2.3.2"
Expand Down
1 change: 1 addition & 0 deletions public/7bebf8841beb4194ab1a71e73d7261b1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7bebf8841beb4194ab1a71e73d7261b1
Binary file added public/img/contributors/shalk.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/img/nacos_dingding.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 10 additions & 7 deletions src/components/common/Header/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,11 @@ let height,
//cnpilot
const copilotJSScript = document.createElement("script");
copilotJSScript.type = "text/javascript";
copilotJSScript.src =
// "//dev.g.alicdn.com/cm-design/copilot-booter/0.0.22/copilot-booter.js";
"https://g.alicdn.com/cm-design/copilot-booter/0.0.22/copilot-booter.js";
// copilotJSScript.src = "https://g.alicdn.com/cm-design/copilot-booter/0.0.23/copilot-booter.js";
copilotJSScript.src = "https://g.alicdn.com/cm-design/copilot-booter/0.0.26/copilot-booter.js";
copilotJSScript.addEventListener("load", function () {
if (window.CNPilot) {
window.CNPilot.mounted({
CNPilot_NODE_ENV: "development",
CNPilot_OPEN_SOURCE: ["nacos.io"],
CNPilot_OPEN_SOURCE_API: "https://ai.nacos.io",
showFloatICON: true,
Expand All @@ -101,12 +99,17 @@ let height,
},
entryIconProps: {
"position-type": "updown",
"icon-hover-text": "AI专家",
// 'icon-url':'https://pic.rmb.bdstatic.com/bjh/914b8c0f9814b14c5fedeec7ec6615df5813.jpeg',
"icon-hover-text": "专家答疑",
"icon-style": {
color: "red",
background: "white",
border: "2px solid red",
borderRadius: "20px"
}
},
headerProps: {
closeIcon: { show: true }, // 关闭按钮
titleText: "nacos文档答疑助手",
titleText: "AI答疑专家",
},
});
}
Expand Down
9 changes: 9 additions & 0 deletions src/components/common/Header/navbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,13 @@ export default [
target: "_blank",
route: "http://console.nacos.io/nacos/index.html",
},
{
label: "答疑样例",
translations: {
en: "FAQ",
},
trigger: "click",
target: "_self",
route: "/wuyi/",
},
];
8 changes: 7 additions & 1 deletion src/components/common/Navbar.astro
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { isChinese } from "@i18n/util";
import cloneDeep from "lodash.clonedeep";
import dataSource from "@components/common/Header/navbar.ts";
import { docsItems } from "@components/common/Header/DocsMenu.astro";
import Flames from '../icon/Flames.astro';
const ifzh = isChinese(Astro);
interface Props {
Expand Down Expand Up @@ -92,10 +93,14 @@ const ifactive = (toggle) => {
} = toggle;
// const component = slot && await import(slot);
const active = ifactive(toggle);
const newFlames = {
aftericon: route == "/wuyi/"? <Flames /> : "",
};
const targetRoute = target == "_self" && route? `${ifzh? "" : "/en"}${route}`: route;
return (
<Toggle
title={ifzh ? label : translations?.en}
route={route}
route={targetRoute}
trigger={trigger}
active={active}
slot={slot}
Expand All @@ -104,6 +109,7 @@ const ifactive = (toggle) => {
top={top}
relativePosition = {relativePosition}
class={`item ${index === lastIdx ? "item-last-child" : ""}`}
hotIcon={newFlames.aftericon}
></Toggle>
);
})
Expand Down
5 changes: 4 additions & 1 deletion src/components/common/Toggle.astro
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ interface Props {
relativePosition?: 'page' | 'parent';
top?: "4rem" | "3.5rem";
showArrow?: boolean;
hotIcon?: HTMLElement;
}
const {
Expand All @@ -25,7 +26,8 @@ const {
showArrow = true,
target = "_self",
top = "4rem",
relativePosition = 'parent'
relativePosition = 'parent',
hotIcon = '',
} = Astro.props;
// 父组件的定位方式
Expand Down Expand Up @@ -67,6 +69,7 @@ const Component = slot;
}`}
>
{title}
{hotIcon}
</a>
)
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/contributors/gitHubData.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"login":"nkorange","avatar_url":"https://avatars.githubusercontent.com/u/4593375?v=4","html_url":"https://github.com/nkorange"},{"login":"KomachiSion","avatar_url":"https://avatars.githubusercontent.com/u/37170243?v=4","html_url":"https://github.com/KomachiSion"},{"login":"chuntaojun","avatar_url":"https://avatars.githubusercontent.com/u/23445172?v=4","html_url":"https://github.com/chuntaojun"},{"login":"loadchange","avatar_url":"https://avatars.githubusercontent.com/u/10842824?v=4","html_url":"https://github.com/loadchange"},{"login":"yanlinly","avatar_url":"https://avatars.githubusercontent.com/u/17695352?v=4","html_url":"https://github.com/yanlinly"},{"login":"xuechaos","avatar_url":"https://avatars.githubusercontent.com/u/3983999?v=4","html_url":"https://github.com/xuechaos"},{"login":"jameslcj","avatar_url":"https://avatars.githubusercontent.com/u/11494059?v=4","html_url":"https://github.com/jameslcj"},{"login":"li-xiao-shuang","avatar_url":"https://avatars.githubusercontent.com/u/34903552?v=4","html_url":"https://github.com/li-xiao-shuang"},{"login":"KeRan213539","avatar_url":"https://avatars.githubusercontent.com/u/1195743?v=4","html_url":"https://github.com/KeRan213539"},{"login":"hxy1991","avatar_url":"https://avatars.githubusercontent.com/u/2517258?v=4","html_url":"https://github.com/hxy1991"},{"login":"shiyiyue1102","avatar_url":"https://avatars.githubusercontent.com/u/20452676?v=4","html_url":"https://github.com/shiyiyue1102"},{"login":"brotherlu-xcq","avatar_url":"https://avatars.githubusercontent.com/u/25661357?v=4","html_url":"https://github.com/brotherlu-xcq"},{"login":"horizonzy","avatar_url":"https://avatars.githubusercontent.com/u/22524871?v=4","html_url":"https://github.com/horizonzy"},{"login":"Daydreamer-ia","avatar_url":"https://avatars.githubusercontent.com/u/83362909?v=4","html_url":"https://github.com/Daydreamer-ia"},{"login":"Maijh97","avatar_url":"https://avatars.githubusercontent.com/u/37288946?v=4","html_url":"https://github.com/Maijh97"},{"login":"onewe","avatar_url":"https://avatars.githubusercontent.com/u/38708836?v=4","html_url":"https://github.com/onewe"},{"login":"hujun-w-2","avatar_url":"https://avatars.githubusercontent.com/u/39894911?v=4","html_url":"https://github.com/hujun-w-2"},{"login":"MajorHe1","avatar_url":"https://avatars.githubusercontent.com/u/53824889?v=4","html_url":"https://github.com/MajorHe1"},{"login":"pbting","avatar_url":"https://avatars.githubusercontent.com/u/11469671?v=4","html_url":"https://github.com/pbting"},{"login":"zhaoyuguang","avatar_url":"https://avatars.githubusercontent.com/u/10150229?v=4","html_url":"https://github.com/zhaoyuguang"},{"login":"zongtanghu","avatar_url":"https://avatars.githubusercontent.com/u/5010883?v=4","html_url":"https://github.com/zongtanghu"},{"login":"mercyblitz","avatar_url":"https://avatars.githubusercontent.com/u/533114?v=4","html_url":"https://github.com/mercyblitz"},{"login":"IanCao","avatar_url":"https://avatars.githubusercontent.com/u/32847163?v=4","html_url":"https://github.com/IanCao"},{"login":"ZZQ001010","avatar_url":"https://avatars.githubusercontent.com/u/33930711?v=4","html_url":"https://github.com/ZZQ001010"}]
[{"login":"nkorange","avatar_url":"https://avatars.githubusercontent.com/u/4593375?v=4","html_url":"https://github.com/nkorange"},{"login":"KomachiSion","avatar_url":"https://avatars.githubusercontent.com/u/37170243?v=4","html_url":"https://github.com/KomachiSion"},{"login":"chuntaojun","avatar_url":"https://avatars.githubusercontent.com/u/23445172?v=4","html_url":"https://github.com/chuntaojun"},{"login":"loadchange","avatar_url":"https://avatars.githubusercontent.com/u/10842824?v=4","html_url":"https://github.com/loadchange"},{"login":"yanlinly","avatar_url":"https://avatars.githubusercontent.com/u/17695352?v=4","html_url":"https://github.com/yanlinly"},{"login":"xuechaos","avatar_url":"https://avatars.githubusercontent.com/u/3983999?v=4","html_url":"https://github.com/xuechaos"},{"login":"jameslcj","avatar_url":"https://avatars.githubusercontent.com/u/11494059?v=4","html_url":"https://github.com/jameslcj"},{"login":"li-xiao-shuang","avatar_url":"https://avatars.githubusercontent.com/u/34903552?v=4","html_url":"https://github.com/li-xiao-shuang"},{"login":"KeRan213539","avatar_url":"https://avatars.githubusercontent.com/u/1195743?v=4","html_url":"https://github.com/KeRan213539"},{"login":"hxy1991","avatar_url":"https://avatars.githubusercontent.com/u/2517258?v=4","html_url":"https://github.com/hxy1991"},{"login":"shiyiyue1102","avatar_url":"https://avatars.githubusercontent.com/u/20452676?v=4","html_url":"https://github.com/shiyiyue1102"},{"login":"brotherlu-xcq","avatar_url":"https://avatars.githubusercontent.com/u/25661357?v=4","html_url":"https://github.com/brotherlu-xcq"},{"login":"horizonzy","avatar_url":"https://avatars.githubusercontent.com/u/22524871?v=4","html_url":"https://github.com/horizonzy"},{"login":"Daydreamer-ia","avatar_url":"https://avatars.githubusercontent.com/u/83362909?v=4","html_url":"https://github.com/Daydreamer-ia"},{"login":"Maijh97","avatar_url":"https://avatars.githubusercontent.com/u/37288946?v=4","html_url":"https://github.com/Maijh97"},{"login":"onewe","avatar_url":"https://avatars.githubusercontent.com/u/38708836?v=4","html_url":"https://github.com/onewe"},{"login":"hujun-w-2","avatar_url":"https://avatars.githubusercontent.com/u/39894911?v=4","html_url":"https://github.com/hujun-w-2"},{"login":"MajorHe1","avatar_url":"https://avatars.githubusercontent.com/u/53824889?v=4","html_url":"https://github.com/MajorHe1"},{"login":"pbting","avatar_url":"https://avatars.githubusercontent.com/u/11469671?v=4","html_url":"https://github.com/pbting"},{"login":"zhaoyuguang","avatar_url":"https://avatars.githubusercontent.com/u/10150229?v=4","html_url":"https://github.com/zhaoyuguang"},{"login":"zongtanghu","avatar_url":"https://avatars.githubusercontent.com/u/5010883?v=4","html_url":"https://github.com/zongtanghu"},{"login":"mercyblitz","avatar_url":"https://avatars.githubusercontent.com/u/533114?v=4","html_url":"https://github.com/mercyblitz"},{"login":"IanCao","avatar_url":"https://avatars.githubusercontent.com/u/32847163?v=4","html_url":"https://github.com/IanCao"},{"login":"shalk","avatar_url":"https://avatars.githubusercontent.com/u/2435781?v=4","html_url":"https://github.com/shalk"}]
10 changes: 7 additions & 3 deletions src/components/home/HomeIntroduce.astro
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
---
import { useTranslations, isChinese } from "@i18n/util";
import StarAndFork from "./StarAndFork.astro";
import StarAndForkV2 from "./StarAndForkV2/index.tsx";
import UpRight from "../icon/UpRight.astro";
import Button from "@components/common/Button.astro";
import HomeBackground from "../home/HomeBackground.astro";
import sendFetch from "@/utils/sendFetch";
import type { StarAndForkT } from 'src/types';
const t = useTranslations(Astro);
const ifzh = isChinese(Astro);
// 服务端构建预先获取star数和fork数作为兜底
const { stargazers_count=0, forks_count=0 }:StarAndForkT = await sendFetch("https://api.github.com/repos/alibaba/nacos");
---

<span class="home-introduce-wrapper">
Expand All @@ -23,7 +27,7 @@ const ifzh = isChinese(Astro);
>
{t("home.introduce.title")}
</div>
<StarAndFork />
<StarAndForkV2 client:load stargazers_count={stargazers_count} forks_count={forks_count} />
<div class="notes mt-16 text-gray-07 text-xs flex justify-between">
<div>
<a
Expand Down
2 changes: 1 addition & 1 deletion src/components/home/OverViewImage/components/DataPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const DataPanel = () => {
const appContext = useContext(AppContext);
return (
<Panel title="数据面" width="90%">
<div className="flex items-center justify-evenly w-full pt-4 pr-4">
<div className="flex items-center justify-evenly w-full pt-1 pr-4">
<Product
image={
"https://gw.alicdn.com/imgextra/i2/O1CN014ZK8OP1msdEMGutsg_!!6000000005010-2-tps-166-160.png"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ export const TelemetryPanel = () => {
label="SkyWalking"
hoverContent={hoverSkyWalkingData}
/> */}
<Product
logo="https://img.alicdn.com/imgextra/i3/O1CN01jYzUO31nQywwUzAAv_!!6000000005085-2-tps-80-80.png"
label="iLogtail"
hoverContent={hoveriLogtailData}
/>
<Product
logo="https://img.alicdn.com/imgextra/i3/O1CN01hTFdm51Jor72V1UQ9_!!6000000001076-2-tps-80-80.png"
label="OpenTelemetry"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const Panel = ({
{children}
</div> */}
</div>
<div class="h-full w-full flex items-center justify-evenly relative p-4">
<div class="h-full w-full flex items-center justify-evenly relative p-1">
{children}
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
import React from "react";
import { useState,useContext } from "preact/hooks";
import { useState,useContext, useEffect } from "preact/hooks";
import { twMerge } from "tailwind-merge";
import { AppContext } from "../../context";
import useCustomSWR from "@/utils/useCustomSWR";

export const PopupContent = ({ image, title, labels, links, direction = 'top',data }) => {
export const PopupContent = ({ image, title, labels, links, direction = 'top', isHovering }) => {
const { swrData={}, fetchData } = useCustomSWR(links?.Github?.apiLink);
const appContext = useContext(AppContext);
const [arrow, setArrow] = useState('');
const { stargazers_count: startCount = 0, forks_count: forkCount = 0 } =
data || { stargazers_count: 0, forks_count: 0 };
const [startCount, setStartCount] = useState(0);
const [forkCount, setForkCount] = useState(0);

useEffect(()=>{
const { stargazers_count = 0, forks_count = 0 } = swrData || {};
setStartCount(stargazers_count || 0);
setForkCount(forks_count || 0);
},[swrData]);

useEffect(()=>{
if(isHovering) {
fetchData();
};
},[isHovering])

if (direction === 'bottom') {
// hover弹框在下面,箭头在上面
Expand Down
16 changes: 8 additions & 8 deletions src/components/home/OverViewImage/components/common/Product.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ export const Product = ({
// 只第一次请求一次
if (!hasFetchedData) {
setHovering(true);
const apiLink = hoverContent?.links?.Github?.apiLink;
const fetchedData = await sendFetch(apiLink);
setData(fetchedData);
// const apiLink = hoverContent?.links?.Github?.apiLink;
// const fetchedData = await sendFetch(apiLink);
// setData(fetchedData);
setHasFetchedData(true); // 更新标志,表示数据已被获取
}
};
Expand All @@ -52,13 +52,13 @@ export const Product = ({
style={{
marginTop: "0 !important",
}}
onMouseLeave={onMouseLeave}
onMouseEnter={onMouseEnter}
onTouchStart={onMouseEnter}
onTouchEnd={onMouseLeave}
>
<div
class="w-16 h-16 "
onMouseLeave={onMouseLeave}
onMouseEnter={onMouseEnter}
onTouchStart={onMouseEnter}
onTouchEnd={onMouseLeave}
ref={triggerRef}
>
{image && !logo && (
Expand Down Expand Up @@ -124,7 +124,7 @@ export const Product = ({
onMouseLeave={() => setHovering(false)}
ref={popupRef}
>
<PopupContent {...hoverContent} direction={direction} data={data} />
<PopupContent {...hoverContent} direction={direction} data={data} isHovering={isHovering}/>
</div>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function sendFetch(url, params = null, method = 'GET') {
}
}


try {
const response = await fetch(url, {
mode: 'cors',
Expand Down
3 changes: 1 addition & 2 deletions src/components/home/OverViewImage/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const t = useTranslations(Astro);
---

<div class="overview-image-wrapper">
<div class="top-title w-full flex flex-col items-center mb-[31px] mt-16">
<div class="top-title w-full flex flex-col items-center mb-[10px] pt-16">
<span class="text-gray-10 text-xs mb-6"
>{t("home.overviewcard.about")}</span
>
Expand Down Expand Up @@ -35,7 +35,6 @@ const t = useTranslations(Astro);
/* 小于50rem 小于 800px */
@media (max-width: 50rem) {
.top-title {
margin-top: 2.5rem;
margin-bottom: 2.5rem;
}
.top-title .title {
Expand Down
7 changes: 1 addition & 6 deletions src/components/home/OverViewImage/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ import React from "react";
import "tailwindcss/tailwind.css";
import "./style.css";
import { useState } from "preact/hooks";
import { Arrow } from "./components/common/Arrow";
import { Panel } from "./components/common/Panel";
import { Product } from "./components/common/Product";

import { PopupContent } from "./components/common/PopupContent";
import { GovernancePanel } from "./components/GovernancePanel";
import { ControlPanel } from "./components/ControlPanel";
import { OpsPanel } from "./components/OpsPanel";
Expand Down Expand Up @@ -50,7 +45,7 @@ function App({ colors = defaultColorConfig, linkStyle = "text-sm", className = '
}}
>
<div
class={` flex flex-col justify-around px-2 pt-14 pb-2 overflow-hidden ` + className}
class={` flex flex-col justify-around px-2 pt-4 pb-2 ` + className}
id="overview-image-root"
style={{
background: colors.background,
Expand Down
Loading

0 comments on commit ea73fb7

Please sign in to comment.