add frontent build date
This commit is contained in:
@@ -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() {
|
||||
<p className="">{t('exit')}</p>
|
||||
</Link>
|
||||
</ul>
|
||||
|
||||
<div className="build-versions">
|
||||
{!frontendBuildDate && (
|
||||
<div className="">
|
||||
front: {frontendBuildDate}
|
||||
</div>
|
||||
)}
|
||||
{/* <div>
|
||||
back:
|
||||
</div> */}
|
||||
</div>
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user