Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Mar 28, 2024
2 parents b424e7f + c93b36f commit 0e71147
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
8 changes: 6 additions & 2 deletions app/components/chat-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import { useChatStore } from "../store";

import Locale from "../locales";
import { Link, useNavigate } from "react-router-dom";
import { Link, useLocation, useNavigate } from "react-router-dom";
import { Path } from "../constant";
import { MaskAvatar } from "./mask";
import { Mask } from "../store/mask";
Expand Down Expand Up @@ -40,12 +40,16 @@ export function ChatItem(props: {
});
}
}, [props.selected]);

const { pathname: currentPath } = useLocation();
return (
<Draggable draggableId={`${props.id}`} index={props.index}>
{(provided) => (
<div
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}
ref={(ele) => {
Expand Down
11 changes: 10 additions & 1 deletion app/components/mask.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,16 @@ export function MaskPage() {
const maskStore = useMaskStore();
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
.getAll()
Expand Down
11 changes: 9 additions & 2 deletions app/utils/cloud/webdav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,15 @@ export function createWebDavClient(store: SyncStore) {
method: "MKCOL",
headers: this.headers(),
});
console.log("[WebDav] check", res.status, res.statusText);
return [201, 200, 404, 301, 302, 307, 308].includes(res.status);
const success = [201, 200, 404, 405, 301, 302, 307, 308].includes(
res.status,
);
console.log(
`[WebDav] check ${success ? "success" : "failed"}, ${res.status} ${
res.statusText
}`,
);
return success;
} catch (e) {
console.error("[WebDav] failed to check", e);
}
Expand Down

0 comments on commit 0e71147

Please sign in to comment.