diff --git a/README.md b/README.md index 0c6c2c2..cc0cfbe 100644 --- a/README.md +++ b/README.md @@ -1,41 +1,39 @@ # Website -This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator. +west2-online 官方网站源代码及发布托管 -### Installation +## 迭代维护 -``` -$ yarn -``` +我们使用 yarn 来进行包管理,下载好源代码后,使用 -### Local Development - -``` -$ yarn start +```bash +$ yarn install # 安装依赖包 +$ yarn run start # 启动本地测试服务器 ``` -This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server. +之后可以在`localhost:3000`中复查看到测试页面,测试服务器支持热重载 -### Build - -``` -$ yarn build -``` +### 更新文档 -This command generates static content into the `build` directory and can be served using any static contents hosting service. +文档侧边栏`sidebars.ts`使用文件夹自动生成,当我们需要添加文档时,只需要在`docs`文件夹里添加文件即可,如果需要对文档进行分类,可以直接创建文件夹,然后把分类的文件放进文件夹中即可 -### Deployment +### 更新成员 -Using SSH: +资源文件位于`src/components/Member`文件夹,编辑其中的`memberData.ts`即可 -``` -$ USE_SSH=true yarn deploy -``` - -Not using SSH: - -``` -$ GIT_USER= yarn deploy -``` +## 文件结构 -If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch. +```text +. +├── README.md +├── babel.config.js +├── components.json +├── docs # 文档 +├── docusaurus.config.ts # Docusaurus 配置 +├── sidebars.ts # 侧边栏配置 +├── src # 页面源代码 +├── static # 静态资源 +├── tailwind.config.js +├── tsconfig.json +└── yarn.lock +``` \ No newline at end of file diff --git a/src/components/Member/index.tsx b/src/components/Member/index.tsx index 48efec8..da874b3 100644 --- a/src/components/Member/index.tsx +++ b/src/components/Member/index.tsx @@ -1,8 +1,34 @@ import { Avatar, AvatarImage, AvatarFallback } from "@/components/ui/avatar" import { memberData } from "@/components/Member/memberData"; +import React, { useState, useEffect } from 'react'; + +async function loadImage(avatar) { + try { + const image = await import(`@site/static/member/${avatar}`); + return image.default; + } catch (e) { + console.error('Failed to load image', e); + return '@site/static/img/logo.svg'; // 返回一个占位图的路径或者你想要的错误图像 + } +} export default function Component() { const data = memberData + const [images, setImages] = useState({}); + + useEffect(() => { + (async () => { + const promises = Object.values(data).flat().map(async member => { + const src = await loadImage(member.avatar); + return { [member.avatar]: src }; + }); + + const imagesArray = await Promise.all(promises); + const imagesObject = imagesArray.reduce((acc, current) => ({ ...acc, ...current }), {}); + setImages(imagesObject); + })(); + }, []); // 空依赖数组意味着这个 effect 只在组件挂载时运行 + return (
{Object.keys(data).map((year) => ( @@ -15,7 +41,7 @@ export default function Component() { className="flex flex-col items-center gap-2 bg-white dark:bg-gray-950 p-4 rounded-lg shadow-md" > - {member.name} + {member.name} {member.name.split(" ").map((word) => word[0])}
diff --git a/src/components/Member/memberData.ts b/src/components/Member/memberData.ts index 25cbf6a..f7f27cc 100644 --- a/src/components/Member/memberData.ts +++ b/src/components/Member/memberData.ts @@ -2,25 +2,26 @@ type MemberData = Record export const memberData: MemberData = { "2023": [ - { avatar: "/placeholder-avatar.jpg", name: "John Doe", profession: "Software Engineer" }, - { avatar: "/placeholder-avatar.jpg", name: "Jane Smith", profession: "Product Manager" }, - { avatar: "/placeholder-avatar.jpg", name: "Michael Johnson", profession: "UI/UX Designer" }, - { avatar: "/placeholder-avatar.jpg", name: "Emily Davis", profession: "Data Analyst" }, + // { avatar: "/placeholder-avatar.jpg", name: "John Doe", profession: "Software Engineer" }, + // { avatar: "/placeholder-avatar.jpg", name: "Jane Smith", profession: "Product Manager" }, + // { avatar: "/placeholder-avatar.jpg", name: "Michael Johnson", profession: "UI/UX Designer" }, + // { avatar: "/placeholder-avatar.jpg", name: "Emily Davis", profession: "Data Analyst" }, ], "2022": [ - { avatar: "/placeholder-avatar.jpg", name: "David Lee", profession: "Backend Developer" }, - { avatar: "/placeholder-avatar.jpg", name: "Sarah Kim", profession: "Frontend Developer" }, - { avatar: "/placeholder-avatar.jpg", name: "Tom Wilson", profession: "Project Manager" }, - { avatar: "/placeholder-avatar.jpg", name: "Olivia Chen", profession: "QA Engineer" }, + { avatar: "2022/android_sqt.jpg", name: "David Lee", profession: "Backend Developer", github: "string" }, + { avatar: "/placeholder-avatar.jpg", name: "Sarah Kim", profession: "Frontend Developer", github: "string" }, + { avatar: "/placeholder-avatar.jpg", name: "Tom Wilson", profession: "Project Manager", github: "string" }, + { avatar: "/placeholder-avatar.jpg", name: "Olivia Chen", profession: "QA Engineer", github: "string" }, ], "2021": [ - { avatar: "/placeholder-avatar.jpg", name: "Alex Park", profession: "DevOps Engineer" }, - { avatar: "/placeholder-avatar.jpg", name: "Sophia Nguyen", profession: "Business Analyst" }, - { avatar: "/placeholder-avatar.jpg", name: "Ryan Gonzalez", profession: "Mobile Developer" }, - { avatar: "/placeholder-avatar.jpg", name: "Isabella Ramirez", profession: "Content Writer" }, + // { avatar: "/placeholder-avatar.jpg", name: "Alex Park", profession: "DevOps Engineer" }, + // { avatar: "/placeholder-avatar.jpg", name: "Sophia Nguyen", profession: "Business Analyst" }, + // { avatar: "/placeholder-avatar.jpg", name: "Ryan Gonzalez", profession: "Mobile Developer" }, + // { avatar: "/placeholder-avatar.jpg", name: "Isabella Ramirez", profession: "Content Writer" }, ], } diff --git a/static/img/docusaurus-social-card1.jpg b/static/img/docusaurus-social-card1.jpg deleted file mode 100644 index ffcb448..0000000 Binary files a/static/img/docusaurus-social-card1.jpg and /dev/null differ diff --git a/static/img/docusaurus.png b/static/img/docusaurus.png deleted file mode 100644 index f458149..0000000 Binary files a/static/img/docusaurus.png and /dev/null differ diff --git a/static/member/2022/android_sqt.jpg b/static/member/2022/android_sqt.jpg new file mode 100644 index 0000000..a04830a Binary files /dev/null and b/static/member/2022/android_sqt.jpg differ diff --git a/static/member/2022/android_sx.jpg b/static/member/2022/android_sx.jpg new file mode 100644 index 0000000..9be08be Binary files /dev/null and b/static/member/2022/android_sx.jpg differ diff --git a/static/member/2022/android_zyn.jpg b/static/member/2022/android_zyn.jpg new file mode 100644 index 0000000..9e18e67 Binary files /dev/null and b/static/member/2022/android_zyn.jpg differ diff --git a/static/member/2022/art_cjw.jpg b/static/member/2022/art_cjw.jpg new file mode 100644 index 0000000..7d86d7a Binary files /dev/null and b/static/member/2022/art_cjw.jpg differ diff --git a/static/member/2022/art_hcx.jpg b/static/member/2022/art_hcx.jpg new file mode 100644 index 0000000..2696e9f Binary files /dev/null and b/static/member/2022/art_hcx.jpg differ diff --git a/static/member/2022/art_lcy.jpg b/static/member/2022/art_lcy.jpg new file mode 100644 index 0000000..2425ef4 Binary files /dev/null and b/static/member/2022/art_lcy.jpg differ diff --git a/static/member/2022/art_lmq.jpg b/static/member/2022/art_lmq.jpg new file mode 100644 index 0000000..1341829 Binary files /dev/null and b/static/member/2022/art_lmq.jpg differ diff --git a/static/member/2022/art_lxy.jpg b/static/member/2022/art_lxy.jpg new file mode 100644 index 0000000..a45937f Binary files /dev/null and b/static/member/2022/art_lxy.jpg differ diff --git a/static/member/2022/frontends_czh.jpg b/static/member/2022/frontends_czh.jpg new file mode 100644 index 0000000..72e4a9b Binary files /dev/null and b/static/member/2022/frontends_czh.jpg differ diff --git a/static/member/2022/frontends_gcj.jpg b/static/member/2022/frontends_gcj.jpg new file mode 100644 index 0000000..5f049f0 Binary files /dev/null and b/static/member/2022/frontends_gcj.jpg differ diff --git a/static/member/2022/frontends_ios_golang_lhx.jpg b/static/member/2022/frontends_ios_golang_lhx.jpg new file mode 100644 index 0000000..f9be30e Binary files /dev/null and b/static/member/2022/frontends_ios_golang_lhx.jpg differ diff --git a/static/member/2022/frontends_lx.jpg b/static/member/2022/frontends_lx.jpg new file mode 100644 index 0000000..bdc3e32 Binary files /dev/null and b/static/member/2022/frontends_lx.jpg differ diff --git a/static/member/2022/frontends_pcy.jpg b/static/member/2022/frontends_pcy.jpg new file mode 100644 index 0000000..c39b112 Binary files /dev/null and b/static/member/2022/frontends_pcy.jpg differ diff --git a/static/member/2022/frontends_python_wy.jpg b/static/member/2022/frontends_python_wy.jpg new file mode 100644 index 0000000..ea6122e Binary files /dev/null and b/static/member/2022/frontends_python_wy.jpg differ diff --git a/static/member/2022/frontends_python_zyy.jpg b/static/member/2022/frontends_python_zyy.jpg new file mode 100644 index 0000000..a15b8bb Binary files /dev/null and b/static/member/2022/frontends_python_zyy.jpg differ diff --git a/static/member/2022/frontends_szx.jpg b/static/member/2022/frontends_szx.jpg new file mode 100644 index 0000000..4091a5a Binary files /dev/null and b/static/member/2022/frontends_szx.jpg differ diff --git a/static/member/2022/frontends_wxy.jpg b/static/member/2022/frontends_wxy.jpg new file mode 100644 index 0000000..6729e5e Binary files /dev/null and b/static/member/2022/frontends_wxy.jpg differ diff --git a/static/member/2022/frontends_wzr.jpg b/static/member/2022/frontends_wzr.jpg new file mode 100644 index 0000000..ce5bd6e Binary files /dev/null and b/static/member/2022/frontends_wzr.jpg differ diff --git a/static/member/2022/frontends_zjz.jpg b/static/member/2022/frontends_zjz.jpg new file mode 100644 index 0000000..76eb80d Binary files /dev/null and b/static/member/2022/frontends_zjz.jpg differ diff --git a/static/member/2022/golang_ckf.jpg b/static/member/2022/golang_ckf.jpg new file mode 100644 index 0000000..354fb04 Binary files /dev/null and b/static/member/2022/golang_ckf.jpg differ diff --git a/static/member/2022/golang_fyc.jpg b/static/member/2022/golang_fyc.jpg new file mode 100644 index 0000000..18ad1d2 Binary files /dev/null and b/static/member/2022/golang_fyc.jpg differ diff --git a/static/member/2022/golang_zzy.jpg b/static/member/2022/golang_zzy.jpg new file mode 100644 index 0000000..e12abd0 Binary files /dev/null and b/static/member/2022/golang_zzy.jpg differ diff --git a/static/member/2022/java_cy.jpg b/static/member/2022/java_cy.jpg new file mode 100644 index 0000000..4f135e9 Binary files /dev/null and b/static/member/2022/java_cy.jpg differ diff --git a/static/member/2022/java_czf.jpg b/static/member/2022/java_czf.jpg new file mode 100644 index 0000000..a83e03e Binary files /dev/null and b/static/member/2022/java_czf.jpg differ diff --git a/static/member/2022/java_czh.jpg b/static/member/2022/java_czh.jpg new file mode 100644 index 0000000..c961550 Binary files /dev/null and b/static/member/2022/java_czh.jpg differ diff --git a/static/member/2022/java_hjq.jpg b/static/member/2022/java_hjq.jpg new file mode 100644 index 0000000..44ee3d3 Binary files /dev/null and b/static/member/2022/java_hjq.jpg differ diff --git a/static/member/2022/java_lb.jpg b/static/member/2022/java_lb.jpg new file mode 100644 index 0000000..0ef6dbd Binary files /dev/null and b/static/member/2022/java_lb.jpg differ diff --git a/static/member/2022/java_ljh.jpg b/static/member/2022/java_ljh.jpg new file mode 100644 index 0000000..6399989 Binary files /dev/null and b/static/member/2022/java_ljh.jpg differ diff --git a/static/member/2022/java_lyd.jpg b/static/member/2022/java_lyd.jpg new file mode 100644 index 0000000..ef6ba72 Binary files /dev/null and b/static/member/2022/java_lyd.jpg differ diff --git a/static/member/2022/java_lzp.jpg b/static/member/2022/java_lzp.jpg new file mode 100644 index 0000000..3a14af5 Binary files /dev/null and b/static/member/2022/java_lzp.jpg differ diff --git a/static/member/2022/java_sjs.jpg b/static/member/2022/java_sjs.jpg new file mode 100644 index 0000000..1f5427c Binary files /dev/null and b/static/member/2022/java_sjs.jpg differ diff --git a/static/member/2022/java_xyj.jpg b/static/member/2022/java_xyj.jpg new file mode 100644 index 0000000..54f967c Binary files /dev/null and b/static/member/2022/java_xyj.jpg differ diff --git a/static/member/2022/java_yjj.jpg b/static/member/2022/java_yjj.jpg new file mode 100644 index 0000000..aee8c47 Binary files /dev/null and b/static/member/2022/java_yjj.jpg differ diff --git a/static/member/2022/java_yrw.jpg b/static/member/2022/java_yrw.jpg new file mode 100644 index 0000000..afe7776 Binary files /dev/null and b/static/member/2022/java_yrw.jpg differ diff --git a/static/member/2022/java_zcx.jpg b/static/member/2022/java_zcx.jpg new file mode 100644 index 0000000..dfb859b Binary files /dev/null and b/static/member/2022/java_zcx.jpg differ diff --git a/static/member/2022/java_zl.jpg b/static/member/2022/java_zl.jpg new file mode 100644 index 0000000..87c3ab8 Binary files /dev/null and b/static/member/2022/java_zl.jpg differ diff --git a/static/member/2022/python_cxy.jpg b/static/member/2022/python_cxy.jpg new file mode 100644 index 0000000..58f39a3 Binary files /dev/null and b/static/member/2022/python_cxy.jpg differ diff --git a/static/member/2022/python_gbq.jpg b/static/member/2022/python_gbq.jpg new file mode 100644 index 0000000..2f7b582 Binary files /dev/null and b/static/member/2022/python_gbq.jpg differ diff --git a/static/member/2022/python_lzp.jpg b/static/member/2022/python_lzp.jpg new file mode 100644 index 0000000..985072d Binary files /dev/null and b/static/member/2022/python_lzp.jpg differ diff --git a/static/member/2022/unity_hhc.jpg b/static/member/2022/unity_hhc.jpg new file mode 100644 index 0000000..48f5355 Binary files /dev/null and b/static/member/2022/unity_hhc.jpg differ diff --git a/static/member/2022/unity_hkh.jpg b/static/member/2022/unity_hkh.jpg new file mode 100644 index 0000000..0fcd185 Binary files /dev/null and b/static/member/2022/unity_hkh.jpg differ diff --git a/static/member/2022/unity_hzy.jpg b/static/member/2022/unity_hzy.jpg new file mode 100644 index 0000000..b8387b5 Binary files /dev/null and b/static/member/2022/unity_hzy.jpg differ diff --git a/static/member/2022/unity_lqy.jpg b/static/member/2022/unity_lqy.jpg new file mode 100644 index 0000000..d79fc7a Binary files /dev/null and b/static/member/2022/unity_lqy.jpg differ diff --git a/static/member/2022/unity_wjy.jpg b/static/member/2022/unity_wjy.jpg new file mode 100644 index 0000000..c72abbe Binary files /dev/null and b/static/member/2022/unity_wjy.jpg differ diff --git a/static/member/2022/unity_ywx.jpg b/static/member/2022/unity_ywx.jpg new file mode 100644 index 0000000..a4960bc Binary files /dev/null and b/static/member/2022/unity_ywx.jpg differ diff --git a/static/member/2022/unity_yxx.jpg b/static/member/2022/unity_yxx.jpg new file mode 100644 index 0000000..b12b30b Binary files /dev/null and b/static/member/2022/unity_yxx.jpg differ