fix: disable old version

This commit is contained in:
reza karimi
2025-12-18 10:13:52 +03:30
parent 877c0e6b33
commit 4c00296f5c
3 changed files with 159 additions and 217 deletions
+41 -117
View File
@@ -1,22 +1,17 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react'
import axios from "axios"; import axios from 'axios'
import AppContainer from "./appContainer"; import AppContainer from './appContainer'
import { AppFile, AppUrl } from "../lib/api"; import { AppFile, AppUrl } from '../lib/api'
import Image from "next/image"; import Image from 'next/image'
import dynamic from "next/dynamic"; import dynamic from 'next/dynamic'
import { Suspense } from 'react' import { Suspense } from 'react'
import { import { MDBBtn, MDBCol, MDBContainer, MDBRow } from 'mdb-react-ui-kit'
MDBBtn, import { LightBox } from 'react-lightbox-pack'
MDBCol, import { Button, Divider, Tab, TabList, TabPanel, TabPanels, Tabs } from '@chakra-ui/react'
MDBContainer,
MDBRow,
} from "mdb-react-ui-kit";
import { LightBox } from "react-lightbox-pack";
import { Button, Divider, Tab, TabList, TabPanel, TabPanels, Tabs } from "@chakra-ui/react";
const APV = dynamic(() => import('./components/Videos'), { const APV = dynamic(() => import('./components/Videos'), {
ssr: false, ssr: false
}) })
const shimmer = (w, h) => ` const shimmer = (w, h) => `
<svg width="${w}" height="${h}" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <svg width="${w}" height="${h}" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
@@ -32,50 +27,47 @@ const shimmer = (w, h) => `
<animate xlink:href="#r" attributeName="x" from="-${w}" to="${w}" dur="1s" repeatCount="indefinite" /> <animate xlink:href="#r" attributeName="x" from="-${w}" to="${w}" dur="1s" repeatCount="indefinite" />
</svg>` </svg>`
const toBase64 = (str) => const toBase64 = str => (typeof window === 'undefined' ? Buffer.from(str).toString('base64') : window.btoa(str))
typeof window === 'undefined'
? Buffer.from(str).toString('base64')
: window.btoa(str)
const Gallery = (dataImage) => { const Gallery = dataImage => {
const [Images, SetImages] = useState(dataImage) const [Images, SetImages] = useState(dataImage)
const [justifyActive, setJustifyActive] = React.useState('tab1'); const [justifyActive, setJustifyActive] = React.useState('tab1')
const [toggle, setToggle] = React.useState(false); const [toggle, setToggle] = React.useState(false)
const [sIndex, setSIndex] = React.useState(0); const [sIndex, setSIndex] = React.useState(0)
const [filterId, setFilterId] = React.useState(1); const [filterId, setFilterId] = React.useState(1)
const Parallax = ({ quality }) => { const Parallax = ({ quality }) => {
return `../resource/parallax/Gallery.jpg`; return `../resource/parallax/Gallery.jpg`
}
const Filter = async (filter) => {
const res = await axios.get(AppUrl(`FilterGalleyImages/${filter}`));
SetImages({ dataImage: res.data })
setFilterId(filter)
} }
// const Filter = async filter => {
// const res = await axios.get(AppUrl(`FilterGalleyImages/${filter}`))
// SetImages({ dataImage: res.data })
// setFilterId(filter)
// }
const AllImage = async () => { // const AllImage = async () => {
const res = await axios.get(AppUrl(`GetGalleyImages`)); // const res = await axios.get(AppUrl(`GetGalleyImages`))
SetImages({ dataImage: res.data }) // SetImages({ dataImage: res.data })
} // }
// Handler // Handler
const lightBoxHandler = (state, sIndex) => { // const lightBoxHandler = (state, sIndex) => {
setToggle(state); // setToggle(state)
setSIndex(sIndex); // setSIndex(sIndex)
}; // }
const handleJustifyClick = (value) => { const handleJustifyClick = value => {
if (value === justifyActive) { if (value === justifyActive) {
return; return
} }
setJustifyActive(value); setJustifyActive(value)
}; }
return ( return (
<div> <div>
<style jsx> <style jsx>
{` {`
.cardImage { .cardImage {
background-color: #F3F4F6; background-color: #f3f4f6;
padding: 5px; padding: 5px;
border-radius: 1rem; border-radius: 1rem;
display: flex; display: flex;
@@ -86,84 +78,16 @@ const Gallery = (dataImage) => {
} }
`} `}
</style> </style>
<AppContainer> <AppContainer></AppContainer>
<div className="parallax-container">
<h1 className={'center-align text-white header_back service-text dana font-weight-bold'}> گالری بیمارستان </h1>
<Image
loader={Parallax}
src="Parallax.png"
className={'responsive-img shadow-5'}
placeholder="blur"
blurDataURL={`data:image/svg+xml;base64,${toBase64(shimmer(3000, 1300))}`}
alt="درباره بیارستان مهر ایرانیان پرند "
width={3000}
height={1300}
/>
</div> </div>
<div className='lg:mx-20 sm:mx-5'>
<Tabs defaultIndex={1} className={'mt-5'} isFitted variant='enclosed'>
<TabList mb='1em'>
{/* <Tab on className={'bk font-weight-bold'} _selected={{ color: 'white', bg: 'teal.500' }}>ویدئو ها</Tab> */}
<Tab className={'bk font-weight-bold'} _selected={{ color: 'white', bg: 'teal.500' }}>تصاویر</Tab>
</TabList>
</Tabs>
<div style={{ flexDirection: 'column' }} className={'flex justify-content-end flex-xl-row flex-lg-row flex-md-column flex-sm-column'}>
<MDBBtn onClick={() => Filter(2)} color={filterId === 2 ? 'light' : 'light'} className={filterId === 2 ? 'm-2' : 'm-2 text-dark'}>تصاویر در حال ساخت</MDBBtn>
<MDBBtn onClick={() => Filter(1)} color={filterId === 1 ? 'light' : 'light'} className={'m-2'}>تصاویر معماری</MDBBtn>
<MDBBtn onClick={() => AllImage()} color={filterId !== 1 && 2 ? 'light' : 'light'} className={'m-2'}>همه تصاویر </MDBBtn>
</div>
<Divider colorScheme={'gray'} />
<MDBRow style={{ marginTop: 10 }}>
{Images && Images.dataImage.map((image, index) => {
return (
<MDBCol xs={12} sm={12} md={6} lg={3}>
<div className={'cardImage'} key={image.id}>
<img
key={image.id}
alt={image.title}
width={350}
style={{ cursor: 'zoom-in' }}
className={'responsive-img'}
src={AppFile(`panel-public/uploads/HospitalGallery/${image.imageAddr}`)}
onClick={() => {
lightBoxHandler(true, index);
}}
/>
<br />
<span>{image.title}</span>
</div>
</MDBCol>
) )
})} }
</MDBRow>
<LightBox
state={toggle}
event={lightBoxHandler}
data={Images.dataImage}
imageWidth="60vw"
imageHeight="70vh"
thumbnailHeight={50}
thumbnailWidth={50}
setImageIndex={setSIndex}
imageIndex={sIndex}
/>
<br />
<br />
<br />
<br />
</div>
</AppContainer>
</div>
);
};
export async function getServerSideProps(context) { export async function getServerSideProps(context) {
const res = await axios.get(AppUrl('GetGalleyImages')); // const res = await axios.get(AppUrl('GetGalleyImages'));
return { return {
props: { props: {
dataImage: res.data dataImage: null
}, // will be passed to the page component as props } // will be passed to the page component as props
} }
} }
export default Gallery; export default Gallery
+56 -32
View File
@@ -1,4 +1,4 @@
import React from 'react'; import React from 'react'
import { import {
MDBCard, MDBCard,
MDBCardImage, MDBCardImage,
@@ -7,35 +7,64 @@ import {
MDBCardText, MDBCardText,
MDBRow, MDBRow,
MDBCol, MDBCol,
MDBContainer, MDBCardHeader, MDBBtn, MDBIcon, MDBInputGroupText, MDBTypography MDBContainer,
} from 'mdb-react-ui-kit'; MDBCardHeader,
import axios from "axios"; MDBBtn,
import Link from "next/link"; MDBIcon,
import AppContainer from "./appContainer"; MDBInputGroupText,
MDBTypography
} from 'mdb-react-ui-kit'
import axios from 'axios'
import Link from 'next/link'
import AppContainer from './appContainer'
import { useRouter } from 'next/router' import { useRouter } from 'next/router'
import {AppUrl} from "../lib/api"; import { AppUrl } from '../lib/api'
import {DownloadIcon} from "@chakra-ui/icons"; import { DownloadIcon } from '@chakra-ui/icons'
const News = ({data, children}) => { const News = ({ data, children }) => {
const router = useRouter(); const router = useRouter()
const query = router.query.list; const query = router.query.list
const dataPage = ( const dataPage = (
<div className='lg:mx-20 sm:mx-5'> <div className='lg:mx-20 sm:mx-5'>
<h5 style={{ marginTop: '2rem' }} className={'right-align font-weight-bold'}>اطلاعیه ها </h5> <h5 style={{ marginTop: '2rem' }} className={'right-align font-weight-bold'}>
اطلاعیه ها{' '}
</h5>
<hr /> <hr />
<div> <div>
<MDBTypography style={{direction: 'rtl',borderRadius: '6px solid',borderRight: '6px solid #1266f1',borderLeft: 'none'}} note noteColor='primary'> <MDBTypography
style={{ direction: 'rtl', borderRadius: '6px solid', borderRight: '6px solid #1266f1', borderLeft: 'none' }}
note
noteColor='primary'
>
<DownloadIcon className={'ml-2'} /> <DownloadIcon className={'ml-2'} />
<a title={'دانلود دفترچه معرفی و فروش سهام عمومی بیمارستان تخصصی مهر ایرانیان پرند'} download href={'./take-stock.pdf'}> دانلود دفترچه معرفی و فروش سهام عمومی بیمارستان تخصصی مهر پرند</a> <a
title={'دانلود دفترچه معرفی و فروش سهام عمومی بیمارستان تخصصی مهر ایرانیان پرند'}
download
href={'./take-stock.pdf'}
>
{' '}
دانلود دفترچه معرفی و فروش سهام عمومی بیمارستان تخصصی مهر پرند
</a>
</MDBTypography> </MDBTypography>
<MDBTypography style={{direction: 'rtl',borderRadius: '6px solid',borderRight: '6px solid #1266f1',borderLeft: 'none'}} note noteColor='primary'> <MDBTypography
style={{ direction: 'rtl', borderRadius: '6px solid', borderRight: '6px solid #1266f1', borderLeft: 'none' }}
note
noteColor='primary'
>
<DownloadIcon className={'ml-2'} /> <DownloadIcon className={'ml-2'} />
<a title={'دانلود طرح توجیهی بیمارستان تخصصی مهر ایرانیان پرند'} download href={'./Explanatory_plan_of_Mehr_ranian_Parand_Hospital.pdf'}> دانلود طرح توجیهی بیمارستان تخصصی مهر ایرانیان پرند</a> <a
title={'دانلود طرح توجیهی بیمارستان تخصصی مهر ایرانیان پرند'}
download
href={'./Explanatory_plan_of_Mehr_ranian_Parand_Hospital.pdf'}
>
{' '}
دانلود طرح توجیهی بیمارستان تخصصی مهر ایرانیان پرند
</a>
</MDBTypography> </MDBTypography>
</div> </div>
<br /> <br />
<MDBRow dir={'rtl'} className='row-cols-1 row-cols-md-3 g-4'> {/* <MDBRow dir={'rtl'} className='row-cols-1 row-cols-md-3 g-4'>
{data && data.map(({ id, slug, title }) => ( {data && data.map(({ id, slug, title }) => (
<MDBCol key={id}> <MDBCol key={id}>
<Link href={`page/news/${id}`} > <Link href={`page/news/${id}`} >
@@ -55,27 +84,22 @@ const News = ({data, children}) => {
</Link> </Link>
</MDBCol> </MDBCol>
))} ))}
</MDBRow> </MDBRow> */}
{children} {children}
</div> </div>
) )
return ( return <div>{/* {query ? <AppContainer children={dataPage} title={'اطلاعیه ها '} /> : dataPage} */}</div>
<div> }
{/* {query ? <AppContainer children={dataPage} title={'اطلاعیه ها '} /> : dataPage} */}
</div>
);
};
export default News; export default News
export const getServerSideProps = async context => {
export const getServerSideProps = async (context) => { // const allPostsData = await axios.get(AppUrl('news'))
const allPostsData = await axios.get(AppUrl('news')); // const data = await allPostsData.data
const data = await allPostsData.data;
return { return {
props: { props: {
data, data: null,
fallback:false fallback: false
}, // will be passed to the page component as props } // will be passed to the page component as props
} }
} }
+4 -10
View File
@@ -2,13 +2,7 @@ import AppContainer from './appContainer'
import Slider from './components/slider' import Slider from './components/slider'
import News from './News' import News from './News'
import axios from 'axios' import axios from 'axios'
import { import { MDBBtn, MDBCard, MDBCardBody, MDBContainer, MDBIcon } from 'mdb-react-ui-kit'
MDBBtn,
MDBCard,
MDBCardBody,
MDBContainer,
MDBIcon,
} from 'mdb-react-ui-kit'
import Link from 'next/link' import Link from 'next/link'
import Paralax from './components/Paralax' import Paralax from './components/Paralax'
import Service from './components/service' import Service from './components/service'
@@ -114,10 +108,10 @@ export default function Home({ data_NEWS }) {
} }
export const getServerSideProps = async context => { export const getServerSideProps = async context => {
const allPostsData = await axios.get(AppUrl('news')) // const allPostsData = await axios.get(AppUrl('news'))
const data_NEWS = await allPostsData.data.slice(0, 6) // const data_NEWS = await allPostsData.data.slice(0, 6)
return { return {
props: { data_NEWS, fallback: false } // will be passed to the page component as props props: { data_NEWS: null, fallback: false } // will be passed to the page component as props
} }
} }