mirror of
https://github.com/stashapp/stash.git
synced 2025-12-16 21:34:14 +01:00
* Move loadStickyHeader to src/hooks * intl stashIDs * Scroll to top on component mount * Add id to gallery cover image and tweak merge functions * Add useTitleProps hook * Also scroll to top on list pages * Refactor loaders and tabs * Use classnames * Add DetailImage
26 lines
615 B
TypeScript
26 lines
615 B
TypeScript
import { MessageDescriptor, useIntl } from "react-intl";
|
|
|
|
export const TITLE = "Stash";
|
|
export const TITLE_SEPARATOR = " | ";
|
|
|
|
export function useTitleProps(...messages: (string | MessageDescriptor)[]) {
|
|
const intl = useIntl();
|
|
|
|
const parts = messages.map((msg) => {
|
|
if (typeof msg === "object") {
|
|
return intl.formatMessage(msg);
|
|
} else {
|
|
return msg;
|
|
}
|
|
});
|
|
|
|
return makeTitleProps(...parts);
|
|
}
|
|
|
|
export function makeTitleProps(...parts: string[]) {
|
|
const title = [...parts, TITLE].join(TITLE_SEPARATOR);
|
|
return {
|
|
titleTemplate: `%s | ${title}`,
|
|
defaultTitle: title,
|
|
};
|
|
}
|