can hide nsfw in MangaSources
This commit is contained in:
@@ -38,6 +38,7 @@ export default function MangaSources() {
|
|||||||
const { setTitle, setAction } = useContext(NavbarContext);
|
const { setTitle, setAction } = useContext(NavbarContext);
|
||||||
|
|
||||||
const [shownLangs, setShownLangs] = useLocalStorage<string[]>('shownSourceLangs', defualtLangs());
|
const [shownLangs, setShownLangs] = useLocalStorage<string[]>('shownSourceLangs', defualtLangs());
|
||||||
|
const [showNsfw] = useLocalStorage<boolean>('showNsfw', false);
|
||||||
|
|
||||||
const [sources, setSources] = useState<ISource[]>([]);
|
const [sources, setSources] = useState<ISource[]>([]);
|
||||||
const [fetched, setFetched] = useState<boolean>(false);
|
const [fetched, setFetched] = useState<boolean>(false);
|
||||||
@@ -70,7 +71,9 @@ export default function MangaSources() {
|
|||||||
shownLangs.indexOf(lang) !== -1 && (
|
shownLangs.indexOf(lang) !== -1 && (
|
||||||
<React.Fragment key={lang}>
|
<React.Fragment key={lang}>
|
||||||
<h1 key={lang} style={{ marginLeft: 25 }}>{langCodeToName(lang)}</h1>
|
<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
|
<SourceCard
|
||||||
key={source.id}
|
key={source.id}
|
||||||
source={source}
|
source={source}
|
||||||
|
|||||||
1
src/typings.d.ts
vendored
1
src/typings.d.ts
vendored
@@ -27,6 +27,7 @@ interface ISource {
|
|||||||
supportsLatest: boolean
|
supportsLatest: boolean
|
||||||
history: any
|
history: any
|
||||||
isConfigurable: boolean
|
isConfigurable: boolean
|
||||||
|
isNsfw: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IMangaCard {
|
interface IMangaCard {
|
||||||
|
|||||||
Reference in New Issue
Block a user