Skip to content

Commit

Permalink
Merge pull request #49 from BhavyaNayak04/main
Browse files Browse the repository at this point in the history
Schema and design for trustee section
  • Loading branch information
Karthik-S-Salian authored Jun 24, 2024
2 parents 4b544b9 + 8066564 commit dc6368b
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 13 deletions.
Binary file modified bun.lockb
Binary file not shown.
3 changes: 2 additions & 1 deletion sanity/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import profile from './schemaTypes/profile'
import organisation from './schemaTypes/organisation'
import career from './schemaTypes/career'
import role from './schemaTypes/role'
import trustee from './schemaTypes/trustee'

export const schema: { types: SchemaTypeDefinition[] } = {
types: [localeString,contact,localeText,localeBlockArray,role,location,gallery,event,ayurvedicCenter,career,features,vriddhashrama, doctor,Home,fqa,facility,testimonial,section,aboutus,row,pricing,organisation,profile],
types: [localeString,contact,localeText,localeBlockArray,role,location,gallery,event,ayurvedicCenter,career,features,vriddhashrama, doctor,Home,fqa,facility,testimonial,section,aboutus,row,pricing,organisation,profile,trustee],
}
13 changes: 13 additions & 0 deletions sanity/schemaTypes/organisation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ export default defineType({
type: 'document',
icon:UsersIcon,
fields: [
defineField({
name: 'trustees',
title: 'Trustees',
type: 'array',
validation: (Rule) => Rule.required(),
of: [
defineField({
name: "trustee",
title: "Trustee",
type: "trustee"
})
]
}),
defineField({
name: 'members',
title: 'Members',
Expand Down
43 changes: 43 additions & 0 deletions sanity/schemaTypes/trustee.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { defineField, defineType } from 'sanity'
import { baseLanguage } from './locale'

export default defineType({
name: 'trustee',
title: 'Trustee',
type: 'object',
fields: [
defineField({
name: 'name',
title: 'Name',
type: 'localeString',
validation: (Rule) => Rule.required(),
}),
defineField({
name: 'image',
title: 'Image',
type: 'image',
validation: (Rule) => Rule.required(),
options: {
hotspot: true,
}
}),
defineField({
name: 'position',
title: 'Position',
type: 'localeString',
validation: (Rule) => Rule.required(),
}),
defineField({
name: 'description',
title: 'Description',
type: 'localeText',
validation: (Rule) => Rule.required(),
}),
],
preview: {
select: {
title: `name.${baseLanguage!.id}`,
media: 'image',
},
},
})
34 changes: 23 additions & 11 deletions src/app/(main)/[locale]/about-us/organisation/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import Heading from "~/components/Heading/Heading";
import ScrollDown from "~/components/Hero/ScrollDown";
import Profile from "~/components/Profile/Profile";
import { fetchOrganisationPage } from "~/lib/queries";
import Reveal from "~/components/Animations/reveal";

export default async function organisor() {
const t = await getTranslations("organisation");
const locale = await getLocale();
const data = await fetchOrganisationPage(locale);
console.log(data);

return (
<div>
Expand Down Expand Up @@ -38,26 +40,36 @@ export default async function organisor() {
className="content-container flex flex-col md:gap-4 gap-2"
id="faculty"
>


<Heading seperatorColor="secondary">{t("Trustee")}</Heading>
<div className="flex flex-col md:flex-row gap-4 w-full items-center md:items-start">
{data.members.slice(0, 1).map((member, index) => (
<div className="flex flex-col w-full items-center md:items-start gap-10">
{data.trustees.map((trustee, index) => (
<div className="w-full flex flex-col md:flex-row items-center md:items-start justify-center gap-2 md:gap-6">
<Profile
key={index}
index={index}
name={member.name}
image={member.image}
position={member.position}
name={trustee.name}
image={trustee.image}
position={trustee.position}
layout="horizontal" // Use horizontal layout for trustee
className="bg-secondary-300 w-full md:w-1/2"
className="w-full md:px-20 bg-secondary-300"
/>
<Reveal delay={0.2 * index}>
<div className="body w-full">
{trustee.description}
</div>
</Reveal>
</div>

))}
<div className="md:w-1/2">
<p className="text-gray-700">{t("trusteeDescription")}</p>
</div>
</div>



<Heading seperatorColor="secondary">{t("faculty")}</Heading>
<div className="flex flex-wrap justify-center gap-4 w-full">
{data.members.slice(1).map((member, index) => (
{data.members.map((member, index) => (
<Profile
key={index}
index={index}
Expand All @@ -72,4 +84,4 @@ export default async function organisor() {
</section>
</div>
);
}
}
1 change: 0 additions & 1 deletion src/components/Career/Career.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export default function Career({ data }: { data: CareerType }) {
{data.title}
<div className="h-1 w-full bg-secondary-500 rounded-full mt-2"></div>
</h2>

<RichText value={data.description} />

<span onClick={() => dialogRef.current?.open()} className="text-blue-600 underline cursor-pointer">{t("question")}</span>
Expand Down
16 changes: 16 additions & 0 deletions src/lib/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,12 @@ export async function fetchPricingPage(locale: string) {


type Organisation = {
trustees: {
name: string,
position: string,
image: Image,
description: string
}[],
members: {
name: string,
position: string,
Expand All @@ -303,6 +309,12 @@ type Organisation = {

export async function fetchOrganisationPage(locale: string) {
const query = `*[_type == "organisation"][0]{
"trustees":trustees[]{
"name":${coalesce("name", locale)},
"position":${coalesce("position", locale)},
image,
"description":${coalesce("description",locale)}
},
"members":members[]{
"name":${coalesce("name", locale)},
"position":${coalesce("position", locale)},
Expand All @@ -314,6 +326,10 @@ export async function fetchOrganisationPage(locale: string) {

return {
...page,
trustees: page.trustees.map(trustee => ({
...trustee,
image: urlForImage(trustee.image)
})),
members: page.members.map(member => ({
...member,
image: urlForImage(member.image)
Expand Down

0 comments on commit dc6368b

Please sign in to comment.