wip: Add browse page

This commit is contained in:
Zoe Roux 2025-06-15 15:48:26 +02:00
parent 9fbddd7b58
commit 8de7f20ac9
No known key found for this signature in database
16 changed files with 33 additions and 225 deletions

View File

@ -21,10 +21,11 @@ export const expo: ExpoConfig = {
foregroundImage: "./public/icon-256x256.png",
backgroundColor: "#eff1f5",
},
edgeToEdgeEnabled: true,
},
web: {
favicon: "./public/icon-256x256.png",
bundler: "metro"
bundler: "metro",
},
updates: {
url: "https://u.expo.dev/55de6b52-c649-4a15-9a45-569ff5ed036c",

View File

@ -1,29 +1,9 @@
/*
* 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 { Icon } from "@kyoo/primitives";
import Browse from "@material-symbols/svg-400/rounded/browse-fill.svg";
import Downloading from "@material-symbols/svg-400/rounded/downloading-fill.svg";
import Home from "@material-symbols/svg-400/rounded/home-fill.svg";
import { Tabs } from "expo-router";
import { useTranslation } from "react-i18next";
import { Icon } from "~/primitives";
export default function TabsLayout() {
const { t } = useTranslation();

View File

@ -0,0 +1,3 @@
import { BrowsePage } from "~/ui/browse";
export default BrowsePage;

View File

@ -12,8 +12,10 @@ export default function Layout() {
<ErrorConsumer scope="app">
<Stack
screenOptions={{
navigationBarColor: "transparent",
navigationBarTranslucent: true,
// navigationBarColor: "transparent",
// navigationBarTranslucent: true,
// statusBarTranslucent: true,
// statusBarBackgroundColor: theme.accent,
headerTitle: () => <NavbarTitle />,
headerRight: () => <NavbarRight />,
contentStyle: {

View File

@ -1,23 +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 { BrowsePage } from "@kyoo/ui";
export default BrowsePage;

2
front/i18n-d.d.ts vendored
View File

@ -1,5 +1,5 @@
import "i18next";
import type en from "./public/translations/en.json";
import type en from "../public/translations/en.json";
declare module "i18next" {
interface CustomTypeOptions {

View File

@ -1,32 +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 "../../../src/ui/navbar";
export { HomePage } from "./home";
export { BrowsePage } from "./browse";
export { MovieDetails, ShowDetails } from "./details";
export { CollectionPage } from "./collection";
export { Player } from "./player";
export { SearchPage } from "./search";
export { ServerUrlPage, LoginPage, RegisterPage, OidcCallbackPage } from "../../../src/ui/login";
export { DownloadPage, DownloadProvider } from "./downloads";
export { SettingsPage } from "./settings";
export { AdminPage } from "./admin";
export * from "../../../src/ui/errors";

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/>.
*/
declare module "*.svg" {
import type React from "react";
import type { SvgProps } from "react-native-svg";
const content: React.FC<SvgProps>;
export default content;
}

View File

@ -1,5 +1,5 @@
import "i18next";
import type en from "./public/translations/en.json";
import type en from "../public/translations/en.json";
declare module "i18next" {
interface CustomTypeOptions {

View File

@ -106,13 +106,13 @@ export const createQueryClient = () =>
retry: false,
},
mutations: {
mutationFn: (({ method, path, body, params }: MutationParam) => {
return queryFn({
method,
path: toQueryKey({ path, params }),
body,
});
}) as any,
// mutationFn: (({ method, path, body, params }: MutationParam) => {
// return queryFn({
// method,
// url: keyToUrl(toQueryKey({ path, params })),
// body,
// });
// }) as any,
},
},
});
@ -147,6 +147,10 @@ export const toQueryKey = (query: {
].filter((x) => x);
};
export const keyToUrl = (key: ReturnType<typeof toQueryKey>) => {
return key.join("/").replace("/?", "?");
};
export const useFetch = <Data,>(query: QueryIdentifier<Data>) => {
const { apiUrl, authToken } = useContext(AccountContext);
const key = toQueryKey({ apiUrl, path: query.path, params: query.params });
@ -155,7 +159,7 @@ export const useFetch = <Data,>(query: QueryIdentifier<Data>) => {
queryKey: key,
queryFn: (ctx) =>
queryFn({
url: key.join("/").replace("/?", "?"),
url: keyToUrl(key),
parser: query.parser,
signal: ctx.signal,
authToken: authToken?.access_token ?? null,
@ -174,7 +178,7 @@ export const useInfiniteFetch = <Data, Ret>(query: QueryIdentifier<Data, Ret>) =
queryKey: key,
queryFn: (ctx) =>
queryFn({
url: (ctx.pageParam as string) ?? key.join("/").replace("/?", "?"),
url: (ctx.pageParam as string) ?? keyToUrl(key),
parser: Paged(query.parser),
signal: ctx.signal,
authToken: authToken?.access_token ?? null,
@ -214,7 +218,7 @@ export const prefetch = async (...queries: QueryIdentifier[]) => {
queryKey: key,
queryFn: (ctx) =>
queryFn({
url: key.join("/").replace("/?", "?"),
url: keyToUrl(key),
parser: Paged(query.parser),
signal: ctx.signal,
authToken: authToken?.access_token ?? null,
@ -227,7 +231,7 @@ export const prefetch = async (...queries: QueryIdentifier[]) => {
queryKey: key,
queryFn: (ctx) =>
queryFn({
url: key.join("/").replace("/?", "?"),
url: keyToUrl(key),
parser: query.parser,
signal: ctx.signal,
authToken: authToken?.access_token ?? null,

View File

@ -1,23 +1,3 @@
/*
* 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 { type KyooImage, WatchStatusV } from "@kyoo/models";
import {
Icon,
@ -35,7 +15,7 @@ import Done from "@material-symbols/svg-400/rounded/check-fill.svg";
import { useState } from "react";
import { type ImageStyle, Platform, View } from "react-native";
import { type Stylable, type Theme, max, percent, px, rem, useYoshiki } from "yoshiki/native";
import { ItemContext } from "../components/context-menus";
import { ItemContext } from "../../../packages/ui/src/components/context-menus";
import type { Layout } from "../fetch";
export const ItemWatchStatus = ({

View File

@ -1,23 +1,3 @@
/*
* 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 { HR, Icon, IconButton, Menu, P, PressableFeedback, tooltip, ts } from "@kyoo/primitives";
import ArrowDownward from "@material-symbols/svg-400/rounded/arrow_downward.svg";
import ArrowUpward from "@material-symbols/svg-400/rounded/arrow_upward.svg";

View File

@ -1,34 +1,13 @@
/*
* 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 { type ComponentProps, useState } from "react";
import {
type LibraryItem,
LibraryItemP,
type QueryIdentifier,
type QueryPage,
getDisplayDate,
} from "@kyoo/models";
import { type ComponentProps, useState } from "react";
import { createParam } from "solito";
import { InfiniteFetch } from "../fetch-infinite";
import { DefaultLayout } from "../layout";
} from "~/models";
import { InfiniteFetch } from "../../query/fetch-infinite"
import { DefaultLayout } from "../../../packages/ui/src/layout";
import { ItemGrid } from "./grid";
import { BrowseSettings } from "./header";
import { ItemList } from "./list";

View File

@ -1,23 +1,3 @@
/*
* 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 type { KyooImage, WatchStatusV } from "@kyoo/models";
import {
GradientImageBackground,
@ -34,7 +14,7 @@ import {
import { useState } from "react";
import { Platform, View } from "react-native";
import { percent, px, rem, useYoshiki } from "yoshiki/native";
import { ItemContext } from "../components/context-menus";
import { ItemContext } from "../../../packages/ui/src/components/context-menus";
import type { Layout } from "../fetch";
import { ItemWatchStatus } from "./grid";

View File

@ -1,23 +1,3 @@
/*
* 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 Collection from "@material-symbols/svg-400/rounded/collections_bookmark.svg";
import Movie from "@material-symbols/svg-400/rounded/movie.svg";
import TV from "@material-symbols/svg-400/rounded/tv.svg";