Skip to content

Commit

Permalink
[add] Language Menu component
Browse files Browse the repository at this point in the history
[add] Lark notification of Vercel preview environment
[optimize] Query & Render of Member List in Home page
[optimize] update Upstream packages
  • Loading branch information
TechQuery committed Dec 14, 2023
1 parent 3613dd5 commit 2417f17
Show file tree
Hide file tree
Showing 11 changed files with 429 additions and 336 deletions.
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ NEXT_PUBLIC_SITE_SUMMARY = 全行业信息化转型专家
NEXT_PUBLIC_LARK_BASE = bascnFeH8Q37XWX0LLlBB9ojQzf
NEXT_PUBLIC_CLIENT_TABLE = tblsb0vx4fqjSrGL
NEXT_PUBLIC_PROJECT_TABLE = tblCxasoUUub3buB
NEXT_PUBLIC_MEMBER_TABLE = tblJ98JHGEX0o6ij
NEXT_PUBLIC_MEMBER_TABLE = tblJ98JHGEX0o6ij
NEXT_PUBLIC_MEMBER_VIEW = vewLf4M0P8
58 changes: 32 additions & 26 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,15 @@ jobs:
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: pnpm/action-setup@v2
with:
version: 8

- uses: actions/setup-node@v3
if: ${{ !env.VERCEL_TOKEN || !env.VERCEL_ORG_ID || !env.VERCEL_PROJECT_ID }}
with:
node-version: 18
cache: pnpm

- name: Install Dependencies
if: ${{ !env.VERCEL_TOKEN || !env.VERCEL_ORG_ID || !env.VERCEL_PROJECT_ID }}
run: pnpm i --frozen-lockfile

- name: Export Static pages
if: ${{ !env.VERCEL_TOKEN || !env.VERCEL_ORG_ID || !env.VERCEL_PROJECT_ID }}
run: pnpm export

- name: Deploy to GitHub pages
uses: peaceiris/actions-gh-pages@v3
if: ${{ !env.VERCEL_TOKEN || !env.VERCEL_ORG_ID || !env.VERCEL_PROJECT_ID }}
- uses: actions/checkout@v4
if: ${{ env.VERCEL_TOKEN && env.VERCEL_ORG_ID && env.VERCEL_PROJECT_ID }}
with:
publish_dir: ./out
personal_token: ${{ secrets.GITHUB_TOKEN }}
force_orphan: true
submodules: recursive
lfs: true
- run: git submodule update --remote

- name: Deploy to Vercel
id: vercel-deployment
uses: amondnet/vercel-action@v25
if: ${{ env.VERCEL_TOKEN && env.VERCEL_ORG_ID && env.VERCEL_PROJECT_ID }}
with:
Expand All @@ -49,3 +29,29 @@ jobs:
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
working-directory: ./
vercel-args: --prod

- name: Lark notification
uses: foxundermoon/feishu-action@v2
with:
url: ${{ secrets.LARK_CHATBOT_HOOK_URL }}
msg_type: post
content: |
post:
zh_cn:
title: Vercel 预览环境
content:
- - tag: text
text: Git 仓库:
- tag: a
text: ${{ github.server_url }}/${{ github.repository }}
href: ${{ github.server_url }}/${{ github.repository }}
- - tag: text
text: 代码分支:
- tag: a
text: ${{ github.ref }}
href: ${{ github.server_url }}/${{ github.repository }}/tree/${{ github.ref_name }}
- - tag: text
text: 预览链接:
- tag: a
text: ${{ steps.vercel-deployment.outputs.preview-url }}
href: ${{ steps.vercel-deployment.outputs.preview-url }}
27 changes: 27 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
if: ${{ env.VERCEL_TOKEN && env.VERCEL_ORG_ID && env.VERCEL_PROJECT_ID }}

- name: Deploy to Vercel
id: vercel-deployment
uses: amondnet/vercel-action@v25
if: ${{ env.VERCEL_TOKEN && env.VERCEL_ORG_ID && env.VERCEL_PROJECT_ID }}
with:
Expand All @@ -23,3 +24,29 @@ jobs:
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
working-directory: ./

- name: Lark notification
uses: foxundermoon/feishu-action@v2
with:
url: ${{ secrets.LARK_CHATBOT_HOOK_URL }}
msg_type: post
content: |
post:
zh_cn:
title: Vercel 预览环境
content:
- - tag: text
text: Git 仓库:
- tag: a
text: ${{ github.server_url }}/${{ github.repository }}
href: ${{ github.server_url }}/${{ github.repository }}
- - tag: text
text: 代码分支:
- tag: a
text: ${{ github.ref }}
href: ${{ github.server_url }}/${{ github.repository }}/tree/${{ github.ref_name }}
- - tag: text
text: 预览链接:
- tag: a
text: ${{ steps.vercel-deployment.outputs.preview-url }}
href: ${{ steps.vercel-deployment.outputs.preview-url }}
24 changes: 24 additions & 0 deletions components/LanguageMenu.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Option, Select } from 'idea-react';
import { observer } from 'mobx-react';
import { FC } from 'react';

import { i18n, LanguageName } from '../models/Translation';

const LanguageMenu: FC = observer(() => {
const { currentLanguage } = i18n;

return (
<Select
value={currentLanguage}
onChange={key => i18n.changeLanguage(key as typeof currentLanguage)}
>
{Object.entries(LanguageName).map(([key, name]) => (
<Option key={key} value={key}>
{name}
</Option>
))}
</Select>
);
});

export default LanguageMenu;
3 changes: 2 additions & 1 deletion components/Member/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Avatar, Icon, text2color } from 'idea-react';
import { observer } from 'mobx-react';
import { FC } from 'react';
import { Badge, Card } from 'react-bootstrap';
import { Markdown } from 'react-marked-renderer';

import { Member } from '../../models/Member';

Expand All @@ -21,7 +22,7 @@ export const MemberCard: FC<MemberCardProps> = observer(
</Card.Title>
{position && <Card.Subtitle>{position + ''}</Card.Subtitle>}

<Card.Text>{summary + ''}</Card.Text>
<Markdown markdown={summary + ''} />
</Card.Body>

<Card.Footer>
Expand Down
8 changes: 7 additions & 1 deletion components/Project/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,13 @@ export const ProjectCard: FC<ProjectCardProps> = ({
</ul>
</Card.Body>
<Card.Footer className="d-flex">
<strong className="flex-fill"></strong>
<strong className="flex-fill">
{(price + '').replace(/\d/g, (matched, offset) =>
offset ? '0' : matched,
)}
+
</strong>

<time>🏁 {formatDate(+settlementDate!, 'YYYY-MM-DD')}</time>
</Card.Footer>
Expand Down
3 changes: 2 additions & 1 deletion models/Member.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ export type Member = Record<
TableCellValue
>;

const MEMBER_TABLE = process.env.NEXT_PUBLIC_MEMBER_TABLE!;
export const MEMBER_TABLE = process.env.NEXT_PUBLIC_MEMBER_TABLE!,
MEMBER_VIEW = process.env.NEXT_PUBLIC_MEMBER_VIEW!;

export class MemberModel extends BiDataTable<Member>() {
client = larkClient;
Expand Down
21 changes: 11 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,34 @@
"lodash": "^4.17.21",
"mobx": "~6.10.2",
"mobx-i18n": "^0.4.2",
"mobx-lark": "^1.0.0-rc.10",
"mobx-lark": "^1.0.0-rc.11",
"mobx-react": "~9.0.2",
"mobx-restful": "^0.6.12",
"mobx-restful-table": "^1.2.2",
"next": "^14.0.3",
"next": "^14.0.4",
"next-pwa": "~5.6.0",
"next-ssr-middleware": "^0.6.1",
"next-with-less": "^3.0.1",
"react": "^18.2.0",
"react-bootstrap": "^2.9.1",
"react-dom": "^18.2.0",
"react-marked-renderer": "^2.0.1",
"web-utility": "^4.1.3",
"webpack": "^5.89.0"
},
"devDependencies": {
"@octokit/openapi-types": "^19.1.0",
"@types/lodash": "^4.14.202",
"@types/node": "^18.19.0",
"@types/react": "^18.2.39",
"eslint": "^8.54.0",
"eslint-config-next": "^14.0.3",
"eslint-config-prettier": "^9.0.0",
"@types/node": "^18.19.3",
"@types/react": "^18.2.45",
"eslint": "^8.55.0",
"eslint-config-next": "^14.0.4",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-simple-import-sort": "^10.0.0",
"husky": "^8.0.3",
"lint-staged": "^15.1.0",
"prettier": "^3.1.0",
"typescript": "~5.3.2"
"lint-staged": "^15.2.0",
"prettier": "^3.1.1",
"typescript": "~5.3.3"
},
"prettier": {
"singleQuote": true,
Expand Down
Loading

1 comment on commit 2417f17

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for idea2app ready!

✅ Preview
https://idea2app-pgb6fd6zc-techquery.vercel.app

Built with commit 2417f17.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.