diff --git a/app/components/ChangelogModal/ChangelogModal.tsx b/app/components/ChangelogModal/ChangelogModal.tsx
index 0d12d07..294ef8f 100644
--- a/app/components/ChangelogModal/ChangelogModal.tsx
+++ b/app/components/ChangelogModal/ChangelogModal.tsx
@@ -4,6 +4,7 @@ import { Modal, Accordion } from "flowbite-react";
import Markdown from "markdown-to-jsx";
import { useEffect, useState } from "react";
import Styles from "./ChangelogModal.module.css";
+import { tryCatch } from "#/api/utils";
export const ChangelogModal = (props: {
isOpen: boolean;
@@ -17,29 +18,20 @@ export const ChangelogModal = (props: {
>({});
async function _fetchVersionChangelog(version: string) {
- const res = await fetch(`/changelog/${version}.md`);
- return await res.text();
+ const { data, error } = await tryCatch(fetch(`/changelog/${version}.md`));
+ if (error) {
+ return "Нет списка изменений";
+ }
+ return await data.text();
}
useEffect(() => {
if (props.version != "" && currentVersionChangelog == "") {
+ setCurrentVersionChangelog("Загрузка ...");
_fetchVersionChangelog(props.version).then((data) => {
setCurrentVersionChangelog(data);
});
}
-
- if (props.previousVersions.length > 0) {
- props.previousVersions.forEach((version) => {
- _fetchVersionChangelog(version).then((data) => {
- setPreviousVersionsChangelog((prev) => {
- return {
- ...prev,
- [version]: data,
- };
- });
- });
- });
- }
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [props.version]);
@@ -50,20 +42,38 @@ export const ChangelogModal = (props: {
{currentVersionChangelog}
- {Object.keys(previousVersionsChangelog).length == props.previousVersions.length && (
-
- {props.previousVersions.map(
- (version) => (
+
+ {props.previousVersions.length > 0 &&
+ props.previousVersions.map((version) => {
+ return (
- Список изменений v{version}
+ {
+ if (!previousVersionsChangelog.hasOwnProperty(version)) {
+ _fetchVersionChangelog(version).then((data) => {
+ setPreviousVersionsChangelog((prev) => {
+ return {
+ ...prev,
+ [version]: data,
+ };
+ });
+ });
+ }
+ }}
+ >
+ Список изменений v{version}
+
- {previousVersionsChangelog[version]}
+ {previousVersionsChangelog.hasOwnProperty(version) ?
+
+ {previousVersionsChangelog[version]}
+
+ : Загрузка ...
}
- )
- )}
-
- )}
+ );
+ })}
+
);
diff --git a/app/components/ReleasePlayer/MediaThemeSutro.tsx b/app/components/ReleasePlayer/MediaThemeSutro.tsx
index 92e9b59..7ebb900 100644
--- a/app/components/ReleasePlayer/MediaThemeSutro.tsx
+++ b/app/components/ReleasePlayer/MediaThemeSutro.tsx
@@ -590,7 +590,7 @@ export default function Page(props: { children: any, className?: string }) {
-