mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 21:04:37 +03:00
Release notes dialog (#2726)
* Move manual docs * Move changelog docs * Add migration notes * Move changelog to settings * Add release notes dialog * Add new changelog
This commit is contained in:
@@ -9,7 +9,11 @@ import LightboxProvider from "src/hooks/Lightbox/context";
|
||||
import { initPolyfills } from "src/polyfills";
|
||||
|
||||
import locales from "src/locales";
|
||||
import { useConfiguration, useSystemStatus } from "src/core/StashService";
|
||||
import {
|
||||
useConfiguration,
|
||||
useConfigureUI,
|
||||
useSystemStatus,
|
||||
} from "src/core/StashService";
|
||||
import { flattenMessages } from "src/utils";
|
||||
import Mousetrap from "mousetrap";
|
||||
import MousetrapPause from "mousetrap-pause";
|
||||
@@ -22,6 +26,9 @@ import { LoadingIndicator, TITLE_SUFFIX } from "./components/Shared";
|
||||
import { ConfigurationProvider } from "./hooks/Config";
|
||||
import { ManualProvider } from "./components/Help/context";
|
||||
import { InteractiveProvider } from "./hooks/Interactive/context";
|
||||
import { ReleaseNotesDialog } from "./components/Dialogs/ReleaseNotesDialog";
|
||||
import { IUIConfig } from "./core/config";
|
||||
import { releaseNotes } from "./docs/en/ReleaseNotes";
|
||||
|
||||
const Performers = lazy(() => import("./components/Performers/Performers"));
|
||||
const FrontPage = lazy(() => import("./components/FrontPage/FrontPage"));
|
||||
@@ -62,6 +69,8 @@ function languageMessageString(language: string) {
|
||||
|
||||
export const App: React.FC = () => {
|
||||
const config = useConfiguration();
|
||||
const [saveUI] = useConfigureUI();
|
||||
|
||||
const { data: systemStatusData } = useSystemStatus();
|
||||
|
||||
const language =
|
||||
@@ -161,6 +170,32 @@ export const App: React.FC = () => {
|
||||
);
|
||||
}
|
||||
|
||||
function maybeRenderReleaseNotes() {
|
||||
const lastNoteSeen = (config.data?.configuration.ui as IUIConfig)
|
||||
?.lastNoteSeen;
|
||||
const notes = releaseNotes.filter((n) => {
|
||||
return !lastNoteSeen || n.date > lastNoteSeen;
|
||||
});
|
||||
|
||||
if (notes.length === 0) return;
|
||||
|
||||
return (
|
||||
<ReleaseNotesDialog
|
||||
notes={notes.map((n) => n.content)}
|
||||
onClose={() => {
|
||||
saveUI({
|
||||
variables: {
|
||||
input: {
|
||||
...config.data?.configuration.ui,
|
||||
lastNoteSeen: notes[0].date,
|
||||
},
|
||||
},
|
||||
});
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<ErrorBoundary>
|
||||
{messages ? (
|
||||
@@ -173,6 +208,7 @@ export const App: React.FC = () => {
|
||||
configuration={config.data?.configuration}
|
||||
loading={config.loading}
|
||||
>
|
||||
{maybeRenderReleaseNotes()}
|
||||
<ToastProvider>
|
||||
<Suspense fallback={<LoadingIndicator />}>
|
||||
<LightboxProvider>
|
||||
|
||||
Reference in New Issue
Block a user