diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json index 7749ee7..d6986bf 100644 --- a/public/locales/en/translation.json +++ b/public/locales/en/translation.json @@ -37,12 +37,19 @@ } }, "flutterCafe": [], - "staffSection": { + "membersSection": { "title": "Active members of the Persian Flutter community", "description": "In this section, you will get to know the individuals who are the driving force behind the Persian Flutter community with their efforts and enthusiasm. These active members, with various specialties, play key roles in advancing our community's goals and growth. From managing social media to organizing events, each of these individuals has an important role in the dynamism and progress of the Persian Flutter ecosystem.", "descriptionShort": "In this section, you will get to know the individuals who are the driving force behind the Persian Flutter community with their efforts and enthusiasm. These active members, with various specialties, play key roles in advancing our community's goals and growth.", "viewButton": "View All" }, + "topicsSection": { + "title": "Persian Flutter Topics", + "membersTitle": "Members of the Persian Flutter Topic", + "description": "On this page, you can view the complete list of topics and their related subcategories. This page allows you to easily explore the subjects and quickly access your desired topics.", + "descriptionShort": "On this page, you can view the complete list of topics and their related subcategories. This page allows you to easily explore the subjects and quickly access your desired topics.", + "viewButton": "View All" + }, "comments": [], "donation": { "title": { diff --git a/public/locales/fa/translation.json b/public/locales/fa/translation.json index 1e18018..2a84d68 100644 --- a/public/locales/fa/translation.json +++ b/public/locales/fa/translation.json @@ -37,12 +37,19 @@ } }, "flutterCafe": [], - "staffSection": { + "membersSection": { "title": "اعضای فعال جامعه فلاتر فارسی", "description": " در این بخش با افرادی آشنا می‌شوید که با تلاش و اشتیاق خود، موتور محرکه جامعه فلاتر فارسی هستند. این اعضای فعال با تخصص‌های گوناگون، نقش‌های کلیدی در پیشبرد اهداف و رشد جامعه ما ایفا می‌کنند. از مدیریت رسانه‌های اجتماعی تا برگزاری رویدادها، هر یک از این افراد سهم مهمی در پویایی و پیشرفت اکوسیستم فلاتر فارسی دارند. ", "descriptionShort": " در این بخش با افرادی آشنا می‌شوید که با تلاش و اشتیاق خود، موتور محرکه جامعه فلاتر فارسی هستند. این اعضای فعال با تخصص‌های گوناگون، نقش‌های کلیدی در پیشبرد اهداف و رشد جامعه ما ایفا می‌کنند. ", "viewButton": "مشاهده همه" }, + "topicsSection": { + "title": "تاپیک‌های فلاتر فارسی", + "membersTitle": "اعضای تاپیک فلاتر فارسی", + "description": "در این صفحه، می‌توانید لیست کامل تاپیک‌ها و زیرمجموعه‌های مرتبط با آن‌ها را مشاهده نمایید. این صفحه به شما امکان می‌دهد تا به راحتی موضوعات را بررسی و به سرعت به تاپیک‌های مورد نظر خود دسترسی داشته باشید.", + "descriptionShort": "در این صفحه، می‌توانید لیست کامل تاپیک‌ها و زیرمجموعه‌های مرتبط با آن‌ها را مشاهده نمایید. این صفحه به شما امکان می‌دهد تا به راحتی موضوعات را بررسی و به سرعت به تاپیک‌های مورد نظر خود دسترسی داشته باشید.", + "viewButton": "مشاهده همه" + }, "comments": [], "donation": { "title": { diff --git a/src/components/topic/TopicCard.astro b/src/components/topic/TopicCard.astro index fbde0d0..cd4f7f1 100644 --- a/src/components/topic/TopicCard.astro +++ b/src/components/topic/TopicCard.astro @@ -1,6 +1,7 @@ --- import { getRelativeLocaleUrl } from 'astro:i18n'; import type { CollectionEntry } from 'astro:content'; +import { Image } from 'astro:assets'; interface Props { topic: CollectionEntry<'topic'>; @@ -12,23 +13,32 @@ const { topic, class: className = '' } = Astro.props; function getTopicUrl(topicSlug: string) { const [lang, ...slugParts] = topicSlug.split('/'); const baseSlug = slugParts.join('/'); - return getRelativeLocaleUrl(lang, `topic/${baseSlug}`); + return getRelativeLocaleUrl(lang, `topics/${baseSlug}`); } const topicUrl = getTopicUrl(topic.slug); +const data = topic.data; ---
-

- - {topic.data.title} - + {data.title} +

+
+ {topic.data.title} +

-

{topic.data.description}

+

{topic.data.description}

diff --git a/src/components/widgets/MembersHeader.astro b/src/components/widgets/PagesHeader.astro similarity index 100% rename from src/components/widgets/MembersHeader.astro rename to src/components/widgets/PagesHeader.astro diff --git a/src/components/widgets/StaffSection.astro b/src/components/widgets/StaffSection.astro index e2b651f..cb134c9 100644 --- a/src/components/widgets/StaffSection.astro +++ b/src/components/widgets/StaffSection.astro @@ -6,11 +6,26 @@ import SectionTitle from './SectionTitle.astro'; import StaffCard from './StaffCard.astro'; import i18n from '~/utils/i18n'; import { getCollection } from 'astro:content'; +import { twMerge } from 'tailwind-merge'; -const { id, isDark = false, classes = {} } = Astro.props; +interface Props { + id?: string; + isDark?: boolean; + classes?: { container?: string }; + inTopics?: boolean; +} +const { id, isDark = false, classes = {}, inTopics = false } = Astro.props as Props; +const { slug } = Astro.params; const currentLocale = Astro.currentLocale!; const members = await getCollection('member'); -const effectiveMembers = members.filter(({ slug }) => slug.startsWith(currentLocale)); + +const defaultMembers = members.filter(({ slug }) => slug.startsWith(currentLocale)); + +const membersInTopics = members + .filter(({ slug }) => slug.startsWith(currentLocale)) + .filter((member) => member.data.topics.some((topic) => topic.slug === `${currentLocale}/${slug}`)); + +const effectiveMembers = inTopics ? membersInTopics : defaultMembers; i18n.setLang(currentLocale); const translations = i18n.t(); @@ -25,32 +40,41 @@ const translations = i18n.t(); {background && } -
+
{effectiveMembers.map((member) => )}
- - {translations.home.staffSection.viewButton} - + rel="noopener" + aria-label="View All" + > + {translations.home.membersSection.viewButton} + + ) + }
diff --git a/src/components/widgets/TopicProse.astro b/src/components/widgets/TopicProse.astro new file mode 100644 index 0000000..0ad1b4c --- /dev/null +++ b/src/components/widgets/TopicProse.astro @@ -0,0 +1,16 @@ +--- + +--- + +
+ +
diff --git a/src/content/config.ts b/src/content/config.ts index 0116cb6..1de30a0 100644 --- a/src/content/config.ts +++ b/src/content/config.ts @@ -64,11 +64,13 @@ const postCollection = defineCollection({ }); const topicCollection = defineCollection({ type: 'content', - schema: z.object({ - title: z.string(), - description: z.string().max(500, { message: 'Description must be 500 characters or less' }), - metadata: metadataDefinition(), - }), + schema: ({ image }) => + z.object({ + title: z.string(), + description: z.string().max(500, { message: 'Description must be 500 characters or less' }), + image: image(), + metadata: metadataDefinition(), + }), }); const memberCollection = defineCollection({ diff --git a/src/content/topic/en/open-source.md b/src/content/topic/en/open-source.md index 7cb4089..9129246 100644 --- a/src/content/topic/en/open-source.md +++ b/src/content/topic/en/open-source.md @@ -1,6 +1,7 @@ --- title: 'Open Source Projects' description: 'At Persian Flutter, we wholeheartedly believe in open source! Open source projects aren’t just lines of code—they’re a driving force for community growth and recognition. Here, we come together to build high-quality projects that benefit everyone. That means learning, collaboration, and progress—all in one place!' +image: './../images/open-source.png' --- ## What We’ve Gained, What We Can Share diff --git a/src/content/topic/en/open-source1.md b/src/content/topic/en/open-source1.md new file mode 100644 index 0000000..9129246 --- /dev/null +++ b/src/content/topic/en/open-source1.md @@ -0,0 +1,32 @@ +--- +title: 'Open Source Projects' +description: 'At Persian Flutter, we wholeheartedly believe in open source! Open source projects aren’t just lines of code—they’re a driving force for community growth and recognition. Here, we come together to build high-quality projects that benefit everyone. That means learning, collaboration, and progress—all in one place!' +image: './../images/open-source.png' +--- + +## What We’ve Gained, What We Can Share + +Throughout our professional journeys, we’ve all benefited from free resources and open source projects—learning from them and growing along the way. Maybe it’s time each of us contributed back, in our own unique way, to keep this culture thriving and available to everyone. + +## Persian Flutter’s Role in Open Source + +In the Persian Flutter community, we put great emphasis on open source projects and resources. We believe that contributing to open source isn’t just about writing code; it’s also a path for personal and professional development. + +When we collaborate on open source projects, we do more than just improve our programming skills. We learn how to work together effectively, exchange knowledge, and grow by learning from each other. This process not only makes us better developers, but helps us become more open-minded and supportive individuals. + +At Persian Flutter, our goal is to keep this spirit alive—supporting open source projects and creating a platform where anyone can get involved. Because for us, open source isn’t just about code; it’s about collaboration, learning, and building a brighter future together. + +## Our Mission at Persian Flutter + +We at **Persian Flutter** have a clear focus on open source: **to create a space for learning, growth, and collaboration.** we want to **make a real impact and spread this culture far and wide.** + +### Our Objectives: + +- **Develop Practical and Educational Projects** + We aim to build high-quality open source projects that not only serve real-world needs but also help developers pick up new skills and advance their expertise. + +- **Boost the Global Standing of the Persian Flutter Community** + By producing standard, impactful open source projects and engaging with the wider community, we strive to establish Persian Flutter as a credible and influential presence in the global developer sphere. + +- **Promote the Open Source Culture** + We want to spread the open source ethos as a model for collaboration and knowledge sharing. By creating learning opportunities for developers and offering a platform where everyone can contribute, we hope to keep this powerful culture growing strong. diff --git a/src/content/topic/en/open-source2.md b/src/content/topic/en/open-source2.md new file mode 100644 index 0000000..9129246 --- /dev/null +++ b/src/content/topic/en/open-source2.md @@ -0,0 +1,32 @@ +--- +title: 'Open Source Projects' +description: 'At Persian Flutter, we wholeheartedly believe in open source! Open source projects aren’t just lines of code—they’re a driving force for community growth and recognition. Here, we come together to build high-quality projects that benefit everyone. That means learning, collaboration, and progress—all in one place!' +image: './../images/open-source.png' +--- + +## What We’ve Gained, What We Can Share + +Throughout our professional journeys, we’ve all benefited from free resources and open source projects—learning from them and growing along the way. Maybe it’s time each of us contributed back, in our own unique way, to keep this culture thriving and available to everyone. + +## Persian Flutter’s Role in Open Source + +In the Persian Flutter community, we put great emphasis on open source projects and resources. We believe that contributing to open source isn’t just about writing code; it’s also a path for personal and professional development. + +When we collaborate on open source projects, we do more than just improve our programming skills. We learn how to work together effectively, exchange knowledge, and grow by learning from each other. This process not only makes us better developers, but helps us become more open-minded and supportive individuals. + +At Persian Flutter, our goal is to keep this spirit alive—supporting open source projects and creating a platform where anyone can get involved. Because for us, open source isn’t just about code; it’s about collaboration, learning, and building a brighter future together. + +## Our Mission at Persian Flutter + +We at **Persian Flutter** have a clear focus on open source: **to create a space for learning, growth, and collaboration.** we want to **make a real impact and spread this culture far and wide.** + +### Our Objectives: + +- **Develop Practical and Educational Projects** + We aim to build high-quality open source projects that not only serve real-world needs but also help developers pick up new skills and advance their expertise. + +- **Boost the Global Standing of the Persian Flutter Community** + By producing standard, impactful open source projects and engaging with the wider community, we strive to establish Persian Flutter as a credible and influential presence in the global developer sphere. + +- **Promote the Open Source Culture** + We want to spread the open source ethos as a model for collaboration and knowledge sharing. By creating learning opportunities for developers and offering a platform where everyone can contribute, we hope to keep this powerful culture growing strong. diff --git a/src/content/topic/fa/open-source.md b/src/content/topic/fa/open-source.md index 48312a4..992bd52 100644 --- a/src/content/topic/fa/open-source.md +++ b/src/content/topic/fa/open-source.md @@ -1,6 +1,7 @@ --- title: 'پروژه های Open Source' description: 'توی پرشین فلاتر، ما به اوپن سورس بودن اعتقاد داریم! پروژه‌های متن‌باز فقط یه سری کد نیستن، بلکه به رشد و اعتبار جامعه‌ی برنامه‌نویسی کمک می‌کنن. ما اینجا کنار هم پروژه‌هایی می‌سازیم که هم کیفیت بالایی داشته باشن، هم به درد بقیه بخورن. این یعنی یادگیری، همکاری و پیشرفت، همه در کنار هم!' +image: './../images/open-source.png' --- ## دانشی که گرفتیم، دانشی که می‌توانیم به اشتراک بگذاریم diff --git a/src/content/topic/fa/open-source1.md b/src/content/topic/fa/open-source1.md new file mode 100644 index 0000000..992bd52 --- /dev/null +++ b/src/content/topic/fa/open-source1.md @@ -0,0 +1,32 @@ +--- +title: 'پروژه های Open Source' +description: 'توی پرشین فلاتر، ما به اوپن سورس بودن اعتقاد داریم! پروژه‌های متن‌باز فقط یه سری کد نیستن، بلکه به رشد و اعتبار جامعه‌ی برنامه‌نویسی کمک می‌کنن. ما اینجا کنار هم پروژه‌هایی می‌سازیم که هم کیفیت بالایی داشته باشن، هم به درد بقیه بخورن. این یعنی یادگیری، همکاری و پیشرفت، همه در کنار هم!' +image: './../images/open-source.png' +--- + +## دانشی که گرفتیم، دانشی که می‌توانیم به اشتراک بگذاریم + +همه‌ی ما در مسیر حرفه‌ای خود از منابع رایگان و پروژه‌های متن‌باز استفاده کرده‌ایم، یاد گرفته‌ایم و رشد کرده‌ایم. شاید بهتر باشد که هرکدام از ما، به اندازه‌ی خودمان، در این جریان سهمی داشته باشیم تا این فرهنگ زنده بماند و در دسترس دیگران هم باشد. + +## سهم فلاتر فارسی در متن باز + +در جامعه‌ی فلاتر فارسی، ما به پروژه‌ها و منابع Open Source اهمیت زیادی می‌دهیم. باور داریم که مشارکت در پروژه‌های متن‌باز تنها یک فعالیت فنی نیست، بلکه مسیری برای رشد فردی و حرفه‌ای است. + +وقتی در یک پروژه‌ی متن‌باز همکاری می‌کنیم، فقط مهارت‌های برنامه‌نویسی‌مان را تقویت نمی‌کنیم، بلکه یاد می‌گیریم چطور بهتر همکاری کنیم، از دیگران یاد بگیریم و دانش خود را به اشتراک بگذاریم. این فرآیند نه‌تنها ما را توسعه‌دهندگان بهتری می‌کند، بلکه از ما انسان بهتری میسازد. + +ما در فلاتر فارسی تلاش می‌کنیم که این فرهنگ را زنده نگه داریم، از پروژه‌های متن‌باز حمایت کنیم و بستری بسازیم که هر کسی بتواند سهمی در آن داشته باشد. چون معتقدیم که متن‌باز فقط درباره‌ی کد نیست، بلکه درباره‌ی همکاری، یادگیری و ساختن آینده‌ای بهتر برای همه است. + +## هدف ما در فلاتر فارسی + +ما در **فلاتر فارسی** با یک هدف مشخص در مسیر متن‌باز حرکت می‌کنیم: **ایجاد فضایی برای یادگیری، رشد و همکاری**. مأموریت ما فقط نوشتن کد نیست؛ بلکه می‌خواهیم **تأثیرگذار باشیم و این فرهنگ را گسترش دهیم**. + +### اهداف ما: + +- **ایجاد پروژه‌های کاربردی و آموزشی** + ساخت پروژه‌های متن‌باز و باکیفیت که هم در دنیای واقعی قابل استفاده باشند و هم به توسعه‌دهندگان کمک کنند مهارت‌های جدید یاد بگیرند و تخصص خود را ارتقا دهند. + +- **افزایش اعتبار جامعه‌ی فلاتر فارسی در دنیا** + معرفی جامعه‌ی فلاتر فارسی به عنوان یک مرجع معتبر و تأثیرگذار در سطح بین‌المللی از طریق تولید پروژه‌های استاندارد، مشارکت در توسعه‌ی متن‌باز و ارتباط مؤثر با جامعه‌ی جهانی. + +- **ترویج فرهنگ Open Source** + گسترش فرهنگ متن‌باز به عنوان مدلی برای همکاری و اشتراک دانش، ایجاد فرصت‌های یادگیری برای توسعه‌دهندگان و فراهم کردن بستری که هر کسی بتواند در آن مشارکت کند و یاد بگیرد. diff --git a/src/content/topic/fa/open-source2.md b/src/content/topic/fa/open-source2.md new file mode 100644 index 0000000..992bd52 --- /dev/null +++ b/src/content/topic/fa/open-source2.md @@ -0,0 +1,32 @@ +--- +title: 'پروژه های Open Source' +description: 'توی پرشین فلاتر، ما به اوپن سورس بودن اعتقاد داریم! پروژه‌های متن‌باز فقط یه سری کد نیستن، بلکه به رشد و اعتبار جامعه‌ی برنامه‌نویسی کمک می‌کنن. ما اینجا کنار هم پروژه‌هایی می‌سازیم که هم کیفیت بالایی داشته باشن، هم به درد بقیه بخورن. این یعنی یادگیری، همکاری و پیشرفت، همه در کنار هم!' +image: './../images/open-source.png' +--- + +## دانشی که گرفتیم، دانشی که می‌توانیم به اشتراک بگذاریم + +همه‌ی ما در مسیر حرفه‌ای خود از منابع رایگان و پروژه‌های متن‌باز استفاده کرده‌ایم، یاد گرفته‌ایم و رشد کرده‌ایم. شاید بهتر باشد که هرکدام از ما، به اندازه‌ی خودمان، در این جریان سهمی داشته باشیم تا این فرهنگ زنده بماند و در دسترس دیگران هم باشد. + +## سهم فلاتر فارسی در متن باز + +در جامعه‌ی فلاتر فارسی، ما به پروژه‌ها و منابع Open Source اهمیت زیادی می‌دهیم. باور داریم که مشارکت در پروژه‌های متن‌باز تنها یک فعالیت فنی نیست، بلکه مسیری برای رشد فردی و حرفه‌ای است. + +وقتی در یک پروژه‌ی متن‌باز همکاری می‌کنیم، فقط مهارت‌های برنامه‌نویسی‌مان را تقویت نمی‌کنیم، بلکه یاد می‌گیریم چطور بهتر همکاری کنیم، از دیگران یاد بگیریم و دانش خود را به اشتراک بگذاریم. این فرآیند نه‌تنها ما را توسعه‌دهندگان بهتری می‌کند، بلکه از ما انسان بهتری میسازد. + +ما در فلاتر فارسی تلاش می‌کنیم که این فرهنگ را زنده نگه داریم، از پروژه‌های متن‌باز حمایت کنیم و بستری بسازیم که هر کسی بتواند سهمی در آن داشته باشد. چون معتقدیم که متن‌باز فقط درباره‌ی کد نیست، بلکه درباره‌ی همکاری، یادگیری و ساختن آینده‌ای بهتر برای همه است. + +## هدف ما در فلاتر فارسی + +ما در **فلاتر فارسی** با یک هدف مشخص در مسیر متن‌باز حرکت می‌کنیم: **ایجاد فضایی برای یادگیری، رشد و همکاری**. مأموریت ما فقط نوشتن کد نیست؛ بلکه می‌خواهیم **تأثیرگذار باشیم و این فرهنگ را گسترش دهیم**. + +### اهداف ما: + +- **ایجاد پروژه‌های کاربردی و آموزشی** + ساخت پروژه‌های متن‌باز و باکیفیت که هم در دنیای واقعی قابل استفاده باشند و هم به توسعه‌دهندگان کمک کنند مهارت‌های جدید یاد بگیرند و تخصص خود را ارتقا دهند. + +- **افزایش اعتبار جامعه‌ی فلاتر فارسی در دنیا** + معرفی جامعه‌ی فلاتر فارسی به عنوان یک مرجع معتبر و تأثیرگذار در سطح بین‌المللی از طریق تولید پروژه‌های استاندارد، مشارکت در توسعه‌ی متن‌باز و ارتباط مؤثر با جامعه‌ی جهانی. + +- **ترویج فرهنگ Open Source** + گسترش فرهنگ متن‌باز به عنوان مدلی برای همکاری و اشتراک دانش، ایجاد فرصت‌های یادگیری برای توسعه‌دهندگان و فراهم کردن بستری که هر کسی بتواند در آن مشارکت کند و یاد بگیرد. diff --git a/src/content/topic/images/open-source.png b/src/content/topic/images/open-source.png new file mode 100644 index 0000000..5885f66 Binary files /dev/null and b/src/content/topic/images/open-source.png differ diff --git a/src/layouts/MembersLayout.astro b/src/layouts/MembersLayout.astro index 51e493e..6943dee 100644 --- a/src/layouts/MembersLayout.astro +++ b/src/layouts/MembersLayout.astro @@ -2,7 +2,7 @@ import type { MetaData } from '~/types'; import PageLayout from './PageLayout.astro'; import { Image } from 'astro:assets'; -import MembersHeader from '~/components/widgets/MembersHeader.astro'; +import PagesHeader from '~/components/widgets/PagesHeader.astro'; import background from '~/assets/images/membersPage-header.png'; import i18n from '~/utils/i18n'; @@ -18,9 +18,9 @@ const { metadata } = Astro.props;
background -
diff --git a/src/layouts/TopicsLayout.astro b/src/layouts/TopicsLayout.astro new file mode 100644 index 0000000..3e6d4ba --- /dev/null +++ b/src/layouts/TopicsLayout.astro @@ -0,0 +1,28 @@ +--- +import type { MetaData } from '~/types'; +import PageLayout from './PageLayout.astro'; +import { Image } from 'astro:assets'; +import PagesHeader from '~/components/widgets/PagesHeader.astro'; +import background from '~/assets/images/membersPage-header.png'; +import i18n from '~/utils/i18n'; + +export interface Props { + metadata?: MetaData; +} +i18n.setLang(Astro.currentLocale); +const translations = i18n.t(); +const { metadata } = Astro.props; +--- + + +
+
+ background + +
+ +
+
diff --git a/src/pages/en/topic/[...slug].astro b/src/pages/en/topic/[...slug].astro deleted file mode 100644 index 32c7af9..0000000 --- a/src/pages/en/topic/[...slug].astro +++ /dev/null @@ -1,47 +0,0 @@ ---- -import { getCollection } from 'astro:content'; -import Layout from '~/layouts/PageLayout.astro'; -import i18n from '~/utils/i18n'; - -export async function getStaticPaths() { - const pages = await getCollection('topic'); - - return pages - .filter(({ slug }) => slug.startsWith('en')) - .filter(({ slug }) => slug.split('/').length === 2) - .map((page) => { - const [, ...slugParts] = page.slug.split('/'); - const baseSlug = slugParts.join('/'); - - return { - params: { - slug: baseSlug, - }, - props: { - page, - }, - }; - }); -} - -const { slug } = Astro.params; -const { page } = Astro.props; -const pageData = page.data; - -const { Content } = await page.render(); - -const metadata = { - title: 'Persin Flutter', - ignoreTitleTemplate: true, -}; - -i18n.setLang(Astro.currentLocale); ---- - - -

Language: {Astro.currentLocale}

-

Slug: {slug}

-

Name: {slug}

-

Page Data: {JSON.stringify(pageData)}

- -
diff --git a/src/pages/en/topic/index.astro b/src/pages/en/topic/index.astro deleted file mode 100644 index 199ac26..0000000 --- a/src/pages/en/topic/index.astro +++ /dev/null @@ -1,34 +0,0 @@ ---- -import { getCollection } from 'astro:content'; -import Layout from '~/layouts/PageLayout.astro'; -import i18n from '~/utils/i18n'; -import TopicCard from '~/components/topic/TopicCard.astro'; - -const metadata = { - title: 'Persin Flutter', - ignoreTitleTemplate: true, -}; -const currentLocale = Astro.currentLocale!; -const topics = await getCollection('topic'); -const effectiveTopics = topics.filter(({ slug }) => slug.startsWith(currentLocale)); - -i18n.setLang(currentLocale); ---- - - -
-

{'Topics'}

- -
- {effectiveTopics.map((topic) => )} -
- - { - effectiveTopics.length === 0 && ( -
-

{'موضوعی یافت نشد'}

-
- ) - } -
-
diff --git a/src/pages/en/topics/[...slug].astro b/src/pages/en/topics/[...slug].astro new file mode 100644 index 0000000..08b7342 --- /dev/null +++ b/src/pages/en/topics/[...slug].astro @@ -0,0 +1,56 @@ +--- +import { getCollection } from 'astro:content'; +import TopicsLayout from '~/layouts/TopicsLayout.astro'; +import i18n from '~/utils/i18n'; +import TopicProse from '~/components/widgets/TopicProse.astro'; +import { Image } from 'astro:assets'; +import StaffSection from '~/components/widgets/StaffSection.astro'; + +export async function getStaticPaths() { + const pages = await getCollection('topic'); + + return pages + .filter(({ slug }) => slug.startsWith('en')) + .filter(({ slug }) => slug.split('/').length === 2) + .map((page) => { + const [, ...slugParts] = page.slug.split('/'); + const baseSlug = slugParts.join('/'); + + return { + params: { + slug: baseSlug, + }, + props: { + page, + }, + }; + }); +} + +const { page } = Astro.props; +const data = page.data; + +const { Content } = await page.render(); + +const metadata = { + title: `${data.title}`, + ignoreTitleTemplate: true, +}; + +i18n.setLang(Astro.currentLocale); +--- + + +
+ {data.title} +
+ + + + +
diff --git a/src/pages/en/topics/index.astro b/src/pages/en/topics/index.astro new file mode 100644 index 0000000..1b41a56 --- /dev/null +++ b/src/pages/en/topics/index.astro @@ -0,0 +1,32 @@ +--- +import { getCollection } from 'astro:content'; +import i18n from '~/utils/i18n'; +import TopicCard from '~/components/topic/TopicCard.astro'; +import TopicsLayout from '~/layouts/TopicsLayout.astro'; + +const metadata = { + title: 'Persin Flutter', + ignoreTitleTemplate: true, +}; +const currentLocale = Astro.currentLocale!; +const topics = await getCollection('topic'); +const effectiveTopics = topics.filter(({ slug }) => slug.startsWith(currentLocale)); + +i18n.setLang(currentLocale); +--- + + + { + effectiveTopics.length === 0 ? ( +
+

{'موضوعی یافت نشد'}

+
+ ) : ( +
+ {effectiveTopics.map((topic) => ( + + ))} +
+ ) + } +
diff --git a/src/pages/topic/[...slug].astro b/src/pages/topic/[...slug].astro deleted file mode 100644 index 20392ca..0000000 --- a/src/pages/topic/[...slug].astro +++ /dev/null @@ -1,49 +0,0 @@ ---- -import { getCollection } from 'astro:content'; -import Layout from '~/layouts/PageLayout.astro'; -import i18n from '~/utils/i18n'; - -export async function getStaticPaths() { - const pages = await getCollection('topic'); - - return pages - .filter(({ slug }) => slug.startsWith('fa')) - .filter(({ slug }) => slug.split('/').length === 2) - .map((page) => { - const [, ...slugParts] = page.slug.split('/'); - const baseSlug = slugParts.join('/'); - - return { - params: { - slug: baseSlug, - }, - props: { - page, - }, - }; - }); -} - -const { slug } = Astro.params; -const { page } = Astro.props; -const pageData = page.data; - -const { Content } = await page.render(); - -const metadata = { - title: 'Persin Flutter', - ignoreTitleTemplate: true, -}; - -i18n.setLang(Astro.currentLocale); ---- - - -

Language: {Astro.currentLocale}

-

Astro preferredLocaleList: {Astro.preferredLocaleList}

-

Astro preferredLocaleList: {JSON.stringify(Astro.locals)}

-

Slug: {slug}

-

Name: {slug}

-

Page Data: {JSON.stringify(pageData)}

- -
diff --git a/src/pages/topic/index.astro b/src/pages/topic/index.astro deleted file mode 100644 index 3f8b98f..0000000 --- a/src/pages/topic/index.astro +++ /dev/null @@ -1,34 +0,0 @@ ---- -import { getCollection } from 'astro:content'; -import Layout from '~/layouts/PageLayout.astro'; -import i18n from '~/utils/i18n'; -import TopicCard from '~/components/topic/TopicCard.astro'; - -const metadata = { - title: 'Persin Flutter', - ignoreTitleTemplate: true, -}; -const currentLocale = Astro.currentLocale!; -const topics = await getCollection('topic'); -const effectiveTopics = topics.filter(({ slug }) => slug.startsWith(currentLocale)); - -i18n.setLang(currentLocale); ---- - - -
-

{'تاپیک ها'}

- -
- {effectiveTopics.map((topic) => )} -
- - { - effectiveTopics.length === 0 && ( -
-

{'موضوعی یافت نشد'}

-
- ) - } -
-
diff --git a/src/pages/topics/[...slug].astro b/src/pages/topics/[...slug].astro new file mode 100644 index 0000000..0819fc5 --- /dev/null +++ b/src/pages/topics/[...slug].astro @@ -0,0 +1,56 @@ +--- +import { getCollection } from 'astro:content'; +import TopicsLayout from '~/layouts/TopicsLayout.astro'; +import i18n from '~/utils/i18n'; +import TopicProse from '~/components/widgets/TopicProse.astro'; +import { Image } from 'astro:assets'; +import StaffSection from '~/components/widgets/StaffSection.astro'; + +export async function getStaticPaths() { + const pages = await getCollection('topic'); + + return pages + .filter(({ slug }) => slug.startsWith('fa')) + .filter(({ slug }) => slug.split('/').length === 2) + .map((page) => { + const [, ...slugParts] = page.slug.split('/'); + const baseSlug = slugParts.join('/'); + + return { + params: { + slug: baseSlug, + }, + props: { + page, + }, + }; + }); +} + +const { page } = Astro.props; +const data = page.data; + +const { Content } = await page.render(); + +const metadata = { + title: `${data.title}`, + ignoreTitleTemplate: true, +}; + +i18n.setLang(Astro.currentLocale); +--- + + +
+ {data.title} +
+ + + + +
diff --git a/src/pages/topics/index.astro b/src/pages/topics/index.astro new file mode 100644 index 0000000..6f40571 --- /dev/null +++ b/src/pages/topics/index.astro @@ -0,0 +1,32 @@ +--- +import { getCollection } from 'astro:content'; +import i18n from '~/utils/i18n'; +import TopicCard from '~/components/topic/TopicCard.astro'; +import TopicsLayout from '~/layouts/TopicsLayout.astro'; + +const metadata = { + title: 'Persin Flutter', + ignoreTitleTemplate: true, +}; +const currentLocale = Astro.currentLocale!; +const topics = await getCollection('topic'); +const effectiveTopics = topics.filter(({ slug }) => slug.startsWith(currentLocale)); + +i18n.setLang(currentLocale); +--- + + + { + effectiveTopics.length === 0 ? ( +
+

{'موضوعی یافت نشد'}

+
+ ) : ( +
+ {effectiveTopics.map((topic) => ( + + ))} +
+ ) + } +