Fix typescript errors

This commit is contained in:
Zoe Roux 2023-01-07 19:49:01 +09:00
parent 01eae3f680
commit aa38b34191
10 changed files with 61 additions and 35 deletions

View File

@ -9,6 +9,9 @@ jobs:
run: run:
working-directory: ./front working-directory: ./front
steps: steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Check for EXPO_TOKEN - name: Check for EXPO_TOKEN
run: | run: |
if [ -z "${{ secrets.EXPO_TOKEN }}" ]; then if [ -z "${{ secrets.EXPO_TOKEN }}" ]; then
@ -16,9 +19,6 @@ jobs:
exit 1 exit 1
fi fi
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Node - name: Setup Node
uses: actions/setup-node@v2 uses: actions/setup-node@v2
with: with:

2
front/.gitignore vendored
View File

@ -43,3 +43,5 @@ yarn-error.log*
.expo .expo
apps/web/next-env.d.ts

View File

@ -1,5 +0,0 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.

View File

@ -18,7 +18,7 @@
* along with Kyoo. If not, see <https://www.gnu.org/licenses/>. * along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { resources, defaultNS } from "./i18n"; import "i18next";
import en from "../../../translations/en.json"; import en from "../../../translations/en.json";
declare module "i18next" { declare module "i18next" {

View File

@ -11,6 +11,7 @@
"update": "yarn workspace mobile update", "update": "yarn workspace mobile update",
"lint": "eslint ." "lint": "eslint ."
}, },
"eslintIgnore": ["next-env.d.ts"],
"workspaces": [ "workspaces": [
"apps/*", "apps/*",
"packages/*" "packages/*"

View File

@ -103,7 +103,9 @@ export const EpisodeLine = ({
{...css({ flexShrink: 0, m: ts(1) })} {...css({ flexShrink: 0, m: ts(1) })}
/> />
<View {...css({ flexGrow: 1, flexShrink: 1, m: ts(1) })}> <View {...css({ flexGrow: 1, flexShrink: 1, m: ts(1) })}>
<Skeleton>{isLoading || <H6 as="p">{name ?? t("show.episodeNoMetadata")}</H6>}</Skeleton> <Skeleton>
{isLoading || <H6 aria-level={undefined}>{name ?? t("show.episodeNoMetadata")}</H6>}
</Skeleton>
<Skeleton>{isLoading || <P numberOfLines={3}>{overview}</P>}</Skeleton> <Skeleton>{isLoading || <P numberOfLines={3}>{overview}</P>}</Skeleton>
</View> </View>
</Link> </Link>

View File

@ -36,25 +36,26 @@ export const EpisodeList = ({
season: string | number; season: string | number;
Header: ComponentType<{ children: JSX.Element }>; Header: ComponentType<{ children: JSX.Element }>;
}) => { }) => {
const { t } = useTranslation(); return null;
// const { t } = useTranslation();
return ( // return (
<InfiniteFetch // <InfiniteFetch
query={EpisodeList.query(slug, season)} // query={EpisodeList.query(slug, season)}
placeholderCount={15} // placeholderCount={15}
layout={EpisodeLine.layout} // layout={EpisodeLine.layout}
empty={t("show.episode-none")} // empty={t("show.episode-none")}
divider // divider
Header={Header} // Header={Header}
> // >
{(item) => ( // {(item) => (
<EpisodeLine // <EpisodeLine
{...item} // {...item}
displayNumber={item.isLoading ? undefined : episodeDisplayNumber(item)} // displayNumber={item.isLoading ? undefined : episodeDisplayNumber(item)}
/> // />
)} // )}
</InfiniteFetch> // </InfiniteFetch>
); // );
}; };
EpisodeList.query = (slug: string, season: string | number): QueryIdentifier<Episode> => ({ EpisodeList.query = (slug: string, season: string | number): QueryIdentifier<Episode> => ({

View File

@ -0,0 +1,29 @@
/*
* Kyoo - A portable and vast media library solution.
* Copyright (c) Kyoo.
*
* See AUTHORS.md and LICENSE file in the project root for full license information.
*
* Kyoo is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* Kyoo is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
*/
import "i18next";
import en from "../../../translations/en.json";
declare module "i18next" {
interface CustomTypeOptions {
returnNull: false;
resources: { translations: typeof en };
}
}

View File

@ -73,12 +73,7 @@ export const reducerAtom = atom<null, Action>(null, (get, set, action) => {
const index = subtitle ? action.subtitles.findIndex((x) => x.id === subtitle.id) : -1; const index = subtitle ? action.subtitles.findIndex((x) => x.id === subtitle.id) : -1;
set( set(
subtitleAtom, subtitleAtom,
index === -1 index === -1 ? null : action.subtitles[(index + 1) % action.subtitles.length],
? null
: {
track: action.subtitles[(index + 1) % action.subtitles.length],
fonts: action.fonts,
},
); );
break; break;
} }

View File

@ -18,7 +18,7 @@
* along with Kyoo. If not, see <https://www.gnu.org/licenses/>. * along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Track, WatchItem } from "@kyoo/models"; import { Track, WatchItem, Font } from "@kyoo/models";
import { atom, useAtom, useAtomValue, useSetAtom } from "jotai"; import { atom, useAtom, useAtomValue, useSetAtom } from "jotai";
import { memo, useEffect, useLayoutEffect, useRef } from "react"; import { memo, useEffect, useLayoutEffect, useRef } from "react";
import NativeVideo, { VideoProperties as VideoProps } from "./video"; import NativeVideo, { VideoProperties as VideoProps } from "./video";
@ -73,6 +73,7 @@ export const Video = memo(function _Video({
}: { }: {
links?: WatchItem["link"]; links?: WatchItem["link"];
setError: (error: string | undefined) => void; setError: (error: string | undefined) => void;
fonts?: Font[];
} & Partial<VideoProps>) { } & Partial<VideoProps>) {
const ref = useRef<NativeVideo | null>(null); const ref = useRef<NativeVideo | null>(null);
const [isPlaying, setPlay] = useAtom(playAtom); const [isPlaying, setPlay] = useAtom(playAtom);