Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement new advanced search by filter-sphere #1

Merged
merged 24 commits into from
Feb 4, 2025

Conversation

lawvs
Copy link
Contributor

@lawvs lawvs commented Jan 29, 2025

@yzqzss yzqzss requested a review from OverflowCat January 29, 2025 03:19
@yzqzss
Copy link
Member

yzqzss commented Jan 29, 2025

是大年初一的PR😍🤩!

@OverflowCat OverflowCat self-assigned this Jan 29, 2025
@OverflowCat
Copy link
Contributor

OverflowCat commented Jan 29, 2025 via email

@lawvs
Copy link
Contributor Author

lawvs commented Feb 2, 2025

按钮的样式我再抽空改一下,segmented button 部分现在是在高级搜索下新加了一个专家模式/开发者模式替代,然后路由跳转还有点问题,其他大概是好了,可以先测一下功能对不对

@yzqzss
Copy link
Member

yzqzss commented Feb 2, 2025

试了下,效果很好耶。

@lawvs lawvs force-pushed the feat/advanced-filter branch from 6e143b3 to 0db383f Compare February 3, 2025 11:24
@lawvs lawvs force-pushed the feat/advanced-filter branch from 0db383f to c510acc Compare February 3, 2025 17:20
@@ -66,7 +66,7 @@ export default function Home() {
<div className="my-8 w-full">
<Marquee items={marqueeItems} />
</div>
<p className="text-center text-sm text-text mb-4">
<div className="text-center text-sm text-text mb-4">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Screenshot 2025-02-04 at 02 04 43

@@ -7,14 +7,16 @@
},
"license": "MIT",
"scripts": {
"dev": "next dev --turbopack",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

开 --turbopack 有时会有个报错(好像有时又正常),没仔细研究

Screenshot 2025-02-04 at 03 14 33

@lawvs lawvs marked this pull request as ready for review February 3, 2025 19:14
@@ -40,7 +49,7 @@ const Input = React.forwardRef<
className
)}
ref={inputRef}
defaultValue={value}
value={value}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

更改 filter 的类型可能会清空输入框,因此更改为受控模式

Copy link
Member

Choose a reason for hiding this comment

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

改成受控模式之后,输入法就无法正常在输入框里输入了。

ref: https://foxact.skk.moe/use-composition-input
看文档的意思,useCompositionInput 不能被受控。

我 revert 了: e7e625f

import { FilterGroup } from "@fn-sphere/filter";
import { deserializeFilterGroup, serializeFilterGroup } from "./transform";

const STORAGE_KEY = "filter-rule-cache";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

由于没有实现 query 到 filter group 的 transform 方法(可能难以覆盖所有 case),这里在 local storage 暂存了一个 cache,用于在刷新页面时恢复状态,和写在 query 相比各有优缺点。

@yzqzss
Copy link
Member

yzqzss commented Feb 4, 2025

LGTM

不懂 TS,但是手动玩弄几下高级搜索没啥毛病。牢猫😷了,Review 不能。我先合了吧。

灰常感谢!

@yzqzss yzqzss merged commit 17d8897 into saveweb:main Feb 4, 2025
@lawvs lawvs deleted the feat/advanced-filter branch February 5, 2025 03:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants