Make the back button of the player goBack instead of going to the details page

This commit is contained in:
Zoe Roux 2023-12-19 23:50:58 +01:00
parent a8ab835365
commit d4ab42d98f

View File

@ -25,7 +25,6 @@ import {
H1, H1,
H2, H2,
IconButton, IconButton,
Link,
Poster, Poster,
PressableFeedback, PressableFeedback,
Skeleton, Skeleton,
@ -35,15 +34,7 @@ import {
} from "@kyoo/primitives"; } from "@kyoo/primitives";
import { Chapter, KyooImage, Subtitle, Audio } from "@kyoo/models"; import { Chapter, KyooImage, Subtitle, Audio } from "@kyoo/models";
import { useAtomValue, useSetAtom, useAtom } from "jotai"; import { useAtomValue, useSetAtom, useAtom } from "jotai";
import { import { ImageStyle, Platform, Pressable, View, ViewProps } from "react-native";
ImageStyle,
Platform,
Pressable,
View,
ViewProps,
PointerEvent as NativePointerEvent,
GestureResponderEvent,
} from "react-native";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { percent, rem, useYoshiki } from "yoshiki/native"; import { percent, rem, useYoshiki } from "yoshiki/native";
import { useRouter } from "solito/router"; import { useRouter } from "solito/router";
@ -127,7 +118,6 @@ export const Hover = ({
<Back <Back
isLoading={isLoading} isLoading={isLoading}
name={showName} name={showName}
href={href}
{...css({ {...css({
pointerEvents: "auto", pointerEvents: "auto",
})} })}
@ -336,9 +326,8 @@ const ProgressBar = ({ chapters }: { chapters?: Chapter[] }) => {
export const Back = ({ export const Back = ({
isLoading, isLoading,
name, name,
href,
...props ...props
}: { isLoading: boolean; name?: string; href?: string } & ViewProps) => { }: { isLoading: boolean; name?: string } & ViewProps) => {
const { css } = useYoshiki(); const { css } = useYoshiki();
const { t } = useTranslation(); const { t } = useTranslation();
const router = useRouter(); const router = useRouter();
@ -363,9 +352,8 @@ export const Back = ({
> >
<IconButton <IconButton
icon={ArrowBack} icon={ArrowBack}
{...(href as={PressableFeedback}
? { as: Link as any, href: href } onPress={router.back}
: { as: PressableFeedback, onPress: router.back })}
{...tooltip(t("player.back"))} {...tooltip(t("player.back"))}
/> />
<Skeleton> <Skeleton>