feat: categories and popups #171
@ -2,7 +2,7 @@ import { FilterOptions, NSFWFilter } from 'types'
|
|||||||
import { Option } from './Option'
|
import { Option } from './Option'
|
||||||
import { NsfwAlertPopup } from 'components/NsfwAlertPopup'
|
import { NsfwAlertPopup } from 'components/NsfwAlertPopup'
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { useLocalStorage, useSessionStorage } from 'hooks'
|
import { useLocalStorage } from 'hooks'
|
||||||
import { DEFAULT_FILTER_OPTIONS } from 'utils'
|
import { DEFAULT_FILTER_OPTIONS } from 'utils'
|
||||||
|
|
||||||
interface NsfwFilterOptionsProps {
|
interface NsfwFilterOptionsProps {
|
||||||
@ -18,7 +18,7 @@ export const NsfwFilterOptions = ({ filterKey }: NsfwFilterOptionsProps) => {
|
|||||||
const [selectedNsfwOption, setSelectedNsfwOption] = useState<
|
const [selectedNsfwOption, setSelectedNsfwOption] = useState<
|
||||||
NSFWFilter | undefined
|
NSFWFilter | undefined
|
||||||
>()
|
>()
|
||||||
const [confirmNsfw] = useSessionStorage<boolean>('confirm-nsfw', false)
|
const [confirmNsfw] = useLocalStorage<boolean>('confirm-nsfw', false)
|
||||||
const handleConfirm = (confirm: boolean) => {
|
const handleConfirm = (confirm: boolean) => {
|
||||||
if (confirm && selectedNsfwOption) {
|
if (confirm && selectedNsfwOption) {
|
||||||
setFilterOptions((prev) => ({
|
setFilterOptions((prev) => ({
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { AlertPopupProps } from 'types'
|
import { AlertPopupProps } from 'types'
|
||||||
import { AlertPopup } from './AlertPopup'
|
import { AlertPopup } from './AlertPopup'
|
||||||
import { useSessionStorage } from 'hooks'
|
import { useLocalStorage } from 'hooks'
|
||||||
|
|
||||||
type NsfwAlertPopup = Omit<AlertPopupProps, 'header' | 'label'>
|
type NsfwAlertPopup = Omit<AlertPopupProps, 'header' | 'label'>
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ export const NsfwAlertPopup = ({
|
|||||||
handleConfirm,
|
handleConfirm,
|
||||||
handleClose
|
handleClose
|
||||||
}: NsfwAlertPopup) => {
|
}: NsfwAlertPopup) => {
|
||||||
const [confirmNsfw, setConfirmNsfw] = useSessionStorage<boolean>(
|
const [confirmNsfw, setConfirmNsfw] = useLocalStorage<boolean>(
|
||||||
'confirm-nsfw',
|
'confirm-nsfw',
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
|
@ -5,7 +5,7 @@ import {
|
|||||||
useAppDispatch,
|
useAppDispatch,
|
||||||
useAppSelector,
|
useAppSelector,
|
||||||
useNDKContext,
|
useNDKContext,
|
||||||
useSessionStorage
|
useLocalStorage
|
||||||
} from 'hooks'
|
} from 'hooks'
|
||||||
import { kinds, UnsignedEvent, Event } from 'nostr-tools'
|
import { kinds, UnsignedEvent, Event } from 'nostr-tools'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
@ -26,7 +26,7 @@ export const PreferencesSetting = () => {
|
|||||||
const [isSaving, setIsSaving] = useState(false)
|
const [isSaving, setIsSaving] = useState(false)
|
||||||
|
|
||||||
const [nsfw, setNsfw] = useState(false)
|
const [nsfw, setNsfw] = useState(false)
|
||||||
const [confirmNsfw] = useSessionStorage<boolean>('confirm-nsfw', false)
|
const [confirmNsfw] = useLocalStorage<boolean>('confirm-nsfw', false)
|
||||||
const [showNsfwPopup, setShowNsfwPopup] = useState<boolean>(false)
|
const [showNsfwPopup, setShowNsfwPopup] = useState<boolean>(false)
|
||||||
const handleNsfwConfirm = (confirm: boolean) => {
|
const handleNsfwConfirm = (confirm: boolean) => {
|
||||||
setNsfw(confirm)
|
setNsfw(confirm)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user