Remove unused files and packages

This commit is contained in:
Zoe Roux 2023-01-02 18:53:29 +09:00
parent 257e78dcaa
commit 1f33d52429
19 changed files with 316 additions and 1070 deletions

View File

@ -13,7 +13,11 @@
"preview": {
"distribution": "internal"
},
"production": {}
"production": {
"android": {
"buildType": "apk"
}
}
},
"submit": {
"production": {}

View File

@ -11,19 +11,12 @@
"format:fix": "prettier --write --ignore-path .gitignore '!src/utils/jotai-utils.tsx' ."
},
"dependencies": {
"@emotion/react": "^11.9.3",
"@emotion/styled": "^11.9.3",
"@kyoo/models": "workspace:^",
"@kyoo/primitives": "workspace:^",
"@kyoo/ui": "workspace:^",
"@material-symbols/svg-400": "^0.4.2",
"@mui/icons-material": "^5.8.4",
"@mui/material": "^5.8.7",
"@mui/system": "^5.10.10",
"@radix-ui/react-dropdown-menu": "^2.0.1",
"@tanstack/react-query": "^4.19.1",
"clsx": "^1.2.1",
"csstype": "^3.1.1",
"expo-linear-gradient": "^12.0.1",
"hls.js": "^1.2.8",
"i18next": "^22.0.6",

View File

@ -1,97 +0,0 @@
/*
* 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 { ArrowLeft, ArrowRight } from "@mui/icons-material";
import { Box, IconButton, Tooltip, Typography } from "@mui/material";
import { ReactNode, useRef } from "react";
import { Container } from "./container";
import useTranslation from "next-translate/useTranslation";
export const HorizontalList = ({
title,
noContent,
children,
}: {
title: string;
noContent: string;
children: ReactNode[];
}) => {
const { t } = useTranslation("browse");
const ref = useRef<HTMLDivElement>(null);
const getScrollSize = () => {
const childSize = ref.current?.children[0].clientWidth;
const containerSize = ref.current?.offsetWidth;
if (!childSize || !containerSize) return childSize || 150;
return Math.round(containerSize / childSize) * childSize;
};
// TODO: handle infinite scroll
return (
<>
<Container
sx={{ display: "flex", flexDirection: "row", justifyContent: "space-between", py: 3 }}
>
<Typography variant="h4" component="h2">
{title}
</Typography>
<Box>
<Tooltip title={t("misc.prev-page")}>
<IconButton
aria-label={t("misc.prev-page")}
onClick={() => ref.current?.scrollBy({ left: -getScrollSize(), behavior: "smooth" })}
>
<ArrowLeft />
</IconButton>
</Tooltip>
<Tooltip title={t("misc.next-page")}>
<IconButton
aria-label={t("misc.next-page")}
onClick={() => ref.current?.scrollBy({ left: getScrollSize(), behavior: "smooth" })}
>
<ArrowRight />
</IconButton>
</Tooltip>
</Box>
</Container>
{children.length == 0 ? (
<Box sx={{ display: "flex", justifyContent: "center" }}>
<Typography sx={{ py: 3 }}>{noContent}</Typography>
</Box>
) : (
<Container
sx={{
display: "flex",
flexDirection: "row",
maxWidth: "100%",
overflowY: "auto",
pt: 1,
pb: 2,
overflowX: "visible",
}}
ref={ref}
>
{children}
</Container>
)}
</>
);
};

View File

@ -1,21 +0,0 @@
/*
* 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/>.
*/
export * from "@kyoo/models";

View File

@ -39,11 +39,7 @@ import { withTranslations } from "../i18n";
const ThemeSelector = ({ children }: { children?: ReactNode | ReactNode[] }) => {
// TODO: Handle user selected mode (light, dark, auto)
// TODO: Hande theme change.
return (
<MTheme theme={createTheme()}>
<KThemeSelector>{children}</KThemeSelector>
</MTheme>
);
return <KThemeSelector>{children}</KThemeSelector>;
};
const GlobalCssTheme = () => {

View File

@ -19,6 +19,6 @@
*/
import { BrowsePage } from "@kyoo/ui";
import { withRoute } from "~/utils/router";
import { withRoute } from "~/router";
export default withRoute(BrowsePage);

View File

@ -19,6 +19,6 @@
*/
import { BrowsePage } from "@kyoo/ui";
import { withRoute } from "~/utils/router";
import { withRoute } from "~/router";
export default withRoute(BrowsePage);

View File

@ -19,6 +19,6 @@
*/
import { MovieDetails } from "@kyoo/ui";
import { withRoute } from "~/utils/router";
import { withRoute } from "~/router";
export default withRoute(MovieDetails);

View File

@ -19,6 +19,6 @@
*/
import { ShowDetails } from "@kyoo/ui";
import { withRoute } from "~/utils/router";
import { withRoute } from "~/router";
export default withRoute(ShowDetails);

View File

@ -19,6 +19,6 @@
*/
import { Player } from "@kyoo/ui";
import { withRoute } from "~/utils/router";
import { withRoute } from "~/router";
export default withRoute(Player);

View File

@ -1,35 +0,0 @@
/*
* 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 { useState, useEffect } from "react";
export const useScroll = () => {
const [scroll, setScroll] = useState(0);
const scrollHandler = () => {
setScroll(window.scrollY);
};
useEffect(() => {
window.addEventListener("scroll", scrollHandler);
return () => window.removeEventListener("scroll", scrollHandler);
}, []);
return scroll;
};

View File

@ -1,26 +0,0 @@
/*
* 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 { withThemeProps } from "./with-theme";
import _InfiniteScroll from "react-infinite-scroll-component";
export const InfiniteScroll = withThemeProps(_InfiniteScroll, {
name: "InfiniteScroll",
});

View File

@ -1,68 +0,0 @@
/*
* 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 { forwardRef, Ref } from "react";
import NLink, { LinkProps as NLinkProps } from "next/link";
import {
Button as MButton,
ButtonProps,
Link as MLink,
LinkProps as MLinkProps,
} from "@mui/material";
type ButtonRef = HTMLButtonElement;
type ButtonLinkProps = Omit<ButtonProps, "href"> &
Pick<NLinkProps, "href" | "as" | "prefetch" | "locale">;
const NextButton = (
{ href, as, prefetch, locale, ...props }: ButtonLinkProps,
ref: Ref<ButtonRef>,
) => (
<NLink href={href} as={as} prefetch={prefetch} locale={locale} legacyBehavior passHref>
<MButton ref={ref} {...props} />
</NLink>
);
export const ButtonLink = forwardRef<ButtonRef, ButtonLinkProps>(NextButton);
type LinkRef = HTMLAnchorElement;
type LinkProps = Omit<MLinkProps, "href"> &
Pick<NLinkProps, "as" | "prefetch" | "locale" | "shallow" | "replace"> &
({ to: NLinkProps["href"]; href?: undefined } | { href: NLinkProps["href"]; to?: undefined });
const NextLink = (
{ href, to, as, prefetch, locale, shallow, replace, ...props }: LinkProps,
ref: Ref<LinkRef>,
) => (
<NLink
href={href ?? to}
as={as}
prefetch={prefetch}
locale={locale}
shallow={shallow}
replace={replace}
passHref
legacyBehavior
>
<MLink ref={ref} {...props} />
</NLink>
);
export const Link = forwardRef<LinkRef, LinkProps>(NextLink);

View File

@ -1,51 +0,0 @@
/*
* 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 { useEffect } from "react";
export const makeTitle = (title?: string) => {
return title ? `${title} - Kyoo` : "Kyoo";
};
let preventHover: boolean = false;
let hoverTimeout: NodeJS.Timeout;
export const useMobileHover = () => {
useEffect(() => {
const enableHover = () => {
if (preventHover) return;
document.body.classList.add("hoverEnabled");
};
const disableHover = () => {
if (hoverTimeout) clearTimeout(hoverTimeout);
preventHover = true;
hoverTimeout = setTimeout(() => (preventHover = false), 500);
document.body.classList.remove("hoverEnabled");
};
document.addEventListener("touchstart", disableHover, true);
document.addEventListener("mousemove", enableHover, true);
return () => {
document.removeEventListener("touchstart", disableHover);
document.removeEventListener("mousemove", enableHover);
};
}, []);
};

View File

@ -1,58 +0,0 @@
/*
* 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 { Theme, useThemeProps, styled } from "@mui/material";
import { MUIStyledCommonProps, MuiStyledOptions } from "@mui/system";
import { WithConditionalCSSProp } from "@emotion/react/types/jsx-namespace";
import clsx from "clsx";
import { FilteringStyledOptions } from "@emotion/styled";
export interface ClassNameProps {
className?: string;
}
export const withThemeProps = <P,>(
component: React.ComponentType<P>,
options?: FilteringStyledOptions<P> & MuiStyledOptions,
) => {
const name = options?.name || component.displayName;
// @ts-ignore
const Component = styled(component, options)<P>(() => ({}));
const WithTheme = (
inProps: P &
WithConditionalCSSProp<P & MUIStyledCommonProps<Theme>> &
ClassNameProps &
MUIStyledCommonProps<Theme>,
) => {
if (!name) {
console.error(
"withTheme could not be defined because the underlining component does not have a display name and the name option was not specified.",
);
return <Component {...inProps} />;
}
const props = useThemeProps({ props: inProps, name: name });
const className = clsx(props.className, `${name}-${options?.slot ?? "Root"}`);
// @ts-ignore
return <Component {...props} className={className} />;
};
WithTheme.displayName = `WithThemeProps(${name || "Component"})`;
return WithTheme;
};

View File

@ -13,13 +13,11 @@
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"jsxImportSource": "@emotion/react",
"incremental": true,
"baseUrl": ".",
"paths": {
"~/*": ["src/*"]
},
"types": ["@emotion/react/types/css-prop"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]

View File

@ -4,6 +4,7 @@
"types": "src/index.ts",
"packageManager": "yarn@3.2.4",
"devDependencies": {
"@gorhom/portal": "^1.0.14",
"@types/react": "^18.0.25",
"typescript": "^4.9.3"
},

File diff suppressed because it is too large Load Diff