Skip to content

Commit

Permalink
Merge pull request #37 from fiatjaf/save-show-replies-setting
Browse files Browse the repository at this point in the history
save "Show Replies" setting on `localStorage`
  • Loading branch information
hzrd149 authored Oct 24, 2023
2 parents 9ba21de + fda8587 commit 7635030
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/views/home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ import RelaySelectionProvider, { useRelaySelectionContext } from "../../provider
import { NostrRequestFilter } from "../../types/nostr-query";
import useClientSideMuteFilter from "../../hooks/use-client-side-mute-filter";

var showRepliesStored = localStorage.getItem("show-replies") === "true";

function HomePage() {
const timelinePageEventFilter = useTimelinePageEventFilter();
const showReplies = useDisclosure();
const showReplies = useDisclosure({ defaultIsOpen: showRepliesStored });
const muteFilter = useClientSideMuteFilter();
const eventFilter = useCallback(
(event: NostrEvent) => {
Expand Down Expand Up @@ -44,7 +46,14 @@ function HomePage() {
const header = (
<Flex gap="2" wrap="wrap" px={["2", 0]} alignItems="center">
<PeopleListSelection />
<Switch isChecked={showReplies.isOpen} onChange={showReplies.onToggle}>
<Switch
isChecked={showReplies.isOpen}
onChange={(v) => {
localStorage.setItem("show-replies", v.target.checked ? "true" : "false");
showRepliesStored = v.target.checked;
showReplies.onToggle();
}}
>
Show Replies
</Switch>
<RelaySelectionButton ml="auto" />
Expand Down

0 comments on commit 7635030

Please sign in to comment.