Compare commits
No commits in common. "dc90be862221a15610197956afe09d06a2efec34" and "89c40f6a98d1f3d1fa46da8f1ac1f6767f12a7df" have entirely different histories.
dc90be8622
...
89c40f6a98
@ -1,45 +1,36 @@
|
|||||||
import { BeforeFooterBlock } from "@/components/Blocks/BeforeFooter";
|
import { BeforeFooterBlock } from "@/components/Blocks/BeforeFooter";
|
||||||
import HeroOther from "@/components/HeroOther";
|
import HeroOther from "@/components/HeroOther";
|
||||||
import { fetchTeamDetail } from "@/services/payload/team";
|
import { fetchTeamDetail } from "@/services/payload/team";
|
||||||
import { getDefaultMetadata } from "@/utils/metadata";
|
|
||||||
import { RichText } from "@payloadcms/richtext-lexical/react";
|
import { RichText } from "@payloadcms/richtext-lexical/react";
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import { Metadata } from "next/types";
|
import { Metadata } from "next/types";
|
||||||
import { Suspense } from "react";
|
import { Suspense } from "react";
|
||||||
|
|
||||||
export async function generateMetadata({ params }: { params: Promise<{ slug: string }> }): Promise<Metadata> {
|
export async function generateMetadata({ params }: { params: Promise<{ slug: string }> }): Promise<Metadata> {
|
||||||
const defaultMetadata = await getDefaultMetadata();
|
const name = "Cochise Oncology";
|
||||||
const name = defaultMetadata.openGraph?.siteName ?? "";
|
|
||||||
let title = "Page";
|
let title = "Page";
|
||||||
|
let description = "Page";
|
||||||
let imgUrl = "";
|
let imgUrl = "";
|
||||||
|
|
||||||
const slug = (await params).slug;
|
const slug = (await params).slug;
|
||||||
const team = await fetchTeamDetail(decodeURIComponent(slug));
|
const blog = await fetchTeamDetail(decodeURIComponent(slug));
|
||||||
|
|
||||||
// check for blog data
|
// check for blog data
|
||||||
if (!!team) {
|
if (!!blog) {
|
||||||
title = `${team.data.name} - ${name}`;
|
title = `${name} Staff - ${blog.data.name}`;
|
||||||
imgUrl = team.imgUrl;
|
description = `${name} Staff - ${blog.data.name}`;
|
||||||
|
imgUrl = blog.imgUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultMetadata.title = title;
|
return {
|
||||||
if (!!defaultMetadata.openGraph) {
|
|
||||||
// @ts-ignore
|
|
||||||
defaultMetadata.openGraph.type = "article";
|
|
||||||
defaultMetadata.openGraph.title = title;
|
|
||||||
defaultMetadata.openGraph.images = !!imgUrl ? [imgUrl] : undefined;
|
|
||||||
}
|
|
||||||
defaultMetadata.twitter = {
|
|
||||||
card: "summary_large_image",
|
|
||||||
title: title,
|
title: title,
|
||||||
images: !!imgUrl ? [imgUrl] : undefined,
|
description: description,
|
||||||
|
openGraph: {
|
||||||
|
title: title,
|
||||||
|
description: description,
|
||||||
|
images: !!imgUrl ? { url: imgUrl } : undefined,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
defaultMetadata.other = {
|
|
||||||
"twitter:label1": "Est. reading time",
|
|
||||||
"twitter:data1": "1 minute",
|
|
||||||
};
|
|
||||||
|
|
||||||
return defaultMetadata;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function BiographySinglePage({ params }: { params: Promise<{ slug: string }> }) {
|
export default async function BiographySinglePage({ params }: { params: Promise<{ slug: string }> }) {
|
@ -97,6 +97,5 @@ export const Blogs: CollectionConfig = {
|
|||||||
admin: {
|
admin: {
|
||||||
hideAPIURL: true,
|
hideAPIURL: true,
|
||||||
group: "Blogs",
|
group: "Blogs",
|
||||||
useAsTitle: "title",
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -104,6 +104,5 @@ export const Pages: CollectionConfig = {
|
|||||||
admin: {
|
admin: {
|
||||||
hideAPIURL: true,
|
hideAPIURL: true,
|
||||||
group: "General",
|
group: "General",
|
||||||
useAsTitle: "title",
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import type { CollectionConfig } from "payload";
|
import type { CollectionConfig } from "payload";
|
||||||
import { lexicalEditor } from "@payloadcms/richtext-lexical";
|
import { lexicalEditor } from "@payloadcms/richtext-lexical";
|
||||||
import formatSlug from "@/utils/payload/formatSlug";
|
|
||||||
|
|
||||||
export const Teams: CollectionConfig = {
|
export const Teams: CollectionConfig = {
|
||||||
slug: "teams",
|
slug: "teams",
|
||||||
@ -10,13 +9,6 @@ export const Teams: CollectionConfig = {
|
|||||||
type: "text",
|
type: "text",
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "slug",
|
|
||||||
type: "text",
|
|
||||||
hooks: {
|
|
||||||
beforeValidate: [formatSlug("name")],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: "role",
|
name: "role",
|
||||||
type: "text",
|
type: "text",
|
||||||
|
@ -2,7 +2,6 @@ import Team from "@/components/Team";
|
|||||||
|
|
||||||
type Team = {
|
type Team = {
|
||||||
id: number;
|
id: number;
|
||||||
slug: string;
|
|
||||||
name: string;
|
name: string;
|
||||||
role: string;
|
role: string;
|
||||||
img: { url: string; alt: string };
|
img: { url: string; alt: string };
|
||||||
|
@ -2,32 +2,25 @@
|
|||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { CardTeam } from "./Teams/CardTeam";
|
import { CardTeam } from "./Teams/CardTeam";
|
||||||
|
|
||||||
type Team = {
|
export default function Team({ data }: any) {
|
||||||
id: number;
|
|
||||||
slug: string;
|
|
||||||
name: string;
|
|
||||||
role: string;
|
|
||||||
img: { url: string; alt: string };
|
|
||||||
biography: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default function Team({ data }: { data: Team[] }) {
|
|
||||||
return (
|
return (
|
||||||
<div className="container">
|
<div className="container">
|
||||||
<div className="flex justify-center">
|
<div className="row">
|
||||||
<h2 className="text-4xl mb-30 mb-sm-20">
|
<div className="col-md-12 offset-md-2 col-lg-6 offset-lg-3 text-center">
|
||||||
<span className="text-gray">Our</span> Team
|
<h2 className="section-title mb-30 mb-sm-20">
|
||||||
<span className="text-gray">.</span>
|
<span className="text-gray">Our</span> Team
|
||||||
</h2>
|
<span className="text-gray">.</span>
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="grid grid-cols-1 md:grid-cols-3 xl:grid-cols-4 gap-x-5 gap-y-2">
|
<div className="grid grid-cols-4 gap-5">
|
||||||
{/* Team item */}
|
{/* Team item */}
|
||||||
{data.map((member: any, index: any) => (
|
{data.map((member: any, index: any) => (
|
||||||
<div key={index} className="flex flex-col text-center justify-between">
|
<div key={index} className="text-center">
|
||||||
<CardTeam data={member} />
|
<CardTeam data={member} />
|
||||||
<Link href={`/staff_member/${member.slug}`} passHref>
|
<Link href={`/biography/${member.name}`} passHref>
|
||||||
<button className="bg-extColorPrimary6 text-white px-5 py-1 m-3 rounded-3xl hover:bg-extColorPrimary4 transition-colors duration-500">
|
<button className="bg-[#64B3B4] text-white px-5 py-1 m-3 rounded-3xl hover:opacity-[0.7]">
|
||||||
BIOGRAPHY
|
Biography
|
||||||
</button>
|
</button>
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
@ -21,6 +21,20 @@ export function CardTeam({ data }: CardTeamProps) {
|
|||||||
data-wow-duration="1.2s"
|
data-wow-duration="1.2s"
|
||||||
alt={`Image of ${data.name}`}
|
alt={`Image of ${data.name}`}
|
||||||
/>
|
/>
|
||||||
|
<div className="team-item-detail">
|
||||||
|
<div className="team-social-links">
|
||||||
|
{[
|
||||||
|
{ platform: "Facebook", icon: "fa-facebook-f", url: "#" },
|
||||||
|
{ platform: "Twitter", icon: "fa-twitter", url: "#" },
|
||||||
|
{ platform: "Pinterest", icon: "fa-pinterest-p", url: "#" },
|
||||||
|
].map((social, idx) => (
|
||||||
|
<a key={idx} href={social.url} target="_blank" rel="noopener nofollow">
|
||||||
|
<div className="visually-hidden">{social.platform}</div>
|
||||||
|
<i className={social.icon} />
|
||||||
|
</a>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="team-item-descr">
|
<div className="team-item-descr">
|
||||||
<div className="team-item-name">{data.name}</div>
|
<div className="team-item-name">{data.name}</div>
|
||||||
|
@ -319,7 +319,6 @@ export interface Page {
|
|||||||
export interface Team {
|
export interface Team {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
slug?: string | null;
|
|
||||||
role: string;
|
role: string;
|
||||||
img: number | Media;
|
img: number | Media;
|
||||||
biography?: {
|
biography?: {
|
||||||
@ -763,7 +762,6 @@ export interface PagesSelect<T extends boolean = true> {
|
|||||||
*/
|
*/
|
||||||
export interface TeamsSelect<T extends boolean = true> {
|
export interface TeamsSelect<T extends boolean = true> {
|
||||||
name?: T;
|
name?: T;
|
||||||
slug?: T;
|
|
||||||
role?: T;
|
role?: T;
|
||||||
img?: T;
|
img?: T;
|
||||||
biography?: T;
|
biography?: T;
|
||||||
|
@ -114,14 +114,11 @@ export default buildConfig({
|
|||||||
fields: undefined,
|
fields: undefined,
|
||||||
admin: {
|
admin: {
|
||||||
group: "General",
|
group: "General",
|
||||||
useAsTitle: "title",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
formSubmissionOverrides: {
|
formSubmissionOverrides: {
|
||||||
fields: undefined,
|
|
||||||
admin: {
|
admin: {
|
||||||
group: "General",
|
group: "General",
|
||||||
useAsTitle: "form",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
@ -2,16 +2,17 @@ import payloadConfig from "@/payload.config";
|
|||||||
import { formatDate } from "@/utils/datetime";
|
import { formatDate } from "@/utils/datetime";
|
||||||
import { getPayload } from "payload";
|
import { getPayload } from "payload";
|
||||||
|
|
||||||
export async function fetchTeamDetail(slug: string) {
|
export async function fetchTeamDetail(name: string | undefined) {
|
||||||
const payload = await getPayload({ config: payloadConfig });
|
const payload = await getPayload({ config: payloadConfig });
|
||||||
const blogDataQuery = await payload.find({
|
const blogDataQuery = await payload.find({
|
||||||
collection: "teams",
|
collection: "teams",
|
||||||
where: {
|
where: {
|
||||||
slug: { equals: slug },
|
name: { like: `%${name}%` },
|
||||||
},
|
},
|
||||||
limit: 1,
|
limit: 1,
|
||||||
pagination: false,
|
pagination: false,
|
||||||
});
|
});
|
||||||
|
console.log("data", name);
|
||||||
|
|
||||||
if (!blogDataQuery?.docs?.[0]) return null;
|
if (!blogDataQuery?.docs?.[0]) return null;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user