feat: add appVersion in browser

This commit is contained in:
SD 2024-09-06 15:22:55 +04:00
parent 76ffdc4094
commit 3345a533d2
4 changed files with 21 additions and 2 deletions

View File

@ -1,6 +1,7 @@
// @ts-check
const withNextIntl = require('next-intl/plugin')();
const path = require('path');
const json = require('./package.json');
/** @type {import('next').NextConfig} */
const nextConfig = {
@ -14,6 +15,9 @@ const nextConfig = {
sassOptions: {
includePaths: [path.join(__dirname, 'styles')],
},
env: {
version: json.version
},
typescript: {
// !! WARN !!
// Dangerously allow production builds to successfully complete even if

View File

@ -1,4 +1,4 @@
import React, { ReactNode } from 'react';
import React, { ReactNode, Suspense } from 'react';
import { Metadata } from 'next';
import { unstable_setRequestLocale } from 'next-intl/server';
import { notFound } from 'next/navigation';
@ -6,7 +6,7 @@ import { ConfigProvider } from 'antd';
import { AntdRegistry } from '@ant-design/nextjs-registry';
import theme from '../../constants/theme';
import { ALLOWED_LOCALES } from '../../constants/locale';
import { Header, Footer } from '../../components/Page';
import { Header, Footer, AppConfig } from '../../components/Page';
type LayoutProps = {
children: ReactNode;
@ -30,6 +30,9 @@ export default function LocaleLayout({ children, params: { locale } }: LayoutPro
<AntdRegistry>
<ConfigProvider theme={theme}>
<div className="b-wrapper">
<Suspense fallback={null}>
<AppConfig />
</Suspense>
<div className="b-content">
<Header locale={locale} />
{children}

View File

@ -0,0 +1,11 @@
'use client'
import { useEffect } from 'react';
export const AppConfig = () => {
useEffect(() => {
console.log('AppVersion', process.env.version);
}, []);
return null;
};

View File

@ -1,3 +1,4 @@
export * from './Header';
export * from './Footer';
export * from './GeneralTopSection';
export * from './AppConfig';