can hide nsfw in MangaSources

This commit is contained in:
Aria Moradi
2021-09-03 04:47:02 +04:30
parent f98ad6e9c9
commit ba26d852dc
2 changed files with 10 additions and 6 deletions

View File

@@ -38,6 +38,7 @@ export default function MangaSources() {
const { setTitle, setAction } = useContext(NavbarContext);
const [shownLangs, setShownLangs] = useLocalStorage<string[]>('shownSourceLangs', defualtLangs());
const [showNsfw] = useLocalStorage<boolean>('showNsfw', false);
const [sources, setSources] = useState<ISource[]>([]);
const [fetched, setFetched] = useState<boolean>(false);
@@ -70,7 +71,9 @@ export default function MangaSources() {
shownLangs.indexOf(lang) !== -1 && (
<React.Fragment key={lang}>
<h1 key={lang} style={{ marginLeft: 25 }}>{langCodeToName(lang)}</h1>
{(list as ISource[]).map((source) => (
{(list as ISource[])
.filter((source) => showNsfw || !source.isNsfw)
.map((source) => (
<SourceCard
key={source.id}
source={source}

1
src/typings.d.ts vendored
View File

@@ -27,6 +27,7 @@ interface ISource {
supportsLatest: boolean
history: any
isConfigurable: boolean
isNsfw: boolean
}
interface IMangaCard {