mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
fix: web build
This commit is contained in:
@ -14,8 +14,8 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/lodash-es": "^4.17.5",
|
||||
"@types/react": "^18.0.8",
|
||||
"@types/react-dom": "^18.0.3",
|
||||
"@types/react": "^18.0.9",
|
||||
"@types/react-dom": "^18.0.4",
|
||||
"@typescript-eslint/eslint-plugin": "^5.6.0",
|
||||
"@typescript-eslint/parser": "^5.6.0",
|
||||
"@vitejs/plugin-react": "^1.0.0",
|
||||
|
@ -13,19 +13,19 @@ const MemoFilter: React.FC<FilterProps> = () => {
|
||||
} = useContext(appContext);
|
||||
|
||||
const { tag: tagQuery, duration, type: memoType, text: textQuery, shortcutId } = query;
|
||||
const queryFilter = shortcutService.getShortcutById(shortcutId);
|
||||
const showFilter = Boolean(tagQuery || (duration && duration.from < duration.to) || memoType || textQuery || queryFilter);
|
||||
const shortcut = shortcutId ? shortcutService.getShortcutById(shortcutId) : null;
|
||||
const showFilter = Boolean(tagQuery || (duration && duration.from < duration.to) || memoType || textQuery || shortcut);
|
||||
|
||||
return (
|
||||
<div className={`filter-query-container ${showFilter ? "" : "hidden"}`}>
|
||||
<span className="tip-text">Filter:</span>
|
||||
<div
|
||||
className={"filter-item-container " + (queryFilter ? "" : "hidden")}
|
||||
className={"filter-item-container " + (shortcut ? "" : "hidden")}
|
||||
onClick={() => {
|
||||
locationService.setMemoShortcut("");
|
||||
locationService.setMemoShortcut(undefined);
|
||||
}}
|
||||
>
|
||||
<span className="icon-text">🎯</span> {queryFilter?.title}
|
||||
<span className="icon-text">🎯</span> {shortcut?.title}
|
||||
</div>
|
||||
<div
|
||||
className={"filter-item-container " + (tagQuery ? "" : "hidden")}
|
||||
|
@ -19,16 +19,16 @@ const MemoList: React.FC<Props> = () => {
|
||||
const wrapperElement = useRef<HTMLDivElement>(null);
|
||||
|
||||
const { tag: tagQuery, duration, type: memoType, text: textQuery, shortcutId } = query;
|
||||
const queryFilter = shortcutService.getShortcutById(shortcutId);
|
||||
const showMemoFilter = Boolean(tagQuery || (duration && duration.from < duration.to) || memoType || textQuery || queryFilter);
|
||||
const shortcut = shortcutId ? shortcutService.getShortcutById(shortcutId) : null;
|
||||
const showMemoFilter = Boolean(tagQuery || (duration && duration.from < duration.to) || memoType || textQuery || shortcut);
|
||||
|
||||
const shownMemos =
|
||||
showMemoFilter || queryFilter
|
||||
showMemoFilter || shortcut
|
||||
? memos.filter((memo) => {
|
||||
let shouldShow = true;
|
||||
|
||||
if (queryFilter) {
|
||||
const filters = JSON.parse(queryFilter.payload) as Filter[];
|
||||
if (shortcut) {
|
||||
const filters = JSON.parse(shortcut.payload) as Filter[];
|
||||
if (Array.isArray(filters)) {
|
||||
shouldShow = checkShouldShowMemoWithFilters(memo, filters);
|
||||
}
|
||||
|
@ -19,11 +19,14 @@ const MemosHeader: React.FC<Props> = () => {
|
||||
const [titleText, setTitleText] = useState("MEMOS");
|
||||
|
||||
useEffect(() => {
|
||||
const query = shortcutService.getShortcutById(shortcutId);
|
||||
if (query) {
|
||||
setTitleText(query.title);
|
||||
} else {
|
||||
if (!shortcutId) {
|
||||
setTitleText("MEMOS");
|
||||
return;
|
||||
}
|
||||
|
||||
const shortcut = shortcutService.getShortcutById(shortcutId);
|
||||
if (shortcut) {
|
||||
setTitleText(shortcut.title);
|
||||
}
|
||||
}, [shortcutId, shortcuts]);
|
||||
|
||||
|
@ -333,10 +333,10 @@
|
||||
resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.5.tgz#5f19d2b85a98e9558036f6a3cacc8819420f05cf"
|
||||
integrity sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==
|
||||
|
||||
"@types/react-dom@^18.0.3":
|
||||
version "18.0.3"
|
||||
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.0.3.tgz#a022ea08c75a476fe5e96b675c3e673363853831"
|
||||
integrity sha512-1RRW9kst+67gveJRYPxGmVy8eVJ05O43hg77G2j5m76/RFJtMbcfAs2viQ2UNsvvDg8F7OfQZx8qQcl6ymygaQ==
|
||||
"@types/react-dom@^18.0.4":
|
||||
version "18.0.4"
|
||||
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.0.4.tgz#dcbcadb277bcf6c411ceff70069424c57797d375"
|
||||
integrity sha512-FgTtbqPOCI3dzZPZoC2T/sx3L34qxy99ITWn4eoSA95qPyXDMH0ALoAqUp49ITniiJFsXUVBtalh/KffMpg21Q==
|
||||
dependencies:
|
||||
"@types/react" "*"
|
||||
|
||||
@ -349,10 +349,10 @@
|
||||
"@types/scheduler" "*"
|
||||
csstype "^3.0.2"
|
||||
|
||||
"@types/react@^18.0.8":
|
||||
version "18.0.8"
|
||||
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.0.8.tgz#a051eb380a9fbcaa404550543c58e1cf5ce4ab87"
|
||||
integrity sha512-+j2hk9BzCOrrOSJASi5XiOyBbERk9jG5O73Ya4M0env5Ixi6vUNli4qy994AINcEF+1IEHISYFfIT4zwr++LKw==
|
||||
"@types/react@^18.0.9":
|
||||
version "18.0.9"
|
||||
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.0.9.tgz#d6712a38bd6cd83469603e7359511126f122e878"
|
||||
integrity sha512-9bjbg1hJHUm4De19L1cHiW0Jvx3geel6Qczhjd0qY5VKVE2X5+x77YxAepuCwVh4vrgZJdgEJw48zrhRIeF4Nw==
|
||||
dependencies:
|
||||
"@types/prop-types" "*"
|
||||
"@types/scheduler" "*"
|
||||
|
Reference in New Issue
Block a user