|
|
|
@@ -29,45 +29,76 @@ import TechStack from '../components/TechStack'; |
|
|
|
import PortfolioSection from '../components/PortfolioSection'; |
|
|
|
import PageLayout from '../layout/PageLayout'; |
|
|
|
import MapDilig from '../components/Map'; |
|
|
|
|
|
|
|
const api_url = process.env.REACT_APP_API_URL; |
|
|
|
|
|
|
|
export default function Home({scrollToView, forwardedRef}) { |
|
|
|
import useDataApi from '../hooks/useDataApi'; |
|
|
|
|
|
|
|
//const api_url = process.env.REACT_APP_API_URL; |
|
|
|
const api_url = 'http://localhost:1337'; |
|
|
|
|
|
|
|
//const query = ''; |
|
|
|
|
|
|
|
const strapiPopulate = [ |
|
|
|
'Cards', |
|
|
|
'Cards.Card1', |
|
|
|
'Cards.Card1.Icon', |
|
|
|
'Cards.Card2', |
|
|
|
'Cards.Card2.Icon', |
|
|
|
'Cards.Card3', |
|
|
|
'Cards.Card3.Icon', |
|
|
|
'HeroNumbers', |
|
|
|
'HeroNumbers.number', |
|
|
|
] |
|
|
|
|
|
|
|
const stringBuilder = () => { |
|
|
|
let stringQuery = ''; |
|
|
|
strapiPopulate.map((item,index) => { |
|
|
|
if (index !== 0) stringQuery += '&'; |
|
|
|
stringQuery += `populate=${item}`; |
|
|
|
}); |
|
|
|
return stringQuery; |
|
|
|
}; |
|
|
|
|
|
|
|
export default function Home({forwardedRef}) { |
|
|
|
const [cnt, setCnt] = useState(''); |
|
|
|
const [isLoaded, setIsLoaded] = useState(''); |
|
|
|
|
|
|
|
const [contactRef, setRef] = useState(forwardedRef) |
|
|
|
const [contactElement, setContactElement] = useState(0); |
|
|
|
|
|
|
|
// const UIContext = useContext(UIContext); |
|
|
|
|
|
|
|
// const initUIValues = UIContext ?? { |
|
|
|
// tab: '', |
|
|
|
// contactRef: contactRef |
|
|
|
// }; |
|
|
|
|
|
|
|
const [{data, isLoading, isError}, doFetch] = useDataApi(`${api_url}/api/w-home-page?${stringBuilder()}`); |
|
|
|
|
|
|
|
const landingData = { |
|
|
|
data |
|
|
|
} |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
document.title = 'Diligent Software'; |
|
|
|
},[]); |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
var vid = document.getElementById('animation'); |
|
|
|
vid.playbackRate = 2; |
|
|
|
axios |
|
|
|
.get( |
|
|
|
`${api_url}/api/homepage?populate[0]=landing&populate[1]=why&populate[2]=why.heading&populate[3]=why.card_left.icon&populate[4]=why.card_mid.icon&populate[5]=why.card_right.icon&populate[6]=why.card_left.icon&populate[7]=why.card_mid.icon&populate[8]=why.card_right.icon&populate[9]=landing.heading`, |
|
|
|
// api/homepage?&populate[0]=why&populate[1]=why.heading&populate[2]=why.card_left.icon&populate[3]=why.card_mid.icon&populate[4]=why.card_right.icon&populate[5]=why.card_left.icon&populate[6]=why.card_mid.icon&populate[7]=why.card_right.icon |
|
|
|
) |
|
|
|
.then(res => { |
|
|
|
setCnt(res.data.data.attributes); |
|
|
|
//console.log(res) |
|
|
|
setIsLoaded(true); |
|
|
|
}) |
|
|
|
.catch(err => { |
|
|
|
console.log(err); |
|
|
|
setIsLoaded(false); |
|
|
|
}); |
|
|
|
}, []); |
|
|
|
console.log(data); |
|
|
|
//stringBuilder(); |
|
|
|
},[data]); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// useEffect(() => { |
|
|
|
// var vid = document.getElementById('animation'); |
|
|
|
// vid.playbackRate = 2; |
|
|
|
// axios |
|
|
|
// .get( |
|
|
|
// `${api_url}/api/homepage?populate[0]=landing&populate[1]=why&populate[2]=why.heading&populate[3]=why.card_left.icon&populate[4]=why.card_mid.icon&populate[5]=why.card_right.icon&populate[6]=why.card_left.icon&populate[7]=why.card_mid.icon&populate[8]=why.card_right.icon&populate[9]=landing.heading`, |
|
|
|
// // api/homepage?&populate[0]=why&populate[1]=why.heading&populate[2]=why.card_left.icon&populate[3]=why.card_mid.icon&populate[4]=why.card_right.icon&populate[5]=why.card_left.icon&populate[6]=why.card_mid.icon&populate[7]=why.card_right.icon |
|
|
|
// ) |
|
|
|
// .then(res => { |
|
|
|
// setCnt(res.data.data.attributes); |
|
|
|
// //console.log(res) |
|
|
|
// setIsLoaded(true); |
|
|
|
// }) |
|
|
|
// .catch(err => { |
|
|
|
// console.log(err); |
|
|
|
// setIsLoaded(false); |
|
|
|
// }); |
|
|
|
// }, []); |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
|
|
|
@@ -77,7 +108,7 @@ export default function Home({scrollToView, forwardedRef}) { |
|
|
|
|
|
|
|
}, [contactRef, cnt]) |
|
|
|
|
|
|
|
if (!isLoaded) { |
|
|
|
if (isLoading) { |
|
|
|
return ( |
|
|
|
<div className="z-50 w-full h-screen bg-white dark:bg-dg-primary-1700 overflow-hidden dark:text-white flex items-center justify-center text-3xl font-semibold"> |
|
|
|
<video id="animation" width="540" height="540" autoPlay muted loop> |
|
|
|
@@ -104,7 +135,7 @@ export default function Home({scrollToView, forwardedRef}) { |
|
|
|
</Tab.Group> */} |
|
|
|
|
|
|
|
{/* Landing Section */} |
|
|
|
<Landing data={cnt.landing.heading} /> |
|
|
|
<Landing /> |
|
|
|
|
|
|
|
{/* Why Us Section */} |
|
|
|
<WhySection data={cnt.why} /> |