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

2
front/.gitignore vendored
View File

@ -43,3 +43,5 @@ yarn-error.log*
.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/>.
*/
import { resources, defaultNS } from "./i18n";
import "i18next";
import en from "../../../translations/en.json";
declare module "i18next" {

View File

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

View File

@ -103,7 +103,9 @@ export const EpisodeLine = ({
{...css({ flexShrink: 0, 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>
</View>
</Link>

View File

@ -36,25 +36,26 @@ export const EpisodeList = ({
season: string | number;
Header: ComponentType<{ children: JSX.Element }>;
}) => {
const { t } = useTranslation();
return null;
// const { t } = useTranslation();
return (
<InfiniteFetch
query={EpisodeList.query(slug, season)}
placeholderCount={15}
layout={EpisodeLine.layout}
empty={t("show.episode-none")}
divider
Header={Header}
>
{(item) => (
<EpisodeLine
{...item}
displayNumber={item.isLoading ? undefined : episodeDisplayNumber(item)}
/>
)}
</InfiniteFetch>
);
// return (
// <InfiniteFetch
// query={EpisodeList.query(slug, season)}
// placeholderCount={15}
// layout={EpisodeLine.layout}
// empty={t("show.episode-none")}
// divider
// Header={Header}
// >
// {(item) => (
// <EpisodeLine
// {...item}
// displayNumber={item.isLoading ? undefined : episodeDisplayNumber(item)}
// />
// )}
// </InfiniteFetch>
// );
};
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;
set(
subtitleAtom,
index === -1
? null
: {
track: action.subtitles[(index + 1) % action.subtitles.length],
fonts: action.fonts,
},
index === -1 ? null : action.subtitles[(index + 1) % action.subtitles.length],
);
break;
}

View File

@ -18,7 +18,7 @@
* 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 { memo, useEffect, useLayoutEffect, useRef } from "react";
import NativeVideo, { VideoProperties as VideoProps } from "./video";
@ -73,6 +73,7 @@ export const Video = memo(function _Video({
}: {
links?: WatchItem["link"];
setError: (error: string | undefined) => void;
fonts?: Font[];
} & Partial<VideoProps>) {
const ref = useRef<NativeVideo | null>(null);
const [isPlaying, setPlay] = useAtom(playAtom);