Skip to content

Commit

Permalink
Add includeRestricted to RecommendedAnime Dashboard Panel (#712)
Browse files Browse the repository at this point in the history
  • Loading branch information
natyusha authored Dec 10, 2023
1 parent e4ce248 commit 7d26456
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/core/rtkQuery/splitV3Api/seriesApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ const seriesApi = splitV3Api.injectEndpoints({
}),

// Gets anidb recommendation for the user
getAniDBRecommendedAnime: build.query<SeriesRecommendedType[], PaginationType>({
getAniDBRecommendedAnime: build.query<SeriesRecommendedType[], PaginationType & { includeRestricted: boolean }>({
query: params => ({ url: 'Series/AniDB/RecommendedForYou', params: { ...params, showAll: true } }),
transformResponse: (response: ListResultType<SeriesRecommendedType>) => response.List,
}),
Expand Down
15 changes: 13 additions & 2 deletions src/pages/dashboard/panels/RecommendedAnime.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
import React from 'react';
import React, { useMemo } from 'react';
import { useSelector } from 'react-redux';
import { mdiEyeArrowRightOutline } from '@mdi/js';
import { Icon } from '@mdi/react';

import BackgroundImagePlaceholderDiv from '@/components/BackgroundImagePlaceholderDiv';
import ShokoPanel from '@/components/Panels/ShokoPanel';
import { useGetAniDBRecommendedAnimeQuery } from '@/core/rtkQuery/splitV3Api/seriesApi';
import { useGetSettingsQuery } from '@/core/rtkQuery/splitV3Api/settingsApi';
import { initialSettings } from '@/pages/settings/SettingsPage';

import type { RootState } from '@/core/store';
import type { SeriesAniDBType } from '@/core/types/api/series';

const RecommendedAnime = () => {
const layoutEditMode = useSelector((state: RootState) => state.mainpage.layoutEditMode);

const items = useGetAniDBRecommendedAnimeQuery({ pageSize: 20 });
const settingsQuery = useGetSettingsQuery();
const { hideR18Content } = useMemo(
() => settingsQuery.data?.WebUI_Settings.dashboard ?? initialSettings.WebUI_Settings.dashboard,
[settingsQuery],
);

const items = useGetAniDBRecommendedAnimeQuery({
includeRestricted: !hideR18Content,
pageSize: 20,
});

const renderItem = (series: SeriesAniDBType, matches: number) => (
<div key={`series-${series.ID}`} className="mr-4 flex w-56 shrink-0 flex-col justify-center last:mr-0">
Expand Down

0 comments on commit 7d26456

Please sign in to comment.