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.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 (
);
}
@@ -125,7 +131,7 @@ function BundledThemePicker() {
}));
return (
-
+
monthYearStr}
renderItem={({ item }) => (
-
+
`${item.monthYearStr}_${day}`}
@@ -113,7 +113,7 @@ function ScreenContents(props: { data: HiddenTrack[] }) {
)}
scrollEnabled={false}
/>
-
+
)}
ListHeaderComponent={
diff --git a/mobile/src/modules/insights/screens/RecapView.tsx b/mobile/src/modules/insights/screens/RecapView.tsx
index 3a804ac9b..6b7f48cb6 100644
--- a/mobile/src/modules/insights/screens/RecapView.tsx
+++ b/mobile/src/modules/insights/screens/RecapView.tsx
@@ -23,7 +23,7 @@ import { Card } from "~/components/next/base/card";
import { Divider } from "~/components/next/base/divider";
import { Icon } from "~/components/next/base/icon";
import type { SheetRef } from "~/components/next/base/sheet";
-import { Sheet, useSheetRef } from "~/components/next/base/sheet";
+import { ScrollableSheet, useSheetRef } from "~/components/next/base/sheet";
import { Text, TText } from "~/components/next/base/typography";
import { ActionButton } from "~/components/next/blocks/button-action";
import { Hint } from "~/components/next/blocks/hint";
@@ -172,27 +172,25 @@ function RecapToolbar() {
/>
-
-
+
+
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/modules/insights/screens/View.tsx b/mobile/src/modules/insights/screens/View.tsx
index 19136e564..c93576344 100644
--- a/mobile/src/modules/insights/screens/View.tsx
+++ b/mobile/src/modules/insights/screens/View.tsx
@@ -20,7 +20,6 @@ import {
} from "~/db/schema";
import { ScrollLayout } from "~/navigation/layouts/ScrollLayout";
-import * as SettingsList from "~/navigation/screens/settings/components/SettingsList";
import { Colors } from "~/constants/Styles";
import { ImageDirectory } from "~/lib/file-system";
@@ -28,6 +27,7 @@ import type { ExtractQueryData } from "~/lib/react-query";
import { mutateGuard } from "~/lib/react-query";
import { Seconds } from "~/utils/date";
import { abbreviateSize } from "~/utils/number";
+import * as List from "~/components/next/composed/list";
import {
LegendItem,
ProgressBar,
@@ -45,38 +45,38 @@ export default function Insights() {
return (
-
+
-
+
-
+
-
+
-
-
+ navigation.navigate("Recap", {})}
/>
-
+
-
-
+ navigation.navigate("HiddenTracks")}
/>
-
-
+ navigation.navigate("SaveErrors")}
/>
-
+
);
}
@@ -251,7 +251,7 @@ function DatabaseOptimizationWidget() {
const count = data ?? 0;
return (
-
-
-
+
-
+
-
-
+
-
+
id}
@@ -87,7 +87,7 @@ export default function LyricsSettings() {
contentContainerClassName="p-4"
alwaysKeyRenderedItems
/>
-
+
);
}
diff --git a/mobile/src/modules/media/components/AddToPlaylistsSheetBase.tsx b/mobile/src/modules/media/components/AddToPlaylistsSheetBase.tsx
new file mode 100644
index 000000000..d4d026386
--- /dev/null
+++ b/mobile/src/modules/media/components/AddToPlaylistsSheetBase.tsx
@@ -0,0 +1,174 @@
+// Copyright (C) 2024 - present, MissingCore
+// SPDX-License-Identifier: AGPL-3.0-only
+
+import { toast } from "@missingcore/ui/toast";
+import { useCallback, useEffect, useState } from "react";
+import { useTranslation } from "react-i18next";
+import { Keyboard } from "react-native";
+
+import { createPlaylist } from "~/data/playlist/api";
+import { usePlaylistsNames } from "~/data/playlist/queries";
+import { sanitizePlaylistName } from "~/data/playlist/utils";
+
+import { clearAllQueries } from "~/lib/react-query";
+import { wait } from "~/utils/promise";
+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,
+ SheetFooter,
+ SheetLegendList,
+} from "~/components/next/base/sheet";
+import { Text } from "~/components/next/base/typography";
+import { CheckboxField } from "~/components/next/blocks/checkbox";
+import { Marquee } from "~/components/next/blocks/marquee";
+import { useInputForm } from "~/modules/form/useInputForm";
+import { FavoritesPlaylistKey } from "../constants";
+
+type SheetAccessType =
+ { ref: SheetRef; name?: never } | { ref?: never; name: string };
+
+interface AddToPlaylistsSheetProps {
+ /** When changed, the internally tracked `inLists` will also be updated. */
+ initiallyInLists?: string[];
+ onToggleInPlaylist: (playlistName: string, remove: boolean) => Promise;
+ onResolve?: () => void | Promise;
+}
+
+/**
+ * Base sheet for implementing "Add To Playlist", with the ability to
+ * also create a playlist at the same time.
+ */
+export function AddToPlaylistsSheetBase({
+ ref,
+ name,
+ initiallyInLists,
+ onToggleInPlaylist,
+ onResolve,
+}: AddToPlaylistsSheetProps & SheetAccessType) {
+ const { data: playlistNames } = usePlaylistsNames();
+ const [inLists, setInLists] = useState(new Set());
+
+ useEffect(() => {
+ setInLists(new Set(initiallyInLists ?? []));
+ }, [initiallyInLists]);
+
+ const handleToggleInPlaylist = useCallback(
+ async (playlistName: string, remove: boolean, propagteError = false) => {
+ try {
+ await onToggleInPlaylist(playlistName, remove);
+ setInLists((prev) => {
+ const updatedList = new Set(prev);
+ const remove = updatedList.has(playlistName);
+ updatedList[remove ? "delete" : "add"](playlistName);
+ return updatedList;
+ });
+ } catch (err) {
+ if (propagteError) throw err;
+ }
+ },
+ [onToggleInPlaylist],
+ );
+
+ const handleCreatedPlaylist = useCallback(
+ async (playlistName: string) => {
+ await createPlaylist({ name: playlistName });
+ await handleToggleInPlaylist(playlistName, false, true);
+ clearAllQueries();
+ },
+ [handleToggleInPlaylist],
+ );
+
+ const onResolveAddAction = useCallback(async () => {
+ await onResolve?.();
+ await wait(1);
+ clearAllQueries();
+ }, [onResolve]);
+
+ return (
+
+
+
+ }
+ >
+ (
+ handleToggleInPlaylist(name, inLists.has(name))}
+ >
+
+
+ )}
+ contentContainerClassName="gap-1.5 pb-0"
+ />
+
+ );
+}
+
+//#region Form
+function PlaylistForm(props: {
+ listEntries: string[];
+ disabled: boolean;
+ handleCreatedPlaylist: (playlistName: string) => Promise;
+}) {
+ const { t } = useTranslation();
+ const inputForm = useInputForm({
+ onSubmit: props.handleCreatedPlaylist,
+ onError: (trimmedName) => {
+ console.warn(`Failed to create playlist: ${trimmedName}`);
+ toast.tError("err.flow.generic.brief");
+ },
+ onConstraints: (trimmedName) => {
+ let isUnique = false;
+ try {
+ const sanitized = sanitizePlaylistName(trimmedName);
+ isUnique =
+ sanitized !== FavoritesPlaylistKey &&
+ !props.listEntries.includes(sanitized);
+ } catch {}
+ return isUnique;
+ },
+ });
+
+ return (
+ {
+ Keyboard.dismiss();
+ await inputForm.onSubmit();
+ }}
+ disabled={!inputForm.canSubmit || inputForm.isSubmitting}
+ intent="primary"
+ filled
+ size="md"
+ />
+ }
+ />
+ );
+}
+//#endregion
diff --git a/mobile/src/modules/media/multiSelect/components/TrackMultiSelectListeners.tsx b/mobile/src/modules/media/multiSelect/TrackMultiSelectListeners.tsx
similarity index 83%
rename from mobile/src/modules/media/multiSelect/components/TrackMultiSelectListeners.tsx
rename to mobile/src/modules/media/multiSelect/TrackMultiSelectListeners.tsx
index ef20bc78d..42ba27c9a 100644
--- a/mobile/src/modules/media/multiSelect/components/TrackMultiSelectListeners.tsx
+++ b/mobile/src/modules/media/multiSelect/TrackMultiSelectListeners.tsx
@@ -1,30 +1,32 @@
// Copyright (C) 2024 - present, MissingCore
// SPDX-License-Identifier: AGPL-3.0-only
+import { toast } from "@missingcore/ui/toast";
import { useNavigation, useNavigationState } from "@react-navigation/native";
import { Portal } from "@rn-primitives/portal";
-import { useEffect } from "react";
+import { useCallback, useEffect } from "react";
import { useTranslation } from "react-i18next";
import { View } from "react-native";
import Animated, { SlideInUp, SlideOutUp } from "react-native-reanimated";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { useBackHandler } from "~/hooks/useBackHandler";
-import { TrackMultiSelect, useTrackMultiSelectStore } from "../core/store";
+import { TrackMultiSelect, useTrackMultiSelectStore } from "./core/store";
import {
favoriteSelected,
hideSelected,
removeSelectedFromPlaylist,
-} from "../core/actions";
+ updateTracksInPlaylist,
+} from "./core/actions";
import { TopDownGradient } from "~/components/Gradient";
import { IconButton } from "~/components/next/base/button-icon";
+import type { SheetRef } from "~/components/next/base/sheet";
import { useSheetRef } from "~/components/next/base/sheet";
import { Text } from "~/components/next/base/typography";
import { ConfirmAction } from "~/components/next/composed/confirm-action";
-import { AddToCreatedPlaylistSheet } from "./AddToCreatedPlaylistSheet";
-import { AddToPlaylistsSheet } from "./AddToPlaylistsSheet";
-import { FavoritesPlaylistKey } from "../../constants";
+import { AddToPlaylistsSheetBase } from "../components/AddToPlaylistsSheetBase";
+import { FavoritesPlaylistKey } from "../constants";
export function TrackMultiSelectListeners() {
const navigation = useNavigation();
@@ -43,7 +45,6 @@ const ESTIMATED_MENU_HEIGHT = 100;
export function TrackMultiSelectMenu() {
const insets = useSafeAreaInsets();
const isMultiSelectEnabled = useTrackMultiSelectStore((s) => s.enabled);
- const addToCreatedPlaylistSheetRef = useSheetRef();
const addToPlaylistsSheetRef = useSheetRef();
// Close multi-select menu when a "back" action is detected. If there
@@ -60,7 +61,6 @@ export function TrackMultiSelectMenu() {
return isMultiSelectEnabled ? (
-
- addToCreatedPlaylistSheetRef.current?.present()
- }
presentAddToPlaylistsSheet={() =>
addToPlaylistsSheetRef.current?.present()
}
@@ -90,6 +87,28 @@ export function TrackMultiSelectMenu() {
) : null;
}
+//#region AddToPlaylist Sheet
+function AddToPlaylistsSheet(props: { ref: SheetRef }) {
+ const toggleInPlaylist = useCallback(
+ async (playlistName: string, remove = false) => {
+ const status = await updateTracksInPlaylist({ playlistName, remove });
+ if (status !== "success") {
+ if (status === "error") toast.tError("err.flow.generic.title");
+ throw new Error("Skip selection handling...");
+ }
+ },
+ [],
+ );
+ return (
+ TrackMultiSelect.reset()}
+ />
+ );
+}
+//#endregion
+
//#region Selection Count
function SelectionCount() {
const { t } = useTranslation();
@@ -114,7 +133,6 @@ function SelectionCount() {
//#region Mutli-Select Actions
function MultiSelectActions(props: {
- presentAddToCreatedPlaylistSheet: VoidFunction;
presentAddToPlaylistsSheet: VoidFunction;
}) {
const { t } = useTranslation();
@@ -157,13 +175,6 @@ function MultiSelectActions(props: {
onPress={props.presentAddToPlaylistsSheet}
/>
)}
- {!isPlaylistRoute ? (
-
- ) : null}
new Set([...(playlistsNames ?? []), FavoritesPlaylistKey]),
- [playlistsNames],
- );
-
- const inputForm = useInputForm({
- onSubmit: async (trimmedName) => {
- props.ref.current?.dismiss();
- await addSelectedToCreatedPlaylist(trimmedName);
- },
- onConstraints: (trimmedName) => {
- // Checks to see if playlist name is unique.
- let isUnique = false;
- try {
- const sanitized = sanitizePlaylistName(trimmedName);
- isUnique = !invalidPlaylistNames.has(sanitized);
- } catch {}
- return isUnique;
- },
- });
-
- const constraintColor = !inputForm.canSubmit ? "onSurfaceVariant" : undefined;
-
- return (
-
-
-
-
-
-
-
-
-
-
- );
-}
diff --git a/mobile/src/modules/media/multiSelect/components/AddToPlaylistsSheet.tsx b/mobile/src/modules/media/multiSelect/components/AddToPlaylistsSheet.tsx
deleted file mode 100644
index 472ddb920..000000000
--- a/mobile/src/modules/media/multiSelect/components/AddToPlaylistsSheet.tsx
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright (C) 2024 - present, MissingCore
-// SPDX-License-Identifier: AGPL-3.0-only
-
-import { toast } from "@missingcore/ui/toast";
-import { useCallback, useEffect, useState } from "react";
-import { useTranslation } from "react-i18next";
-
-import { usePlaylistsNames } from "~/data/playlist/queries";
-import { TrackMultiSelect, useTrackMultiSelectStore } from "../core/store";
-import { updateTracksInPlaylist } from "../core/actions";
-
-import { ContentPlaceholder } from "~/navigation/components/Placeholder";
-
-import { clearAllQueries } from "~/lib/react-query";
-import { wait } from "~/utils/promise";
-import { CheckboxField } from "~/components/Form/Checkbox";
-import type { SheetRef } from "~/components/next/base/sheet";
-import { Sheet } from "~/components/next/base/sheet";
-import { Text } from "~/components/next/base/typography";
-import { Marquee } from "~/components/next/blocks/marquee";
-
-export function AddToPlaylistsSheet(props: { ref: SheetRef }) {
- const { t } = useTranslation();
- const { data: playlistsNames } = usePlaylistsNames();
- const amountSelected = useTrackMultiSelectStore((s) => s.selected.size);
- const [inLists, setInLists] = useState(new Set());
-
- const toggleInPlaylist = useCallback(
- async (playlistName: string, remove = false) => {
- const status = await updateTracksInPlaylist({ playlistName, remove });
- if (status === "success") {
- setInLists((prev) => {
- const updatedList = new Set(prev);
- updatedList[remove ? "delete" : "add"](playlistName);
- return updatedList;
- });
- } else if (status === "error") {
- toast.tError("err.flow.generic.title");
- }
- },
- [],
- );
-
- // Reset selection whenever the number of items of selected items change.
- useEffect(() => {
- setInLists(new Set());
- }, [amountSelected]);
-
- return (
-
-
- name}
- extraData={inLists}
- renderItem={({ item: name }) => (
- toggleInPlaylist(name, inLists.has(name))}
- >
-
-
- )}
- ListEmptyComponent={
-
- }
- contentContainerClassName="gap-1.5"
- />
-
- );
-}
-
-/** Dismiss multi-select menu when we finish adding the selected tracks to the playlists. */
-async function resolveAddAction() {
- TrackMultiSelect.reset();
- await wait(1);
- clearAllQueries();
-}
diff --git a/mobile/src/modules/search/components/SearchEngine.tsx b/mobile/src/modules/search/components/SearchEngine.tsx
index 7a95ba876..2d56bf179 100644
--- a/mobile/src/modules/search/components/SearchEngine.tsx
+++ b/mobile/src/modules/search/components/SearchEngine.tsx
@@ -1,7 +1,7 @@
// Copyright (C) 2024 - present, MissingCore
// SPDX-License-Identifier: AGPL-3.0-only
-import { useImperativeHandle, useMemo, useState } from "react";
+import { useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { View } from "react-native";
@@ -39,7 +39,6 @@ type SearchEngineListProps = {
/** If we should render the track actions via the results. */
withTrackActions?: boolean;
- ref?: React.RefObject;
CustomList?: typeof LegendList;
};
@@ -55,7 +54,6 @@ export function SearchEngineList({
const [selectedTab, setSelectedTab] = useState("all");
const [filterHeight, setFilterHeight] = useState(52); // Height will be ~52px
const listRef = useLegendListRef();
- useImperativeHandle(props.ref, () => listRef.current);
const overrideItemLayout = useMemo(
() => overrideItemLayoutFactory(listLayout.count),
@@ -110,7 +108,7 @@ export function SearchEngineList({
0 })}
+ className={cn("mx-0.75", { "pt-1.5": index > 0 })}
/>
) : (
({
/>
) : undefined
}
+ spacing="column"
/>
)
}
@@ -137,12 +136,11 @@ export function SearchEngineList({
) : undefined
}
- className={cn("-mx-0.75 -mb-1.5", {
- "-mb-5.5": props.forSheets,
- })}
- contentContainerClassName={
- props.forSheets ? "pb-4" : "pb-safe-offset-20"
- }
+ className="-mx-0.75"
+ contentContainerClassName={cn(
+ "gap-y-1.5",
+ !props.forSheets ? "pb-safe-offset-20" : undefined,
+ )}
contentContainerStyle={{
paddingTop: tabsWithData.length > 0 ? filterHeight : 24,
}}
diff --git a/mobile/src/modules/search/components/SearchList.tsx b/mobile/src/modules/search/components/SearchList.tsx
index 5fe423444..4cdb39beb 100644
--- a/mobile/src/modules/search/components/SearchList.tsx
+++ b/mobile/src/modules/search/components/SearchList.tsx
@@ -149,7 +149,7 @@ function List({
ListEmptyComponent={
!stopRender ? : null
}
- contentContainerClassName={cn("pt-6", contentContainerClassName)}
+ contentContainerClassName={cn("pt-4", contentContainerClassName)}
{...props}
/>
);
diff --git a/mobile/src/navigation/routes.tsx b/mobile/src/navigation/routes.tsx
index 52f4fdfd3..cd5713323 100644
--- a/mobile/src/navigation/routes.tsx
+++ b/mobile/src/navigation/routes.tsx
@@ -44,7 +44,7 @@ import type { LibraryTab } from "~/stores/Preference/types";
import { capitalize } from "~/utils/string";
import { Toolbar } from "~/components/next/composed/toolbar";
-import { TrackMultiSelectListeners } from "~/modules/media/multiSelect/components/TrackMultiSelectListeners";
+import { TrackMultiSelectListeners } from "~/modules/media/multiSelect/TrackMultiSelectListeners";
import { MiniplayerProvider } from "./components/BottomActions/Miniplayer";
import { DeferredRender } from "./components/DeferredRender";
diff --git a/mobile/src/navigation/screens/now-playing/sheets/AppearanceSheet.tsx b/mobile/src/navigation/screens/now-playing/sheets/AppearanceSheet.tsx
index 01523173c..cae164f40 100644
--- a/mobile/src/navigation/screens/now-playing/sheets/AppearanceSheet.tsx
+++ b/mobile/src/navigation/screens/now-playing/sheets/AppearanceSheet.tsx
@@ -1,6 +1,8 @@
// Copyright (C) 2024 - present, MissingCore
// SPDX-License-Identifier: AGPL-3.0-only
+import { useTranslation } from "react-i18next";
+
import { usePreferenceStore } from "~/stores/Preference/store";
import {
PreferenceSetters,
@@ -11,13 +13,14 @@ import {
SeekbarDesignOptions,
} from "~/stores/Preference/constants";
-import { RadioChipField } from "~/components/Form/Radio";
-import { SwitchInput } from "~/components/Form/Switch";
-import { SheetLabelAction } from "~/components/Sheet/SheetLabelAction";
import type { SheetRef } from "~/components/next/base/sheet";
-import { Sheet } from "~/components/next/base/sheet";
+import { ScrollableSheet } from "~/components/next/base/sheet";
+import { SegmentedPicker } from "~/components/next/blocks/segmented-picker";
+import { TText } from "~/components/next/base/typography";
+import * as List from "~/components/next/composed/list";
export function AppearanceSheet(props: { ref: SheetRef }) {
+ const { t } = useTranslation();
const nowPlayingDesign = usePreferenceStore((s) => s.nowPlayingDesign);
const alternativeInfoLayout = usePreferenceStore(
(s) => s.alternativeInfoLayout,
@@ -25,48 +28,61 @@ export function AppearanceSheet(props: { ref: SheetRef }) {
const standardVinylSpeed = usePreferenceStore((s) => s.standardVinylSpeed);
const seekbarDesign = usePreferenceStore((s) => s.seekbarDesign);
+ const artworkPickerOptions = NowPlayingDesignOptions.map((option) => ({
+ label: t(`feat.nowPlayingDesign.extra.${option}`),
+ value: option,
+ }));
+
+ const seekbarPickerOptions = SeekbarDesignOptions.map((option) => ({
+ label: t(`feat.seekbar.extra.${option}`),
+ value: option,
+ }));
+
return (
-
-
- }
+
+
+
+
+
+
+
+
-
- }
+
-
- {NowPlayingDesignOptions.map((design) => (
- PreferenceSetters.setNowPlayingDesign(design)}
- />
- ))}
-
-
-
- {SeekbarDesignOptions.map((design) => (
- PreferenceSetters.setSeekbarDesign(design)}
- />
- ))}
-
-
+
+
+
);
}
diff --git a/mobile/src/navigation/screens/now-playing/sheets/PlaybackOptionsSheet.tsx b/mobile/src/navigation/screens/now-playing/sheets/PlaybackOptionsSheet.tsx
index 9087a24da..a58e4a742 100644
--- a/mobile/src/navigation/screens/now-playing/sheets/PlaybackOptionsSheet.tsx
+++ b/mobile/src/navigation/screens/now-playing/sheets/PlaybackOptionsSheet.tsx
@@ -2,8 +2,10 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { useNavigation } from "@react-navigation/native";
-import { useCallback, useState } from "react";
+import { useCallback, useMemo, useState } from "react";
+import { useTranslation } from "react-i18next";
import AudioBrowser from "react-native-audio-browser";
+import { scheduleOnRN } from "react-native-worklets";
import { playbackStore, usePlaybackStore } from "~/stores/Playback/store";
import { usePreferenceStore } from "~/stores/Preference/store";
@@ -13,19 +15,21 @@ import { PlaybackDelayConfig } from "~/stores/Preference/utils";
import { getMediaLinkContext } from "~/navigation/utils/router";
import { AppearanceSheet } from "./AppearanceSheet";
-import { NumberStepper } from "~/components/Form/NumberStepper";
import { NothingSlider } from "~/components/Form/Slider.variant";
-import { SegmentedList } from "~/components/List/Segmented";
-import { SheetLabelAction } from "~/components/Sheet/SheetLabelAction";
-import { Icon } from "~/components/next/base/icon";
+import { Button } from "~/components/next/base/button";
import type { SheetRef } from "~/components/next/base/sheet";
-import { Sheet, useSheetRef } from "~/components/next/base/sheet";
+import { ScrollableSheet, useSheetRef } from "~/components/next/base/sheet";
+import type { LabeledSliderProps } from "~/components/next/blocks/slider-labeled";
+import { LabeledSlider } from "~/components/next/blocks/slider-labeled";
+import { TextStack } from "~/components/next/blocks/text-stack";
+import * as List from "~/components/next/composed/list";
import { PlayingIndicator } from "~/modules/media/components/AnimatedBars";
export function PlaybackOptionsSheet(props: {
ref: SheetRef;
trackId: string;
}) {
+ const { t } = useTranslation();
const navigation = useNavigation("NowPlaying");
const [stopDrag, setStopDrag] = useState(false);
const playingSource = usePlaybackStore((s) => s.playingFrom);
@@ -52,51 +56,70 @@ export function PlaybackOptionsSheet(props: {
}, [appearanceSheetRef, props.ref]);
//#endregion
+ const playbackDelaySliderOptions = useMemo<
+ Omit
+ >(
+ () => ({
+ ...PlaybackDelayConfig.bound,
+ label: t("feat.playback.extra.delay"),
+ formatValue: (value) => {
+ "worklet";
+ return `${value}s`;
+ },
+ onChange: (value) => {
+ "worklet";
+ scheduleOnRN(PreferenceSetters.setPlaybackDelay, value);
+ },
+ onStatusChange: (status) => {
+ "worklet";
+ scheduleOnRN(setStopDrag, status !== "idle");
+ },
+ }),
+ [t, setStopDrag],
+ );
+
return (
<>
-
-
+ }
- className="py-2 pl-2"
- _overflow={false}
- />
+ className="rounded-lg py-2 pl-2"
+ >
+
+
+
+
-
-
- }
+
-
-
+ }
/>
-
+ }
/>
-
-
+
+
>
);
}
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"
+ >
+
+
+ );
+ }}
+ 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 (
-
-
+
+
+
+
+
+
+ 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}
/>
-
-
-
-
-
-
-
- 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 (
-
+