mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 08:26:00 +01:00
Add custom title setting
This commit is contained in:
parent
d77d667679
commit
bf1c7a0e36
5 changed files with 24 additions and 6 deletions
|
|
@ -307,7 +307,8 @@ export const App: React.FC = () => {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const titleProps = makeTitleProps();
|
const title = config.data?.configuration.ui.title || "Stash";
|
||||||
|
const titleProps = makeTitleProps(title);
|
||||||
|
|
||||||
if (!messages) {
|
if (!messages) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
|
|
@ -248,6 +248,14 @@ export const SettingsInterfacePanel: React.FC = PatchComponent(
|
||||||
onChange={(v) => saveInterface({ sfwContentMode: v })}
|
onChange={(v) => saveInterface({ sfwContentMode: v })}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<StringSetting
|
||||||
|
id="custom-title"
|
||||||
|
headingID="config.ui.custom_title.heading"
|
||||||
|
subHeadingID="config.ui.custom_title.description"
|
||||||
|
value={ui.title ?? ""}
|
||||||
|
onChange={(v) => saveUI({ title: v })}
|
||||||
|
/>
|
||||||
|
|
||||||
<div className="setting-group">
|
<div className="setting-group">
|
||||||
<div className="setting">
|
<div className="setting">
|
||||||
<div>
|
<div>
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,8 @@ export interface IUIConfig {
|
||||||
defaultFilters?: DefaultFilters;
|
defaultFilters?: DefaultFilters;
|
||||||
|
|
||||||
taggerConfig?: ITaggerConfig;
|
taggerConfig?: ITaggerConfig;
|
||||||
|
|
||||||
|
title?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getFrontPageContent(
|
export function getFrontPageContent(
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,13 @@
|
||||||
import { MessageDescriptor, useIntl } from "react-intl";
|
import { MessageDescriptor, useIntl } from "react-intl";
|
||||||
|
import { useConfigurationContext } from "./Config";
|
||||||
|
|
||||||
export const TITLE = "Stash";
|
export const TITLE = "Stash";
|
||||||
export const TITLE_SEPARATOR = " | ";
|
export const TITLE_SEPARATOR = " | ";
|
||||||
|
|
||||||
export function useTitleProps(...messages: (string | MessageDescriptor)[]) {
|
export function useTitleProps(...messages: (string | MessageDescriptor)[]) {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
|
const config = useConfigurationContext();
|
||||||
|
const title = config.configuration.ui.title || TITLE;
|
||||||
|
|
||||||
const parts = messages.map((msg) => {
|
const parts = messages.map((msg) => {
|
||||||
if (typeof msg === "object") {
|
if (typeof msg === "object") {
|
||||||
|
|
@ -14,13 +17,13 @@ export function useTitleProps(...messages: (string | MessageDescriptor)[]) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return makeTitleProps(...parts);
|
return makeTitleProps(title, ...parts);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function makeTitleProps(...parts: string[]) {
|
export function makeTitleProps(title: string, ...parts: string[]) {
|
||||||
const title = [...parts, TITLE].join(TITLE_SEPARATOR);
|
const fullTitle = [...parts, title].join(TITLE_SEPARATOR);
|
||||||
return {
|
return {
|
||||||
titleTemplate: `%s | ${title}`,
|
titleTemplate: `%s | ${fullTitle}`,
|
||||||
defaultTitle: title,
|
defaultTitle: fullTitle,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -621,6 +621,10 @@
|
||||||
"heading": "Custom localisation",
|
"heading": "Custom localisation",
|
||||||
"option_label": "Custom localisation enabled"
|
"option_label": "Custom localisation enabled"
|
||||||
},
|
},
|
||||||
|
"custom_title": {
|
||||||
|
"description": "Custom text to append to the page title. If empty, defaults to 'Stash'.",
|
||||||
|
"heading": "Custom Title"
|
||||||
|
},
|
||||||
"delete_options": {
|
"delete_options": {
|
||||||
"description": "Default settings when deleting images, galleries, and scenes.",
|
"description": "Default settings when deleting images, galleries, and scenes.",
|
||||||
"heading": "Delete Options",
|
"heading": "Delete Options",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue