Skip to content

Commit

Permalink
[fix] invalid Navigator links & Stage-2.7 badge color
Browse files Browse the repository at this point in the history
[optimize] simplify models based on MobX-RESTful 1.0
[optimize] update Upstream packages
  • Loading branch information
TechQuery committed Jun 20, 2024
1 parent df02902 commit 2bb55dc
Show file tree
Hide file tree
Showing 8 changed files with 206 additions and 143 deletions.
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,17 @@
"pack-dist": "npm run clean && parcel build source/index.html --public-url .",
"pack-sw": "rm -f dist/sw.js.map && workbox generateSW",
"start": "npm run clean && parcel source/index.html --open",
"test": "lint-staged"
"test": "lint-staged && tsc --noEmit"
},
"dependencies": {
"boot-cell": "^2.0.0-beta.29",
"browser-unhandled-rejection": "^1.0.2",
"cell-router": "^3.0.0-rc.7",
"cell-router": "^3.0.0-rc.8",
"classnames": "^2.5.1",
"dom-renderer": "^2.1.8",
"koajax": "^1.1.2",
"mobx": "^6.12.4",
"mobx-restful": "^1.0.0",
"web-cell": "^3.0.0-rc.16",
"web-utility": "^4.4.0"
},
Expand All @@ -33,14 +34,14 @@
"@parcel/transformer-less": "2.12.0",
"@parcel/transformer-typescript-tsc": "~2.12.0",
"@parcel/transformer-webmanifest": "~2.12.0",
"@types/node": "^18.19.36",
"@types/node": "^18.19.37",
"husky": "^9.0.11",
"lint-staged": "^15.2.7",
"parcel": "~2.12.0",
"postcss": "^8.4.38",
"postcss-modules": "^4.3.1",
"prettier": "^3.3.2",
"typescript": "~5.4.5",
"typescript": "~5.5.2",
"workbox-cli": "^7.1.0"
}
}
292 changes: 179 additions & 113 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions source/data/navigator-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const topMenu: NavMenu[] = [
{
title: '中文讨论',
target: '_blank',
href: 'https://github.com/JSCIG/es-discuss/discussions',
href: 'https://github.com/orgs/JSCIG/discussions',
},
{ title: '开放组织', target: '_blank', href: 'https://github.com/JSCIG' },
{
Expand Down Expand Up @@ -43,7 +43,11 @@ export const topMenu: NavMenu[] = [
target: '_blank',
href: 'https://compat-table.github.io/compat-table/es6/',
},
{ title: 'ES 6 学习', target: '_blank', href: 'http://es6-features.org/' },
{
title: 'ES 6 学习',
target: '_blank',
href: 'https://rse.github.io/es6-features/',
},
{ title: '技术委员会', target: '_blank', href: 'https://tc39.es/' },
{
title: '标准补丁',
Expand Down
11 changes: 3 additions & 8 deletions source/model/Member.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { observable } from 'mobx';
import { BaseModel, toggle } from 'mobx-restful';

import { service } from './service';

Expand All @@ -8,21 +9,15 @@ export type Member = Record<
> &
Partial<Record<'bio' | 'location' | 'company', string>>;

export class MemberModel {
@observable
accessor loading = false;

export class MemberModel extends BaseModel {
@observable
accessor list: Member[] = [];

@toggle('downloading')
async getList() {
this.loading = true;

const { body } = await service.get<Member[]>(
'https://jscig.github.io/dataset/members-jscig.json',
);
this.loading = false;

return (this.list = body);
}
}
15 changes: 6 additions & 9 deletions source/model/Proposal.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { observable, reaction } from 'mobx';
import { BaseModel, toggle } from 'mobx-restful';

import { service } from './service';
import { Member } from './Member';
Expand Down Expand Up @@ -34,29 +35,27 @@ export type ProposalSortKey =
| `${'stargazers' | 'open_issues'}_count`
| 'meeting_at';

export class ProposalModel {
@observable
accessor loading = false;

export class ProposalModel extends BaseModel {
@observable
accessor list: Proposal[] = [];

@observable
accessor sortKey: ProposalSortKey;
accessor sortKey: ProposalSortKey | undefined;

@observable
accessor finishedList: Proposal[] = [];

constructor() {
super();

reaction(
() => this.sortKey,
key => this.sortBy(key),
);
}

@toggle('downloading')
async getList() {
this.loading = true;

const { body } = await service.get<Proposal[]>(
'dataset/proposals.min.json',
);
Expand All @@ -77,8 +76,6 @@ export class ProposalModel {
[[], []] as Proposal[][],
);

this.loading = false;

return (this.finishedList = finished), (this.list = processing);
}

Expand Down
4 changes: 2 additions & 2 deletions source/page/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,13 @@ export class MainPage extends HTMLElement {

<h2 className="my-5 text-center">JSCIG 成员</h2>

<SpinnerBox className="row" cover={member.loading}>
<SpinnerBox className="row" cover={member.downloading > 0}>
{member.list.map(this.renderMember)}
</SpinnerBox>

<h2 className="my-5 text-center">TC39 既成提案</h2>

<SpinnerBox className="row" cover={proposal.loading}>
<SpinnerBox className="row" cover={proposal.downloading > 0}>
{proposal.finishedList.map(this.renderProposal)}
</SpinnerBox>
</>
Expand Down
7 changes: 3 additions & 4 deletions source/page/Proposal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export class ProposalPage extends HTMLElement {
className="stretched-link"
type="badge"
// @ts-ignore
bg={StageMap[stage + 1]}
bg={StageMap[stage + 1] || 'dark'}
path="proposals"
filter="stage"
value={stage}
Expand Down Expand Up @@ -232,14 +232,13 @@ export class ProposalPage extends HTMLElement {
);

render() {
const { stage, author, champion, data } = this,
{ loading } = proposal;
const { stage, author, champion, data } = this;

return (
<>
<h1 className="text-center py-3">ECMAScript 标准提案</h1>

<SpinnerBox className={style.box} cover={loading}>
<SpinnerBox className={style.box} cover={proposal.downloading > 0}>
<p className="text-center text-muted">
{stage != null ? `处于 Stage ${stage} 的` : null}
{author && `${author} 提交的`}
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"jsx": "react-jsx",
"jsxImportSource": "dom-renderer",
"lib": ["ES2023", "DOM"],
"skipLibCheck": true
},
"include": ["source/**/*"],
"include": ["source/**/*"]
}

1 comment on commit 2bb55dc

@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 jscig ready!

✅ Preview
https://jscig-qg1qbbny3-techquerys-projects.vercel.app

Built with commit 2bb55dc.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.