Improve release notes dialog (#3497)

* Fix multiple release notes
* Improve release notes dialog
* Hide release notes dialog after setup
This commit is contained in:
DingDongSoLong4
2023-03-01 06:08:56 +02:00
committed by GitHub
parent f992b9a0de
commit b1325ce03f
5 changed files with 45 additions and 16 deletions

View File

@@ -207,7 +207,7 @@ export const App: React.FC = () => {
return ( return (
<ReleaseNotesDialog <ReleaseNotesDialog
notes={notes.map((n) => n.content)} notes={notes}
onClose={() => { onClose={() => {
saveUI({ saveUI({
variables: { variables: {

View File

@@ -1,12 +1,12 @@
import React from "react"; import React from "react";
import { Form } from "react-bootstrap";
import { ModalComponent } from "../Shared/Modal"; import { ModalComponent } from "../Shared/Modal";
import { faCogs } from "@fortawesome/free-solid-svg-icons"; import { faCogs } from "@fortawesome/free-solid-svg-icons";
import { useIntl } from "react-intl"; import { useIntl } from "react-intl";
import { MarkdownPage } from "../Shared/MarkdownPage"; import { MarkdownPage } from "../Shared/MarkdownPage";
import { IReleaseNotes } from "src/docs/en/ReleaseNotes";
interface IReleaseNotesDialog { interface IReleaseNotesDialog {
notes: string[]; notes: IReleaseNotes[];
onClose: () => void; onClose: () => void;
} }
@@ -26,11 +26,22 @@ export const ReleaseNotesDialog: React.FC<IReleaseNotesDialog> = ({
text: intl.formatMessage({ id: "actions.close" }), text: intl.formatMessage({ id: "actions.close" }),
}} }}
> >
<Form> <div className="m-n3">
{notes.map((n, i) => ( {notes
<MarkdownPage page={n} key={i} /> .map((n, i) => (
))} <div key={i} className="m-3">
</Form> <h3>{n.version}</h3>
<MarkdownPage page={n.content} />
</div>
))
.reduce((accu, curr) => (
<>
{accu}
<hr />
{curr}
</>
))}
</div>
</ModalComponent> </ModalComponent>
); );
}; };

View File

@@ -9,7 +9,11 @@ import {
InputGroup, InputGroup,
} from "react-bootstrap"; } from "react-bootstrap";
import * as GQL from "src/core/generated-graphql"; import * as GQL from "src/core/generated-graphql";
import { mutateSetup, useSystemStatus } from "src/core/StashService"; import {
mutateSetup,
useConfigureUI,
useSystemStatus,
} from "src/core/StashService";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import { ConfigurationContext } from "src/hooks/Config"; import { ConfigurationContext } from "src/hooks/Config";
import StashConfiguration from "../Settings/StashConfiguration"; import StashConfiguration from "../Settings/StashConfiguration";
@@ -22,10 +26,12 @@ import {
faExclamationTriangle, faExclamationTriangle,
faQuestionCircle, faQuestionCircle,
} from "@fortawesome/free-solid-svg-icons"; } from "@fortawesome/free-solid-svg-icons";
import { releaseNotes } from "src/docs/en/ReleaseNotes";
export const Setup: React.FC = () => { export const Setup: React.FC = () => {
const { configuration, loading: configLoading } = const { configuration, loading: configLoading } =
useContext(ConfigurationContext); useContext(ConfigurationContext);
const [saveUI] = useConfigureUI();
const [step, setStep] = useState(0); const [step, setStep] = useState(0);
const [configLocation, setConfigLocation] = useState(""); const [configLocation, setConfigLocation] = useState("");
@@ -400,6 +406,15 @@ export const Setup: React.FC = () => {
generatedLocation, generatedLocation,
stashes, stashes,
}); });
// Set lastNoteSeen to hide release notes dialog
await saveUI({
variables: {
input: {
...configuration?.ui,
lastNoteSeen: releaseNotes[0].date,
},
},
});
} catch (e) { } catch (e) {
if (e instanceof Error) setSetupError(e.message ?? e.toString()); if (e instanceof Error) setSetupError(e.message ?? e.toString());
} finally { } finally {

View File

@@ -1,19 +1,22 @@
import v0170 from "./v0170.md"; import v0170 from "./v0170.md";
import v0200 from "./v0200.md"; import v0200 from "./v0200.md";
interface IReleaseNotes { export interface IReleaseNotes {
// handle should be in the form of YYYYMMDD // handle should be in the form of YYYYMMDD
date: number; date: number;
version: string;
content: string; content: string;
} }
export const releaseNotes: IReleaseNotes[] = [ export const releaseNotes: IReleaseNotes[] = [
{
date: 20220906,
content: v0170,
},
{ {
date: 20230224, date: 20230224,
version: "v0.20.0",
content: v0200, content: v0200,
}, },
{
date: 20220906,
version: "v0.17.0",
content: v0170,
},
]; ];

View File

@@ -1,7 +1,7 @@
After migrating, please run a scan on your entire library to populate missing data, and to ingest identical files which were previously ignored. After migrating, please run a scan on your entire library to populate missing data, and to ingest identical files which were previously ignored.
### Other changes: ##### Other changes:
* Import/export schema has changed and is incompatible with the previous version. * Import/export schema has changed and is incompatible with the previous version.
* Changelog has been moved from the stats page to a section in the Settings page. * Changelog has been moved from the stats page to a section in the Settings page.
* Object titles are now displayed as the file basename if the title is not explicitly set. The `Don't include file extension as part of the title` scan flag is no longer supported. * Object titles are now displayed as the file basename if the title is not explicitly set. The `Don't include file extension as part of the title` scan flag is no longer supported.
* `Set name, date, details from embedded file metadata` scan flag is no longer supported. This functionality may be implemented as a built-in scraper in the future. * `Set name, date, details from embedded file metadata` scan flag is no longer supported. This functionality may be implemented as a built-in scraper in the future.