mirror of
https://github.com/aykhans/slash-e.git
synced 2025-07-06 21:22:36 +00:00
feat: add visibility filter
This commit is contained in:
@ -2,7 +2,7 @@ import { Button, Tab, TabList, Tabs } from "@mui/joy";
|
||||
import { useEffect, useState } from "react";
|
||||
import { shortcutService } from "../services";
|
||||
import { useAppSelector } from "../stores";
|
||||
import useViewStore, { Filter } from "../stores/v1/filter";
|
||||
import useViewStore, { Filter } from "../stores/v1/view";
|
||||
import useUserStore from "../stores/v1/user";
|
||||
import useLoading from "../hooks/useLoading";
|
||||
import Icon from "../components/Icon";
|
||||
@ -15,7 +15,7 @@ interface State {
|
||||
}
|
||||
|
||||
const getFilteredShortcutList = (shortcutList: Shortcut[], filter: Filter, currentUser: User) => {
|
||||
const { tag, mineOnly } = filter;
|
||||
const { tag, mineOnly, visibility } = filter;
|
||||
const filteredShortcutList = shortcutList.filter((shortcut) => {
|
||||
if (tag) {
|
||||
if (!shortcut.tags.includes(tag)) {
|
||||
@ -27,6 +27,11 @@ const getFilteredShortcutList = (shortcutList: Shortcut[], filter: Filter, curre
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (visibility) {
|
||||
if (shortcut.visibility !== visibility) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
return filteredShortcutList;
|
||||
|
Reference in New Issue
Block a user