浏览代码

about

blog-new
Pavle Golubovic 3 年前
父节点
当前提交
b4a8074aac
共有 4 个文件被更改,包括 32 次插入32 次删除
  1. 31
    20
      frontend/src/pages/About.jsx
  2. 1
    0
      frontend/src/pages/Careers.jsx
  3. 0
    4
      frontend/src/pages/DiligentLife.jsx
  4. 0
    8
      frontend/src/pages/Home.jsx

+ 31
- 20
frontend/src/pages/About.jsx 查看文件

@@ -25,6 +25,11 @@ import TimelineLogo from '../components/TimelineLogo';
import PageLayout from '../layout/PageLayout';
import useAnalytics from '../hooks/useAnalytics';
import ReactHelmet from '../components/shared/ReactHelmet';
import { strapiApiBuilder } from './../utils/strapiApiBuilder';
import useDataApi from './../hooks/useDataApi';




const _data = {
heading: {
@@ -189,31 +194,37 @@ const _data = {

const api_url = process.env.REACT_APP_API_URL;

const strapiPopulate = [
'AboutUs',
'AboutUsCard',
'AboutUsCard.Image',
'Values',
'Values.Items',
'Values.Items.Image',
'Partners',
'Partners.images',
'Indrustries',
'Industries.Items',
'Industries.Items.Image',
'Timeline',
'Timeline.Steps'
];

export default function About() {
const [cnt, setCnt] = useState('');
const [isLoaded, setIsLoaded] = useState('');

useEffect(async () => {
const strapi = strapiApiBuilder('aboutpage', strapiPopulate);

const [{ data, isLoading, isError }, doFetch] = useDataApi(strapi);

useAnalytics('Home page');

useEffect(() => {
document.title = 'About Us';
var vid = document.getElementById('animation');
vid.playbackRate = 2;
await axios
.get(
`${api_url}/api/aboutpage?populate[0]=SEO&populate[1]=SEO.metaSocial&populate[2]=SEO.metaImage&populate[3]=SEO.metaSocial.image`,
)
.then(res => {
setCnt(res.data.data.attributes);
setIsLoaded(true);
})
.catch(err => {
console.log(err);
setIsLoaded(false);
});
}, []);

useAnalytics('About Us');

if (!isLoaded) {

if (isLoading) {
return (
<div className="z-50 w-full h-screen bg-white dark:bg-dg-primary-1700 dark:text-white flex items-center justify-center text-3xl font-semibold">
<video id="animation" width="540" height="540" autoPlay muted loop>
@@ -226,7 +237,7 @@ export default function About() {

return (
<PageLayout>
{cnt.SEO && <ReactHelmet seo={cnt.SEO} />}
{data.SEO && <ReactHelmet seo={data.SEO} />}
<div className="bg-white dark:bg-dg-primary-1700 w-full pt-32">
{/* Heading Section */}
<section

+ 1
- 0
frontend/src/pages/Careers.jsx 查看文件

@@ -213,6 +213,7 @@ export default function Careers({ forwardedRef }) {
<p className="paragraph">
{cntCareers.diligent_life.heading_section.paragraph}
</p>

{/* Video Frame */}
{cntCareers && cntCareers.Video != undefined ? (
<VideoComponent source={cntCareers.Video.data.attributes.url} />

+ 0
- 4
frontend/src/pages/DiligentLife.jsx 查看文件

@@ -104,10 +104,6 @@ export default function Careers({ forwardedRef }) {
});
}, []);

useEffect(() => {
console.log(cntCareers)
},[cntCareers])

if (!isLoaded) {
return (
<div className="z-50 w-full h-screen bg-white dark:bg-dg-primary-1700 dark:text-white flex items-center justify-center text-3xl font-semibold">

+ 0
- 8
frontend/src/pages/Home.jsx 查看文件

@@ -69,15 +69,11 @@ const strapiPopulate = [
];

export default function Home({ forwardedRef }) {
const [cnt, setCnt] = useState('');

const [contactRef, setRef] = useState(forwardedRef);

const strapi = strapiApiBuilder('w-home-page', strapiPopulate);

const [{ data, isLoading, isError }, doFetch] = useDataApi(strapi);

const [contactElement, setContactElement] = useState(0);

useAnalytics('Home page');

@@ -85,10 +81,6 @@ export default function Home({ forwardedRef }) {
document.title = 'Diligent Software';
}, []);

useEffect(() => {
const url = window.location.pathname;
const h = window.document.body.offsetHeight;
}, [contactRef, cnt]);

if (isLoading) {
return (

正在加载...
取消
保存