This commit is contained in:
GH Action - Upstream Sync 2024-03-28 00:25:39 +00:00
commit 4ca2cb85d0
3 changed files with 25 additions and 5 deletions

View File

@ -12,7 +12,7 @@ import {
import { useChatStore } from "../store"; import { useChatStore } from "../store";
import Locale from "../locales"; import Locale from "../locales";
import { Link, useNavigate } from "react-router-dom"; import { Link, useLocation, useNavigate } from "react-router-dom";
import { Path } from "../constant"; import { Path } from "../constant";
import { MaskAvatar } from "./mask"; import { MaskAvatar } from "./mask";
import { Mask } from "../store/mask"; import { Mask } from "../store/mask";
@ -40,12 +40,16 @@ export function ChatItem(props: {
}); });
} }
}, [props.selected]); }, [props.selected]);
const { pathname: currentPath } = useLocation();
return ( return (
<Draggable draggableId={`${props.id}`} index={props.index}> <Draggable draggableId={`${props.id}`} index={props.index}>
{(provided) => ( {(provided) => (
<div <div
className={`${styles["chat-item"]} ${ className={`${styles["chat-item"]} ${
props.selected && styles["chat-item-selected"] props.selected &&
(currentPath === Path.Chat || currentPath === Path.Home) &&
styles["chat-item-selected"]
}`} }`}
onClick={props.onClick} onClick={props.onClick}
ref={(ele) => { ref={(ele) => {

View File

@ -404,7 +404,16 @@ export function MaskPage() {
const maskStore = useMaskStore(); const maskStore = useMaskStore();
const chatStore = useChatStore(); const chatStore = useChatStore();
const [filterLang, setFilterLang] = useState<Lang>(); const [filterLang, setFilterLang] = useState<Lang | undefined>(
localStorage.getItem("Mask-language") as Lang | undefined,
);
useEffect(() => {
if (filterLang) {
localStorage.setItem("Mask-language", filterLang);
} else {
localStorage.removeItem("Mask-language");
}
}, [filterLang]);
const allMasks = maskStore const allMasks = maskStore
.getAll() .getAll()

View File

@ -18,8 +18,15 @@ export function createWebDavClient(store: SyncStore) {
method: "MKCOL", method: "MKCOL",
headers: this.headers(), headers: this.headers(),
}); });
console.log("[WebDav] check", res.status, res.statusText); const success = [201, 200, 404, 405, 301, 302, 307, 308].includes(
return [201, 200, 404, 301, 302, 307, 308].includes(res.status); res.status,
);
console.log(
`[WebDav] check ${success ? "success" : "failed"}, ${res.status} ${
res.statusText
}`,
);
return success;
} catch (e) { } catch (e) {
console.error("[WebDav] failed to check", e); console.error("[WebDav] failed to check", e);
} }