diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..06c2b40 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,5 @@ +#!/bin/sh + +. "$(dirname "$0")/_/husky.sh" + +npm test diff --git a/.husky/pre-push b/.husky/pre-push new file mode 100644 index 0000000..952f7e3 --- /dev/null +++ b/.husky/pre-push @@ -0,0 +1,5 @@ +#!/bin/sh + +. "$(dirname "$0")/_/husky.sh" + +npm run build diff --git a/fix-script.ts b/fix-script.ts new file mode 100644 index 0000000..d965e0f --- /dev/null +++ b/fix-script.ts @@ -0,0 +1,25 @@ +import { promises } from 'fs'; + +const title = 'fix Parcel bundle', + filePattern = /^index\..+\.js$/i, + bugPattern = /\$\w+?\$import\$\w+?;/g; + +console.time(title); + +(async () => { + const files = await promises.readdir('dist'); + + for (const name of files) + if (filePattern.test(name)) { + const file = `dist/${name}`; + + const source = await promises.readFile(file, { encoding: 'utf-8' }); + + if (!bugPattern.test(source)) continue; + + await promises.writeFile(file, source.replace(bugPattern, '')); + + console.log(`[fixed] ${file}`); + } + console.timeEnd(title); +})(); diff --git a/package.json b/package.json index a1144e6..dd2cf86 100644 --- a/package.json +++ b/package.json @@ -48,6 +48,7 @@ "parcel-transformer-markdown": "^3.0.1", "prettier": "^3.2.4", "process": "^0.11.10", + "tsx": "^4.7.0", "typescript": "~5.3.3", "workbox-cli": "^7.0.0" }, @@ -69,13 +70,15 @@ "*.{html,md,less,json,yml}": "prettier --write", "*.{js,ts,tsx}": "eslint --fix" }, + "browserslist": "> 0.5%, last 2 versions, not dead, IE 11", "scripts": { + "prepare": "husky install", "test": "lint-staged", "clean": "rm -rf .parcel-cache/ dist/", "start:local": "npm run clean && cross-env HTTP_ENV=local parcel source/index.html --open", "start:remote": "npm run clean && cross-env HTTP_ENV=remote parcel source/index.html --open", "start": "npm run clean && cross-env HTTP_ENV=test parcel source/index.html --open", - "pack-dist": "parcel build source/index.html --public-url .", + "pack-dist": "parcel build source/index.html --public-url . --no-source-maps && tsx fix-script", "pack-sw": "rm -f dist/sw.js.map && workbox generateSW", "build": "npm run clean && npm run pack-dist && npm run pack-sw" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7160aff..94970ae 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -106,6 +106,9 @@ devDependencies: process: specifier: ^0.11.10 version: 0.11.10 + tsx: + specifier: ^4.7.0 + version: 4.7.0 typescript: specifier: ~5.3.3 version: 5.3.3 @@ -1320,6 +1323,213 @@ packages: to-fast-properties: 2.0.0 dev: true + /@esbuild/aix-ppc64@0.19.11: + resolution: {integrity: sha512-FnzU0LyE3ySQk7UntJO4+qIiQgI7KoODnZg5xzXIrFJlKd2P2gwHsHY4927xj9y5PJmJSzULiUCWmv7iWnNa7g==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [aix] + requiresBuild: true + dev: true + optional: true + + /@esbuild/android-arm64@0.19.11: + resolution: {integrity: sha512-aiu7K/5JnLj//KOnOfEZ0D90obUkRzDMyqd/wNAUQ34m4YUPVhRZpnqKV9uqDGxT7cToSDnIHsGooyIczu9T+Q==} + engines: {node: '>=12'} + cpu: [arm64] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@esbuild/android-arm@0.19.11: + resolution: {integrity: sha512-5OVapq0ClabvKvQ58Bws8+wkLCV+Rxg7tUVbo9xu034Nm536QTII4YzhaFriQ7rMrorfnFKUsArD2lqKbFY4vw==} + engines: {node: '>=12'} + cpu: [arm] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@esbuild/android-x64@0.19.11: + resolution: {integrity: sha512-eccxjlfGw43WYoY9QgB82SgGgDbibcqyDTlk3l3C0jOVHKxrjdc9CTwDUQd0vkvYg5um0OH+GpxYvp39r+IPOg==} + engines: {node: '>=12'} + cpu: [x64] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@esbuild/darwin-arm64@0.19.11: + resolution: {integrity: sha512-ETp87DRWuSt9KdDVkqSoKoLFHYTrkyz2+65fj9nfXsaV3bMhTCjtQfw3y+um88vGRKRiF7erPrh/ZuIdLUIVxQ==} + engines: {node: '>=12'} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@esbuild/darwin-x64@0.19.11: + resolution: {integrity: sha512-fkFUiS6IUK9WYUO/+22omwetaSNl5/A8giXvQlcinLIjVkxwTLSktbF5f/kJMftM2MJp9+fXqZ5ezS7+SALp4g==} + engines: {node: '>=12'} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@esbuild/freebsd-arm64@0.19.11: + resolution: {integrity: sha512-lhoSp5K6bxKRNdXUtHoNc5HhbXVCS8V0iZmDvyWvYq9S5WSfTIHU2UGjcGt7UeS6iEYp9eeymIl5mJBn0yiuxA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/freebsd-x64@0.19.11: + resolution: {integrity: sha512-JkUqn44AffGXitVI6/AbQdoYAq0TEullFdqcMY/PCUZ36xJ9ZJRtQabzMA+Vi7r78+25ZIBosLTOKnUXBSi1Kw==} + engines: {node: '>=12'} + cpu: [x64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-arm64@0.19.11: + resolution: {integrity: sha512-LneLg3ypEeveBSMuoa0kwMpCGmpu8XQUh+mL8XXwoYZ6Be2qBnVtcDI5azSvh7vioMDhoJFZzp9GWp9IWpYoUg==} + engines: {node: '>=12'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-arm@0.19.11: + resolution: {integrity: sha512-3CRkr9+vCV2XJbjwgzjPtO8T0SZUmRZla+UL1jw+XqHZPkPgZiyWvbDvl9rqAN8Zl7qJF0O/9ycMtjU67HN9/Q==} + engines: {node: '>=12'} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-ia32@0.19.11: + resolution: {integrity: sha512-caHy++CsD8Bgq2V5CodbJjFPEiDPq8JJmBdeyZ8GWVQMjRD0sU548nNdwPNvKjVpamYYVL40AORekgfIubwHoA==} + engines: {node: '>=12'} + cpu: [ia32] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-loong64@0.19.11: + resolution: {integrity: sha512-ppZSSLVpPrwHccvC6nQVZaSHlFsvCQyjnvirnVjbKSHuE5N24Yl8F3UwYUUR1UEPaFObGD2tSvVKbvR+uT1Nrg==} + engines: {node: '>=12'} + cpu: [loong64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-mips64el@0.19.11: + resolution: {integrity: sha512-B5x9j0OgjG+v1dF2DkH34lr+7Gmv0kzX6/V0afF41FkPMMqaQ77pH7CrhWeR22aEeHKaeZVtZ6yFwlxOKPVFyg==} + engines: {node: '>=12'} + cpu: [mips64el] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-ppc64@0.19.11: + resolution: {integrity: sha512-MHrZYLeCG8vXblMetWyttkdVRjQlQUb/oMgBNurVEnhj4YWOr4G5lmBfZjHYQHHN0g6yDmCAQRR8MUHldvvRDA==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-riscv64@0.19.11: + resolution: {integrity: sha512-f3DY++t94uVg141dozDu4CCUkYW+09rWtaWfnb3bqe4w5NqmZd6nPVBm+qbz7WaHZCoqXqHz5p6CM6qv3qnSSQ==} + engines: {node: '>=12'} + cpu: [riscv64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-s390x@0.19.11: + resolution: {integrity: sha512-A5xdUoyWJHMMlcSMcPGVLzYzpcY8QP1RtYzX5/bS4dvjBGVxdhuiYyFwp7z74ocV7WDc0n1harxmpq2ePOjI0Q==} + engines: {node: '>=12'} + cpu: [s390x] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-x64@0.19.11: + resolution: {integrity: sha512-grbyMlVCvJSfxFQUndw5mCtWs5LO1gUlwP4CDi4iJBbVpZcqLVT29FxgGuBJGSzyOxotFG4LoO5X+M1350zmPA==} + engines: {node: '>=12'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/netbsd-x64@0.19.11: + resolution: {integrity: sha512-13jvrQZJc3P230OhU8xgwUnDeuC/9egsjTkXN49b3GcS5BKvJqZn86aGM8W9pd14Kd+u7HuFBMVtrNGhh6fHEQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [netbsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/openbsd-x64@0.19.11: + resolution: {integrity: sha512-ysyOGZuTp6SNKPE11INDUeFVVQFrhcNDVUgSQVDzqsqX38DjhPEPATpid04LCoUr2WXhQTEZ8ct/EgJCUDpyNw==} + engines: {node: '>=12'} + cpu: [x64] + os: [openbsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/sunos-x64@0.19.11: + resolution: {integrity: sha512-Hf+Sad9nVwvtxy4DXCZQqLpgmRTQqyFyhT3bZ4F2XlJCjxGmRFF0Shwn9rzhOYRB61w9VMXUkxlBy56dk9JJiQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [sunos] + requiresBuild: true + dev: true + optional: true + + /@esbuild/win32-arm64@0.19.11: + resolution: {integrity: sha512-0P58Sbi0LctOMOQbpEOvOL44Ne0sqbS0XWHMvvrg6NE5jQ1xguCSSw9jQeUk2lfrXYsKDdOe6K+oZiwKPilYPQ==} + engines: {node: '>=12'} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@esbuild/win32-ia32@0.19.11: + resolution: {integrity: sha512-6YOrWS+sDJDmshdBIQU+Uoyh7pQKrdykdefC1avn76ss5c+RN6gut3LZA4E2cH5xUEp5/cA0+YxRaVtRAb0xBg==} + engines: {node: '>=12'} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@esbuild/win32-x64@0.19.11: + resolution: {integrity: sha512-vfkhltrjCAb603XaFhqhAF4LGDi2M4OrCRrFusyQ+iTLQ/o60QQXxc9cZC/FFpihBI9N1Grn6SMKVJ4KP7Fuiw==} + engines: {node: '>=12'} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + /@eslint-community/eslint-utils@4.4.0(eslint@8.56.0): resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -3726,6 +3936,37 @@ packages: is-symbol: 1.0.4 dev: true + /esbuild@0.19.11: + resolution: {integrity: sha512-HJ96Hev2hX/6i5cDVwcqiJBBtuo9+FeIJOtZ9W1kA5M6AMJRHUZlpYZ1/SbEwtO0ioNAW8rUooVpC/WehY2SfA==} + engines: {node: '>=12'} + hasBin: true + requiresBuild: true + optionalDependencies: + '@esbuild/aix-ppc64': 0.19.11 + '@esbuild/android-arm': 0.19.11 + '@esbuild/android-arm64': 0.19.11 + '@esbuild/android-x64': 0.19.11 + '@esbuild/darwin-arm64': 0.19.11 + '@esbuild/darwin-x64': 0.19.11 + '@esbuild/freebsd-arm64': 0.19.11 + '@esbuild/freebsd-x64': 0.19.11 + '@esbuild/linux-arm': 0.19.11 + '@esbuild/linux-arm64': 0.19.11 + '@esbuild/linux-ia32': 0.19.11 + '@esbuild/linux-loong64': 0.19.11 + '@esbuild/linux-mips64el': 0.19.11 + '@esbuild/linux-ppc64': 0.19.11 + '@esbuild/linux-riscv64': 0.19.11 + '@esbuild/linux-s390x': 0.19.11 + '@esbuild/linux-x64': 0.19.11 + '@esbuild/netbsd-x64': 0.19.11 + '@esbuild/openbsd-x64': 0.19.11 + '@esbuild/sunos-x64': 0.19.11 + '@esbuild/win32-arm64': 0.19.11 + '@esbuild/win32-ia32': 0.19.11 + '@esbuild/win32-x64': 0.19.11 + dev: true + /escalade@3.1.1: resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} engines: {node: '>=6'} @@ -4066,6 +4307,12 @@ packages: get-intrinsic: 1.2.2 dev: true + /get-tsconfig@4.7.2: + resolution: {integrity: sha512-wuMsz4leaj5hbGgg4IvDU0bqJagpftG5l5cXIAvo8uZrqn0NJqwtfupTN00VnkQJPcIRrxYrm1Ue24btpCha2A==} + dependencies: + resolve-pkg-maps: 1.0.0 + dev: true + /github-web-widget@4.0.0-rc.1(typescript@5.3.3): resolution: {integrity: sha512-QFZ408NQR/XA4iw+9Lb71zRhZV4DF8Q05dq0CaOP/D28+L+mrGHHuz0wNUuHpnhYc5OwjAxz/rGE33/6uXqj7g==} peerDependencies: @@ -5776,6 +6023,10 @@ packages: engines: {node: '>=4'} dev: true + /resolve-pkg-maps@1.0.0: + resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==} + dev: true + /resolve@1.22.8: resolution: {integrity: sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==} hasBin: true @@ -6301,6 +6552,17 @@ packages: /tslib@2.6.2: resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} + /tsx@4.7.0: + resolution: {integrity: sha512-I+t79RYPlEYlHn9a+KzwrvEwhJg35h/1zHsLC2JXvhC2mdynMv6Zxzvhv5EMV6VF5qJlLlkSnMVvdZV3PSIGcg==} + engines: {node: '>=18.0.0'} + hasBin: true + dependencies: + esbuild: 0.19.11 + get-tsconfig: 4.7.2 + optionalDependencies: + fsevents: 2.3.3 + dev: true + /type-check@0.4.0: resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} engines: {node: '>= 0.8.0'} diff --git a/source/component/AuditBar.tsx b/source/component/AuditBar.tsx index 66e7497..cb69fb8 100644 --- a/source/component/AuditBar.tsx +++ b/source/component/AuditBar.tsx @@ -1,48 +1,44 @@ -import { createCell, Fragment } from 'web-cell'; +import { FC, observer } from 'web-cell'; import { diffTime } from 'web-utility'; -import { Button } from 'boot-cell/source/Form/Button'; +import { Button } from 'boot-cell'; import { TimeUnitName } from '../utility'; import { DataItem, Organization } from '../service'; import { session, BaseModel, VerifiableModel } from '../model'; -interface AuditBarProps extends DataItem, Organization { +export interface AuditBarProps extends DataItem, Organization { scope: string; model: BaseModel; } -function TimeStamp({ +const TimeStamp: FC> = ({ date, phone, label -}: { - date: string; - phone: string; - label: string; -}) { +}) => { const { distance, unit } = diffTime(date); return ( - + + ); -} +}; -export function AuditBar({ - createdAt, - updatedAt, - creator, - verified, - verifier, - objectId, - scope, - model -}: AuditBarProps) { +export const AuditBar: FC = observer(props => { + const { + createdAt, + updatedAt, + creator, + verified, + verifier, + objectId, + scope, + model + } = props; const isAdmin = session.hasRole('Admin'); - const authorized = - session.user?.objectId === creator.objectId || isAdmin || null; + const authorized = session.user?.objectId === creator.objectId || isAdmin; return ( <> @@ -51,7 +47,7 @@ export function AuditBar({ date={createdAt} phone={creator.mobilePhoneNumber} /> - {!verified ? null : ( + {verified && (
- {!districtFilter ? null : ( + {districtFilter && ( )} - {!admin ? null : ( - + {admin && ( + 审核 - + )}
- + extends mixin() {

{noMore ? '没有更多数据了' : '加载更多...'}

-
+ ); } diff --git a/source/component/DistrictFilter.tsx b/source/component/DistrictFilter.tsx index eef03e1..8745a41 100644 --- a/source/component/DistrictFilter.tsx +++ b/source/component/DistrictFilter.tsx @@ -1,52 +1,40 @@ -import { - WebCellProps, - component, - mixin, - watch, - attribute, - createCell, - Fragment -} from 'web-cell'; -import { observer } from 'mobx-web-cell'; -import { FieldProps } from 'boot-cell/source/Form/Field'; -import { DropMenu, DropMenuItem } from 'boot-cell/source/Navigator/DropMenu'; +import { WebCell, component, attribute, observer } from 'web-cell'; +import { observable } from 'mobx'; +import { FormControlProps, DropdownButton, DropdownItem } from 'boot-cell'; import { area } from '../model'; +import { GeoCode } from '../service'; -export interface District { - province?: string; - city?: string; - district?: string; -} +export type District = Partial>; -export type DistrictFilterProps = FieldProps & WebCellProps & District; +export type DistrictFilterProps = FormControlProps<'input'> & District; export interface DistrictEvent extends CustomEvent { detail: District; } +export interface DistrictFilter extends WebCell {} + +@component({ tagName: 'district-filter' }) @observer -@component({ - tagName: 'district-filter', - renderTarget: 'children' -}) -export class DistrictFilter extends mixin() { +export class DistrictFilter + extends HTMLElement + implements WebCell +{ @attribute - @watch - province = ''; + @observable + accessor province = ''; @attribute - @watch - city = ''; + @observable + accessor city = ''; @attribute - @watch - district = ''; + @observable + accessor district = ''; connectedCallback() { - this.classList.add('d-flex', 'flex-wrap'); - - super.connectedCallback(); + this.classList.add('d-flex', 'flex-wrap', 'gap-2'); } async change(level: keyof District, name: string) { @@ -67,60 +55,61 @@ export class DistrictFilter extends mixin() { break; } - const { defaultSlot, ...data } = this.props; + const { province, city, district } = this; this.emit( 'change', Object.fromEntries( - Object.entries(data).filter( + Object.entries({ province, city, district }).filter( ([key, value]) => value && value !== '全部' ) ) ); } - render({ province, city, district }: DistrictFilterProps) { - const allItem = { name: '全部' }; + render() { + const { province, city, district } = this, + allItem = { name: '全部' }; return ( <> - {[allItem, ...area.provinces].map(({ name }) => ( - this.change('province', name)} > {name} - + ))} - - + {[allItem, ...area.cities].map(({ name }) => ( - this.change('city', name)}> + this.change('city', name)}> {name} - + ))} - - + {[allItem, ...area.districts].map(({ name }) => ( - this.change('district', name)} > {name} - + ))} - + ); } diff --git a/source/component/InputGroup.tsx b/source/component/InputGroup.tsx new file mode 100644 index 0000000..0d1eab2 --- /dev/null +++ b/source/component/InputGroup.tsx @@ -0,0 +1,34 @@ +import classNames from 'classnames'; +import { FC, WebCellProps } from 'web-cell'; + +export interface InputGroupProps extends WebCellProps { + size?: 'sm' | 'lg'; +} + +export const InputGroup: FC = ({ + className = '', + size, + children, + ...props +}) => ( +
+ {children} +
+); + +export const InputGroupText: FC> = ({ + className = '', + children, + ...props +}) => ( + + {children} + +); diff --git a/source/page/Community/index.tsx b/source/page/Community/index.tsx index 60bb531..b938e62 100644 --- a/source/page/Community/index.tsx +++ b/source/page/Community/index.tsx @@ -1,39 +1,36 @@ -import { component, mixin, createCell } from 'web-cell'; -import { SpinnerBox } from 'boot-cell/source/Prompt/Spinner'; -import { GithubRepository } from 'github-web-widget/source/Repository'; +import { attribute, component, observer } from 'web-cell'; +import { Image, SpinnerBox } from 'boot-cell'; +import { GithubRepository } from 'github-web-widget'; +import { observable } from 'mobx'; import { Contributor, repository } from '../../service'; -interface CommunityPageState { - loading?: boolean; - list?: Contributor[]; -} +@component({ tagName: 'community-page' }) +@observer +export class CommunityPage extends HTMLElement { + @attribute + @observable + accessor loading = false; -@component({ - tagName: 'community-page', - renderTarget: 'children' -}) -export class CommunityPage extends mixin<{}, CommunityPageState>() { - state = { - loading: false, - list: [] - }; + @observable + accessor list: Contributor[] = []; async connectedCallback() { - this.setState({ loading: true }); + this.loading = true; + + this.list = await repository.getContributors(); - this.setState({ - list: await repository.getContributors(), - loading: false - }); + this.loading = false; } - render(_, { loading, list }: CommunityPageState) { + render() { + const { loading, list } = this; + return ( - -

开放社区

+ +

开放社区

-

开源代码

+

开源代码

() { owner="wuhan2020" repository="WebApp" /> -

开发志愿者

+

开发志愿者

    {list.map(({ html_url, avatar_url, login }) => ( @@ -51,12 +48,9 @@ export class CommunityPage extends mixin<{}, CommunityPageState>() { target="_blank" href={html_url} > - {login} diff --git a/source/page/Home.tsx b/source/page/Home.tsx index e0b040d..0f2e4fd 100644 --- a/source/page/Home.tsx +++ b/source/page/Home.tsx @@ -21,7 +21,7 @@ export const HomePage: FC = props => ( {title} diff --git a/source/page/Hospital/index.tsx b/source/page/Hospital/index.tsx index e863246..80a06df 100644 --- a/source/page/Hospital/index.tsx +++ b/source/page/Hospital/index.tsx @@ -1,18 +1,18 @@ -import { component, createCell } from 'web-cell'; -import { observer } from 'mobx-web-cell'; - -import { Card, CardFooter } from 'boot-cell/source/Content/Card'; -import { Button } from 'boot-cell/source/Form/Button'; -import { DropMenu, DropMenuItem } from 'boot-cell/source/Navigator/DropMenu'; +import { component, observer } from 'web-cell'; +import { + Card, + CardFooter, + Button, + DropdownButton, + DropdownItem +} from 'boot-cell'; import { suppliesRequirement, SuppliesRequirement } from '../../model'; -import { AuditBar, CardsPage } from '../../component'; +import { AuditBar } from '../../component/AuditBar'; +import { CardsPage } from '../../component/CardsPage'; +@component({ tagName: 'hospital-page' }) @observer -@component({ - tagName: 'hospital-page', - renderTarget: 'children' -}) export class HospitalPage extends CardsPage { scope = 'hospital'; model = suppliesRequirement; @@ -45,7 +45,7 @@ export class HospitalPage extends CardsPage {
    {contacts[0] && ( - {contacts.map(({ name, phone }) => ( - + {name}:{phone} - + ))} - + )}
    diff --git a/source/page/index.tsx b/source/page/index.tsx index 1a77c6d..b943ae9 100644 --- a/source/page/index.tsx +++ b/source/page/index.tsx @@ -31,8 +31,6 @@ import { CommunityPage } from './Community'; import Disclaimer from '../../Disclaimer.md'; // const routes = [ -// { paths: [''], component: HomePage }, -// { paths: [RouteRoot.Hospital], component: HospitalPage }, // { paths: [RouteRoot.Hospital + '/edit'], component: HospitalEdit }, // { paths: [RouteRoot.Logistics], component: LogisticsPage }, // { paths: [RouteRoot.Logistics + '/edit'], component: LogisticsEdit }, @@ -51,8 +49,7 @@ import Disclaimer from '../../Disclaimer.md'; // { // paths: [RouteRoot.Admin, RouteRoot.Admin + '/user'], // component: UserAdmin -// }, -// { paths: [RouteRoot.Community], component: CommunityPage } +// } // ], const userMenu = [ { @@ -115,9 +112,17 @@ export const PageFrame: FC = () => ( + +
    } + component={({ className = '', ...props }) => ( +
    + )} /> diff --git a/source/service/AMap.ts b/source/service/AMap.ts index c139317..4f4710b 100644 --- a/source/service/AMap.ts +++ b/source/service/AMap.ts @@ -44,7 +44,7 @@ export async function getSubDistricts(keywords = '中国') { return body!.districts[0].districts; } -type GeoCode = Record< +export type GeoCode = Record< 'location' | 'province' | 'city' | 'district' | 'street' | 'number', string >;