Merge branch 'kmmiio99o:main' into main
This commit is contained in:
commit
8d0f313630
4 changed files with 22 additions and 15 deletions
|
|
@ -156,6 +156,15 @@ export function formatString<T = void>(
|
|||
val: Record<string, T>,
|
||||
): FormatStringRet<T> {
|
||||
const str = Strings[key];
|
||||
// @ts-ignore
|
||||
return new IntlMessageFormat(str).format(val);
|
||||
if (!str) return str as FormatStringRet<T>;
|
||||
try {
|
||||
// @ts-ignore
|
||||
return new IntlMessageFormat(str).format(val);
|
||||
} catch (e) {
|
||||
if (e instanceof SyntaxError) {
|
||||
logger.warn(`[i18n] Failed to parse message for key "${String(key)}":`, e.message);
|
||||
return str as FormatStringRet<T>;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ const useStyles = createStyles({
|
|||
headerLeading: {
|
||||
flexDirection: "column",
|
||||
justifyContent: "center",
|
||||
flexShrink: 1,
|
||||
scale: 1.2,
|
||||
},
|
||||
headerTrailing: {
|
||||
|
|
@ -108,9 +109,9 @@ export default function AddonCard(props: CardProps) {
|
|||
<Stack spacing={16}>
|
||||
<View style={{ flexDirection: "row", alignItems: "center" }}>
|
||||
<View style={styles.headerLeading}>
|
||||
<Text style={styles.headerLabel}>{props.headerLabel}</Text>
|
||||
<Text numberOfLines={1} ellipsizeMode="tail" style={styles.headerLabel}>{props.headerLabel}</Text>
|
||||
{props.headerSublabel && (
|
||||
<Text style={styles.headerSubtitle}>{props.headerSublabel}</Text>
|
||||
<Text numberOfLines={1} ellipsizeMode="tail" style={styles.headerSubtitle}>{props.headerSublabel}</Text>
|
||||
)}
|
||||
</View>
|
||||
<View style={[styles.headerTrailing, { marginLeft: "auto" }]}>
|
||||
|
|
|
|||
|
|
@ -5,15 +5,14 @@ import type { ImageURISource } from "react-native";
|
|||
import { patchTabsUI } from "./patches/tabs";
|
||||
|
||||
export interface RowConfig {
|
||||
key: string;
|
||||
title: () => string;
|
||||
onPress?: () => any;
|
||||
render?: Parameters<typeof lazy>[0];
|
||||
icon?: ImageURISource | number;
|
||||
IconComponent?: React.ReactNode;
|
||||
usePredicate?: () => boolean;
|
||||
useTrailing?: () => string | JSX.Element;
|
||||
rawTabsConfig?: Record<string, any>;
|
||||
key: string;
|
||||
title: () => string;
|
||||
onPress?: () => any;
|
||||
render?: Parameters<typeof lazy>[0];
|
||||
icon?: ImageURISource | number;
|
||||
IconComponent?: React.ReactNode,
|
||||
usePredicate?: () => boolean,
|
||||
useTrailing?: () => string | JSX.Element
|
||||
}
|
||||
|
||||
export const registeredSections = {} as {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import { after } from "@lib/api/patcher";
|
|||
import { TableRow } from "@metro/common/components";
|
||||
import { findByNameLazy, findByPropsLazy } from "@metro/wrappers";
|
||||
import { registeredSections } from "@ui/settings";
|
||||
import { Strings } from "@core/i18n";
|
||||
|
||||
import { CustomPageRenderer, wrapOnPress } from "./shared";
|
||||
import { findInReactTree } from "@lib/utils";
|
||||
|
|
@ -32,7 +31,6 @@ export function patchTabsUI(unpatches: (() => void | boolean)[]) {
|
|||
useTitle: row.title,
|
||||
onPress: wrapOnPress(row.onPress, null, row.render, row.title()),
|
||||
withArrow: true,
|
||||
...row.rawTabsConfig,
|
||||
},
|
||||
})),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue