Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Aniruddha-Upadhya-K committed Jun 4, 2024
2 parents bace217 + dafc310 commit aa7b5ca
Show file tree
Hide file tree
Showing 17 changed files with 164 additions and 55 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: (main) push to external repo
on:
push:
branches:
- main
jobs:
push-to-external-repo:
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v3
- name: push to external repository
uses: peaceiris/actions-gh-pages@v3
with:
deploy_key: ${{ secrets.SSH_DEPLOY_KEY }}
publish_dir: .
external_repository: finiteloopclub/krishnaveni-ashryadhama
publish_branch: main
allow_empty_commit: true
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"@portabletext/react": "^3.1.0",
"@radix-ui/react-accordion": "^1.1.2",
"@radix-ui/react-slot": "^1.0.2",
"@sanity/document-internationalization": "^3.0.0",
Expand Down
4 changes: 2 additions & 2 deletions sanity/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { type SchemaTypeDefinition } from 'sanity'
import doctor from './schemaTypes/doctor'
import event from './schemaTypes/event'
import gallery from './schemaTypes/gallery'
import { localeString,localeText } from './schemaTypes/locale'
import { localeBlockArray, localeString,localeText } from './schemaTypes/locale'
import Home from './schemaTypes/home'
import ayurvedicCenter from './schemaTypes/ayurvedicCenter'
import vriddhashrama from './schemaTypes/vriddhashrama'
Expand All @@ -13,5 +13,5 @@ import facility from './schemaTypes/facility'
import testimonial from './schemaTypes/testimonial'

export const schema: { types: SchemaTypeDefinition[] } = {
types: [localeString,localeText,gallery,event,ayurvedicCenter,features,vriddhashrama, doctor,Home,fqa,facility,testimonial],
types: [localeString,localeText,localeBlockArray,gallery,event,ayurvedicCenter,features,vriddhashrama, doctor,Home,fqa,facility,testimonial],
}
25 changes: 25 additions & 0 deletions sanity/schemaTypes/locale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,29 @@ export const localeText = defineType({
type: 'text',
fieldset: lang.isDefault ? undefined : 'translations'
}))
})


