mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-06-30 01:22:56 +01:00
fix(tv): scale option-modal cards with text size + honor cardWidth
The TV option modal hardcoded the card size to scaleSize(160)/(75), ignoring the caller's cardWidth/cardHeight and never growing with the user's text-scale setting. With "Large" text, long values (e.g. a root-folder path) overflowed the fixed card and were truncated. Honor the provided cardWidth/cardHeight and multiply by the text scale (new useTVRelativeScale) so the card grows in step with the font. Claude-Session: https://claude.ai/code/session_016Hhu5DruGLPhdP4LAoy1Xd
This commit is contained in:
@@ -55,6 +55,20 @@ export type ScaledTVTypography = {
|
||||
callout: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the user's text-scale factor relative to the Default scale (1.0 at
|
||||
* Default, >1 for Large/ExtraLarge, <1 for Small). Use it to scale containers
|
||||
* (e.g. option-card width/height) in step with the scaled font so larger text
|
||||
* settings don't overflow fixed boxes.
|
||||
*/
|
||||
export const useTVRelativeScale = (): number => {
|
||||
const { settings } = useSettings();
|
||||
const scale =
|
||||
scaleMultipliers[settings.tvTypographyScale] ??
|
||||
scaleMultipliers[TVTypographyScale.Default];
|
||||
return scale / scaleMultipliers[TVTypographyScale.Default];
|
||||
};
|
||||
|
||||
/**
|
||||
* Hook that returns scaled TV typography values based on user settings.
|
||||
* Use this instead of the static TVTypography constant for dynamic scaling.
|
||||
|
||||
Reference in New Issue
Block a user