Skip to content

Commit

Permalink
feat(web): 加入 searchBar 组件
Browse files Browse the repository at this point in the history
  • Loading branch information
xinyao27 committed Jul 22, 2022
1 parent 6a63f7f commit df71220
Show file tree
Hide file tree
Showing 25 changed files with 812 additions and 489 deletions.
2 changes: 1 addition & 1 deletion mock/data.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"apiKey":"5c00f9696c97880bed9dc701168fa734e5f063132ba5a9df6775678b67b91db8", "appVersion":"0.0.0", "appType":"react", "timestamp":"2022-07-15T01:24:55.606Z", "category":"error", "type":"unhandledrejectionError", "sdk":{"platform":"ohbug-browser", "version":"2.0.3"}, "device":{"language":"zh-CN", "userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.114 Safari/537.36 Edg/103.0.1264.49", "title":"Ohbug", "url":"https://localhost:4000/"}, "detail":{"message":"this is a reject message in Promise", "stack":"Error: this is a reject message in Promise\n at https://localhost:4000/src/App.tsx:42:14\n at new Promise (<anonymous>)\n at https://localhost:4000/src/App.tsx:41:21\n at HTMLUnknownElement.callCallback2 (https://localhost:4000/node_modules/.vite/deps/react-dom_client.js?v=a7e32710:3449:22)\n at Object.invokeGuardedCallbackDev (https://localhost:4000/node_modules/.vite/deps/react-dom_client.js?v=a7e32710:3474:24)\n at invokeGuardedCallback (https://localhost:4000/node_modules/.vite/deps/react-dom_client.js?v=a7e32710:3508:39)\n at invokeGuardedCallbackAndCatchFirstError (https://localhost:4000/node_modules/.vite/deps/react-dom_client.js?v=a7e32710:3511:33)\n at executeDispatch (https://localhost:4000/node_modules/.vite/deps/react-dom_client.js?v=a7e32710:6546:11)\n at processDispatchQueueItemsInOrder (https://localhost:4000/node_modules/.vite/deps/react-dom_client.js?v=a7e32710:6566:15)\n at processDispatchQueue (https://localhost:4000/node_modules/.vite/deps/react-dom_client.js?v=a7e32710:6575:13)"}, "actions":[{"type":"click", "timestamp":"2022-07-15T01:24:55.605Z", "message":"click node", "data":{"tagName":"BUTTON", "id":"", "className":"", "name":"", "outerHTML":"<button>Promise错误</button>", "nodeType":1, "selector":"html > body > div#root > div#react-app > div > button:nth-child(2)"}}], "metadata":{}, "releaseStage":"production"}
{"apiKey":"e1c0b078de9ec6bc9a8d29ed882e68f3181d4a3ac24b55516a39a281f4c8b51c", "appVersion":"0.0.0", "appType":"react", "timestamp":"2022-07-15T01:24:55.606Z", "category":"error", "type":"unhandledrejectionError", "sdk":{"platform":"ohbug-browser", "version":"2.0.3"}, "device":{"language":"zh-CN", "userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.114 Safari/537.36 Edg/103.0.1264.49", "title":"Ohbug", "url":"https://localhost:4000/"}, "detail":{"message":"nothis is a reject message in Promise", "stack":"Error: this is a reject message in Promise\n at https://localhost:4000/src/App.tsx:42:14\n at new Promise (<anonymous>)\n at https://localhost:4000/src/App.tsx:41:21\n at HTMLUnknownElement.callCallback2 (https://localhost:4000/node_modules/.vite/deps/react-dom_client.js?v=a7e32710:3449:22)\n at Object.invokeGuardedCallbackDev (https://localhost:4000/node_modules/.vite/deps/react-dom_client.js?v=a7e32710:3474:24)\n at invokeGuardedCallback (https://localhost:4000/node_modules/.vite/deps/react-dom_client.js?v=a7e32710:3508:39)\n at invokeGuardedCallbackAndCatchFirstError (https://localhost:4000/node_modules/.vite/deps/react-dom_client.js?v=a7e32710:3511:33)\n at executeDispatch (https://localhost:4000/node_modules/.vite/deps/react-dom_client.js?v=a7e32710:6546:11)\n at processDispatchQueueItemsInOrder (https://localhost:4000/node_modules/.vite/deps/react-dom_client.js?v=a7e32710:6566:15)\n at processDispatchQueue (https://localhost:4000/node_modules/.vite/deps/react-dom_client.js?v=a7e32710:6575:13)"}, "actions":[{"type":"click", "timestamp":"2022-07-15T01:24:55.605Z", "message":"click node", "data":{"tagName":"BUTTON", "id":"", "className":"", "name":"", "outerHTML":"<button>Promise错误</button>", "nodeType":1, "selector":"html > body > div#root > div#react-app > div > button:nth-child(2)"}}], "metadata":{}, "releaseStage":"production"}
2 changes: 1 addition & 1 deletion mock/request.http
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
POST http://localhost:6660
content-type: application/json

