From 842112898ae3e4dbac4b20bbec32349076b4894c Mon Sep 17 00:00:00 2001 From: Blucas <15555602203@163.com> Date: Mon, 4 Dec 2023 15:49:01 +0800 Subject: [PATCH 1/2] feat: search by title --- src/assets/locales/en.json | 3 ++- src/assets/locales/ja.json | 3 ++- src/assets/locales/ko.json | 3 ++- src/assets/locales/zh.json | 3 ++- src/pages/RoomList/index.tsx | 14 ++++++++++++-- 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/assets/locales/en.json b/src/assets/locales/en.json index 9e3c681f..590b55f7 100644 --- a/src/assets/locales/en.json +++ b/src/assets/locales/en.json @@ -14,7 +14,8 @@ "os": "OS", "browser": "Browser", "project": "Project", - "debug": "Debug" + "debug": "Debug", + "title": "Title" }, "error": { "oops": "Oops! Errors happened~", diff --git a/src/assets/locales/ja.json b/src/assets/locales/ja.json index 96c765a6..61346443 100644 --- a/src/assets/locales/ja.json +++ b/src/assets/locales/ja.json @@ -14,7 +14,8 @@ "os": "オペレーティング システム", "browser": "ブラウザ", "project": "プロジェクト", - "debug": "デバッグ" + "debug": "デバッグ", + "title": "タイトル" }, "error": { "oops": "おっと!エラーが発生しました。", diff --git a/src/assets/locales/ko.json b/src/assets/locales/ko.json index daf4787e..f3a2c6aa 100644 --- a/src/assets/locales/ko.json +++ b/src/assets/locales/ko.json @@ -14,7 +14,8 @@ "os": "운영 체제", "browser": "브라우저", "project": "프로젝트", - "debug": "디버그" + "debug": "디버그", + "title": "제목" }, "error": { "oops": "이런! 오류가 발생했습니다.", diff --git a/src/assets/locales/zh.json b/src/assets/locales/zh.json index 63e8de95..0bdbe17f 100644 --- a/src/assets/locales/zh.json +++ b/src/assets/locales/zh.json @@ -14,7 +14,8 @@ "os": "系统", "browser": "浏览器", "project": "项目", - "debug": "调试" + "debug": "调试", + "title": "标题" }, "error": { "oops": " 哎呀!发生错误~", diff --git a/src/pages/RoomList/index.tsx b/src/pages/RoomList/index.tsx index fb72c408..7aa750a5 100644 --- a/src/pages/RoomList/index.tsx +++ b/src/pages/RoomList/index.tsx @@ -39,10 +39,14 @@ const sortConnections = (data: I.SpyRoom[]) => { const filterConnections = ( data: I.SpyRoom[], - condition: Record<'address' | 'os' | 'browser', string>, + condition: Record<'title' | 'address' | 'os' | 'browser', string>, ) => { - const { address = '', os = '', browser = '' } = condition; + const { title = '', address = '', os = '', browser = '' } = condition; + const lowerCaseTitle = String(title).trim().toLowerCase(); return data + .filter(({ tags }) => { + return String(tags.title).toLowerCase().includes(lowerCaseTitle); + }) .filter((i) => i.address.slice(0, 4).includes(address || '')) .filter(({ name }) => { const { osName, browserName } = resolveClientInfo(name); @@ -86,6 +90,7 @@ export const RoomList = () => { ); const [conditions, setConditions] = useState({ + title: '', address: '', os: '', browser: '', @@ -221,6 +226,11 @@ export const RoomList = () => { + + + + + From ed72b061ac2056c73f39b84ec64fb552c431da4e Mon Sep 17 00:00:00 2001 From: Blucas <15555602203@163.com> Date: Mon, 4 Dec 2023 15:52:29 +0800 Subject: [PATCH 2/2] chore: upgrade SDK --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 95b7d7bd..b845ae94 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ }, "devDependencies": { "@babel/eslint-parser": "^7.19.1", - "@huolala-tech/page-spy": "^1.4.1", + "@huolala-tech/page-spy": "^1.4.3", "@mdx-js/rollup": "^2.3.0", "@types/lodash-es": "^4.17.7", "@types/mdx": "^2.0.4", diff --git a/yarn.lock b/yarn.lock index dee92864..cb20d7c4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -746,10 +746,10 @@ "@huolala-tech/page-spy-api-win32-arm" "1.2.2" "@huolala-tech/page-spy-api-win32-arm64" "1.2.2" -"@huolala-tech/page-spy@^1.4.1": - version "1.4.1" - resolved "https://registry.npmjs.org/@huolala-tech/page-spy/-/page-spy-1.4.1.tgz#98c2f85c222f9fb6749b4f360016157056d499f3" - integrity sha512-96QRoMiZggoF2o8y2Lr665/nImi7hwyGsISSAlboOhvIhaZh3RTk0IWHlJkbV5TL37h1AbMhNhOu5Q7NyTPZHg== +"@huolala-tech/page-spy@^1.4.3": + version "1.4.3" + resolved "https://registry.npmjs.org/@huolala-tech/page-spy/-/page-spy-1.4.3.tgz#53cca424889bd7bc9f29ddc43659082caf10f37d" + integrity sha512-uRiv3JIpCFSoAjpqHOZtzd6QlhhKyQiKqznEtj09hOcwtDNVUNcet1uwjxtHTsreSKtEof+vgNzbffSwbnUqsA== dependencies: "@babel/runtime" "^7.13.0" copy-to-clipboard "^3.3.1"