Skip to content

Commit

Permalink
Merge pull request #115 from Lilypad-Tech/developerteve/lottie
Browse files Browse the repository at this point in the history
Developerteve/lottie
  • Loading branch information
developersteve authored Nov 11, 2024
2 parents affdff5 + a3f3e11 commit a9d76c7
Show file tree
Hide file tree
Showing 7 changed files with 158 additions and 88 deletions.
6 changes: 3 additions & 3 deletions apps/website/public/sitemap-0.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
<url><loc>https://lilypad.tech/about-us</loc><lastmod>2024-11-07T00:24:52.741Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://lilypad.tech</loc><lastmod>2024-11-07T00:24:52.743Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://lilypad.tech/team</loc><lastmod>2024-11-07T00:24:52.743Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://lilypad.tech/about-us</loc><lastmod>2024-11-11T04:33:04.331Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://lilypad.tech</loc><lastmod>2024-11-11T04:33:04.331Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://lilypad.tech/team</loc><lastmod>2024-11-11T04:33:04.331Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
</urlset>
4 changes: 3 additions & 1 deletion apps/website/src/app/hooks/strapi/UseStrapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ function useStrapi({ pathname }: StrapiProps): StrapiResponse {
const trustedByResp = results[1];

if (homepageInfoResp.status === "fulfilled" && trustedByResp.status === "fulfilled") {
const homepageData = homepageInfoResp.value as HomePageCmsInfo;
setStrapi((prevState) => ({
...prevState,
...(homepageInfoResp.value as HomePageCmsInfo),
...homepageData,
trusted_bies: trustedByResp.value || [],
header_lottie: homepageData.header_lottie || null,
}));
}
})
Expand Down
20 changes: 14 additions & 6 deletions apps/website/src/app/hooks/strapi/requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,22 @@ const cms_home_url = cms_base_url?.replace("/api", "");

export function getHomepageInfo() {
return new Promise((resolve, reject) => {
fetch(`${cms_base_url}/website-homepage`, {
headers: {
authorization: `bearer ${process.env.NEXT_PUBLIC_STRAPI_API}`,
},
})
fetch(
`${cms_base_url}/website-homepage?populate[header_image][fields][0]=url&populate[header_lottie][fields][0]=url`,
{
headers: {
authorization: `Bearer ${process.env.NEXT_PUBLIC_STRAPI_API}`,
},
}
)
.then((data) => {
data.json().then(({ data: info }) => {
resolve(info); // Return the whole info object
const homepageInfo = {
...info,
header_image_url: info.header_image ? info.header_image.url : null,
header_lottie: info.header_lottie ? { url: info.header_lottie.url } : null,
};
resolve(homepageInfo); // Return the updated homepage info with header image and Lottie file URLs
});
})
.catch((err) => {
Expand Down
24 changes: 14 additions & 10 deletions apps/website/src/app/hooks/strapi/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,22 @@ export interface StrapiContext {
}

export interface HomePageCmsInfo {
badge_url: string;
badge_badge: string;
badge_icon: string;
badge_message: string;
badge_text: string;
mission_statement: string;
trusted_bies: {
src: string;
alt: string;
}[];
badge_url: string;
badge_badge: string;
badge_icon: string;
badge_message: string;
badge_text: string;
mission_statement: string;
header_image_alt: string;
header_image_url?: string | null;
header_lottie?: { url: string } | null;
trusted_bies: {
src: string;
alt: string;
}[];
}


export interface TeamPageCmsInfo {
trusted_bies: {
src: string;
Expand Down
27 changes: 20 additions & 7 deletions apps/website/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import useFade from "./hooks/UseFade";
import useFadeInView from "./hooks/UseFadeInView";
import { PageContext } from "./clientLayout";
import { HomePageCmsInfo } from "./hooks/strapi/types";
import { Player } from '@lottiefiles/react-lottie-player';

export default function Home() {
const { strapi } = useContext(PageContext) as { strapi: HomePageCmsInfo };
Expand Down Expand Up @@ -347,13 +348,25 @@ export default function Home() {
style={fade}
className="relative w-full lg:w-1/2 lg:h-full max-w-2xl mr-auto pb-uui-7xl lg:pb-uui-none"
>
<Image
className="mr-auto lg:mx-auto lg:mr-0 lg:ml-auto object-cover w-full h-full"
width={500}
height={500}
alt="Lilypad Header"
src="/lilypad-fill.png"
/>
{strapi?.header_lottie?.url ? (
<Player
autoplay
loop
src={`https://webadmin.lilypad.team${strapi.header_lottie.url}`}
style={{ width: '100%', height: '100%' }}
/>
) : (
<Image
width={500}
height={500}
alt={strapi?.header_image_alt || "Default Image"}
src={
strapi?.header_image_url
? `https://webadmin.lilypad.team${strapi.header_image_url}`
: "/lilypad-fill.png" // Default image if none exists
}
/>
)}
</animated.div>
</div>
</SectionContainer>
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,9 @@
},
"keywords": [],
"author": "",
"license": "ISC"
"license": "ISC",
"dependencies": {
"@lottiefiles/dotlottie-react": "^0.9.3",
"@lottiefiles/react-lottie-player": "^3.5.4"
}
}
Loading

0 comments on commit a9d76c7

Please sign in to comment.