From 953f2f22a9a4e584c7e886817111f0e3dd723d06 Mon Sep 17 00:00:00 2001 From: smanylov Date: Wed, 11 Feb 2026 20:47:40 +0700 Subject: [PATCH] add frontent build date --- public/build-info.json | 3 +++ src/app/lib/prefetch-queries.ts | 2 +- src/app/styles/global-styles.scss | 9 ++++++++ src/app/ui/navigation/nav-links.tsx | 36 +++++++++++++++++++++++++++++ 4 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 public/build-info.json diff --git a/public/build-info.json b/public/build-info.json new file mode 100644 index 0000000..37d74ed --- /dev/null +++ b/public/build-info.json @@ -0,0 +1,3 @@ +{ + "buildTime": null +} \ No newline at end of file diff --git a/src/app/lib/prefetch-queries.ts b/src/app/lib/prefetch-queries.ts index c9e7059..c384463 100644 --- a/src/app/lib/prefetch-queries.ts +++ b/src/app/lib/prefetch-queries.ts @@ -1,7 +1,7 @@ import { QueryClient } from '@tanstack/react-query'; import { getUserData, getUserFilesInfo } from '@/app/actions/action'; import { getUserFilesData } from '@/app/actions/fileEntity'; -import {fetchReferralUserStats} from '@/app/actions/referralsActions'; +import { fetchReferralUserStats } from '@/app/actions/referralsActions'; export async function prefetchLayoutQueries(queryClient: QueryClient) { await Promise.all([ diff --git a/src/app/styles/global-styles.scss b/src/app/styles/global-styles.scss index 0bee0de..75f973b 100644 --- a/src/app/styles/global-styles.scss +++ b/src/app/styles/global-styles.scss @@ -306,6 +306,15 @@ width: var(--side-bar-width); transform: translateX(0); } + + .build-versions { + position: absolute; +/* margin-top: 20px; + margin-left: 5px; */ + bottom: 10px; + left: 10px; + color: #fffc; + } } .sidebar-close-button { diff --git a/src/app/ui/navigation/nav-links.tsx b/src/app/ui/navigation/nav-links.tsx index 3788d2d..6c555d5 100644 --- a/src/app/ui/navigation/nav-links.tsx +++ b/src/app/ui/navigation/nav-links.tsx @@ -13,6 +13,7 @@ import { useRef } from 'react'; import { useClickOutside } from '@/app/hooks/useClickOutside'; import { fetchReferralUserStats } from '@/app/actions/referralsActions'; import { useQuery } from '@tanstack/react-query'; +import { env } from 'process'; export default function NavLinks() { const { @@ -34,6 +35,30 @@ export default function NavLinks() { } }); + const { + data: frontendBuildDate, + } = useQuery({ + queryKey: ['frontendBuildDate'], + queryFn: async () => { + try { + const response = await fetch('/build-info.json'); + if (!response.ok) { + return null; + } + return response.json(); + } catch (error) { + return null; + } + }, + select: (data) => { + if (data?.buildTime) { + return data.buildTime; + } + return null; + }, + retry: false // Не повторять запрос при ошибке + }); + const pathname = usePathname().replace('/en/', '/').replace('/ru/', '/'); const t = useTranslations('Global'); @@ -133,6 +158,17 @@ export default function NavLinks() {

{t('exit')}

+ +
+ {!frontendBuildDate && ( +
+ front: {frontendBuildDate} +
+ )} + {/*
+ back: +
*/} +
); }