From 7eaeb6796a27658f2adc8944d476c465cb0dc9bd Mon Sep 17 00:00:00 2001 From: Karthik-S-Salian Date: Mon, 3 Jun 2024 20:18:15 +0530 Subject: [PATCH 1/4] fix: modified schema --- sanity/schemaTypes/testimonial.ts | 2 +- sanity/schemaTypes/vriddhashrama.ts | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/sanity/schemaTypes/testimonial.ts b/sanity/schemaTypes/testimonial.ts index 3ef1971..7f9b24e 100644 --- a/sanity/schemaTypes/testimonial.ts +++ b/sanity/schemaTypes/testimonial.ts @@ -4,7 +4,7 @@ import { defineField, defineType } from 'sanity' export default defineType({ name: 'testimonial', title: 'Testimonial', - type: 'document', + type: 'object', fields: [ defineField({ name: 'name', diff --git a/sanity/schemaTypes/vriddhashrama.ts b/sanity/schemaTypes/vriddhashrama.ts index ff9c914..f8c8f1d 100644 --- a/sanity/schemaTypes/vriddhashrama.ts +++ b/sanity/schemaTypes/vriddhashrama.ts @@ -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', From 2eef91e8211156e2d0eae61f367998ad9242f3cc Mon Sep 17 00:00:00 2001 From: Karthik-S-Salian Date: Tue, 4 Jun 2024 11:18:49 +0530 Subject: [PATCH 2/4] changed schemas --- package-lock.json | 1 + package.json | 1 + sanity/schema.ts | 4 +- sanity/schemaTypes/locale.ts | 25 + sanity/schemaTypes/vriddhashrama.ts | 5 + .../(main)/[locale]/vriddhashrama/page.tsx | 23 +- src/app/error.tsx | 16 +- src/app/globals.css | 450 +----------------- src/app/not-found.tsx | 11 +- src/components/Fqas/Fqas.tsx | 10 +- .../RulesandRegulation/RulesandRegulation.tsx | 28 +- src/components/RulesandRegulation/style.css | 11 + src/components/Testimonials/page.tsx | 4 +- src/lib/queries.ts | 41 ++ src/messages/en.json | 10 +- src/messages/kn.json | 10 +- 16 files changed, 141 insertions(+), 509 deletions(-) create mode 100644 src/components/RulesandRegulation/style.css diff --git a/package-lock.json b/package-lock.json index ab57a8a..8759992 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,6 +8,7 @@ "name": "krishnaveni", "version": "0.1.0", "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", diff --git a/package.json b/package.json index 5900fc2..d0e16ad 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/sanity/schema.ts b/sanity/schema.ts index 56a84fb..e24ef4a 100644 --- a/sanity/schema.ts +++ b/sanity/schema.ts @@ -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' @@ -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], } diff --git a/sanity/schemaTypes/locale.ts b/sanity/schemaTypes/locale.ts index 6b7161b..07c2959 100644 --- a/sanity/schemaTypes/locale.ts +++ b/sanity/schemaTypes/locale.ts @@ -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' + })) }) \ No newline at end of file diff --git a/sanity/schemaTypes/vriddhashrama.ts b/sanity/schemaTypes/vriddhashrama.ts index f8c8f1d..7395f2d 100644 --- a/sanity/schemaTypes/vriddhashrama.ts +++ b/sanity/schemaTypes/vriddhashrama.ts @@ -35,6 +35,11 @@ export default { type: "feature" }) ] + }), + defineField({ + title: 'Rules and Regulation', + name: 'rules', + type: 'localeBlockArray', }) ], preview: { diff --git a/src/app/(main)/[locale]/vriddhashrama/page.tsx b/src/app/(main)/[locale]/vriddhashrama/page.tsx index f24ae52..3d9a688 100644 --- a/src/app/(main)/[locale]/vriddhashrama/page.tsx +++ b/src/app/(main)/[locale]/vriddhashrama/page.tsx @@ -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 (

- Vriddhashrama + {pageData.title}

- 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}

- - + +

- Vriddhashram Rules And Regulations + {t("rulesAndRegulation.heading")}

- +
diff --git a/src/app/error.tsx b/src/app/error.tsx index 9b4cc81..c904786 100644 --- a/src/app/error.tsx +++ b/src/app/error.tsx @@ -1,7 +1,5 @@ 'use client' - -import { useEffect } from 'react' - + export default function Error({ error, reset, @@ -9,14 +7,14 @@ export default function Error({ error: Error & { digest?: string } reset: () => void }) { - useEffect(() => { - console.error(error) - }, [error]) - return ( -
-

Something went wrong!

+
+

Something went wrong!

+ +

{error.message}

+

Possibly caused due to bad internet connection

diff --git a/src/components/RulesandRegulation/RulesandRegulation.tsx b/src/components/RulesandRegulation/RulesandRegulation.tsx index 035c4ff..d2765df 100644 --- a/src/components/RulesandRegulation/RulesandRegulation.tsx +++ b/src/components/RulesandRegulation/RulesandRegulation.tsx @@ -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 ( -
+
- {krishnaveniVriddhashramRules.map((ruleSet, index) => ( -
-

- {ruleSet.heading} -

-
    - {ruleSet.rules.map((rule, i) => ( -
  • - {rule} -
  • - ))} -
-
- ))} +
-
+ ); }; diff --git a/src/components/RulesandRegulation/style.css b/src/components/RulesandRegulation/style.css new file mode 100644 index 0000000..62b6c71 --- /dev/null +++ b/src/components/RulesandRegulation/style.css @@ -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 +} \ No newline at end of file diff --git a/src/components/Testimonials/page.tsx b/src/components/Testimonials/page.tsx index 91fd2d2..f1e2f17 100644 --- a/src/components/Testimonials/page.tsx +++ b/src/components/Testimonials/page.tsx @@ -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 (
-

Testimonials

+

{t("heading")}

Lorem ipsum dolor sit amet consectetur adipisicing elit. Neque quibusdam similique labore fuga impedit, consectetur facilis odit diff --git a/src/lib/queries.ts b/src/lib/queries.ts index d755b80..38b5a4e 100644 --- a/src/lib/queries.ts +++ b/src/lib/queries.ts @@ -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(query); + + console.log(page) + + return { + ...page, + features: page.features.map(feature => ({ + ...feature, + image: urlForImage(feature.image) + })) + } +} \ No newline at end of file diff --git a/src/messages/en.json b/src/messages/en.json index 3a43399..5e022c7 100644 --- a/src/messages/en.json +++ b/src/messages/en.json @@ -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": { @@ -25,5 +28,10 @@ }, "ayurvedicCenter":{ "heading":"ayurvedic center" + }, + "vridddhashrama":{ + "rulesAndRegulation":{ + "heading":"rules and regulations" + } } } \ No newline at end of file diff --git a/src/messages/kn.json b/src/messages/kn.json index 4953bb1..f8a8c70 100644 --- a/src/messages/kn.json +++ b/src/messages/kn.json @@ -4,10 +4,13 @@ { "heading": "ಸೌಲಭ್ಯಗಳು" }, - "fqa": { + "fqas": { "heading": "ಪದೇ ಪದೇ ಕೇಳಲಾಗುವ ಪ್ರಶ್ನೆಗಳು...", "description":"ಸಾಮಾನ್ಯ ಪ್ರಶ್ನೆಗಳನ್ನು ಅನ್ವೇಷಿಸಿ ಮತ್ತು ಕೆಳಗಿನ ಉತ್ತರಗಳನ್ನು ಹುಡುಕಿ. ನೀವು ಹುಡುಕುತ್ತಿರುವುದನ್ನು ನೀವು ನೋಡದಿದ್ದರೆ, ಸಹಾಯಕ್ಕಾಗಿ ನಮ್ಮನ್ನು ಸಂಪರ್ಕಿಸಲು ಮುಕ್ತವಾಗಿರಿ.", "contactUs":"ಸಂಪರ್ಕಿಸಿ" + }, + "testimonials":{ + "heading":"ಪ್ರಶಂಸಾಪತ್ರಗಳು" } }, "events":{ @@ -27,5 +30,10 @@ }, "ayurvedicCenter":{ "heading":"ಆಯುರ್ವೇದ ಕೇಂದ್ರ" + }, + "vridddhashrama":{ + "rulesAndRegulation":{ + "heading":"ನಿಯಮಗಳು ಮತ್ತು ನಿಬಂಧನೆಗಳು" + } } } \ No newline at end of file From 2e396c7ca3d4a08d9b7cae1e6b1b6932a3f74d00 Mon Sep 17 00:00:00 2001 From: finiteloopclub Date: Tue, 4 Jun 2024 11:57:48 +0530 Subject: [PATCH 3/4] Create main.yml --- .github/workflows/main.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..ae83c1f --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,18 @@ +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: + publish_dir: . + external_repository: finiteloopclub/krishnaveni-ashryadhama + publish_branch: main + allow_empty_commit: true From dafc310683a71601a21b6ee958972cdee2612c8b Mon Sep 17 00:00:00 2001 From: finiteloopclub Date: Tue, 4 Jun 2024 12:02:14 +0530 Subject: [PATCH 4/4] Update main.yml --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ae83c1f..ec36ddb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,6 +12,7 @@ jobs: - 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