{"apiKey":"5c00f9696c97880bed9dc701168fa734e5f063132ba5a9df6775678b67b91db8", "appVersion":"0.0.0", "appType":"react", "timestamp":"2022-07-15T01:24:55.606Z", "category":"error", "type":"unhandledrejectionError", "sdk":{"platform":"ohbug-browser", "version":"2.0.3"}, "device":{"language":"zh-CN", "userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.114 Safari/537.36 Edg/103.0.1264.49", "title":"Ohbug", "url":"https://localhost:4000/"}, "detail":{"message":"this is a reject message in Promise", "stack":"Error: this is a reject message in Promise\n at https://localhost:4000/src/App.tsx:42:14\n at new Promise (<anonymous>)\n at https://localhost:4000/src/App.tsx:41:21\n at HTMLUnknownElement.callCallback2 (https://localhost:4000/node_modules/.vite/deps/react-dom_client.js?v=a7e32710:3449:22)\n at Object.invokeGuardedCallbackDev (https://localhost:4000/node_modules/.vite/deps/react-dom_client.js?v=a7e32710:3474:24)\n at invokeGuardedCallback (https://localhost:4000/node_modules/.vite/deps/react-dom_client.js?v=a7e32710:3508:39)\n at invokeGuardedCallbackAndCatchFirstError (https://localhost:4000/node_modules/.vite/deps/react-dom_client.js?v=a7e32710:3511:33)\n at executeDispatch (https://localhost:4000/node_modules/.vite/deps/react-dom_client.js?v=a7e32710:6546:11)\n at processDispatchQueueItemsInOrder (https://localhost:4000/node_modules/.vite/deps/react-dom_client.js?v=a7e32710:6566:15)\n at processDispatchQueue (https://localhost:4000/node_modules/.vite/deps/react-dom_client.js?v=a7e32710:6575:13)"}, "actions":[{"type":"click", "timestamp":"2022-07-15T01:24:55.605Z", "message":"click node", "data":{"tagName":"BUTTON", "id":"", "className":"", "name":"", "outerHTML":"<button>Promise错误</button>", "nodeType":1, "selector":"html > body > div#root > div#react-app > div > button:nth-child(2)"}}], "metadata":{}, "releaseStage":"production"}
{"apiKey":"e1c0b078de9ec6bc9a8d29ed882e68f3181d4a3ac24b55516a39a281f4c8b51c", "appVersion":"0.0.0", "appType":"react", "timestamp":"2022-07-15T01:24:55.606Z", "category":"error", "type":"unhandledrejectionError", "sdk":{"platform":"ohbug-browser", "version":"2.0.3"}, "device":{"language":"zh-CN", "userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.114 Safari/537.36 Edg/103.0.1264.49", "title":"Ohbug", "url":"https://localhost:4000/"}, "detail":{"message":"this is a reject message in Promise", "stack":"Error: this is a reject message in Promise\n at https://localhost:4000/src/App.tsx:42:14\n at new Promise (<anonymous>)\n at https://localhost:4000/src/App.tsx:41:21\n at HTMLUnknownElement.callCallback2 (https://localhost:4000/node_modules/.vite/deps/react-dom_client.js?v=a7e32710:3449:22)\n at Object.invokeGuardedCallbackDev (https://localhost:4000/node_modules/.vite/deps/react-dom_client.js?v=a7e32710:3474:24)\n at invokeGuardedCallback (https://localhost:4000/node_modules/.vite/deps/react-dom_client.js?v=a7e32710:3508:39)\n at invokeGuardedCallbackAndCatchFirstError (https://localhost:4000/node_modules/.vite/deps/react-dom_client.js?v=a7e32710:3511:33)\n at executeDispatch (https://localhost:4000/node_modules/.vite/deps/react-dom_client.js?v=a7e32710:6546:11)\n at processDispatchQueueItemsInOrder (https://localhost:4000/node_modules/.vite/deps/react-dom_client.js?v=a7e32710:6566:15)\n at processDispatchQueue (https://localhost:4000/node_modules/.vite/deps/react-dom_client.js?v=a7e32710:6575:13)"}, "actions":[{"type":"click", "timestamp":"2022-07-15T01:24:55.605Z", "message":"click node", "data":{"tagName":"BUTTON", "id":"", "className":"", "name":"", "outerHTML":"<button>Promise错误</button>", "nodeType":1, "selector":"html > body > div#root > div#react-app > div > button:nth-child(2)"}}], "metadata":{}, "releaseStage":"production"}
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,42 +31,42 @@
"start": "cross-env NODE_ENV=production pnpm run setup && pnpm --parallel -r run start",
"setup": "cross-env NODE_ENV=production pnpm run prebuild && npx prisma migrate deploy && npx prisma db seed",
"studio": "npx prisma studio",
"lint": "eslint . --fix",
"prepublishOnly": "pnpm run build",
"lint": "pnpm -r run lint",
"test": "pnpm -r run test"
},
"dependencies": {
"@ohbug/browser": "^2.0.3",
"@ohbug/core": "^2.0.3",
"@ohbug/react": "^2.0.3",
"@ohbug/types": "^2.0.3",
"@ohbug/vue": "^2.0.3",
"@prisma/client": "^4.0.0",
"dayjs": "^1.11.3",
"@ohbug/browser": "^2.0.7",
"@ohbug/core": "^2.1.0",
"@ohbug/react": "^2.0.6",
"@ohbug/types": "^2.1.0",
"@ohbug/vue": "^2.0.6",
"@prisma/client": "^4.1.0",
"dayjs": "^1.11.4",
"js-yaml": "^4.1.0",
"nodemailer": "^6.7.7",
"ramda": "^0.28.0",
"source-map-trace": "^0.2.6"
},
"devDependencies": {
"@antfu/ni": "^0.17.2",
"@babel/types": "^7.18.8",
"@babel/types": "^7.18.9",
"@changesets/cli": "^2.23.2",
"@chenyueban/eslint-config": "^1.0.12",
"@chenyueban/tsconfig": "^2.1.0",
"@commitlint/cli": "^17.0.3",
"@types/js-yaml": "^4.0.5",
"@types/node": "^18.0.5",
"@types/node": "^18.0.6",
"@types/ramda": "^0.28.15",
"commitizen": "^4.2.4",
"commitizen": "^4.2.5",
"cross-env": "^7.0.3",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^8.20.0",
"husky": "^8.0.1",
"lint-staged": "^13.0.3",
"pm2": "^5.2.0",
"pnpm": "^7.5.2",
"prisma": "^4.0.0",
"prisma": "^4.1.0",
"rimraf": "^3.0.2",
"tsup": "^6.1.3",
"tsx": "^3.8.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"scripts": {
"prebuild": "rimraf dist",
"dev": "tsup src/index.ts --dts --format esm,cjs --watch --env.NODE_ENV development",
"build": "tsup src/index.ts --dts --format esm,cjs --env.NODE_ENV production"
"build": "tsup src/index.ts --dts --format esm,cjs --env.NODE_ENV production",
"lint": "tsc && eslint . --fix"
}
}
2 changes: 1 addition & 1 deletion packages/common/src/interfaces/issue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface Issue {
id: string
apiKey: string
type: string
metadata: MetaData
metadata: string
createdAt: Date
updatedAt: Date
_count?: {
Expand Down
3 changes: 2 additions & 1 deletion packages/config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"scripts": {
"prebuild": "rimraf dist",
"dev": "tsup src/index.ts --dts --format esm,cjs --watch --env.NODE_ENV development",
"build": "tsup src/index.ts --dts --format esm,cjs --env.NODE_ENV production"
"build": "tsup src/index.ts --dts --format esm,cjs --env.NODE_ENV production",
"lint": "tsc && eslint . --fix"
}
}
9 changes: 5 additions & 4 deletions packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,17 @@
"start:pm2": "pm2 start dist/main.js",
"dev": "nest start --watch",
"dev:debug": "nest start --debug --watch",
"dev:prod": "node dist/main"
"dev:prod": "node dist/main",
"lint": "tsc && eslint . --fix"
},
"dependencies": {
"@nestjs/axios": "^0.1.0",
"@nestjs/bull": "^0.6.0",
"@nestjs/common": "^9.0.3",
"@nestjs/common": "^9.0.5",
"@nestjs/config": "^2.2.0",
"@nestjs/core": "^9.0.3",
"@nestjs/core": "^9.0.5",
"@nestjs/mapped-types": "^1.1.0",
"@nestjs/platform-fastify": "^9.0.3",
"@nestjs/platform-fastify": "^9.0.5",
"@webundsoehne/nest-fastify-file-upload": "^2.0.0",
"bull": "^4.8.4",
"class-transformer": "^0.5.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/server/src/api/report/report.processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ export class ReportProcessor {
device: event.device as Prisma.InputJsonObject,
user: event.user as Prisma.InputJsonObject,
actions: event.actions as unknown as Prisma.InputJsonArray,
metadata: event.metadata as Prisma.InputJsonObject,
metadata: event.metadata,
issue: {
connectOrCreate: {
where: { id: issueIntro },
create: {
id: issueIntro,
apiKey: event.apiKey,
type: event.type,
metadata,
metadata: JSON.stringify(metadata),
users: {
connectOrCreate: {
where: {
Expand Down
12 changes: 7 additions & 5 deletions packages/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"dev": "next dev",
"build": "next build",
"start": "node server.js",
"lint": "next lint"
"lint": "tsc && eslint . --fix"
},
"dependencies": {
"@chakra-ui/react": "^2.2.4",
Expand All @@ -20,10 +20,12 @@
"framer-motion": "^6.5.1",
"highcharts": "^10.2.0",
"highcharts-react-official": "^3.1.0",
"jotai": "^1.7.5",
"jotai": "^1.7.6",
"kbar": "0.1.0-beta.36",
"next": "12.2.2",
"next-auth": "^4.10.0",
"next-auth": "^4.10.1",
"react": "18.2.0",
"react-device-detect": "^2.2.2",
"react-dom": "18.2.0",
"react-hook-form": "^7.33.1",
"react-icons": "^4.4.0",
Expand All @@ -32,10 +34,10 @@
"source-map-trace": "^0.2.6",
"swr": "^1.3.0",
"ua-parser-js": "^1.0.2",
"zustand": "4.0.0-rc.1"
"zustand": "4.0.0-rc.4"
},
"devDependencies": {
"@types/node": "^18.0.5",
"@types/node": "^18.0.6",
"@types/react": "18.0.15",
"@types/react-dom": "18.0.6",
"@types/ua-parser-js": "^0.7.36",
Expand Down
8 changes: 5 additions & 3 deletions packages/web/src/components/issueDetailTitle.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Box, Stat, StatGroup, StatLabel, StatNumber } from '@chakra-ui/react'
import type { FC } from 'react'
import { useMemo } from 'react'
import type { Issue, OhbugEventLike } from 'common'
import Title from './title'
import IssueDetailTabs from './issueDetailTabs'
Expand All @@ -11,6 +12,7 @@ interface Props {
}

const IssueDetailTitle: FC<Props> = ({ issue, event }) => {
const metadata = useMemo(() => JSON.parse(issue.metadata) || {}, [issue])
return (
<Title
bg="current"
Expand Down Expand Up @@ -48,17 +50,17 @@ const IssueDetailTitle: FC<Props> = ({ issue, event }) => {
{issue.type}
</Box>
<code>
{renderStringOrJson(issue.metadata.filename ?? issue.metadata.others)}
{renderStringOrJson(metadata.filename ?? metadata.others)}
</code>
</Box>
<Box
noOfLines={[1, 2]}
textColor="gray.400"
>
{
issue.metadata.message && (
metadata.message && (
<code>
{renderStringOrJson(issue.metadata.message)}
{renderStringOrJson(metadata.message)}
</code>
)
}
Expand Down
Loading

0 comments on commit df71220

Please sign in to comment.