export const localeBlockArray = defineType({
title: 'Localized Block array',
name: 'localeBlockArray',
type: 'object',
// Fieldsets can be used to group object fields.
// Here we omit a fieldset for the "default language",
// making it stand out as the main field.
fieldsets: [
{
title: 'Translations',
name: 'translations',
options: { collapsible: true }
}
],
// Dynamically define one field per language
fields: supportedLanguages.map(lang => ({
title: lang.title,
name: lang.id,
type: 'array',
of: [{ type: 'block' }],
fieldset: lang.isDefault ? undefined : 'translations'
}))
})
2 changes: 1 addition & 1 deletion sanity/schemaTypes/testimonial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { defineField, defineType } from 'sanity'
export default defineType({
name: 'testimonial',
title: 'Testimonial',
type: 'document',
type: 'object',
fields: [
defineField({
name: 'name',
Expand Down
11 changes: 11 additions & 0 deletions sanity/schemaTypes/vriddhashrama.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ export default {
title: 'Vriddhashrama',
type: 'document',
fields: [
defineField({
name: 'title',
title: 'Title',
type: 'localeString',
validation: (Rule) => Rule.required(),
}),
defineField({
name: 'description',
title: 'description',
Expand All @@ -29,6 +35,11 @@ export default {
type: "feature"
})
]
}),
defineField({
title: 'Rules and Regulation',
name: 'rules',
type: 'localeBlockArray',
})
],
preview: {
Expand Down
23 changes: 12 additions & 11 deletions src/app/(main)/[locale]/vriddhashrama/page.tsx
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
import { getLocale, getTranslations } from "next-intl/server";
import ImageContent from "~/components/Features/Features";
import NearbyPlaces from "~/components/NearbyPlaces/NearbyPlaces";
import RulesandRegulation from "~/components/RulesandRegulation/RulesandRegulation";
import VideoSection from "~/components/VideoSection/VideoSection";
import { VridddhashramaImageContentsImageContents, VridddhashramaPageVideo } from "~/constants";
import { fetchVriddhashramaPage } from "~/lib/queries";


export default function Vridddhashrama() {

export default async function Vridddhashrama() {
const locale = await getLocale();
const t = await getTranslations("vridddhashrama")
const pageData = await fetchVriddhashramaPage(locale);
return (
<main className="bg-white page-container ">
<section className="content-container">

<h2 className="text-3xl md:text-5xl font-bold mt-12 p-6 text-action-950 ">
Vriddhashrama
{pageData.title}
</h2>
<p className="mt-1 text-gray-800 p-6">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Repellat
dolores iure fugit totam iste obcaecati. Consequatur ipsa quod ipsum
sequi culpa delectus, cumque id tenetur quibusdam, quos fuga minima.
{pageData.description}
</p>
</section>

<ImageContent data={VridddhashramaImageContentsImageContents}/>
<VideoSection videoSrc={VridddhashramaPageVideo} />
<ImageContent data={pageData.features}/>
<VideoSection videoSrc={pageData.videoLink} />
<div>
<h2 className="text-2xl md:text-3xl uppercase font-bold text-center mt-10 text-action-950">
Vriddhashram Rules And Regulations
{t("rulesAndRegulation.heading")}
</h2>

<RulesandRegulation />
<RulesandRegulation rules={pageData.rules}/>
</div>
<NearbyPlaces />
</main>
Expand Down
16 changes: 7 additions & 9 deletions src/app/error.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
'use client'

import { useEffect } from 'react'


export default function Error({
error,
reset,
}: {
error: Error & { digest?: string }
reset: () => void
}) {
useEffect(() => {
console.error(error)
}, [error])

return (
<div>
<h2>Something went wrong!</h2>
<div className='flex w-full min-h-screen justify-center items-center flex-col gap-4 text-center'>
<h2 className="text-red-600">Something went wrong!</h2>

<h2 className="text-red-600">{error.message}</h2>
<p>Possibly caused due to bad internet connection</p>
<button
className="bg-green-500 rounded px-4 py-2 transition-transform scale-100 hover:scale-105 shadow-md cursor-pointer"
onClick={
() => reset()
}
Expand Down
3 changes: 1 addition & 2 deletions src/app/not-found.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ export default function NotFound() {
<div className="mx-auto max-w-xl text-center">
<h1 className="text-7xl font-extrabold sm:text-9xl">OOPS!</h1>
<strong className="font-extrabold text-red-700 sm:block heading">
{" "}
404 | page could not be found{" "}
404 | page could not be found
</strong>

<p className="mt-4 sm:text-xl/relaxed text-sm">
Expand Down
10 changes: 5 additions & 5 deletions src/components/Fqas/Fqas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React, { useEffect, useState } from "react";
import { questionAndAnswers } from "~/constants";
import { Button } from "../ui/button";
import { FqaType } from "~/lib/types";
import { useTranslations } from "next-intl";

const QuestionAnswer = ({
question,
Expand Down Expand Up @@ -53,6 +54,7 @@ const QuestionAnswer = ({
};

const Fqas = ({ fqas }: { fqas: FqaType[] }) => {
const t=useTranslations("home.fqas");
const [visibleIndexes, setVisibleIndexes] = useState<number[]>([]);

useEffect(() => {
Expand All @@ -73,15 +75,13 @@ const Fqas = ({ fqas }: { fqas: FqaType[] }) => {
<div className="relative grid grid-cols-1 gap-4 lg:grid-cols-3 lg:items-center lg:gap-16 justify-between content-container">
<div className="text-center sm:mx-auto lg:col-span-1">
<h2 className="heading text-gray-900 sm:mt-5">
Frequently Asked Questions
{t("heading")}
</h2>
<p className="mt-4 text-gray-700">
Explore common questions and find answers below. If you don&#39;t
see what you&#39;re looking for, feel free to contact us for
assistance.
{t("description")}
</p>
<Button className="sm:mt-2 bg-secondary-300 transition-colors duration-150 p-4 mt-2 rounded-md font-bold hover:bg-secondary-400 text-action-950">
Contact us
{t("contactUs")}
</Button>
</div>
<div className="-mx-6 p-6 lg:col-span-2 lg:mx-0 sm:w-full md:w-3/4 lg:w-full">
Expand Down
28 changes: 6 additions & 22 deletions src/components/RulesandRegulation/RulesandRegulation.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,13 @@
import React from "react";
import { krishnaveniVriddhashramRules } from "~/constants";
import { PortableText } from '@portabletext/react'
import "./style.css"

const RulesandRegulation = () => {
const RulesandRegulation = ({ rules }: { rules: [any] }) => {
return (
<main>
<article>
<section className="space-y-4 content-container mt-3 md:mt-1">
{krishnaveniVriddhashramRules.map((ruleSet, index) => (
<div key={index} className="mb-8">
<h2 className="text-[18px] md:text-[24px] font-bold text-action-900 mb-4 uppercase">
{ruleSet.heading}
</h2>
<ul className="list-disc pl-5">
{ruleSet.rules.map((rule, i) => (
<li
key={i}
className="text-gray-800 text-[14px] md:text-[19px] leading-relaxed tracking-wide text-justify mb-2"
>
{rule}
</li>
))}
</ul>
</div>
))}
<PortableText value={rules} />
</section>
</main>
</article>
);
};

Expand Down
11 changes: 11 additions & 0 deletions src/components/RulesandRegulation/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
h1,h2,h3{
@apply text-[18px] md:text-[24px] font-bold text-action-900 mb-4 uppercase
}

ul{
@apply list-disc pl-5
}

li{
@apply text-gray-800 text-[14px] md:text-[19px] leading-relaxed tracking-wide text-justify mb-2
}
4 changes: 3 additions & 1 deletion src/components/Testimonials/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ import React from "react";
import Autoplay from "embla-carousel-autoplay";
import { TestimonialType } from "~/lib/types";
import { Carousel, CarouselContent, CarouselItem } from "../ui/carousel";
import { useTranslations } from "next-intl";

function Testimonials({ testimonials }: { testimonials: TestimonialType[] }) {
const t = useTranslations("home.testimonials")
return (
<section className="relative">
<div className="content-container flex flex-col gap-8">
<div className="flex flex-col gap-4">
<h2 className="heading text-gray-900">Testimonials</h2>
<h2 className="heading text-gray-900">{t("heading")}</h2>
<p className="body text-gray-700">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Neque
quibusdam similique labore fuga impedit, consectetur facilis odit
Expand Down
41 changes: 41 additions & 0 deletions src/lib/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,44 @@ export async function fetchHomePage(locale: string) {
}))
}
}


interface VriddhashramaCenter {
title: string,
description: string,
videoLink: string,
features: {
image: Image,
title: string,
description: string

}[]
rules:[any]
}

export async function fetchVriddhashramaPage(locale: string) {

const query = `*[_type == "vriddhashrama"][0]{
"title":${coalesce("title",locale)},
"description":${coalesce("description",locale)},
videoLink,
"features":features[]{
"title":${coalesce("title",locale)},
image,
"description":${coalesce("description",locale)},
},
"rules":${coalesce("rules",locale)}
}`

let page = await client.fetch<VriddhashramaCenter>(query);

console.log(page)

return {
...page,
features: page.features.map(feature => ({
...feature,
image: urlForImage(feature.image)
}))
}
}
10 changes: 9 additions & 1 deletion src/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
"facilities": {
"heading": "Facilities"
},
"fqa": {
"fqas": {
"heading": "Frequently Asked Questions...",
"description": "Explore common questions and find answers below. If you don't see what you're looking for, feel free to contact us for assistance.",
"contactUs": "contact us"
},
"testimonials":{
"heading":"testimonials"
}
},
"events": {
Expand All @@ -25,5 +28,10 @@
},
"ayurvedicCenter":{
"heading":"ayurvedic center"
},
"vridddhashrama":{
"rulesAndRegulation":{
"heading":"rules and regulations"
}
}
}
Loading

0 comments on commit aa7b5ca

Please sign in to comment.