diff --git a/mobile/package.json b/mobile/package.json index 62c3af4db..8712dd06a 100644 --- a/mobile/package.json +++ b/mobile/package.json @@ -25,7 +25,7 @@ "dependencies": { "@boterop/react-native-background-timer": "2.6.0", "@legendapp/list": "3.7.0", - "@lodev09/react-native-true-sheet": "4.0.0-beta.25", + "@lodev09/react-native-true-sheet": "4.0.1", "@missingcore/react-native-actual-path": "0.1.0", "@missingcore/react-native-audio-analyzer": "3.2.0-beta.5", "@missingcore/react-native-metadata-retriever": "4.0.0-beta.2", diff --git a/mobile/patches/@lodev09__react-native-true-sheet.patch b/mobile/patches/@lodev09__react-native-true-sheet.patch new file mode 100644 index 000000000..847b974c0 --- /dev/null +++ b/mobile/patches/@lodev09__react-native-true-sheet.patch @@ -0,0 +1,49 @@ +diff --git a/android/src/main/java/com/lodev09/truesheet/TrueSheetView.kt b/android/src/main/java/com/lodev09/truesheet/TrueSheetView.kt +index 4852ff16c3f706fd2da5f29aa0059b83e9250350..dd741b3460ab1bdf4762067431f5c27a39d8ab7c 100644 +--- a/android/src/main/java/com/lodev09/truesheet/TrueSheetView.kt ++++ b/android/src/main/java/com/lodev09/truesheet/TrueSheetView.kt +@@ -454,8 +454,10 @@ class TrueSheetView(private val reactContext: ThemedReactContext) : + viewController.coordinatorLayout?.let { + it.blocksTouches = true + container.addView(it) +- // Touches skip a view without a frame — don't wait for the next layout pass +- it.layout(0, 0, container.width, container.height) ++ //! The following code (added in `v4.0.0-beta.30`) caused an issue where the sheet's initial ++ //! height can be incorrect. ++ // // Touches skip a view without a frame — don't wait for the next layout pass ++ // it.layout(0, 0, container.width, container.height) + } + } + +diff --git a/lib/module/TrueSheet.js b/lib/module/TrueSheet.js +index 4012f3a0d30000baa2b36c561c68ac8d02dec6f3..0d7b13fe4c18e737a12132a6105591ebbfcd81d6 100644 +--- a/lib/module/TrueSheet.js ++++ b/lib/module/TrueSheet.js +@@ -135,7 +135,7 @@ export class TrueSheet extends PureComponent { + // it on unmount) or a handle with no usable scroll accessor. Treat it as + // no scrollable instead of crashing. + if (__DEV__) { +- console.warn('TrueSheet: scrollableRef could not be resolved to a native view. It may be stale or expose no scroll node.', error); ++ // console.warn('TrueSheet: scrollableRef could not be resolved to a native view. It may be stale or expose no scroll node.', error); + } + } + } +diff --git a/src/TrueSheet.tsx b/src/TrueSheet.tsx +index 734e7d3119c821842445415dc772f45ca9380771..8dafb41f174cce9bb47c63af72bbba6d598f4ef1 100644 +--- a/src/TrueSheet.tsx ++++ b/src/TrueSheet.tsx +@@ -216,10 +216,10 @@ export class TrueSheet + // it on unmount) or a handle with no usable scroll accessor. Treat it as + // no scrollable instead of crashing. + if (__DEV__) { +- console.warn( +- 'TrueSheet: scrollableRef could not be resolved to a native view. It may be stale or expose no scroll node.', +- error +- ); ++ // console.warn( ++ // 'TrueSheet: scrollableRef could not be resolved to a native view. It may be stale or expose no scroll node.', ++ // error ++ // ); + } + } + } diff --git a/mobile/pnpm-lock.yaml b/mobile/pnpm-lock.yaml index a51f9c8ca..48d428677 100644 --- a/mobile/pnpm-lock.yaml +++ b/mobile/pnpm-lock.yaml @@ -5,6 +5,7 @@ settings: excludeLinksFromLockfile: false patchedDependencies: + '@lodev09/react-native-true-sheet': db2d3a355811465e6ed7b08cdfa36345d93ec83756db2573cf21609cc93df03e react-native-material-palette: cb6604a7852903e36cef6eda789a4886aad57bbedd78f525bb2ba98ee28b97b8 importers: @@ -18,8 +19,8 @@ importers: specifier: 3.7.0 version: 3.7.0(react-native@0.88.1(@babel/core@7.29.7)(@react-native/metro-config@0.88.1(@babel/core@7.29.7))(@types/react@19.3.0)(react@19.3.0))(react@19.3.0) '@lodev09/react-native-true-sheet': - specifier: 4.0.0-beta.25 - version: 4.0.0-beta.25(61bda1a75ea501803a948faf9219f379) + specifier: 4.0.1 + version: 4.0.1(patch_hash=db2d3a355811465e6ed7b08cdfa36345d93ec83756db2573cf21609cc93df03e)(61bda1a75ea501803a948faf9219f379) '@missingcore/react-native-actual-path': specifier: 0.1.0 version: 0.1.0(react-native@0.88.1(@babel/core@7.29.7)(@react-native/metro-config@0.88.1(@babel/core@7.29.7))(@types/react@19.3.0)(react@19.3.0))(react@19.3.0) @@ -438,6 +439,12 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 + '@babel/plugin-transform-block-scoping@7.29.12': + resolution: {integrity: sha512-nEreZBofjfd6FG621xe9Rk3+tMGBXf1nAuFrR6NUGF67fkQbSQf3NrbRuhgWRn+zb0qcy9XVok1GVFI/t9wWVQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + '@babel/plugin-transform-class-properties@7.29.7': resolution: {integrity: sha512-GtcpjFvanPfzNQi3eTitsCqtRRmmqzpy/A+yhTR1HaZo1Ly3EA8ZXxlPyHdR8/IuRMYc3E4wdGBewB2QKQjAaA==} engines: {node: '>=6.9.0'} @@ -1570,8 +1577,8 @@ packages: react-native: optional: true - '@lodev09/react-native-true-sheet@4.0.0-beta.25': - resolution: {integrity: sha512-oF4zp61fzhxNb0mD+tOk4OfpbVXzKrCD5IFH33vGYKtrQa8PUkzsIA/6rioPqc/u7KtJNrqJf4yG5kryf41Dtg==} + '@lodev09/react-native-true-sheet@4.0.1': + resolution: {integrity: sha512-7FebcsouW7VGUB6F/Ah2gCAvhP0geZbSVbxfMG72zOjzpEbPzl5pwxHj8nQQ/0q8KnkQoKWiF4tuHhDqLGyVnw==} peerDependencies: '@radix-ui/react-dialog': '>=1' '@radix-ui/react-presence': '>=1' @@ -1580,8 +1587,8 @@ packages: react: '*' react-dom: '*' react-native: '>=0.82.0' - react-native-reanimated: '>=4' - react-native-worklets: '*' + react-native-reanimated: '>=4.1.0' + react-native-worklets: '>=0.5.0' standard-navigation: '>=0.0.9' peerDependenciesMeta: '@radix-ui/react-dialog': @@ -5999,6 +6006,11 @@ snapshots: '@babel/core': 7.29.7 '@babel/helper-plugin-utils': 7.29.7 + '@babel/plugin-transform-block-scoping@7.29.12(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + '@babel/plugin-transform-class-properties@7.29.7(@babel/core@7.29.7)': dependencies: '@babel/core': 7.29.7 @@ -7107,7 +7119,7 @@ snapshots: optionalDependencies: react-native: 0.88.1(@babel/core@7.29.7)(@react-native/metro-config@0.88.1(@babel/core@7.29.7))(@types/react@19.3.0)(react@19.3.0) - '@lodev09/react-native-true-sheet@4.0.0-beta.25(61bda1a75ea501803a948faf9219f379)': + '@lodev09/react-native-true-sheet@4.0.1(patch_hash=db2d3a355811465e6ed7b08cdfa36345d93ec83756db2573cf21609cc93df03e)(61bda1a75ea501803a948faf9219f379)': dependencies: react: 19.3.0 react-native: 0.88.1(@babel/core@7.29.7)(@react-native/metro-config@0.88.1(@babel/core@7.29.7))(@types/react@19.3.0)(react@19.3.0) @@ -7215,7 +7227,7 @@ snapshots: '@babel/plugin-syntax-optional-chaining': 7.8.3(@babel/core@7.29.7) '@babel/plugin-transform-async-generator-functions': 7.29.7(@babel/core@7.29.7) '@babel/plugin-transform-async-to-generator': 7.29.7(@babel/core@7.29.7) - '@babel/plugin-transform-block-scoping': 7.29.11(@babel/core@7.29.7) + '@babel/plugin-transform-block-scoping': 7.29.12(@babel/core@7.29.7) '@babel/plugin-transform-class-properties': 7.29.7(@babel/core@7.29.7) '@babel/plugin-transform-classes': 7.29.11(@babel/core@7.29.7) '@babel/plugin-transform-destructuring': 7.29.7(@babel/core@7.29.7) diff --git a/mobile/pnpm-workspace.yaml b/mobile/pnpm-workspace.yaml index cb1ffb518..9fc624743 100644 --- a/mobile/pnpm-workspace.yaml +++ b/mobile/pnpm-workspace.yaml @@ -11,4 +11,5 @@ allowBuilds: unrs-resolver: false patchedDependencies: + '@lodev09/react-native-true-sheet': patches/@lodev09__react-native-true-sheet.patch react-native-material-palette: patches/react-native-material-palette.patch diff --git a/mobile/src/components/Form/Checkbox.tsx b/mobile/src/components/Form/Checkbox.tsx deleted file mode 100644 index fd5e26010..000000000 --- a/mobile/src/components/Form/Checkbox.tsx +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright (C) 2024 - present, MissingCore -// SPDX-License-Identifier: AGPL-3.0-only - -import type { ParseKeys } from "i18next"; -import React, { memo } from "react"; -import { View } from "react-native"; - -import { cn } from "~/lib/style"; -import { Icon } from "~/components/next/base/icon"; -import { Pressable, Ripple } from "../Base/Pressable"; -import { TStyledText } from "../Typography/StyledText"; - -//#region Base -function Checkbox({ checked, size = 20 }: { checked: boolean; size?: number }) { - return ( - - {checked ? : null} - - ); -} - -type CheckboxFieldBaseProps = { - accessibilityLabel?: string; - checked: boolean; - onCheck: VoidFunction; - disabled?: boolean; - className?: string; -}; - -const CheckboxFieldBase = memo(function CheckboxFieldBase( - props: CheckboxFieldBaseProps & { children: React.ReactNode }, -) { - return ( - - {props.children} - - ); -}); -//#endregion - -//#region Field -export const CheckboxField = memo(function CheckboxField( - props: CheckboxFieldBaseProps & { children: React.ReactNode }, -) { - return ( - - {props.children} - - - ); -}); -//#endregion - -//#region Checkbox Input -export const CheckboxInput = memo(function CheckboxInput( - props: CheckboxFieldBaseProps & { accessibilityLabel: string }, -) { - return ( - - - - ); -}); -//#endregion - -//region Clickwrap -/** More traditional checkbox field appearance. */ -export const ClickwrapCheckbox = memo(function ClickwrapCheckbox( - props: CheckboxFieldBaseProps & { textKey: ParseKeys }, -) { - return ( - - - - - ); -}); -//#endregion diff --git a/mobile/src/components/Form/Input.tsx b/mobile/src/components/Form/Input.tsx deleted file mode 100644 index fc80a8ee8..000000000 --- a/mobile/src/components/Form/Input.tsx +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (C) 2024 - present, MissingCore -// SPDX-License-Identifier: AGPL-3.0-only - -import { useMemo, useRef } from "react"; -import type { TextInputInstance, TextInputProps } from "react-native"; -import { TextInput as RNTextInput } from "react-native"; -import { TextInput as RNGHTextInput } from "react-native-gesture-handler"; - -import { usePreferenceStore } from "~/stores/Preference/store"; - -import { FontSize } from "~/constants/Styles"; -import { OnRTL } from "~/lib/react"; -import { cn } from "~/lib/style"; -import { getFont } from "~/modules/customization/font/utils"; - -export function useInputRef() { - return useRef(null); -} - -export type InputProps = TextInputProps & { - ref?: React.Ref; - forSheet?: boolean; -}; - -//#region Numeric Input -/** Numeric input using the accent font. */ -export function NumericInput({ - className, - style, - forSheet, - ...props -}: InputProps) { - const accentFont = usePreferenceStore((s) => s.accentFont); - const Input = useMemo( - () => (forSheet ? RNGHTextInput : RNTextInput), - [forSheet], - ); - - return ( - - ); -} -//#endregion - -//#region Text Input -/** Styled text input meeting the recommended touch target size. */ -export function TextInput({ - className, - style, - forSheet, - ...props -}: InputProps) { - const primaryFont = usePreferenceStore((s) => s.primaryFont); - const Input = useMemo( - () => (forSheet ? RNGHTextInput : RNTextInput), - [forSheet], - ); - - return ( - - ); -} -//#endregion diff --git a/mobile/src/components/Form/NumberStepper.tsx b/mobile/src/components/Form/NumberStepper.tsx deleted file mode 100644 index 3db623b9c..000000000 --- a/mobile/src/components/Form/NumberStepper.tsx +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (C) 2024 - present, MissingCore -// SPDX-License-Identifier: AGPL-3.0-only - -import { memo, useCallback } from "react"; -import { useTranslation } from "react-i18next"; -import { View } from "react-native"; - -import { Em } from "../Typography/StyledText"; -import { IconButton } from "../next/base/button-icon"; - -export const NumberStepper = memo(function NumberStepper({ - value, - onChange, - ...props -}: { - value: number; - onChange: (step: number) => void; - min?: number; - max?: number; - step?: number; - suffix?: string; -}) { - const { t } = useTranslation(); - - const step = props.step !== undefined ? Math.abs(props.step) : 1; - - const decrementOnChange = useCallback( - () => onChange(-step), - [onChange, step], - ); - const incrementOnChange = useCallback(() => onChange(step), [onChange, step]); - - return ( - - - - {value} - {props.suffix} - - = props.max : undefined} - filled - size="xs" - className="rounded-sm" - /> - - ); -}); diff --git a/mobile/src/components/Form/SegmentedPicker.tsx b/mobile/src/components/Form/SegmentedPicker.tsx deleted file mode 100644 index 575f22dd5..000000000 --- a/mobile/src/components/Form/SegmentedPicker.tsx +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (C) 2024 - present, MissingCore -// SPDX-License-Identifier: AGPL-3.0-only - -import { View } from "react-native"; -import Animated, { - useAnimatedStyle, - useSharedValue, - withTiming, -} from "react-native-reanimated"; - -import { OnRTLWorklet } from "~/lib/react"; -import { cn } from "~/lib/style"; -import type { SupportedIconName } from "~/components/next/base/icon"; -import { Icon } from "~/components/next/base/icon"; -import { Pressable } from "../Base/Pressable"; -import { Em } from "../Typography/StyledText"; - -export type PickerOption = { - icon: SupportedIconName; - label: string; -}; - -/** Custom segmented picker design to match the one in the Nothing X app. */ -export function SegmentedPicker({ - options, - selectedIndex, - onOptionSelected, -}: { - options: PickerOption[]; - selectedIndex: number; - onOptionSelected: (index: number) => void; -}) { - const pickerWidth = useSharedValue(0); - - const selectedIndicatorStyle = useAnimatedStyle(() => ({ - width: `${(1 / options.length) * 100}%`, - transform: [ - { - translateX: withTiming( - OnRTLWorklet.decide(-selectedIndex, selectedIndex) * - (pickerWidth.get() / options.length), - { duration: 250 }, - ), - }, - ], - })); - - return ( - - - pickerWidth.set(e.nativeEvent.layout.width)} - className="relative flex-row items-start justify-center" - > - - {options.map(({ icon }, idx) => ( - onOptionSelected(idx)} - disabled={selectedIndex === idx} - className="min-h-10 flex-1 items-center justify-center rounded-full active:opacity-50" - > - - - ))} - - - - {options.map(({ label }, idx) => { - const active = selectedIndex === idx; - return ( - - {label.toLocaleUpperCase()} - - ); - })} - - - ); -} diff --git a/mobile/src/components/Sheet/SheetButtonGroup.tsx b/mobile/src/components/Sheet/SheetButtonGroup.tsx deleted file mode 100644 index 056984063..000000000 --- a/mobile/src/components/Sheet/SheetButtonGroup.tsx +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2024 - present, MissingCore -// SPDX-License-Identifier: AGPL-3.0-only - -import { View } from "react-native"; - -import { cn } from "~/lib/style"; -import type { ExtendedTButtonProps } from "../Form/Button"; -import { ExtendedTButton } from "../Form/Button"; - -export function SheetButtonGroup(props: { - leftButton: ExtendedTButtonProps; - rightButton: ExtendedTButtonProps; - className?: string; -}) { - return ( - - - - - ); -} diff --git a/mobile/src/components/next/base/sheet.tsx b/mobile/src/components/next/base/sheet.tsx index 56b48071b..3f837ccdc 100644 --- a/mobile/src/components/next/base/sheet.tsx +++ b/mobile/src/components/next/base/sheet.tsx @@ -1,22 +1,22 @@ // Copyright (C) 2024 - present, MissingCore // SPDX-License-Identifier: AGPL-3.0-only +import type { TrueSheetProps } from "@lodev09/react-native-true-sheet"; import { TrueSheet } from "@lodev09/react-native-true-sheet"; -import { cloneElement, useMemo, useRef, useState } from "react"; -import flattenChildren from "react-keyed-flatten-children"; +import { createContext, use, useImperativeHandle, useRef } from "react"; import type { ViewProps } from "react-native"; -import { View, useWindowDimensions } from "react-native"; +import { View } from "react-native"; +import type { AnimatedRef } from "react-native-reanimated"; import { useAnimatedRef } from "react-native-reanimated"; -import { useSafeAreaInsets } from "react-native-safe-area-context"; import { withUniwind } from "uniwind"; import { cn } from "~/lib/style"; import { GestureHandlerRootView } from "~/components/Base/GestureHandlerRootView"; import type { LegendListProps } from "~/components/Base/LegendList"; import { LegendList } from "~/components/Base/LegendList"; +import type { ScrollViewProps } from "~/components/Base/ScrollView"; import { ScrollView } from "~/components/Base/ScrollView"; -import { Text } from "./typography"; -import { Marquee } from "../blocks/marquee"; +import { useTheme } from "~/modules/customization/theme/hooks"; const WrappedSheet = withUniwind(TrueSheet); @@ -26,225 +26,135 @@ export function useSheetRef() { return useRef(null); } +//#region Scroll Context +const ScrollableRefContext = createContext>(null as never); +//#endregion + //#region Sheet -interface SheetProps { +interface SheetProps extends Pick< + TrueSheetProps, + "name" | "draggable" | "children" | "header" | "footer" +> { ref?: SheetRef; - /** Makes sheet accessible globally using this key. */ - name?: string; - draggable?: boolean; /** Render sheet at its max height. */ snapTop?: boolean; /** Fires when the sheet is dismissed. */ onCleanup?: VoidFunction; - children: React.ReactNode; } const MAX_SHEET_HEIGHT = 640; /** Child nodes will automatically be wrapped with a `ScrollView`. */ -function Sheet(props: SheetProps) { - const { header, footer, scrollableRef, children } = useSheetComponents( - props.children, - ); - const { maxHeight, setHeaderHeight, setFooterHeight } = - useScrollableMaxHeight(); - +export function Sheet(props: SheetProps) { + const { surfaceBright } = useTheme(); + const scrollableRef = useAnimatedRef(); return ( - props.onCleanup?.()} - className="p-4 pt-0" - > - - - setHeaderHeight(e.nativeEvent.layout.height)}> - - {header} - - - {children} - - setFooterHeight(e.nativeEvent.layout.height)}> - {footer} - + + props.onCleanup?.()} + grabber={false} + maxContentHeight={MAX_SHEET_HEIGHT} + header={props.header ?? } + headerClassName="bg-surfaceBright" + //? We get incorrect automatic insets for `SheetLegendList` if we + //? don't provide a footer. A non-zero height must be specified to + //? work in some situations (ie: `AddMusicSheet`). + footer={props.footer ?? } + footerOptions={{ position: "absolute" }} + footerClassName="bg-surfaceBright" + //? We don't use `transparent` as sometimes, you can see the seam + //? between the header, content, and footer. + backgroundColor={surfaceBright} + cornerRadius={24} + className="bg-surfaceBright" + > + + {props.children} - - - ); -} - -function useSheetComponents(children: React.ReactNode) { - const listRef = useAnimatedRef(); - return useMemo(() => { - const nodes = flattenChildren(children) as React.JSX.Element[]; - - const header = nodes.find((n) => n?.type === Header); - const footer = nodes.find((n) => n?.type === Footer); - const contentNodes = nodes.filter( - (n) => n?.type !== Header && n?.type !== Footer, - ); - - //? We assume that if `Sheet.List` is rendered, then no other content is rendered. - const list = contentNodes.find( - (n) => n?.type === List || n?.props?.CustomList === List, - ); - if (list) { - const scrollableRef = list.props.ref ?? listRef; - const children = - list.props.ref == null ? cloneElement(list, { ref: listRef }) : list; - return { header, footer, scrollableRef, children }; - } else { - return { - header, - footer, - scrollableRef: listRef, - children: ( - - {contentNodes} - - ), - }; - } - }, [children, listRef]); -} - -/** - * Identifoes the max height of the inner scrollable since it's auto-height - * gets really funky when we render other components adjacent to it. - */ -function useScrollableMaxHeight() { - const { height } = useWindowDimensions(); - const { top, bottom } = useSafeAreaInsets(); - const [headerHeight, setHeaderHeight] = useState(0); - const [footerHeight, setFooterHeight] = useState(0); - return useMemo( - () => ({ - maxHeight: - Math.min(height, MAX_SHEET_HEIGHT) - - top - - bottom - - headerHeight - - footerHeight - - 32, - setHeaderHeight, - setFooterHeight, - }), - [height, top, bottom, headerHeight, footerHeight], + + ); } //#endregion -//#region Header -/** - * Non-scrolling content we want appearing at the top of the sheet. - * - * Should be rendered as a direct child of `Sheet`. - */ -function Header(props: { - label?: string; - children?: React.ReactNode; - Leading?: React.ReactNode; - Trailing?: React.ReactNode; -}) { +//#region Decoration +export function SheetHeader({ children, className, ...props }: ViewProps) { return ( - - {props.label || props.Leading || props.Trailing ? ( - - {props.Leading} - - - {props.label} - - - {props.Trailing} - - ) : null} - {props.children} + + + {children} ); } -//#endregion -//#region Footer -/** - * Non-scrolling content we want appearing at the bottom of the sheet. - * - * Should be rendered as a direct child of `Sheet`. - */ -function Footer({ className, ...props }: Omit) { - return ; +export function SheetFooter({ className, ...props }: ViewProps) { + return ( + + ); } //#endregion -//#region List -/** - * Displays a list of items in the sheet. If rendered, will be the only - * child rendered by the sheet. - * - * Should be rendered as a direct child of `Sheet`. - */ -function List(props: LegendListProps) { +//#region Scrollables +export function SheetLegendList({ + ref, + contentContainerClassName, + ...props +}: LegendListProps) { + const scrollableRef = use(ScrollableRefContext); + useImperativeHandle(ref, () => scrollableRef.current); return ( ); } //#endregion -//#region Actions -/** A list of buttons in a row. */ -function Actions(props: { children: React.JSX.Element[] }) { - const styledComponents = useMemo(() => { - const nodes = flattenChildren(props.children) as React.JSX.Element[]; - return nodes.map((node, index) => - cloneElement(node, { - className: cn( - "flex-1 bg-surfaceContainerLowest", - node.props.className, - { - "rounded-l-xs": index > 0, - "rounded-r-xs": index < nodes.length - 1, - }, - ), - }), - ); - }, [props.children]); +//#region Scrollable Sheet +/** Sheet with contents wrapped in `ScrollView`. */ +export function ScrollableSheet({ + children, + className, + contentContainerClassName, + ...props +}: SheetProps & { className?: string; contentContainerClassName?: string }) { return ( - {styledComponents} + + + {children} + + ); } -//#endregion - -//#region Exports -Sheet.Header = Header; -Sheet.List = List; -Sheet.Footer = Footer; -Sheet.Actions = Actions; -export { Sheet }; +function SheetScrollView({ + contentContainerClassName, + ...props +}: Omit) { + const scrollableRef = use(ScrollableRefContext); + return ( + + ); +} //#endregion diff --git a/mobile/src/components/next/base/switch.tsx b/mobile/src/components/next/base/switch.tsx index 71f1479de..458724139 100644 --- a/mobile/src/components/next/base/switch.tsx +++ b/mobile/src/components/next/base/switch.tsx @@ -48,8 +48,9 @@ export function SwitchInput(props: { }) { return ( + {checked ? : null} + + ); +} + +type CheckboxFieldBaseProps = { + checked: boolean; + onCheck: VoidFunction; + disabled?: boolean; + className?: string; +}; + +function CheckboxFieldBase( + props: CheckboxFieldBaseProps & { children: React.ReactNode }, +) { + return ( + + {props.children} + + ); +} +//#endregion + +//#region Field +export function CheckboxField( + props: CheckboxFieldBaseProps & { children: React.ReactNode }, +) { + return ( + + + {props.children} + + ); +} +//#endregion + +//#region Clickwrap +const clickwrapCheckboxStyle = cva({ + composes: [baseContainerStyle], + base: "min-h-6 gap-3 rounded-lg p-3", + defaultVariants: { outline: true }, +}); + +export function ClickwrapCheckbox( + props: CheckboxFieldBaseProps & { textKey: ParseKeys }, +) { + return ( + + + + + ); +} +//#endregion diff --git a/mobile/src/components/next/blocks/hint.tsx b/mobile/src/components/next/blocks/hint.tsx index 9055ff37f..6ab0d87cb 100644 --- a/mobile/src/components/next/blocks/hint.tsx +++ b/mobile/src/components/next/blocks/hint.tsx @@ -5,8 +5,8 @@ import { View } from "react-native"; import { cn, cva } from "~/lib/style"; import { Icon } from "../base/icon"; -import { Text } from "../base/typography"; import { baseContainerStyle } from "../base/styles"; +import { Text } from "../base/typography"; const hintStyle = cva({ composes: [baseContainerStyle], diff --git a/mobile/src/components/next/blocks/radio.tsx b/mobile/src/components/next/blocks/radio.tsx new file mode 100644 index 000000000..400414ba9 --- /dev/null +++ b/mobile/src/components/next/blocks/radio.tsx @@ -0,0 +1,61 @@ +// Copyright (C) 2024 - present, MissingCore +// SPDX-License-Identifier: AGPL-3.0-only + +import { View } from "react-native"; + +import { cn } from "~/lib/style"; +import { Ripple } from "../base/ripple"; + +//#region Base +function Radio({ selected, size = 20 }: { selected: boolean; size?: number }) { + return ( + + ); +} + +type RadioFieldBaseProps = { + selected: boolean; + onSelect: VoidFunction; + disabled?: boolean; + className?: string; +}; + +function RadioFieldBase( + props: RadioFieldBaseProps & { children: React.ReactNode }, +) { + return ( + + {props.children} + + ); +} +//#endregion + +//#region Field +export function RadioField( + props: RadioFieldBaseProps & { children: React.ReactNode }, +) { + return ( + + + {props.children} + + ); +} +//#endregion diff --git a/mobile/src/navigation/screens/settings/components/SettingsList.tsx b/mobile/src/components/next/composed/list.tsx similarity index 72% rename from mobile/src/navigation/screens/settings/components/SettingsList.tsx rename to mobile/src/components/next/composed/list.tsx index 8d01c6a9f..05fb004e7 100644 --- a/mobile/src/navigation/screens/settings/components/SettingsList.tsx +++ b/mobile/src/components/next/composed/list.tsx @@ -6,15 +6,15 @@ import { View } from "react-native"; import { OnRTL } from "~/lib/react"; import { cn } from "~/lib/style"; import { openLink } from "~/lib/web-browser"; -import { Card } from "~/components/next/base/card"; -import { Divider as DividerBase } from "~/components/next/base/divider"; -import type { SupportedIconName } from "~/components/next/base/icon"; -import { Icon } from "~/components/next/base/icon"; -import { Ripple } from "~/components/next/base/ripple"; -import { Switch } from "~/components/next/base/switch"; -import { Text } from "~/components/next/base/typography"; -import { TextStack } from "~/components/next/blocks/text-stack"; -import type { PressableProps } from "~/components/next/primitive/pressable"; +import { Card } from "../base/card"; +import { Divider as DividerBase } from "../base/divider"; +import type { SupportedIconName } from "../base/icon"; +import { Icon } from "../base/icon"; +import { Ripple } from "../base/ripple"; +import { Switch } from "../base/switch"; +import { Text } from "../base/typography"; +import { TextStack } from "../blocks/text-stack"; +import type { PressableProps } from "../primitive/pressable"; export function Group(props: { children: React.ReactNode; label?: string }) { const renderedComponent = {props.children}; @@ -41,6 +41,7 @@ export function ExternalLinkItem({ return ( openLink(href)} Trailing={} /> @@ -64,8 +65,9 @@ export function ToggleItem({ return ( } /> @@ -74,7 +76,8 @@ export function ToggleItem({ //#region Internal Helpers interface ItemBaseProps { - icon: SupportedIconName; + /** The design is icon-first (ie: we assume an icon is provided). */ + icon?: SupportedIconName; label: string; supporting?: string; disabled?: boolean; @@ -92,7 +95,7 @@ function ItemBase({ {...props} className="flex-row items-center gap-4 p-4 disabled:opacity-25" > - + {icon ? : null} {Trailing} diff --git a/mobile/src/components/next/composed/sheet-radio.tsx b/mobile/src/components/next/composed/sheet-radio.tsx index 5896c686d..b3c137c3e 100644 --- a/mobile/src/components/next/composed/sheet-radio.tsx +++ b/mobile/src/components/next/composed/sheet-radio.tsx @@ -3,44 +3,59 @@ import { Button } from "../base/button"; import type { SheetRef } from "../base/sheet"; -import { Sheet } from "../base/sheet"; +import { Sheet, SheetLegendList } from "../base/sheet"; import { Text } from "../base/typography"; -interface RadioSheetProps { - ref: SheetRef; +interface SheetRadioListProps { data: TData[]; onSelect: (item: TData) => void; isSelected: (item: TData) => boolean; } -export function RadioSheet( - props: RadioSheetProps, +/** Radio list built for sheets. */ +export function SheetRadioList( + props: SheetRadioListProps, ) { return ( - //? ~11 items will have the sheet at its current max height, meaning - //? it should be safe to enable the short dismiss threshold. - 10}> - item.label} - renderItem={({ item }) => { - const isSelected = props.isSelected(item); - return ( - - ); + item.label} + extraData={props.isSelected} + renderItem={({ item }) => { + const isSelected = props.isSelected(item); + return ( + + ); + }} + contentContainerClassName="gap-1.5" + /> + ); +} + +export function RadioSheet({ + ref, + onSelect, + ...props +}: SheetRadioListProps & { ref: SheetRef }) { + return ( + + { + onSelect(item); + ref.current?.dismiss(); }} - className="-mb-5.5" /> ); diff --git a/mobile/src/modules/customization/font/sheet.tsx b/mobile/src/modules/customization/font/sheet.tsx index 0a33f5142..329316346 100644 --- a/mobile/src/modules/customization/font/sheet.tsx +++ b/mobile/src/modules/customization/font/sheet.tsx @@ -11,13 +11,18 @@ import type { CustomFont } from "~/db/schema"; import { usePreferenceStore } from "~/stores/Preference/store"; import { PreferenceSetters } from "~/stores/Preference/actions"; +import { useGetLayoutConfig } from "~/hooks/useLayoutConfigs"; import { pickFile } from "~/lib/file-system"; import { cn } from "~/lib/style"; import { Button } from "~/components/next/base/button"; import { IconButton } from "~/components/next/base/button-icon"; import type { SheetRef } from "~/components/next/base/sheet"; -import { Sheet } from "~/components/next/base/sheet"; +import { + Sheet, + SheetFooter, + SheetLegendList, +} from "~/components/next/base/sheet"; import { Text } from "~/components/next/base/typography"; import type { Font } from "./core/constants"; import { BundledFontOptions } from "./core/constants"; @@ -49,8 +54,11 @@ const FontConfig = { }, } as const; +const sheetColumnConfig = { minCols: 2, minWidth: 128, gap: 0 }; + function FontSheet(props: { ref: SheetRef; type: "Accent" | "Primary" }) { const { t } = useTranslation(); + const { count: columnCount } = useGetLayoutConfig(sheetColumnConfig); const { data } = useCustomFonts(); const fontOptions = useMemo(() => { @@ -77,9 +85,23 @@ function FontSheet(props: { ref: SheetRef; type: "Accent" | "Primary" }) { //#endregion return ( - - + importFont(setFont)} + intent="inverse" + filled + wide + /> + + } + > + (isBundledFont(font) ? font : font.id)} extraData={selectedFont} @@ -88,7 +110,7 @@ function FontSheet(props: { ref: SheetRef; type: "Accent" | "Primary" }) { return ( @@ -122,20 +144,8 @@ function FontSheet(props: { ref: SheetRef; type: "Accent" | "Primary" }) { ); }} - className="mb-0" contentContainerClassName="pb-0" /> - - importFont(setFont)} - intent="inverse" - filled - wide - className="self-center" - /> - ); } diff --git a/mobile/src/modules/customization/theme/sheet.tsx b/mobile/src/modules/customization/theme/sheet.tsx index d20ce3dc2..91e020719 100644 --- a/mobile/src/modules/customization/theme/sheet.tsx +++ b/mobile/src/modules/customization/theme/sheet.tsx @@ -13,7 +13,11 @@ import { PreferenceSetters } from "~/stores/Preference/actions"; import { Button } from "~/components/next/base/button"; import { IconButton } from "~/components/next/base/button-icon"; import type { SheetRef } from "~/components/next/base/sheet"; -import { Sheet } from "~/components/next/base/sheet"; +import { + Sheet, + SheetFooter, + SheetLegendList, +} from "~/components/next/base/sheet"; import { Text } from "~/components/next/base/typography"; import { SegmentedPicker } from "~/components/next/blocks/segmented-picker"; import type { CustomTheme, ResolvedTheme } from "./core/constants"; @@ -38,8 +42,22 @@ export function ThemeSheet(props: { ref: SheetRef }) { }, [data]); return ( - - + navigation.navigate("CreateTheme")} + intent="inverse" + filled + wide + /> + + } + > + id} extraData={[selectedTheme, themeMap]} @@ -56,14 +74,14 @@ export function ThemeSheet(props: { ref: SheetRef }) { return ( + - - - } + - - + } /> - + } /> - - + + ); } diff --git a/mobile/src/navigation/screens/now-playing/sheets/SleepTimerSheet/index.tsx b/mobile/src/navigation/screens/now-playing/sheets/SleepTimerSheet/index.tsx index aaad99282..249b5f145 100644 --- a/mobile/src/navigation/screens/now-playing/sheets/SleepTimerSheet/index.tsx +++ b/mobile/src/navigation/screens/now-playing/sheets/SleepTimerSheet/index.tsx @@ -4,17 +4,21 @@ import { useEffect, useMemo, useState } from "react"; import { useTranslation } from "react-i18next"; import { Keyboard } from "react-native"; +import { scheduleOnRN } from "react-native-worklets"; import { useInForeground } from "~/stores/ListenerState"; import { useSleepTimerStore } from "./store"; import { wait } from "~/utils/promise"; -import { ClickwrapCheckbox } from "~/components/Form/Checkbox"; -import { NumericInput } from "~/components/Form/Input"; +import { Card } from "~/components/next/base/card"; +import { Divider } from "~/components/next/base/divider"; import type { SheetRef } from "~/components/next/base/sheet"; -import { Sheet } from "~/components/next/base/sheet"; +import { ScrollableSheet } from "~/components/next/base/sheet"; import { Text, TText } from "~/components/next/base/typography"; import { ActionButton } from "~/components/next/blocks/button-action"; +import { ClickwrapCheckbox } from "~/components/next/blocks/checkbox"; +import type { LabeledSliderProps } from "~/components/next/blocks/slider-labeled"; +import { LabeledSlider } from "~/components/next/blocks/slider-labeled"; export function SleepTimerSheet(props: { ref: SheetRef }) { const { t } = useTranslation(); @@ -24,6 +28,7 @@ export function SleepTimerSheet(props: { ref: SheetRef }) { const endAt = useSleepTimerStore((s) => s.endAt); const createTimer = useSleepTimerStore((s) => s.create); const clearTimer = useSleepTimerStore((s) => s.clear); + const [stopDrag, setStopDrag] = useState(false); const [minutes, setMinutes] = useState(`${sleepTimerLength}`); const hasTimer = endAt !== null; @@ -52,37 +57,55 @@ export function SleepTimerSheet(props: { ref: SheetRef }) { createTimer(minutesAsNum); }; - return ( - - + const sleepTimerDurationSlider = useMemo( + () => ({ + min: 1, + max: 60, + initValue: Number(minutes) || 5, + label: t("feat.modalViewPreference.extra.duration"), + formatValue: (value) => { + "worklet"; + return `${value}min`; + }, + onChange: (value) => { + "worklet"; + scheduleOnRN(setMinutes, `${value}`); + }, + onStatusChange: (status) => { + "worklet"; + scheduleOnRN(setStopDrag, status !== "idle"); + }, + }), + [t, setStopDrag, minutes], + ); - - {hasTimer ? ( - - ) : ( - setMinutes(text)} - maxLength={3} // Max out at 999 minutes (~16.5 hours). - className="mx-auto w-full max-w-1/2 border-b border-outline text-center" - forSheet + return ( + + + + {hasTimer ? ( + + ) : ( + + )} + + {t("feat.sleepTimer.extra.stopTime", { time: endString })} + + + - )} - - {t("feat.sleepTimer.extra.stopTime", { time: endString })} - - + - + ); } diff --git a/mobile/src/navigation/screens/playlists/sheets/AddMusicSheet.tsx b/mobile/src/navigation/screens/playlists/sheets/AddMusicSheet.tsx index 18e3d25eb..502422300 100644 --- a/mobile/src/navigation/screens/playlists/sheets/AddMusicSheet.tsx +++ b/mobile/src/navigation/screens/playlists/sheets/AddMusicSheet.tsx @@ -2,7 +2,11 @@ // SPDX-License-Identifier: AGPL-3.0-only import type { SheetRef } from "~/components/next/base/sheet"; -import { Sheet } from "~/components/next/base/sheet"; +import { + Sheet, + SheetHeader, + SheetLegendList, +} from "~/components/next/base/sheet"; import { SearchEngineList } from "~/modules/search/components/SearchEngine"; import { Search } from "~/modules/search/components/SearchList"; import type { SearchCallbacks } from "~/modules/search/types"; @@ -17,12 +21,17 @@ export function AddMusicSheet(props: { }) { return ( - - - - + + + + } + > setExportOption("absolute")}> - - - setExportOption("absolute")} + > + value} + renderItem={({ item: { value, label } }) => { + const selected = value === exportOption; + return ( + setExportOption(value)} + className="rounded-none p-4" + > + + {label} + + + ); + }} + scrollEnabled={false} + className="rounded-xl bg-surfaceContainerLowest" /> - + ); } diff --git a/mobile/src/navigation/screens/settings/AboutView.tsx b/mobile/src/navigation/screens/settings/AboutView.tsx index ca752b409..b82f76dff 100644 --- a/mobile/src/navigation/screens/settings/AboutView.tsx +++ b/mobile/src/navigation/screens/settings/AboutView.tsx @@ -9,12 +9,12 @@ import { usePreferenceStore } from "~/stores/Preference/store"; import { PreferenceTogglers } from "~/stores/Preference/actions"; import { ScrollLayout } from "~/navigation/layouts/ScrollLayout"; -import * as SettingsList from "./components/SettingsList"; import { APP_VERSION } from "~/constants/Config"; import { Links } from "~/lib/web-browser"; import { Card } from "~/components/next/base/card"; import { createTextStack } from "~/components/next/blocks/text-stack"; +import * as List from "~/components/next/composed/list"; import { Image } from "~/components/next/primitive/image"; const CTATextStack = createTextStack({ @@ -39,66 +39,66 @@ export default function AboutApp() { - - + - - + - - + - + - - + - - + - + - - + - - + - - + navigation.navigate("ThirdParty")} /> - + ); } diff --git a/mobile/src/navigation/screens/settings/AppUpdateView.tsx b/mobile/src/navigation/screens/settings/AppUpdateView.tsx index 702a58109..d6aa439a2 100644 --- a/mobile/src/navigation/screens/settings/AppUpdateView.tsx +++ b/mobile/src/navigation/screens/settings/AppUpdateView.tsx @@ -11,12 +11,12 @@ import { usePreferenceStore } from "~/stores/Preference/store"; import { useHasNewUpdate } from "~/navigation/hooks/useHasNewUpdate"; import { ScrollLayout } from "~/navigation/layouts/ScrollLayout"; -import * as SettingsList from "~/navigation/screens/settings/components/SettingsList"; import { FontSize } from "~/constants/Styles"; import { Links, openLink } from "~/lib/web-browser"; import { Card } from "~/components/next/base/card"; import { Icon } from "~/components/next/base/icon"; +import * as List from "~/components/next/composed/list"; import { getFont } from "~/modules/customization/font/utils"; import { useTheme } from "~/modules/customization/theme/hooks"; @@ -117,22 +117,22 @@ export default function AppUpdate() { - + {DISTRIBUTION === "google-play" ? ( - ) : ( - )} - + ); } diff --git a/mobile/src/navigation/screens/settings/AppearanceSettingsView.tsx b/mobile/src/navigation/screens/settings/AppearanceSettingsView.tsx index adfcaa327..02bc63935 100644 --- a/mobile/src/navigation/screens/settings/AppearanceSettingsView.tsx +++ b/mobile/src/navigation/screens/settings/AppearanceSettingsView.tsx @@ -12,9 +12,9 @@ import { DefaultLibraryTabSheet, DefaultOpenTabSheet, } from "./sheets/TabSelectionSheets"; -import * as SettingsList from "./components/SettingsList"; import { useSheetRef } from "~/components/next/base/sheet"; +import * as List from "~/components/next/composed/list"; import { AccentFontSheet, PrimaryFontSheet, @@ -56,22 +56,22 @@ export default function AppearanceSettings() { - - + accentFontSheetRef.current?.present()} /> - - + primaryFontSheetRef.current?.present()} /> - - + themeSheetRef.current?.present()} /> - + - - + columnSizeSheetRef.current?.present()} /> - - + defaultOpenTabSheetRef.current?.present()} /> - - + defaultLibraryTabSheetRef.current?.present()} /> - + - - + - - + - + - - + - - + - + - - + - - + - + - - + - + ); diff --git a/mobile/src/navigation/screens/settings/ExperimentalSettingsView.tsx b/mobile/src/navigation/screens/settings/ExperimentalSettingsView.tsx index 40c0f1db0..2ef04b177 100644 --- a/mobile/src/navigation/screens/settings/ExperimentalSettingsView.tsx +++ b/mobile/src/navigation/screens/settings/ExperimentalSettingsView.tsx @@ -22,12 +22,12 @@ import { PreferenceTogglers } from "~/stores/Preference/actions"; import { sessionStore } from "~/stores/Session/store"; import { ScrollLayout } from "~/navigation/layouts/ScrollLayout"; -import * as SettingsList from "./components/SettingsList"; import { ImageDirectory } from "~/lib/file-system"; import { queryClient } from "~/lib/react-query"; import { Links } from "~/lib/web-browser"; import { ConfirmAction } from "~/components/next/composed/confirm-action"; +import * as List from "~/components/next/composed/list"; export default function ExperimentalSettings() { const { t } = useTranslation(); @@ -38,43 +38,43 @@ export default function ExperimentalSettings() { return ( - - + - - + - + - - + - + - - + - + - + - {unhashedImagesCount !== undefined && unhashedImagesCount !== 0 ? ( <> - + - ) : null} - + ); } diff --git a/mobile/src/navigation/screens/settings/PlaybackSettingsView.tsx b/mobile/src/navigation/screens/settings/PlaybackSettingsView.tsx index dd953a174..e1fc36d75 100644 --- a/mobile/src/navigation/screens/settings/PlaybackSettingsView.tsx +++ b/mobile/src/navigation/screens/settings/PlaybackSettingsView.tsx @@ -7,7 +7,8 @@ import { usePreferenceStore } from "~/stores/Preference/store"; import { PreferenceTogglers } from "~/stores/Preference/actions"; import { ScrollLayout } from "~/navigation/layouts/ScrollLayout"; -import * as SettingsList from "./components/SettingsList"; + +import * as List from "~/components/next/composed/list"; export default function PlaybackSettings() { const { t } = useTranslation(); @@ -20,40 +21,40 @@ export default function PlaybackSettings() { return ( - - + - - + - + - - + - - + - + ); } diff --git a/mobile/src/navigation/screens/settings/ScanningSettingsView.tsx b/mobile/src/navigation/screens/settings/ScanningSettingsView.tsx index bb80d8146..17a56312d 100644 --- a/mobile/src/navigation/screens/settings/ScanningSettingsView.tsx +++ b/mobile/src/navigation/screens/settings/ScanningSettingsView.tsx @@ -12,13 +12,13 @@ import { ScrollLayout } from "~/navigation/layouts/ScrollLayout"; import { MinDurationSheet } from "./sheets/MinDurationSheet"; import { ScanFilterListSheet } from "./sheets/ScanFilterListSheet"; import { SeparatorsSheet } from "./sheets/SeparatorsSheet"; -import * as SettingsList from "./components/SettingsList"; import { getAPIVersionCode } from "~/lib/device"; import { mutateGuard } from "~/lib/react-query"; import type { SheetRef } from "~/components/next/base/sheet"; import { useSheetRef } from "~/components/next/base/sheet"; import { ConfirmAction } from "~/components/next/composed/confirm-action"; +import * as List from "~/components/next/composed/list"; export default function ScanningSettings() { const { t } = useTranslation(); @@ -30,17 +30,17 @@ export default function ScanningSettings() { <> - - + mutateGuard(rescan, undefined)} disabled={rescan.isPending} /> - + - - + - - + - + - + - + @@ -82,7 +82,7 @@ export function OptimizedImageSavingSetting() { ]} skipConfirmation={!optimizedImageSave} > - s.mediaStoreScanner); return getAPIVersionCode() >= 30 ? ( - - - + props.allowListSheetRef.current?.present()} /> - - + props.blockListSheetRef.current?.present()} /> - - + props.minDurationSheetRef.current?.present()} /> - + - - + props.separatorsSheetRef.current?.present()} /> - + ); }), diff --git a/mobile/src/navigation/screens/settings/View.tsx b/mobile/src/navigation/screens/settings/View.tsx index 975389678..116806d7d 100644 --- a/mobile/src/navigation/screens/settings/View.tsx +++ b/mobile/src/navigation/screens/settings/View.tsx @@ -9,9 +9,9 @@ import { usePreferenceStore } from "~/stores/Preference/store"; import { ScrollLayout } from "~/navigation/layouts/ScrollLayout"; import { BackupSheet } from "./sheets/BackupSheet"; import { LanguageSheet } from "./sheets/LanguageSheet"; -import * as SettingsList from "./components/SettingsList"; import { useSheetRef } from "~/components/next/base/sheet"; +import * as List from "~/components/next/composed/list"; import { LANGUAGES } from "~/modules/i18n/constants"; export default function Settings() { @@ -29,74 +29,74 @@ export default function Settings() { - - + navigation.navigate("AppearanceSettings")} /> - - + languageSheetRef.current?.present()} /> - + - - + backupSheetRef.current?.present()} /> - - + navigation.navigate("Insights")} /> - - + navigation.navigate("ScanningSettings")} /> - + - - + navigation.navigate("AudioEffects", {})} /> - - + navigation.navigate("LyricsSettings")} /> - - + navigation.navigate("PlaybackSettings")} /> - + - - + navigation.navigate("ExperimentalSettings")} /> - - + navigation.navigate("About")} /> - + ); diff --git a/mobile/src/navigation/screens/settings/sheets/BackupSheet.tsx b/mobile/src/navigation/screens/settings/sheets/BackupSheet.tsx index d843ab5ee..e90e05a07 100644 --- a/mobile/src/navigation/screens/settings/sheets/BackupSheet.tsx +++ b/mobile/src/navigation/screens/settings/sheets/BackupSheet.tsx @@ -2,12 +2,13 @@ // SPDX-License-Identifier: AGPL-3.0-only import { useTranslation } from "react-i18next"; +import { View } from "react-native"; import { useExportBackup, useImportBackup } from "~/modules/backup/JSON"; import { mutateGuard } from "~/lib/react-query"; import type { SheetRef } from "~/components/next/base/sheet"; -import { Sheet } from "~/components/next/base/sheet"; +import { ScrollableSheet } from "~/components/next/base/sheet"; import { ActionButton } from "~/components/next/blocks/button-action"; import { Hint } from "~/components/next/blocks/hint"; @@ -19,26 +20,24 @@ export function BackupSheet(props: { ref: SheetRef }) { const inProgress = exportBackup.isPending || importBackup.isPending; return ( - - + + mutateGuard(exportBackup, undefined)} disabled={inProgress} leadingIcon="download" - className="rounded-lg" + className="flex-1 rounded-lg rounded-r-xs" /> mutateGuard(importBackup, undefined)} disabled={inProgress} leadingIcon="upload" - className="rounded-lg" + className="flex-1 rounded-lg rounded-l-xs" /> - - - - - + + + ); } diff --git a/mobile/src/navigation/screens/settings/sheets/ColumnSizeSheet.tsx b/mobile/src/navigation/screens/settings/sheets/ColumnSizeSheet.tsx index dc5469dbb..2a9a206ae 100644 --- a/mobile/src/navigation/screens/settings/sheets/ColumnSizeSheet.tsx +++ b/mobile/src/navigation/screens/settings/sheets/ColumnSizeSheet.tsx @@ -19,7 +19,7 @@ import { } from "~/hooks/useLayoutConfigs"; import type { SheetRef } from "~/components/next/base/sheet"; -import { Sheet } from "~/components/next/base/sheet"; +import { ScrollableSheet } from "~/components/next/base/sheet"; import { Text } from "~/components/next/base/typography"; import type { LabeledSliderProps } from "~/components/next/blocks/slider-labeled"; import { LabeledSlider } from "~/components/next/blocks/slider-labeled"; @@ -27,11 +27,11 @@ import { LabeledSlider } from "~/components/next/blocks/slider-labeled"; export function ColumnSizeSheet(props: { ref: SheetRef }) { const [stopDrag, setStopDrag] = useState(false); return ( - + - + ); } diff --git a/mobile/src/navigation/screens/settings/sheets/LanguageSheet.tsx b/mobile/src/navigation/screens/settings/sheets/LanguageSheet.tsx index 5bbee961c..9bba3c8fe 100644 --- a/mobile/src/navigation/screens/settings/sheets/LanguageSheet.tsx +++ b/mobile/src/navigation/screens/settings/sheets/LanguageSheet.tsx @@ -12,15 +12,15 @@ import { import { OnRTL } from "~/lib/react"; import { Links, openLink } from "~/lib/web-browser"; -import { ClickwrapCheckbox } from "~/components/Form/Checkbox"; -import { Button } from "~/components/next/base/button"; +import { IconButton } from "~/components/next/base/button-icon"; import { Divider } from "~/components/next/base/divider"; import type { SheetRef } from "~/components/next/base/sheet"; -import { Sheet } from "~/components/next/base/sheet"; +import { Sheet, SheetFooter } from "~/components/next/base/sheet"; import { Text, TText } from "~/components/next/base/typography"; +import { ClickwrapCheckbox } from "~/components/next/blocks/checkbox"; import { Marquee } from "~/components/next/blocks/marquee"; +import { SheetRadioList } from "~/components/next/composed/sheet-radio"; import { LANGUAGES } from "~/modules/i18n/constants"; -import { IconButton } from "~/components/next/base/button-icon"; export function LanguageSheet(props: { ref: SheetRef }) { const { t } = useTranslation(); @@ -33,52 +33,41 @@ export function LanguageSheet(props: { ref: SheetRef }) { .join(", "); return ( - - + + + + + + {translatorsString} + + + openLink(Links.Translations)} + intent="inverse" + filled + /> + + {selectedLanguage?.rtl ? ( + + ) : null} + + } + > + item.label} - extraData={languageCode} - renderItem={({ item }) => { - const isSelected = languageCode === item.code; - return ( - - ); - }} + onSelect={(item) => PreferenceSetters.setLanguage(item.code)} + isSelected={(item) => languageCode === item.code} /> - - - - - - - {translatorsString} - - - openLink(Links.Translations)} - intent="inverse" - filled - /> - - {selectedLanguage?.rtl ? ( - - ) : null} - ); } diff --git a/mobile/src/navigation/screens/settings/sheets/MinDurationSheet.tsx b/mobile/src/navigation/screens/settings/sheets/MinDurationSheet.tsx index 8ac151cad..4f6193d02 100644 --- a/mobile/src/navigation/screens/settings/sheets/MinDurationSheet.tsx +++ b/mobile/src/navigation/screens/settings/sheets/MinDurationSheet.tsx @@ -9,7 +9,7 @@ import { usePreferenceStore } from "~/stores/Preference/store"; import { PreferenceSetters } from "~/stores/Preference/actions"; import type { SheetRef } from "~/components/next/base/sheet"; -import { Sheet } from "~/components/next/base/sheet"; +import { ScrollableSheet } from "~/components/next/base/sheet"; import { Hint } from "~/components/next/blocks/hint"; import type { LabeledSliderProps } from "~/components/next/blocks/slider-labeled"; import { LabeledSlider } from "~/components/next/blocks/slider-labeled"; @@ -43,11 +43,9 @@ export function MinDurationSheet(props: { ref: SheetRef }) { ); return ( - + - - - - + + ); } diff --git a/mobile/src/navigation/screens/settings/sheets/ScanFilterListSheet.tsx b/mobile/src/navigation/screens/settings/sheets/ScanFilterListSheet.tsx index b612d0620..2934c5e08 100644 --- a/mobile/src/navigation/screens/settings/sheets/ScanFilterListSheet.tsx +++ b/mobile/src/navigation/screens/settings/sheets/ScanFilterListSheet.tsx @@ -15,7 +15,11 @@ import { addTrailingSlash, getSafeUri } from "~/utils/string"; import { IconButton } from "~/components/next/base/button-icon"; import { TextInput } from "~/components/next/base/input"; import type { SheetRef } from "~/components/next/base/sheet"; -import { Sheet } from "~/components/next/base/sheet"; +import { + Sheet, + SheetFooter, + SheetLegendList, +} from "~/components/next/base/sheet"; import { Text } from "~/components/next/base/typography"; import { Hint } from "~/components/next/blocks/hint"; import { Marquee } from "~/components/next/blocks/marquee"; @@ -31,8 +35,16 @@ export function ScanFilterListSheet(props: { const { t } = useTranslation(); const listEntries = usePreferenceStore((s) => s[props.listType]); return ( - - + + + + } + > + 0))} @@ -51,13 +63,8 @@ export function ScanFilterListSheet(props: { /> )} - className="mb-0" contentContainerClassName="gap-1.5 pb-0" /> - - - - ); } diff --git a/mobile/src/navigation/screens/settings/sheets/SeparatorsSheet.tsx b/mobile/src/navigation/screens/settings/sheets/SeparatorsSheet.tsx index b8da6ced0..fc1de055a 100644 --- a/mobile/src/navigation/screens/settings/sheets/SeparatorsSheet.tsx +++ b/mobile/src/navigation/screens/settings/sheets/SeparatorsSheet.tsx @@ -11,7 +11,11 @@ import { preferenceStore, usePreferenceStore } from "~/stores/Preference/store"; import { IconButton } from "~/components/next/base/button-icon"; import { TextInput } from "~/components/next/base/input"; import type { SheetRef } from "~/components/next/base/sheet"; -import { Sheet } from "~/components/next/base/sheet"; +import { + Sheet, + SheetFooter, + SheetLegendList, +} from "~/components/next/base/sheet"; import { Text } from "~/components/next/base/typography"; import { Hint } from "~/components/next/blocks/hint"; import { Marquee } from "~/components/next/blocks/marquee"; @@ -21,8 +25,21 @@ export function SeparatorsSheet(props: { ref: SheetRef }) { const { t } = useTranslation(); const delimiters = usePreferenceStore((s) => s.separators); return ( - - + + + + } + > + 0))} @@ -41,18 +58,8 @@ export function SeparatorsSheet(props: { ref: SheetRef }) { /> )} - className="mb-0" contentContainerClassName="gap-1.5 pb-0" /> - - - - ); } diff --git a/mobile/src/navigation/screens/tracks/sheets/AddAlbumSheet.tsx b/mobile/src/navigation/screens/tracks/sheets/AddAlbumSheet.tsx index 5a884e914..cdfefdeae 100644 --- a/mobile/src/navigation/screens/tracks/sheets/AddAlbumSheet.tsx +++ b/mobile/src/navigation/screens/tracks/sheets/AddAlbumSheet.tsx @@ -5,7 +5,11 @@ import { useAlbums } from "~/data/album/queries"; import type { AlbumSummary } from "~/data/album/types"; import type { SheetRef } from "~/components/next/base/sheet"; -import { Sheet } from "~/components/next/base/sheet"; +import { + Sheet, + SheetHeader, + SheetLegendList, +} from "~/components/next/base/sheet"; import { ImageListItem } from "~/components/next/composed/image-list-item"; import { Search } from "~/modules/search/components/SearchList"; import { containSorter } from "~/modules/search/utils"; @@ -17,12 +21,17 @@ export function AddAlbumSheet(props: { const { data } = useAlbums(); return ( - - - - + + + + } + > id} @@ -33,11 +42,11 @@ export function AddAlbumSheet(props: { label={item.name} supporting={item.artistName} onPress={() => props.onSelect(item)} - spacing="row" + spacing="none" /> )} renderOnQuery - className="-mb-5.5" + contentContainerClassName="gap-1.5" /> diff --git a/mobile/src/navigation/screens/tracks/sheets/TrackSheet.tsx b/mobile/src/navigation/screens/tracks/sheets/TrackSheet.tsx index 05a29a58e..f9e2d6f53 100644 --- a/mobile/src/navigation/screens/tracks/sheets/TrackSheet.tsx +++ b/mobile/src/navigation/screens/tracks/sheets/TrackSheet.tsx @@ -3,39 +3,43 @@ import { TrueSheet } from "@lodev09/react-native-true-sheet"; import { useNavigation, useNavigationState } from "@react-navigation/native"; +import { useCallback } from "react"; import { useTranslation } from "react-i18next"; import { View } from "react-native"; +import { toggleTrackInPlaylist } from "~/data/track/api"; import { useHideTrack, useToggleTrackInPlaylist, useTrackFavoriteStatus, + useTrackPlaylists, } from "~/data/track/queries"; import type { Track } from "~/data/track/types"; import { Queue } from "~/stores/Playback/actions"; import { useSessionStore } from "~/stores/Session/store"; import { TrackArtworkSheet } from "~/navigation/sheets/ArtworkSheet"; -import { TrackToPlaylistsSheet } from "./TrackToPlaylistsSheet"; import { shareFile } from "~/lib/file-system"; import { mutateGuard } from "~/lib/react-query"; import { Epoch, Seconds } from "~/utils/date"; import { abbreviateBitRate, abbreviateSize } from "~/utils/number"; -import { SheetButtonGroup } from "~/components/Sheet/SheetButtonGroup"; import { IconButton } from "~/components/next/base/button-icon"; import { Divider } from "~/components/next/base/divider"; import type { SupportedIconName } from "~/components/next/base/icon"; import { Icon } from "~/components/next/base/icon"; -import { Sheet, useSheetRef } from "~/components/next/base/sheet"; +import { ScrollableSheet, useSheetRef } from "~/components/next/base/sheet"; import { Text } from "~/components/next/base/typography"; +import { ActionButton } from "~/components/next/blocks/button-action"; import { Marquee } from "~/components/next/blocks/marquee"; import { MediaImage } from "~/components/next/blocks/media-image"; import { Pressable } from "~/components/next/primitive/pressable"; import { FavoritesPlaylistKey } from "~/modules/media/constants"; import { ArtistsLink } from "~/modules/media/components/ArtistsLink"; +import { AddToPlaylistsSheetBase } from "~/modules/media/components/AddToPlaylistsSheetBase"; -const GLOBAL_SHEET_KEY = "TrackSheet"; +const TRACK_GLOBAL_SHEET_KEY = "TrackSheet"; +const TRACK_PLAYLIST_GLOBAL_SHEET_KEY = "TrackToPlaylistsSheet"; /** Displays information about a track and enables adding it to playlists. */ export function TrackSheet() { @@ -44,7 +48,7 @@ export function TrackSheet() { return ( <> - + {data !== null ? ( <> @@ -56,7 +60,7 @@ export function TrackSheet() { ) : null} - + {data !== null ? ( @@ -65,6 +69,27 @@ export function TrackSheet() { ); } +//#region AddToPlaylist Sheet +function TrackToPlaylistsSheet({ id }: { id: string }) { + const { data: inList } = useTrackPlaylists(id); + + const onToggleInPlaylist = useCallback( + async (playlistName: string) => { + await toggleTrackInPlaylist({ trackId: id, playlistName }); + }, + [id], + ); + + return ( + + ); +} +//#endregion + //#region Introduction function TrackIntro({ data }: { data: Track }) { const navigation = useNavigation(); @@ -83,7 +108,7 @@ function TrackIntro({ data }: { data: Track }) { TrueSheet.dismiss(GLOBAL_SHEET_KEY)} + beforeNavigation={() => TrueSheet.dismiss(TRACK_GLOBAL_SHEET_KEY)} popStrategy={onNowPlaying ? "popScreen" : undefined} /> {data.albumName ? ( @@ -107,7 +132,7 @@ function TrackIntro({ data }: { data: Track }) { //#region Metadata function TrackMetadata({ data }: { data: Track }) { return ( - + {data.bitrate !== null ? abbreviateBitRate(data.bitrate) : "—"} @@ -151,7 +176,7 @@ function IconActions(props: { data: Track; editArtwork: VoidFunction }) { const isFav = toggleInPlaylist.isPending ? !favStatus : favStatus; return ( - + ) { + const { t } = useTranslation(); return ( - Queue.add({ id, name })), - Leading: , - }} - rightButton={{ - textKey: "feat.queue.extra.playLast", - onPress: sheetAction(() => Queue.addToEnd({ id, name })), - Leading: , - }} - /> + + Queue.add({ id, name }))} + leadingIcon="queue-music" + className="flex-1 rounded-lg rounded-r-xs" + /> + Queue.addToEnd({ id, name }))} + leadingIcon="low-priority" + className="flex-1 rounded-lg rounded-l-xs" + /> + ); } //#endregion @@ -228,7 +256,7 @@ function Badge(props: { icon?: SupportedIconName; children: string }) { /** Calls action after dismissing sheet. */ function sheetAction(onPress: VoidFunction) { return () => { - TrueSheet.dismiss(GLOBAL_SHEET_KEY); + TrueSheet.dismiss(TRACK_GLOBAL_SHEET_KEY); onPress(); }; } diff --git a/mobile/src/navigation/screens/tracks/sheets/TrackToPlaylistsSheet.tsx b/mobile/src/navigation/screens/tracks/sheets/TrackToPlaylistsSheet.tsx deleted file mode 100644 index caf308581..000000000 --- a/mobile/src/navigation/screens/tracks/sheets/TrackToPlaylistsSheet.tsx +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (C) 2024 - present, MissingCore -// SPDX-License-Identifier: AGPL-3.0-only - -import { useQueryClient } from "@tanstack/react-query"; -import { useCallback, useEffect, useState } from "react"; -import { useTranslation } from "react-i18next"; - -import { queries as q } from "~/data/keyStore"; -import { usePlaylistsNames } from "~/data/playlist/queries"; -import { toggleTrackInPlaylist } from "~/data/track/api"; -import { useTrackPlaylists } from "~/data/track/queries"; - -import { ContentPlaceholder } from "~/navigation/components/Placeholder"; - -import { CheckboxField } from "~/components/Form/Checkbox"; -import { Sheet } from "~/components/next/base/sheet"; -import { Text } from "~/components/next/base/typography"; -import { Marquee } from "~/components/next/blocks/marquee"; - -const GLOBAL_SHEET_KEY = "TrackToPlaylistsSheet"; - -export function TrackToPlaylistsSheet({ id }: { id: string }) { - const { t } = useTranslation(); - const queryClient = useQueryClient(); - const { data: playlistsNames } = usePlaylistsNames(); - const { data: inList } = useTrackPlaylists(id); - const [inListSet, setInListSet] = useState(new Set()); - - const toggleInPlaylist = useCallback( - async (playlistName: string) => { - await toggleTrackInPlaylist({ trackId: id, playlistName }); - setInListSet((prev) => { - const updatedList = new Set(prev); - const remove = updatedList.has(playlistName); - updatedList[remove ? "delete" : "add"](playlistName); - return updatedList; - }); - }, - [id], - ); - - useEffect(() => { - setInListSet(new Set(inList ?? [])); - }, [inList]); - - const handleSheetClose = useCallback(async () => { - queryClient.invalidateQueries({ queryKey: q.tracks.detail(id).queryKey }); - queryClient.invalidateQueries({ queryKey: q.playlists._def }); - }, [queryClient, id]); - - return ( - - - name} - extraData={inListSet} - renderItem={({ item: name }) => ( - toggleInPlaylist(name)} - > - - {name} - - - )} - ListEmptyComponent={ - - } - contentContainerClassName="gap-1.5" - /> - - ); -} diff --git a/mobile/src/navigation/sheets/ArtistsSheet.tsx b/mobile/src/navigation/sheets/ArtistsSheet.tsx index 91bd73573..d236981f1 100644 --- a/mobile/src/navigation/sheets/ArtistsSheet.tsx +++ b/mobile/src/navigation/sheets/ArtistsSheet.tsx @@ -7,7 +7,7 @@ import { useNavigation } from "@react-navigation/native"; import { useSessionStore } from "~/stores/Session/store"; import { navigateToArtist } from "~/stores/Session/actions"; -import { Sheet } from "~/components/next/base/sheet"; +import { Sheet, SheetLegendList } from "~/components/next/base/sheet"; import { createTextPlaceholder } from "~/components/next/blocks/media-image"; import { ImageListItem } from "~/components/next/composed/image-list-item"; @@ -20,7 +20,7 @@ export function ArtistsSheet() { if (!artistsInfo || artistsInfo.artists.length === 0) return null; return ( - name} @@ -32,10 +32,10 @@ export function ArtistsSheet() { TrueSheet.dismiss(GLOBAL_SHEET_KEY); navigateToArtist(navigation, name, artistsInfo.popStrategy); }} - spacing="row" + spacing="none" /> )} - className="-mb-5.5" + contentContainerClassName="gap-1.5" /> ); diff --git a/mobile/src/navigation/sheets/ArtworkSheet.tsx b/mobile/src/navigation/sheets/ArtworkSheet.tsx index 0ef4698cd..ab631b316 100644 --- a/mobile/src/navigation/sheets/ArtworkSheet.tsx +++ b/mobile/src/navigation/sheets/ArtworkSheet.tsx @@ -3,6 +3,7 @@ import { useQueryClient } from "@tanstack/react-query"; import { useState } from "react"; +import { useTranslation } from "react-i18next"; import { View, useWindowDimensions } from "react-native"; import { queries as q } from "~/data/keyStore"; @@ -22,9 +23,9 @@ import { pickImage } from "~/lib/file-system"; import { clearAllQueries } from "~/lib/react-query"; import { wait } from "~/utils/promise"; import { isRecord } from "~/utils/validation"; -import { SheetButtonGroup } from "~/components/Sheet/SheetButtonGroup"; import type { SheetRef } from "~/components/next/base/sheet"; -import { Sheet } from "~/components/next/base/sheet"; +import { ScrollableSheet } from "~/components/next/base/sheet"; +import { ActionButton } from "~/components/next/blocks/button-action"; import type { MediaImageSrc } from "~/components/next/blocks/media-image"; import { MediaImage } from "~/components/next/blocks/media-image"; @@ -118,6 +119,7 @@ function BaseArtworkSheet(props: { onSuccess: () => Promise | void; disabled?: boolean; }) { + const { t } = useTranslation(); const { height, width } = useWindowDimensions(); const [disabled, setDisabled] = useState(false); @@ -140,27 +142,30 @@ function BaseArtworkSheet(props: { }; return ( - + - onSubmit(null), - disabled: + + onSubmit(null)} + disabled={ props.disabled || disabled || !props.imageSource || Array.isArray(props.imageSource) || - isRecord(props.imageSource), - }} - rightButton={{ - textKey: "feat.artwork.extra.change", - onPress: () => onSubmit(pickImage()), - disabled, - }} - /> - + isRecord(props.imageSource) + } + className="flex-1 rounded-lg rounded-r-xs" + /> + onSubmit(pickImage())} + disabled={disabled} + className="flex-1 rounded-lg rounded-l-xs" + /> + + ); } diff --git a/mobile/src/navigation/sheets/ViewOptionsSheet.tsx b/mobile/src/navigation/sheets/ViewOptionsSheet.tsx index 11004f15c..f016bcd22 100644 --- a/mobile/src/navigation/sheets/ViewOptionsSheet.tsx +++ b/mobile/src/navigation/sheets/ViewOptionsSheet.tsx @@ -26,7 +26,7 @@ import type { } from "~/stores/ViewPreference/types"; import type { SheetRef } from "~/components/next/base/sheet"; -import { Sheet } from "~/components/next/base/sheet"; +import { ScrollableSheet } from "~/components/next/base/sheet"; import { TText } from "~/components/next/base/typography"; import { SegmentedPicker } from "~/components/next/blocks/segmented-picker"; import type { LabeledSliderProps } from "~/components/next/blocks/slider-labeled"; @@ -83,7 +83,7 @@ export function AlbumsViewOptionsSheet(props: { ref: SheetRef }) { ); return ( - + - + ); } //#endregion @@ -137,10 +137,10 @@ function ViewOptionsSheetTemplate(props: { screen: MutableViewLayout; }) { return ( - + - + ); } //#endregion @@ -173,9 +173,9 @@ export function SortOptionsSheet(props: { screen: MutableViewOrder; }) { return ( - + - + ); } diff --git a/mobile/src/resources/licenses.json b/mobile/src/resources/licenses.json index 2fc0a71ab..65743fb3f 100644 --- a/mobile/src/resources/licenses.json +++ b/mobile/src/resources/licenses.json @@ -15,7 +15,7 @@ }, "@lodev09/react-native-true-sheet": { "name": "@lodev09/react-native-true-sheet", - "version": "4.0.0", + "version": "4.0.1", "source": "https://github.com/lodev09/react-native-true-sheet", "license": "MIT", "licenseText": "MIT License\n\nCopyright (c) 2026 lodev09\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE." diff --git a/mobile/src/stores/Preference/actions/preferenceSetters.ts b/mobile/src/stores/Preference/actions/preferenceSetters.ts index 0e5e57c15..04ea0141f 100644 --- a/mobile/src/stores/Preference/actions/preferenceSetters.ts +++ b/mobile/src/stores/Preference/actions/preferenceSetters.ts @@ -61,6 +61,12 @@ export function setNowPlayingDesign(nowPlayingDesign: NowPlayingDesign) { preferenceStore.setState({ nowPlayingDesign }); } +export function setPlaybackDelay(playbackDelay: number) { + preferenceStore.setState({ + playbackDelay: PlaybackDelayConfig.clamp(playbackDelay), + }); +} + export function setPrimaryFont(primaryFont: Font) { preferenceStore.setState({ primaryFont }); } @@ -98,9 +104,3 @@ export async function setTheme(theme: DefaultTheme | (string & {})) { }); } } - -export function updatePlaybackDelayByDelta(delta: number) { - preferenceStore.setState((prev) => ({ - playbackDelay: PlaybackDelayConfig.clamp(prev.playbackDelay + delta), - })); -} diff --git a/mobile/src/stores/ViewPreference/store.ts b/mobile/src/stores/ViewPreference/store.ts index 61a2fe4a8..1aafe74b7 100644 --- a/mobile/src/stores/ViewPreference/store.ts +++ b/mobile/src/stores/ViewPreference/store.ts @@ -16,7 +16,7 @@ export const viewPreferenceStore = createPersistedStore( listSize: 272, gridSize: 144, - compactGridSize: 72, + compactGridSize: 96, albumLayout: "grid", albumIsAsc: true,