feat: visibility click filter (#463)

* feat: visibility click filter

* update

Co-authored-by: boojack <stevenlgtm@gmail.com>
This commit is contained in:
Zeng1998
2022-11-13 21:23:40 +08:00
committed by GitHub
parent a90acdabb3
commit d208731f5f
5 changed files with 42 additions and 5 deletions

View File

@ -17,9 +17,9 @@ const MemoList = () => {
const { memos, isFetching } = useAppSelector((state) => state.memo);
const [isComplete, setIsComplete] = useState<boolean>(false);
const { tag: tagQuery, duration, type: memoType, text: textQuery, shortcutId } = query ?? {};
const { tag: tagQuery, duration, type: memoType, text: textQuery, shortcutId, visibility } = query ?? {};
const shortcut = shortcutId ? shortcutService.getShortcutById(shortcutId) : null;
const showMemoFilter = Boolean(tagQuery || (duration && duration.from < duration.to) || memoType || textQuery || shortcut);
const showMemoFilter = Boolean(tagQuery || (duration && duration.from < duration.to) || memoType || textQuery || shortcut || visibility);
const shownMemos =
showMemoFilter || shortcut
@ -65,6 +65,9 @@ const MemoList = () => {
if (textQuery && !memo.content.toLowerCase().includes(textQuery.toLowerCase())) {
shouldShow = false;
}
if (visibility) {
shouldShow = memo.visibility === visibility;
}
return shouldShow;
})