Skip to content

Commit

Permalink
feat: hide adult and chinese in some screens
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangvu12 committed Nov 22, 2023
1 parent 161f195 commit 27ad3d8
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 17 deletions.
24 changes: 12 additions & 12 deletions src/gql/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ const documents = {
types.ViewerDocument,
'\n mutation SaveMediaListEntry(\n $id: Int\n $mediaId: Int\n $status: MediaListStatus\n $score: Float\n $scoreRaw: Int\n $progress: Int\n $progressVolumes: Int\n $repeat: Int\n $priority: Int\n $private: Boolean\n $notes: String\n $hiddenFromStatusLists: Boolean\n $customLists: [String]\n $advancedScores: [Float]\n $startedAt: FuzzyDateInput\n $completedAt: FuzzyDateInput\n ) {\n SaveMediaListEntry(\n id: $id\n mediaId: $mediaId\n status: $status\n score: $score\n scoreRaw: $scoreRaw\n progress: $progress\n progressVolumes: $progressVolumes\n repeat: $repeat\n priority: $priority\n private: $private\n notes: $notes\n hiddenFromStatusLists: $hiddenFromStatusLists\n customLists: $customLists\n advancedScores: $advancedScores\n startedAt: $startedAt\n completedAt: $completedAt\n ) {\n progress\n score(format: POINT_10_DECIMAL)\n status\n }\n }\n':
types.SaveMediaListEntryDocument,
'\n query AiringScheduleScreen($airingAt_greater: Int, $airingAt_lesser: Int) {\n Page(page: 1, perPage: 50) {\n airingSchedules(\n airingAt_greater: $airingAt_greater\n airingAt_lesser: $airingAt_lesser\n sort: [TIME_DESC]\n ) {\n airingAt\n media {\n id\n ...DetailsCard\n }\n }\n }\n }\n':
'\n query AiringScheduleScreen($airingAt_greater: Int, $airingAt_lesser: Int) {\n Page(page: 1, perPage: 50) {\n airingSchedules(\n airingAt_greater: $airingAt_greater\n airingAt_lesser: $airingAt_lesser\n sort: [TIME_DESC]\n ) {\n airingAt\n media {\n id\n isAdult\n ...DetailsCard\n }\n }\n }\n }\n':
types.AiringScheduleScreenDocument,
'\n query AiringSchedule($airingAt_greater: Int, $airingAt_lesser: Int) {\n Page(page: 1, perPage: 20) {\n airingSchedules(\n airingAt_greater: $airingAt_greater\n airingAt_lesser: $airingAt_lesser\n sort: [TIME_DESC]\n ) {\n media {\n ...CardMedia\n }\n }\n }\n }\n':
'\n query AiringSchedule($airingAt_greater: Int, $airingAt_lesser: Int) {\n Page(page: 1, perPage: 20) {\n airingSchedules(\n airingAt_greater: $airingAt_greater\n airingAt_lesser: $airingAt_lesser\n sort: [TIME_DESC]\n ) {\n media {\n isAdult\n ...CardMedia\n }\n }\n }\n }\n':
types.AiringScheduleDocument,
'\n query PopularThisSeason($season: MediaSeason, $seasonYear: Int) {\n Page(page: 1, perPage: 10) {\n media(\n type: ANIME\n sort: [POPULARITY_DESC]\n season: $season\n seasonYear: $seasonYear\n ) {\n ...CardMedia\n }\n }\n }\n':
'\n query PopularThisSeason($season: MediaSeason, $seasonYear: Int) {\n Page(page: 1, perPage: 10) {\n media(\n type: ANIME\n sort: [POPULARITY_DESC]\n season: $season\n seasonYear: $seasonYear\n isAdult: false\n countryOfOrigin: "JP"\n ) {\n ...CardMedia\n }\n }\n }\n':
types.PopularThisSeasonDocument,
'\n query UpcomingNextSeason($season: MediaSeason, $seasonYear: Int) {\n Page(page: 1, perPage: 10) {\n media(\n type: ANIME\n sort: [POPULARITY_DESC]\n season: $season\n seasonYear: $seasonYear\n ) {\n ...CardMedia\n }\n }\n }\n':
'\n query UpcomingNextSeason($season: MediaSeason, $seasonYear: Int) {\n Page(page: 1, perPage: 10) {\n media(\n type: ANIME\n sort: [POPULARITY_DESC]\n season: $season\n seasonYear: $seasonYear\n isAdult: false\n countryOfOrigin: "JP"\n ) {\n ...CardMedia\n }\n }\n }\n':
types.UpcomingNextSeasonDocument,
'\n fragment WatchCard on Media {\n id\n title {\n userPreferred\n }\n coverImage {\n large\n }\n bannerImage\n ...MediaUnitStatsMedia\n }\n':
types.WatchCardFragmentDoc,
Expand Down Expand Up @@ -123,26 +123,26 @@ export function graphql(
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(
source: '\n query AiringScheduleScreen($airingAt_greater: Int, $airingAt_lesser: Int) {\n Page(page: 1, perPage: 50) {\n airingSchedules(\n airingAt_greater: $airingAt_greater\n airingAt_lesser: $airingAt_lesser\n sort: [TIME_DESC]\n ) {\n airingAt\n media {\n id\n ...DetailsCard\n }\n }\n }\n }\n'
): (typeof documents)['\n query AiringScheduleScreen($airingAt_greater: Int, $airingAt_lesser: Int) {\n Page(page: 1, perPage: 50) {\n airingSchedules(\n airingAt_greater: $airingAt_greater\n airingAt_lesser: $airingAt_lesser\n sort: [TIME_DESC]\n ) {\n airingAt\n media {\n id\n ...DetailsCard\n }\n }\n }\n }\n'];
source: '\n query AiringScheduleScreen($airingAt_greater: Int, $airingAt_lesser: Int) {\n Page(page: 1, perPage: 50) {\n airingSchedules(\n airingAt_greater: $airingAt_greater\n airingAt_lesser: $airingAt_lesser\n sort: [TIME_DESC]\n ) {\n airingAt\n media {\n id\n isAdult\n ...DetailsCard\n }\n }\n }\n }\n'
): (typeof documents)['\n query AiringScheduleScreen($airingAt_greater: Int, $airingAt_lesser: Int) {\n Page(page: 1, perPage: 50) {\n airingSchedules(\n airingAt_greater: $airingAt_greater\n airingAt_lesser: $airingAt_lesser\n sort: [TIME_DESC]\n ) {\n airingAt\n media {\n id\n isAdult\n ...DetailsCard\n }\n }\n }\n }\n'];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(
source: '\n query AiringSchedule($airingAt_greater: Int, $airingAt_lesser: Int) {\n Page(page: 1, perPage: 20) {\n airingSchedules(\n airingAt_greater: $airingAt_greater\n airingAt_lesser: $airingAt_lesser\n sort: [TIME_DESC]\n ) {\n media {\n ...CardMedia\n }\n }\n }\n }\n'
): (typeof documents)['\n query AiringSchedule($airingAt_greater: Int, $airingAt_lesser: Int) {\n Page(page: 1, perPage: 20) {\n airingSchedules(\n airingAt_greater: $airingAt_greater\n airingAt_lesser: $airingAt_lesser\n sort: [TIME_DESC]\n ) {\n media {\n ...CardMedia\n }\n }\n }\n }\n'];
source: '\n query AiringSchedule($airingAt_greater: Int, $airingAt_lesser: Int) {\n Page(page: 1, perPage: 20) {\n airingSchedules(\n airingAt_greater: $airingAt_greater\n airingAt_lesser: $airingAt_lesser\n sort: [TIME_DESC]\n ) {\n media {\n isAdult\n ...CardMedia\n }\n }\n }\n }\n'
): (typeof documents)['\n query AiringSchedule($airingAt_greater: Int, $airingAt_lesser: Int) {\n Page(page: 1, perPage: 20) {\n airingSchedules(\n airingAt_greater: $airingAt_greater\n airingAt_lesser: $airingAt_lesser\n sort: [TIME_DESC]\n ) {\n media {\n isAdult\n ...CardMedia\n }\n }\n }\n }\n'];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(
source: '\n query PopularThisSeason($season: MediaSeason, $seasonYear: Int) {\n Page(page: 1, perPage: 10) {\n media(\n type: ANIME\n sort: [POPULARITY_DESC]\n season: $season\n seasonYear: $seasonYear\n ) {\n ...CardMedia\n }\n }\n }\n'
): (typeof documents)['\n query PopularThisSeason($season: MediaSeason, $seasonYear: Int) {\n Page(page: 1, perPage: 10) {\n media(\n type: ANIME\n sort: [POPULARITY_DESC]\n season: $season\n seasonYear: $seasonYear\n ) {\n ...CardMedia\n }\n }\n }\n'];
source: '\n query PopularThisSeason($season: MediaSeason, $seasonYear: Int) {\n Page(page: 1, perPage: 10) {\n media(\n type: ANIME\n sort: [POPULARITY_DESC]\n season: $season\n seasonYear: $seasonYear\n isAdult: false\n countryOfOrigin: "JP"\n ) {\n ...CardMedia\n }\n }\n }\n'
): (typeof documents)['\n query PopularThisSeason($season: MediaSeason, $seasonYear: Int) {\n Page(page: 1, perPage: 10) {\n media(\n type: ANIME\n sort: [POPULARITY_DESC]\n season: $season\n seasonYear: $seasonYear\n isAdult: false\n countryOfOrigin: "JP"\n ) {\n ...CardMedia\n }\n }\n }\n'];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(
source: '\n query UpcomingNextSeason($season: MediaSeason, $seasonYear: Int) {\n Page(page: 1, perPage: 10) {\n media(\n type: ANIME\n sort: [POPULARITY_DESC]\n season: $season\n seasonYear: $seasonYear\n ) {\n ...CardMedia\n }\n }\n }\n'
): (typeof documents)['\n query UpcomingNextSeason($season: MediaSeason, $seasonYear: Int) {\n Page(page: 1, perPage: 10) {\n media(\n type: ANIME\n sort: [POPULARITY_DESC]\n season: $season\n seasonYear: $seasonYear\n ) {\n ...CardMedia\n }\n }\n }\n'];
source: '\n query UpcomingNextSeason($season: MediaSeason, $seasonYear: Int) {\n Page(page: 1, perPage: 10) {\n media(\n type: ANIME\n sort: [POPULARITY_DESC]\n season: $season\n seasonYear: $seasonYear\n isAdult: false\n countryOfOrigin: "JP"\n ) {\n ...CardMedia\n }\n }\n }\n'
): (typeof documents)['\n query UpcomingNextSeason($season: MediaSeason, $seasonYear: Int) {\n Page(page: 1, perPage: 10) {\n media(\n type: ANIME\n sort: [POPULARITY_DESC]\n season: $season\n seasonYear: $seasonYear\n isAdult: false\n countryOfOrigin: "JP"\n ) {\n ...CardMedia\n }\n }\n }\n'];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
Expand Down
32 changes: 30 additions & 2 deletions src/gql/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4696,7 +4696,7 @@ export type AiringScheduleScreenQuery = {
__typename?: 'AiringSchedule';
airingAt: number;
media?:
| ({ __typename?: 'Media'; id: number } & {
| ({ __typename?: 'Media'; id: number; isAdult?: boolean | null } & {
' $fragmentRefs'?: { DetailsCardFragment: DetailsCardFragment };
})
| null;
Expand All @@ -4716,7 +4716,7 @@ export type AiringScheduleQuery = {
airingSchedules?: Array<{
__typename?: 'AiringSchedule';
media?:
| ({ __typename?: 'Media' } & {
| ({ __typename?: 'Media'; isAdult?: boolean | null } & {
' $fragmentRefs'?: { CardMediaFragment: CardMediaFragment };
})
| null;
Expand Down Expand Up @@ -8270,6 +8270,10 @@ export const AiringScheduleScreenDocument = {
kind: 'Field',
name: { kind: 'Name', value: 'id' },
},
{
kind: 'Field',
name: { kind: 'Name', value: 'isAdult' },
},
{
kind: 'FragmentSpread',
name: { kind: 'Name', value: 'DetailsCard' },
Expand Down Expand Up @@ -8415,6 +8419,10 @@ export const AiringScheduleDocument = {
selectionSet: {
kind: 'SelectionSet',
selections: [
{
kind: 'Field',
name: { kind: 'Name', value: 'isAdult' },
},
{
kind: 'FragmentSpread',
name: { kind: 'Name', value: 'CardMedia' },
Expand Down Expand Up @@ -8594,6 +8602,16 @@ export const PopularThisSeasonDocument = {
name: { kind: 'Name', value: 'seasonYear' },
},
},
{
kind: 'Argument',
name: { kind: 'Name', value: 'isAdult' },
value: { kind: 'BooleanValue', value: false },
},
{
kind: 'Argument',
name: { kind: 'Name', value: 'countryOfOrigin' },
value: { kind: 'StringValue', value: 'JP', block: false },
},
],
selectionSet: {
kind: 'SelectionSet',
Expand Down Expand Up @@ -8777,6 +8795,16 @@ export const UpcomingNextSeasonDocument = {
name: { kind: 'Name', value: 'seasonYear' },
},
},
{
kind: 'Argument',
name: { kind: 'Name', value: 'isAdult' },
value: { kind: 'BooleanValue', value: false },
},
{
kind: 'Argument',
name: { kind: 'Name', value: 'countryOfOrigin' },
value: { kind: 'StringValue', value: 'JP', block: false },
},
],
selectionSet: {
kind: 'SelectionSet',
Expand Down
7 changes: 6 additions & 1 deletion src/screens/anime/airing-schedule/screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const document = graphql(`
airingAt
media {
id
isAdult
...DetailsCard
}
}
Expand Down Expand Up @@ -223,6 +224,10 @@ const AiringScheduleScreen = () => {

const isReleased = day.isBefore(dayjs());

const nonAdultList = list.filter(
(schedule) => !schedule.media?.isAdult
);

return (
<View className="relative" key={time}>
<View className="my-2 ml-4 flex flex-row items-center">
Expand All @@ -240,7 +245,7 @@ const AiringScheduleScreen = () => {

<View className="relative">
<View className="ml-4 space-y-2">
{list.map((schedule) => (
{nonAdultList.map((schedule) => (
<View className="flex" key={schedule.media!.id}>
<DetailsCard media={schedule.media!} />
</View>
Expand Down
5 changes: 3 additions & 2 deletions src/screens/anime/components/airing-today-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const document = graphql(`
sort: [TIME_DESC]
) {
media {
isAdult
...CardMedia
}
}
Expand All @@ -34,8 +35,8 @@ const AiringTodayList = () => {
});

const mediaList = data?.Page?.airingSchedules
?.filter(Boolean)
?.map((schedule) => schedule.media)
?.map((schedule) => schedule?.media)
?.filter((media) => !media?.isAdult)
?.filter(Boolean);

if (isLoading) {
Expand Down
2 changes: 2 additions & 0 deletions src/screens/anime/components/popular-this-season.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const document = graphql(`
sort: [POPULARITY_DESC]
season: $season
seasonYear: $seasonYear
isAdult: false
countryOfOrigin: "JP"
) {
...CardMedia
}
Expand Down
2 changes: 2 additions & 0 deletions src/screens/anime/components/upcoming-next-season.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const document = graphql(`
sort: [POPULARITY_DESC]
season: $season
seasonYear: $seasonYear
isAdult: false
countryOfOrigin: "JP"
) {
...CardMedia
}
Expand Down

0 comments on commit 27ad3d8

Please sign in to comment.