@promakeai/cli 0.3.2 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +415 -209
- package/dist/registry/about-page.json +3 -3
- package/dist/registry/about-section.json +4 -4
- package/dist/registry/animations.json +2 -2
- package/dist/registry/announcement-bar.json +4 -4
- package/dist/registry/api.json +1 -1
- package/dist/registry/auth-core.json +3 -3
- package/dist/registry/auth.json +70 -0
- package/dist/registry/bento-grid-section.json +4 -4
- package/dist/registry/blog-core.json +5 -5
- package/dist/registry/blog-list-page.json +3 -3
- package/dist/registry/blog-section.json +4 -4
- package/dist/registry/cards-carousel-section.json +4 -4
- package/dist/registry/cart-drawer.json +3 -3
- package/dist/registry/cart-page.json +3 -3
- package/dist/registry/case-study-page.json +3 -3
- package/dist/registry/category-section.json +3 -3
- package/dist/registry/checkout-page.json +3 -3
- package/dist/registry/coming-soon-page-minimal.json +4 -4
- package/dist/registry/coming-soon-page.json +4 -4
- package/dist/registry/contact-info-grid.json +4 -4
- package/dist/registry/contact-page-centered.json +4 -4
- package/dist/registry/contact-page-split.json +4 -4
- package/dist/registry/contact-page.json +3 -3
- package/dist/registry/content-section.json +4 -4
- package/dist/registry/cookie-consent.json +4 -4
- package/dist/registry/cookies-page.json +3 -3
- package/dist/registry/cta-section.json +3 -3
- package/dist/registry/docs/reset-password-page.md +36 -0
- package/dist/registry/ecommerce-core.json +10 -10
- package/dist/registry/empty-page.json +3 -3
- package/dist/registry/faq-categorized.json +4 -4
- package/dist/registry/faq-simple.json +4 -4
- package/dist/registry/favorites-blog-block.json +1 -1
- package/dist/registry/favorites-blog-page.json +4 -4
- package/dist/registry/favorites-ecommerce-block.json +1 -1
- package/dist/registry/favorites-ecommerce-page.json +4 -4
- package/dist/registry/feature-section.json +3 -3
- package/dist/registry/featured-products.json +3 -3
- package/dist/registry/footer-detailed.json +4 -4
- package/dist/registry/footer-minimal.json +3 -3
- package/dist/registry/footer.json +3 -3
- package/dist/registry/forgot-password-page-split.json +4 -4
- package/dist/registry/forgot-password-page.json +4 -4
- package/dist/registry/google-adsense.json +4 -4
- package/dist/registry/google-map.json +2 -2
- package/dist/registry/header-centered-pill.json +4 -4
- package/dist/registry/header-ecommerce.json +3 -3
- package/dist/registry/header-mega.json +4 -4
- package/dist/registry/header-minimal.json +4 -4
- package/dist/registry/header-simple.json +3 -3
- package/dist/registry/hero-carousel.json +3 -3
- package/dist/registry/hero-cta.json +4 -4
- package/dist/registry/hero-gradient.json +4 -4
- package/dist/registry/hero-grid.json +4 -4
- package/dist/registry/hero-profile.json +3 -3
- package/dist/registry/hero.json +3 -3
- package/dist/registry/landing-page-app.json +3 -3
- package/dist/registry/landing-page-saas.json +3 -3
- package/dist/registry/login-page-split.json +4 -4
- package/dist/registry/login-page.json +4 -4
- package/dist/registry/logo-cloud.json +4 -4
- package/dist/registry/masonry-grid.json +3 -3
- package/dist/registry/my-orders-page.json +4 -4
- package/dist/registry/newsletter-section.json +4 -4
- package/dist/registry/order-card-compact.json +1 -1
- package/dist/registry/order-confirmation-page.json +4 -4
- package/dist/registry/order-detail-block.json +1 -1
- package/dist/registry/orders-list-block.json +1 -1
- package/dist/registry/payment-success-block.json +1 -1
- package/dist/registry/portfolio-page.json +4 -4
- package/dist/registry/post-card.json +3 -3
- package/dist/registry/post-detail-block.json +1 -1
- package/dist/registry/post-detail-page.json +4 -4
- package/dist/registry/pricing-card.json +3 -3
- package/dist/registry/pricing-page.json +4 -4
- package/dist/registry/pricing-section.json +4 -4
- package/dist/registry/privacy-page.json +3 -3
- package/dist/registry/product-card-detailed.json +4 -4
- package/dist/registry/product-card-hover.json +4 -4
- package/dist/registry/product-card.json +3 -3
- package/dist/registry/product-detail-block.json +1 -1
- package/dist/registry/product-detail-page.json +4 -4
- package/dist/registry/product-detail-section.json +4 -4
- package/dist/registry/product-quick-view.json +4 -4
- package/dist/registry/products-page.json +3 -3
- package/dist/registry/reading-progress.json +4 -4
- package/dist/registry/register-page-split.json +4 -4
- package/dist/registry/register-page.json +4 -4
- package/dist/registry/related-posts-block.json +1 -1
- package/dist/registry/related-products-block.json +1 -1
- package/dist/registry/reset-password-page-split.json +4 -4
- package/dist/registry/reset-password-page.json +39 -0
- package/dist/registry/service-card.json +1 -1
- package/dist/registry/share-buttons.json +4 -4
- package/dist/registry/skill-card.json +1 -1
- package/dist/registry/team-page.json +4 -4
- package/dist/registry/terms-page.json +3 -3
- package/dist/registry/testimonials-carousel.json +4 -4
- package/dist/registry/testimonials-grid.json +4 -4
- package/dist/registry/timeline-section.json +4 -4
- package/dist/registry/video-hero.json +4 -4
- package/dist/registry/youtube-embed.json +4 -4
- package/package.json +2 -2
- package/template/.env +6 -6
- package/template/public/_redirects +1 -1
- package/template/public/robots.txt +14 -14
- package/template/src/components/GoogleAnalytics.tsx +34 -34
- package/template/src/components/LanguageSwitcher.tsx +53 -53
- package/template/src/components/ScriptInjector.tsx +62 -62
- package/template/src/lib/env.ts +19 -19
- package/template/src/router.tsx +14 -14
- package/template/src/vite-env.d.ts +1 -1
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"path": "about-page/index.ts",
|
|
17
17
|
"type": "registry:index",
|
|
18
18
|
"target": "$modules$/about-page/index.ts",
|
|
19
|
-
"content": "export * from './about-page';\nexport { AboutPage as default } from './about-page';\n"
|
|
19
|
+
"content": "export * from './about-page';\r\nexport { AboutPage as default } from './about-page';\r\n"
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
22
|
"path": "about-page/about-page.tsx",
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
"path": "about-page/lang/en.json",
|
|
29
29
|
"type": "registry:lang",
|
|
30
30
|
"target": "$modules$/about-page/lang/en.json",
|
|
31
|
-
"content": "{\n \"title\": \"About Us\",\n \"subtitle\": \"Tell your brand's story, vision, and value in a few sentences.\",\n \"storyTitle\": \"Our Story\",\n \"storyP1\": \"Tell your brand's origins, motivation, and current position. Include key turning points.\",\n \"storyP2\": \"Continue your story. Deepen the journey mentioned in the first paragraph.\",\n \"missionTitle\": \"Our Mission\",\n \"missionDesc\": \"Describe your brand's core purpose and user value.\",\n \"valuesTitle\": \"Our Values\",\n \"valuesDesc\": \"Share the core values that define your brand.\",\n \"teamTitle\": \"Our Team\",\n \"teamDesc\": \"Describe your team structure, culture, and collaboration.\",\n \"qualityTitle\": \"Quality First\",\n \"qualityDesc\": \"Emphasize quality standards and user experience focus.\",\n \"customersValue\": \"500+\",\n \"customersLabel\": \"Happy Customers\",\n \"projectsValue\": \"1000+\",\n \"projectsLabel\": \"Projects Completed\",\n \"experienceValue\": \"10+\",\n \"experienceLabel\": \"Years Experience\",\n \"satisfactionValue\": \"99%\",\n \"satisfactionLabel\": \"Client Satisfaction\",\n \"ctaTitle\": \"Ready to Work Together?\",\n \"ctaDesc\": \"Update this CTA based on your goals.\"\n}"
|
|
31
|
+
"content": "{\r\n \"title\": \"About Us\",\r\n \"subtitle\": \"Tell your brand's story, vision, and value in a few sentences.\",\r\n \"storyTitle\": \"Our Story\",\r\n \"storyP1\": \"Tell your brand's origins, motivation, and current position. Include key turning points.\",\r\n \"storyP2\": \"Continue your story. Deepen the journey mentioned in the first paragraph.\",\r\n \"missionTitle\": \"Our Mission\",\r\n \"missionDesc\": \"Describe your brand's core purpose and user value.\",\r\n \"valuesTitle\": \"Our Values\",\r\n \"valuesDesc\": \"Share the core values that define your brand.\",\r\n \"teamTitle\": \"Our Team\",\r\n \"teamDesc\": \"Describe your team structure, culture, and collaboration.\",\r\n \"qualityTitle\": \"Quality First\",\r\n \"qualityDesc\": \"Emphasize quality standards and user experience focus.\",\r\n \"customersValue\": \"500+\",\r\n \"customersLabel\": \"Happy Customers\",\r\n \"projectsValue\": \"1000+\",\r\n \"projectsLabel\": \"Projects Completed\",\r\n \"experienceValue\": \"10+\",\r\n \"experienceLabel\": \"Years Experience\",\r\n \"satisfactionValue\": \"99%\",\r\n \"satisfactionLabel\": \"Client Satisfaction\",\r\n \"ctaTitle\": \"Ready to Work Together?\",\r\n \"ctaDesc\": \"Update this CTA based on your goals.\"\r\n}"
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
"path": "about-page/lang/tr.json",
|
|
35
35
|
"type": "registry:lang",
|
|
36
36
|
"target": "$modules$/about-page/lang/tr.json",
|
|
37
|
-
"content": "{\n \"title\": \"Hakkımızda\",\n \"subtitle\": \"Markanızın hikayesini, vizyonunu ve değerini birkaç cümleyle anlatın.\",\n \"storyTitle\": \"Hikayemiz\",\n \"storyP1\": \"Markanızın doğuşunu, motivasyonunu ve bugünkü konumunu anlatın. Dönüm noktalarını ekleyin.\",\n \"storyP2\": \"Hikayenizin devamı. İlk paragraftaki yolculuğu derinleştirin.\",\n \"missionTitle\": \"Misyonumuz\",\n \"missionDesc\": \"Markanızın temel amacını ve kullanıcı değerini anlatın.\",\n \"valuesTitle\": \"Değerlerimiz\",\n \"valuesDesc\": \"Markanızı tanımlayan temel değerleri paylaşın.\",\n \"teamTitle\": \"Ekibimiz\",\n \"teamDesc\": \"Ekip yapınızı, kültürünüzü ve işbirliğinizi anlatın.\",\n \"qualityTitle\": \"Önce Kalite\",\n \"qualityDesc\": \"Kalite standartlarınızı ve kullanıcı deneyimi odağınızı vurgulayın.\",\n \"customersValue\": \"500+\",\n \"customersLabel\": \"Mutlu Müşteri\",\n \"projectsValue\": \"1000+\",\n \"projectsLabel\": \"Tamamlanan Proje\",\n \"experienceValue\": \"10+\",\n \"experienceLabel\": \"Yıllık Deneyim\",\n \"satisfactionValue\": \"%99\",\n \"satisfactionLabel\": \"Müşteri Memnuniyeti\",\n \"ctaTitle\": \"Birlikte Çalışmaya Hazır mısınız?\",\n \"ctaDesc\": \"Bu CTA'yı hedeflerinize göre güncelleyin.\"\n}"
|
|
37
|
+
"content": "{\r\n \"title\": \"Hakkımızda\",\r\n \"subtitle\": \"Markanızın hikayesini, vizyonunu ve değerini birkaç cümleyle anlatın.\",\r\n \"storyTitle\": \"Hikayemiz\",\r\n \"storyP1\": \"Markanızın doğuşunu, motivasyonunu ve bugünkü konumunu anlatın. Dönüm noktalarını ekleyin.\",\r\n \"storyP2\": \"Hikayenizin devamı. İlk paragraftaki yolculuğu derinleştirin.\",\r\n \"missionTitle\": \"Misyonumuz\",\r\n \"missionDesc\": \"Markanızın temel amacını ve kullanıcı değerini anlatın.\",\r\n \"valuesTitle\": \"Değerlerimiz\",\r\n \"valuesDesc\": \"Markanızı tanımlayan temel değerleri paylaşın.\",\r\n \"teamTitle\": \"Ekibimiz\",\r\n \"teamDesc\": \"Ekip yapınızı, kültürünüzü ve işbirliğinizi anlatın.\",\r\n \"qualityTitle\": \"Önce Kalite\",\r\n \"qualityDesc\": \"Kalite standartlarınızı ve kullanıcı deneyimi odağınızı vurgulayın.\",\r\n \"customersValue\": \"500+\",\r\n \"customersLabel\": \"Mutlu Müşteri\",\r\n \"projectsValue\": \"1000+\",\r\n \"projectsLabel\": \"Tamamlanan Proje\",\r\n \"experienceValue\": \"10+\",\r\n \"experienceLabel\": \"Yıllık Deneyim\",\r\n \"satisfactionValue\": \"%99\",\r\n \"satisfactionLabel\": \"Müşteri Memnuniyeti\",\r\n \"ctaTitle\": \"Birlikte Çalışmaya Hazır mısınız?\",\r\n \"ctaDesc\": \"Bu CTA'yı hedeflerinize göre güncelleyin.\"\r\n}"
|
|
38
38
|
}
|
|
39
39
|
],
|
|
40
40
|
"exports": {
|
|
@@ -10,25 +10,25 @@
|
|
|
10
10
|
"path": "about-section/index.ts",
|
|
11
11
|
"type": "registry:index",
|
|
12
12
|
"target": "$modules$/about-section/index.ts",
|
|
13
|
-
"content": "export * from './about-section';\n"
|
|
13
|
+
"content": "export * from './about-section';\r\n"
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
16
|
"path": "about-section/about-section.tsx",
|
|
17
17
|
"type": "registry:component",
|
|
18
18
|
"target": "$modules$/about-section/about-section.tsx",
|
|
19
|
-
"content": "import { Link } from \"react-router\";\nimport { useTranslation } from \"react-i18next\";\nimport { cn } from \"@/lib/utils\";\nimport { Button } from \"@/components/ui/button\";\n\ninterface AboutSectionProps {\n className?: string;\n}\n\nexport function AboutSection({ className }: AboutSectionProps) {\n const { t } = useTranslation(\"about-section\");\n\n const stats = [\n { value: t(\"stat1Value\", \"500+\"), label: t(\"stat1Label\", \"Happy Clients\") },\n { value: t(\"stat2Value\", \"1000+\"), label: t(\"stat2Label\", \"Projects Completed\") },\n { value: t(\"stat3Value\", \"99%\"), label: t(\"stat3Label\", \"Satisfaction Rate\") },\n { value: t(\"stat4Value\", \"15+\"), label: t(\"stat4Label\", \"Years Experience\") },\n ];\n\n const companies = [\"Google\", \"Microsoft\", \"Amazon\", \"Apple\", \"Meta\"];\n\n return (\n <section className={cn(\"py-16 md:py-24\", className)}>\n <div className=\"w-full max-w-[var(--container-max-width)] mx-auto px-4\">\n {/* Header */}\n <div className=\"grid md:grid-cols-2 gap-8 mb-12\">\n <h2 className=\"text-3xl md:text-4xl lg:text-5xl font-bold\">\n {t(\"title\", \"About Our Company\")}\n </h2>\n <p className=\"text-muted-foreground text-lg\">\n {t(\"description\", \"We are a passionate team dedicated to creating innovative solutions that empower businesses to thrive in the digital age. Our mission is to deliver excellence in everything we do.\")}\n </p>\n </div>\n\n {/* Images Grid */}\n <div className=\"grid lg:grid-cols-3 gap-6 mb-16\">\n {/* Main Image */}\n <div className=\"lg:col-span-2\">\n <div className=\"aspect-[16/10] lg:aspect-auto lg:h-full rounded-2xl bg-muted overflow-hidden\">\n <img\n src=\"/images/placeholder.png\"\n alt={t(\"mainImageAlt\", \"Our team\")}\n className=\"w-full h-full object-cover\"\n onError={(e) => {\n e.currentTarget.style.display = \"none\";\n }}\n />\n </div>\n </div>\n\n {/* Side Column */}\n <div className=\"flex flex-col gap-6\">\n {/* Info Card */}\n <div className=\"bg-muted rounded-2xl p-6 flex flex-col justify-between flex-1\">\n <div>\n <h3 className=\"text-lg font-semibold mb-2\">\n {t(\"cardTitle\", \"Our Mission\")}\n </h3>\n <p className=\"text-muted-foreground text-sm mb-4\">\n {t(\"cardDescription\", \"Providing businesses with effective tools to improve workflows, boost efficiency, and encourage sustainable growth.\")}\n </p>\n </div>\n <Button variant=\"outline\" asChild className=\"w-fit\">\n <Link to=\"/about\">{t(\"cardButton\", \"Learn More\")}</Link>\n </Button>\n </div>\n\n {/* Secondary Image */}\n <div className=\"aspect-square rounded-2xl bg-muted overflow-hidden flex-1\">\n <img\n src=\"/images/placeholder.png\"\n alt={t(\"secondaryImageAlt\", \"Our office\")}\n className=\"w-full h-full object-cover\"\n onError={(e) => {\n e.currentTarget.style.display = \"none\";\n }}\n />\n </div>\n </div>\n </div>\n\n {/* Companies */}\n <div className=\"text-center mb-16\">\n <p className=\"text-muted-foreground mb-6\">\n {t(\"companiesTitle\", \"Trusted by leading companies worldwide\")}\n </p>\n <div className=\"flex flex-wrap justify-center items-center gap-8 md:gap-12\">\n {companies.map((company) => (\n <span\n key={company}\n className=\"text-xl md:text-2xl font-semibold text-muted-foreground/50\"\n >\n {company}\n </span>\n ))}\n </div>\n </div>\n\n {/* Stats */}\n <div className=\"bg-muted rounded-2xl p-8 md:p-12\">\n <div className=\"text-center md:text-left mb-8\">\n <h3 className=\"text-2xl md:text-3xl font-bold mb-2\">\n {t(\"statsTitle\", \"Our Achievements\")}\n </h3>\n <p className=\"text-muted-foreground max-w-xl\">\n {t(\"statsDescription\", \"Numbers that reflect our commitment to excellence and client satisfaction.\")}\n </p>\n </div>\n <div className=\"grid grid-cols-2 lg:grid-cols-4 gap-8\">\n {stats.map((stat, index) => (\n <div key={index} className=\"text-center\">\n <div className=\"text-3xl md:text-4xl lg:text-5xl font-bold text-primary mb-2\">\n {stat.value}\n </div>\n <p className=\"text-sm md:text-base text-muted-foreground\">\n {stat.label}\n </p>\n </div>\n ))}\n </div>\n </div>\n </div>\n </section>\n );\n}\n"
|
|
19
|
+
"content": "import { Link } from \"react-router\";\r\nimport { useTranslation } from \"react-i18next\";\r\nimport { cn } from \"@/lib/utils\";\r\nimport { Button } from \"@/components/ui/button\";\r\n\r\ninterface AboutSectionProps {\r\n className?: string;\r\n}\r\n\r\nexport function AboutSection({ className }: AboutSectionProps) {\r\n const { t } = useTranslation(\"about-section\");\r\n\r\n const stats = [\r\n { value: t(\"stat1Value\", \"500+\"), label: t(\"stat1Label\", \"Happy Clients\") },\r\n { value: t(\"stat2Value\", \"1000+\"), label: t(\"stat2Label\", \"Projects Completed\") },\r\n { value: t(\"stat3Value\", \"99%\"), label: t(\"stat3Label\", \"Satisfaction Rate\") },\r\n { value: t(\"stat4Value\", \"15+\"), label: t(\"stat4Label\", \"Years Experience\") },\r\n ];\r\n\r\n const companies = [\"Google\", \"Microsoft\", \"Amazon\", \"Apple\", \"Meta\"];\r\n\r\n return (\r\n <section className={cn(\"py-16 md:py-24\", className)}>\r\n <div className=\"w-full max-w-[var(--container-max-width)] mx-auto px-4\">\r\n {/* Header */}\r\n <div className=\"grid md:grid-cols-2 gap-8 mb-12\">\r\n <h2 className=\"text-3xl md:text-4xl lg:text-5xl font-bold\">\r\n {t(\"title\", \"About Our Company\")}\r\n </h2>\r\n <p className=\"text-muted-foreground text-lg\">\r\n {t(\"description\", \"We are a passionate team dedicated to creating innovative solutions that empower businesses to thrive in the digital age. Our mission is to deliver excellence in everything we do.\")}\r\n </p>\r\n </div>\r\n\r\n {/* Images Grid */}\r\n <div className=\"grid lg:grid-cols-3 gap-6 mb-16\">\r\n {/* Main Image */}\r\n <div className=\"lg:col-span-2\">\r\n <div className=\"aspect-[16/10] lg:aspect-auto lg:h-full rounded-2xl bg-muted overflow-hidden\">\r\n <img\r\n src=\"/images/placeholder.png\"\r\n alt={t(\"mainImageAlt\", \"Our team\")}\r\n className=\"w-full h-full object-cover\"\r\n onError={(e) => {\r\n e.currentTarget.style.display = \"none\";\r\n }}\r\n />\r\n </div>\r\n </div>\r\n\r\n {/* Side Column */}\r\n <div className=\"flex flex-col gap-6\">\r\n {/* Info Card */}\r\n <div className=\"bg-muted rounded-2xl p-6 flex flex-col justify-between flex-1\">\r\n <div>\r\n <h3 className=\"text-lg font-semibold mb-2\">\r\n {t(\"cardTitle\", \"Our Mission\")}\r\n </h3>\r\n <p className=\"text-muted-foreground text-sm mb-4\">\r\n {t(\"cardDescription\", \"Providing businesses with effective tools to improve workflows, boost efficiency, and encourage sustainable growth.\")}\r\n </p>\r\n </div>\r\n <Button variant=\"outline\" asChild className=\"w-fit\">\r\n <Link to=\"/about\">{t(\"cardButton\", \"Learn More\")}</Link>\r\n </Button>\r\n </div>\r\n\r\n {/* Secondary Image */}\r\n <div className=\"aspect-square rounded-2xl bg-muted overflow-hidden flex-1\">\r\n <img\r\n src=\"/images/placeholder.png\"\r\n alt={t(\"secondaryImageAlt\", \"Our office\")}\r\n className=\"w-full h-full object-cover\"\r\n onError={(e) => {\r\n e.currentTarget.style.display = \"none\";\r\n }}\r\n />\r\n </div>\r\n </div>\r\n </div>\r\n\r\n {/* Companies */}\r\n <div className=\"text-center mb-16\">\r\n <p className=\"text-muted-foreground mb-6\">\r\n {t(\"companiesTitle\", \"Trusted by leading companies worldwide\")}\r\n </p>\r\n <div className=\"flex flex-wrap justify-center items-center gap-8 md:gap-12\">\r\n {companies.map((company) => (\r\n <span\r\n key={company}\r\n className=\"text-xl md:text-2xl font-semibold text-muted-foreground/50\"\r\n >\r\n {company}\r\n </span>\r\n ))}\r\n </div>\r\n </div>\r\n\r\n {/* Stats */}\r\n <div className=\"bg-muted rounded-2xl p-8 md:p-12\">\r\n <div className=\"text-center md:text-left mb-8\">\r\n <h3 className=\"text-2xl md:text-3xl font-bold mb-2\">\r\n {t(\"statsTitle\", \"Our Achievements\")}\r\n </h3>\r\n <p className=\"text-muted-foreground max-w-xl\">\r\n {t(\"statsDescription\", \"Numbers that reflect our commitment to excellence and client satisfaction.\")}\r\n </p>\r\n </div>\r\n <div className=\"grid grid-cols-2 lg:grid-cols-4 gap-8\">\r\n {stats.map((stat, index) => (\r\n <div key={index} className=\"text-center\">\r\n <div className=\"text-3xl md:text-4xl lg:text-5xl font-bold text-primary mb-2\">\r\n {stat.value}\r\n </div>\r\n <p className=\"text-sm md:text-base text-muted-foreground\">\r\n {stat.label}\r\n </p>\r\n </div>\r\n ))}\r\n </div>\r\n </div>\r\n </div>\r\n </section>\r\n );\r\n}\r\n"
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
22
|
"path": "about-section/lang/en.json",
|
|
23
23
|
"type": "registry:lang",
|
|
24
24
|
"target": "$modules$/about-section/lang/en.json",
|
|
25
|
-
"content": "{\n \"title\": \"About Us\",\n \"description\": \"We're a team of passionate professionals dedicated to delivering exceptional results for our clients.\",\n \"mainImageAlt\": \"Our team\",\n \"secondaryImageAlt\": \"Our office\",\n \"cardTitle\": \"Our Mission\",\n \"cardDescription\": \"To empower businesses with innovative solutions that drive growth and success.\",\n \"cardButton\": \"Learn More\",\n \"companiesTitle\": \"Trusted by Leading Brands\",\n \"statsTitle\": \"Our Achievements\",\n \"statsDescription\": \"Numbers that showcase our commitment to excellence.\",\n \"stat1Value\": \"500+\",\n \"stat1Label\": \"Happy Clients\",\n \"stat2Value\": \"1000+\",\n \"stat2Label\": \"Projects Completed\",\n \"stat3Value\": \"99%\",\n \"stat3Label\": \"Satisfaction Rate\",\n \"stat4Value\": \"15+\",\n \"stat4Label\": \"Years Experience\"\n}"
|
|
25
|
+
"content": "{\r\n \"title\": \"About Us\",\r\n \"description\": \"We're a team of passionate professionals dedicated to delivering exceptional results for our clients.\",\r\n \"mainImageAlt\": \"Our team\",\r\n \"secondaryImageAlt\": \"Our office\",\r\n \"cardTitle\": \"Our Mission\",\r\n \"cardDescription\": \"To empower businesses with innovative solutions that drive growth and success.\",\r\n \"cardButton\": \"Learn More\",\r\n \"companiesTitle\": \"Trusted by Leading Brands\",\r\n \"statsTitle\": \"Our Achievements\",\r\n \"statsDescription\": \"Numbers that showcase our commitment to excellence.\",\r\n \"stat1Value\": \"500+\",\r\n \"stat1Label\": \"Happy Clients\",\r\n \"stat2Value\": \"1000+\",\r\n \"stat2Label\": \"Projects Completed\",\r\n \"stat3Value\": \"99%\",\r\n \"stat3Label\": \"Satisfaction Rate\",\r\n \"stat4Value\": \"15+\",\r\n \"stat4Label\": \"Years Experience\"\r\n}"
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
28
|
"path": "about-section/lang/tr.json",
|
|
29
29
|
"type": "registry:lang",
|
|
30
30
|
"target": "$modules$/about-section/lang/tr.json",
|
|
31
|
-
"content": "{\n \"title\": \"Hakkımızda\",\n \"description\": \"Müşterilerimize olağanüstü sonuçlar sunmaya kendini adamış, tutkulu profesyonellerden oluşan bir ekibiz.\",\n \"mainImageAlt\": \"Ekibimiz\",\n \"secondaryImageAlt\": \"Ofisimiz\",\n \"cardTitle\": \"Misyonumuz\",\n \"cardDescription\": \"İşletmeleri büyüme ve başarı sağlayan yenilikçi çözümlerle güçlendirmek.\",\n \"cardButton\": \"Daha Fazla\",\n \"companiesTitle\": \"Önde Gelen Markalar Tarafından Güvenilir\",\n \"statsTitle\": \"Başarılarımız\",\n \"statsDescription\": \"Mükemmeliyete olan bağlılığımızı gösteren rakamlar.\",\n \"stat1Value\": \"500+\",\n \"stat1Label\": \"Mutlu Müşteri\",\n \"stat2Value\": \"1000+\",\n \"stat2Label\": \"Tamamlanan Proje\",\n \"stat3Value\": \"%99\",\n \"stat3Label\": \"Memnuniyet Oranı\",\n \"stat4Value\": \"15+\",\n \"stat4Label\": \"Yıllık Deneyim\"\n}"
|
|
31
|
+
"content": "{\r\n \"title\": \"Hakkımızda\",\r\n \"description\": \"Müşterilerimize olağanüstü sonuçlar sunmaya kendini adamış, tutkulu profesyonellerden oluşan bir ekibiz.\",\r\n \"mainImageAlt\": \"Ekibimiz\",\r\n \"secondaryImageAlt\": \"Ofisimiz\",\r\n \"cardTitle\": \"Misyonumuz\",\r\n \"cardDescription\": \"İşletmeleri büyüme ve başarı sağlayan yenilikçi çözümlerle güçlendirmek.\",\r\n \"cardButton\": \"Daha Fazla\",\r\n \"companiesTitle\": \"Önde Gelen Markalar Tarafından Güvenilir\",\r\n \"statsTitle\": \"Başarılarımız\",\r\n \"statsDescription\": \"Mükemmeliyete olan bağlılığımızı gösteren rakamlar.\",\r\n \"stat1Value\": \"500+\",\r\n \"stat1Label\": \"Mutlu Müşteri\",\r\n \"stat2Value\": \"1000+\",\r\n \"stat2Label\": \"Tamamlanan Proje\",\r\n \"stat3Value\": \"%99\",\r\n \"stat3Label\": \"Memnuniyet Oranı\",\r\n \"stat4Value\": \"15+\",\r\n \"stat4Label\": \"Yıllık Deneyim\"\r\n}"
|
|
32
32
|
}
|
|
33
33
|
],
|
|
34
34
|
"exports": {
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
"path": "animations/index.ts",
|
|
14
14
|
"type": "registry:index",
|
|
15
15
|
"target": "$modules$/animations/index.ts",
|
|
16
|
-
"content": "export * from \"./animations\";\nexport * from \"./components\";\n"
|
|
16
|
+
"content": "export * from \"./animations\";\r\nexport * from \"./components\";\r\n"
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
"path": "animations/animations.ts",
|
|
20
20
|
"type": "registry:lib",
|
|
21
21
|
"target": "$modules$/animations/animations.ts",
|
|
22
|
-
"content": "import type { Variants, Transition } from \"motion/react\";\n\n/**\n * Fade in from bottom animation\n * Use for: Hero sections, cards on scroll, page content\n */\nexport const fadeInUp: Variants = {\n initial: { opacity: 0, y: 20 },\n animate: { opacity: 1, y: 0 },\n exit: { opacity: 0, y: -10 },\n};\n\n/**\n * Fade in from top animation\n * Use for: Dropdowns, modals, notifications\n */\nexport const fadeInDown: Variants = {\n initial: { opacity: 0, y: -20 },\n animate: { opacity: 1, y: 0 },\n exit: { opacity: 0, y: -10 },\n};\n\n/**\n * Slide in from left animation\n * Use for: Sidebars, navigation, list items\n */\nexport const slideInLeft: Variants = {\n initial: { opacity: 0, x: -20 },\n animate: { opacity: 1, x: 0 },\n exit: { opacity: 0, x: -20 },\n};\n\n/**\n * Slide in from right animation\n * Use for: Panels, drawers, cart sidebars\n */\nexport const slideInRight: Variants = {\n initial: { opacity: 0, x: 20 },\n animate: { opacity: 1, x: 0 },\n exit: { opacity: 0, x: 20 },\n};\n\n/**\n * Scale up animation\n * Use for: Modals, popups, dialogs\n */\nexport const scaleUp: Variants = {\n initial: { opacity: 0, scale: 0.95 },\n animate: { opacity: 1, scale: 1 },\n exit: { opacity: 0, scale: 0.95 },\n};\n\n/**\n * Simple fade animation\n * Use for: Overlays, backgrounds, subtle transitions\n */\nexport const fade: Variants = {\n initial: { opacity: 0 },\n animate: { opacity: 1 },\n exit: { opacity: 0 },\n};\n\n/**\n * Stagger container for child animations\n * Use with children that have their own variants\n *\n * @example\n * <motion.div variants={staggerContainer} initial=\"initial\" animate=\"animate\">\n * {items.map(item => (\n * <motion.div key={item.id} variants={fadeInUp}>\n * {item.content}\n * </motion.div>\n * ))}\n * </motion.div>\n */\nexport const staggerContainer: Variants = {\n initial: {},\n animate: {\n transition: {\n staggerChildren: 0.1,\n delayChildren: 0.1,\n },\n },\n};\n\n/**\n * Fast stagger for many items\n */\nexport const staggerContainerFast: Variants = {\n initial: {},\n animate: {\n transition: {\n staggerChildren: 0.05,\n delayChildren: 0.05,\n },\n },\n};\n\n/**\n * Slow stagger for fewer, larger items\n */\nexport const staggerContainerSlow: Variants = {\n initial: {},\n animate: {\n transition: {\n staggerChildren: 0.15,\n delayChildren: 0.2,\n },\n },\n};\n\n/**\n * Default spring transition\n * Use for: Most animations\n */\nexport const springTransition: Transition = {\n type: \"spring\",\n stiffness: 300,\n damping: 30,\n};\n\n/**\n * Smooth ease transition\n * Use for: Subtle, elegant animations\n */\nexport const easeTransition: Transition = {\n type: \"tween\",\n ease: \"easeOut\",\n duration: 0.3,\n};\n\n/**\n * Quick transition\n * Use for: Hover effects, quick feedback\n */\nexport const quickTransition: Transition = {\n type: \"tween\",\n ease: \"easeOut\",\n duration: 0.15,\n};\n\n/**\n * Hover scale effect props\n * Use with motion components for card hover effects\n *\n * @example\n * <motion.div {...hoverScale}>\n * <Card>...</Card>\n * </motion.div>\n */\nexport const hoverScale = {\n whileHover: { scale: 1.02 },\n whileTap: { scale: 0.98 },\n transition: springTransition,\n};\n\n/**\n * Subtle hover scale for smaller elements\n */\nexport const hoverScaleSubtle = {\n whileHover: { scale: 1.01 },\n whileTap: { scale: 0.99 },\n transition: quickTransition,\n};\n\n/**\n * Hover lift effect (scale + shadow simulation via y)\n */\nexport const hoverLift = {\n whileHover: { scale: 1.02, y: -4 },\n whileTap: { scale: 0.98, y: 0 },\n transition: springTransition,\n};\n\n/**\n * Button press effect\n */\nexport const buttonPress = {\n whileHover: { scale: 1.02 },\n whileTap: { scale: 0.95 },\n transition: quickTransition,\n};\n\n/**\n * Icon hover rotation\n */\nexport const iconHoverRotate = {\n whileHover: { rotate: 15 },\n transition: springTransition,\n};\n\n/**\n * Accordion/collapse animation variants\n * Use with AnimatePresence for expand/collapse\n *\n * @example\n * <AnimatePresence>\n * {isOpen && (\n * <motion.div\n * variants={collapseVariants}\n * initial=\"collapsed\"\n * animate=\"expanded\"\n * exit=\"collapsed\"\n * >\n * Content\n * </motion.div>\n * )}\n * </AnimatePresence>\n */\nexport const collapseVariants: Variants = {\n collapsed: {\n height: 0,\n opacity: 0,\n overflow: \"hidden\",\n },\n expanded: {\n height: \"auto\",\n opacity: 1,\n overflow: \"visible\",\n transition: {\n height: { duration: 0.3, ease: \"easeOut\" },\n opacity: { duration: 0.2, delay: 0.1 },\n },\n },\n};\n\n/**\n * Page transition variants\n * Use for route transitions with AnimatePresence\n */\nexport const pageTransition: Variants = {\n initial: { opacity: 0, y: 10 },\n animate: {\n opacity: 1,\n y: 0,\n transition: {\n duration: 0.3,\n ease: \"easeOut\",\n },\n },\n exit: {\n opacity: 0,\n y: -10,\n transition: {\n duration: 0.2,\n ease: \"easeIn\",\n },\n },\n};\n\n/**\n * Carousel slide variants\n * Direction should be passed as custom prop\n *\n * @example\n * <motion.div\n * custom={direction}\n * variants={carouselSlide}\n * initial=\"enter\"\n * animate=\"center\"\n * exit=\"exit\"\n * >\n */\nexport const carouselSlide: Variants = {\n enter: (direction: number) => ({\n x: direction > 0 ? 300 : -300,\n opacity: 0,\n }),\n center: {\n x: 0,\n opacity: 1,\n transition: {\n x: { type: \"spring\", stiffness: 300, damping: 30 },\n opacity: { duration: 0.2 },\n },\n },\n exit: (direction: number) => ({\n x: direction < 0 ? 300 : -300,\n opacity: 0,\n transition: {\n x: { type: \"spring\", stiffness: 300, damping: 30 },\n opacity: { duration: 0.2 },\n },\n }),\n};\n\n/**\n * Notification/toast animation\n */\nexport const notificationVariants: Variants = {\n initial: { opacity: 0, y: -20, scale: 0.95 },\n animate: {\n opacity: 1,\n y: 0,\n scale: 1,\n transition: springTransition,\n },\n exit: {\n opacity: 0,\n y: -20,\n scale: 0.95,\n transition: quickTransition,\n },\n};\n\n/**\n * List item animation for staggered lists\n */\nexport const listItem: Variants = {\n initial: { opacity: 0, x: -10 },\n animate: { opacity: 1, x: 0 },\n exit: { opacity: 0, x: 10 },\n};\n\n/**\n * Grid item animation for staggered grids\n */\nexport const gridItem: Variants = {\n initial: { opacity: 0, scale: 0.9 },\n animate: { opacity: 1, scale: 1 },\n exit: { opacity: 0, scale: 0.9 },\n};\n"
|
|
22
|
+
"content": "import type { Variants, Transition } from \"motion/react\";\r\n\r\n/**\r\n * Fade in from bottom animation\r\n * Use for: Hero sections, cards on scroll, page content\r\n */\r\nexport const fadeInUp: Variants = {\r\n initial: { opacity: 0, y: 20 },\r\n animate: { opacity: 1, y: 0 },\r\n exit: { opacity: 0, y: -10 },\r\n};\r\n\r\n/**\r\n * Fade in from top animation\r\n * Use for: Dropdowns, modals, notifications\r\n */\r\nexport const fadeInDown: Variants = {\r\n initial: { opacity: 0, y: -20 },\r\n animate: { opacity: 1, y: 0 },\r\n exit: { opacity: 0, y: -10 },\r\n};\r\n\r\n/**\r\n * Slide in from left animation\r\n * Use for: Sidebars, navigation, list items\r\n */\r\nexport const slideInLeft: Variants = {\r\n initial: { opacity: 0, x: -20 },\r\n animate: { opacity: 1, x: 0 },\r\n exit: { opacity: 0, x: -20 },\r\n};\r\n\r\n/**\r\n * Slide in from right animation\r\n * Use for: Panels, drawers, cart sidebars\r\n */\r\nexport const slideInRight: Variants = {\r\n initial: { opacity: 0, x: 20 },\r\n animate: { opacity: 1, x: 0 },\r\n exit: { opacity: 0, x: 20 },\r\n};\r\n\r\n/**\r\n * Scale up animation\r\n * Use for: Modals, popups, dialogs\r\n */\r\nexport const scaleUp: Variants = {\r\n initial: { opacity: 0, scale: 0.95 },\r\n animate: { opacity: 1, scale: 1 },\r\n exit: { opacity: 0, scale: 0.95 },\r\n};\r\n\r\n/**\r\n * Simple fade animation\r\n * Use for: Overlays, backgrounds, subtle transitions\r\n */\r\nexport const fade: Variants = {\r\n initial: { opacity: 0 },\r\n animate: { opacity: 1 },\r\n exit: { opacity: 0 },\r\n};\r\n\r\n/**\r\n * Stagger container for child animations\r\n * Use with children that have their own variants\r\n *\r\n * @example\r\n * <motion.div variants={staggerContainer} initial=\"initial\" animate=\"animate\">\r\n * {items.map(item => (\r\n * <motion.div key={item.id} variants={fadeInUp}>\r\n * {item.content}\r\n * </motion.div>\r\n * ))}\r\n * </motion.div>\r\n */\r\nexport const staggerContainer: Variants = {\r\n initial: {},\r\n animate: {\r\n transition: {\r\n staggerChildren: 0.1,\r\n delayChildren: 0.1,\r\n },\r\n },\r\n};\r\n\r\n/**\r\n * Fast stagger for many items\r\n */\r\nexport const staggerContainerFast: Variants = {\r\n initial: {},\r\n animate: {\r\n transition: {\r\n staggerChildren: 0.05,\r\n delayChildren: 0.05,\r\n },\r\n },\r\n};\r\n\r\n/**\r\n * Slow stagger for fewer, larger items\r\n */\r\nexport const staggerContainerSlow: Variants = {\r\n initial: {},\r\n animate: {\r\n transition: {\r\n staggerChildren: 0.15,\r\n delayChildren: 0.2,\r\n },\r\n },\r\n};\r\n\r\n/**\r\n * Default spring transition\r\n * Use for: Most animations\r\n */\r\nexport const springTransition: Transition = {\r\n type: \"spring\",\r\n stiffness: 300,\r\n damping: 30,\r\n};\r\n\r\n/**\r\n * Smooth ease transition\r\n * Use for: Subtle, elegant animations\r\n */\r\nexport const easeTransition: Transition = {\r\n type: \"tween\",\r\n ease: \"easeOut\",\r\n duration: 0.3,\r\n};\r\n\r\n/**\r\n * Quick transition\r\n * Use for: Hover effects, quick feedback\r\n */\r\nexport const quickTransition: Transition = {\r\n type: \"tween\",\r\n ease: \"easeOut\",\r\n duration: 0.15,\r\n};\r\n\r\n/**\r\n * Hover scale effect props\r\n * Use with motion components for card hover effects\r\n *\r\n * @example\r\n * <motion.div {...hoverScale}>\r\n * <Card>...</Card>\r\n * </motion.div>\r\n */\r\nexport const hoverScale = {\r\n whileHover: { scale: 1.02 },\r\n whileTap: { scale: 0.98 },\r\n transition: springTransition,\r\n};\r\n\r\n/**\r\n * Subtle hover scale for smaller elements\r\n */\r\nexport const hoverScaleSubtle = {\r\n whileHover: { scale: 1.01 },\r\n whileTap: { scale: 0.99 },\r\n transition: quickTransition,\r\n};\r\n\r\n/**\r\n * Hover lift effect (scale + shadow simulation via y)\r\n */\r\nexport const hoverLift = {\r\n whileHover: { scale: 1.02, y: -4 },\r\n whileTap: { scale: 0.98, y: 0 },\r\n transition: springTransition,\r\n};\r\n\r\n/**\r\n * Button press effect\r\n */\r\nexport const buttonPress = {\r\n whileHover: { scale: 1.02 },\r\n whileTap: { scale: 0.95 },\r\n transition: quickTransition,\r\n};\r\n\r\n/**\r\n * Icon hover rotation\r\n */\r\nexport const iconHoverRotate = {\r\n whileHover: { rotate: 15 },\r\n transition: springTransition,\r\n};\r\n\r\n/**\r\n * Accordion/collapse animation variants\r\n * Use with AnimatePresence for expand/collapse\r\n *\r\n * @example\r\n * <AnimatePresence>\r\n * {isOpen && (\r\n * <motion.div\r\n * variants={collapseVariants}\r\n * initial=\"collapsed\"\r\n * animate=\"expanded\"\r\n * exit=\"collapsed\"\r\n * >\r\n * Content\r\n * </motion.div>\r\n * )}\r\n * </AnimatePresence>\r\n */\r\nexport const collapseVariants: Variants = {\r\n collapsed: {\r\n height: 0,\r\n opacity: 0,\r\n overflow: \"hidden\",\r\n },\r\n expanded: {\r\n height: \"auto\",\r\n opacity: 1,\r\n overflow: \"visible\",\r\n transition: {\r\n height: { duration: 0.3, ease: \"easeOut\" },\r\n opacity: { duration: 0.2, delay: 0.1 },\r\n },\r\n },\r\n};\r\n\r\n/**\r\n * Page transition variants\r\n * Use for route transitions with AnimatePresence\r\n */\r\nexport const pageTransition: Variants = {\r\n initial: { opacity: 0, y: 10 },\r\n animate: {\r\n opacity: 1,\r\n y: 0,\r\n transition: {\r\n duration: 0.3,\r\n ease: \"easeOut\",\r\n },\r\n },\r\n exit: {\r\n opacity: 0,\r\n y: -10,\r\n transition: {\r\n duration: 0.2,\r\n ease: \"easeIn\",\r\n },\r\n },\r\n};\r\n\r\n/**\r\n * Carousel slide variants\r\n * Direction should be passed as custom prop\r\n *\r\n * @example\r\n * <motion.div\r\n * custom={direction}\r\n * variants={carouselSlide}\r\n * initial=\"enter\"\r\n * animate=\"center\"\r\n * exit=\"exit\"\r\n * >\r\n */\r\nexport const carouselSlide: Variants = {\r\n enter: (direction: number) => ({\r\n x: direction > 0 ? 300 : -300,\r\n opacity: 0,\r\n }),\r\n center: {\r\n x: 0,\r\n opacity: 1,\r\n transition: {\r\n x: { type: \"spring\", stiffness: 300, damping: 30 },\r\n opacity: { duration: 0.2 },\r\n },\r\n },\r\n exit: (direction: number) => ({\r\n x: direction < 0 ? 300 : -300,\r\n opacity: 0,\r\n transition: {\r\n x: { type: \"spring\", stiffness: 300, damping: 30 },\r\n opacity: { duration: 0.2 },\r\n },\r\n }),\r\n};\r\n\r\n/**\r\n * Notification/toast animation\r\n */\r\nexport const notificationVariants: Variants = {\r\n initial: { opacity: 0, y: -20, scale: 0.95 },\r\n animate: {\r\n opacity: 1,\r\n y: 0,\r\n scale: 1,\r\n transition: springTransition,\r\n },\r\n exit: {\r\n opacity: 0,\r\n y: -20,\r\n scale: 0.95,\r\n transition: quickTransition,\r\n },\r\n};\r\n\r\n/**\r\n * List item animation for staggered lists\r\n */\r\nexport const listItem: Variants = {\r\n initial: { opacity: 0, x: -10 },\r\n animate: { opacity: 1, x: 0 },\r\n exit: { opacity: 0, x: 10 },\r\n};\r\n\r\n/**\r\n * Grid item animation for staggered grids\r\n */\r\nexport const gridItem: Variants = {\r\n initial: { opacity: 0, scale: 0.9 },\r\n animate: { opacity: 1, scale: 1 },\r\n exit: { opacity: 0, scale: 0.9 },\r\n};\r\n"
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
25
|
"path": "animations/components.tsx",
|
|
@@ -13,25 +13,25 @@
|
|
|
13
13
|
"path": "announcement-bar/index.ts",
|
|
14
14
|
"type": "registry:index",
|
|
15
15
|
"target": "$modules$/announcement-bar/index.ts",
|
|
16
|
-
"content": "export { AnnouncementBar } from \"./announcement-bar\";\n"
|
|
16
|
+
"content": "export { AnnouncementBar } from \"./announcement-bar\";\r\n"
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
"path": "announcement-bar/announcement-bar.tsx",
|
|
20
20
|
"type": "registry:component",
|
|
21
21
|
"target": "$modules$/announcement-bar/announcement-bar.tsx",
|
|
22
|
-
"content": "import { useState } from \"react\";\nimport { Link } from \"react-router\";\nimport { useTranslation } from \"react-i18next\";\nimport { X, ArrowRight, Sparkles, Megaphone, Gift, Zap } from \"lucide-react\";\nimport { cn } from \"@/lib/utils\";\nimport { motion, AnimatePresence } from \"motion/react\";\n\ntype BarVariant = \"default\" | \"primary\" | \"warning\" | \"success\" | \"gradient\";\n\ninterface AnnouncementBarProps {\n message?: string;\n linkText?: string;\n linkUrl?: string;\n variant?: BarVariant;\n icon?: \"sparkles\" | \"megaphone\" | \"gift\" | \"zap\" | \"none\";\n dismissible?: boolean;\n storageKey?: string;\n className?: string;\n}\n\nconst icons = {\n sparkles: Sparkles,\n megaphone: Megaphone,\n gift: Gift,\n zap: Zap,\n none: null,\n};\n\nconst variantStyles: Record<BarVariant, string> = {\n default: \"bg-muted text-muted-foreground\",\n primary: \"bg-primary text-primary-foreground\",\n warning: \"bg-yellow-500 text-yellow-950\",\n success: \"bg-green-500 text-white\",\n gradient: \"bg-gradient-to-r from-primary via-purple-500 to-pink-500 text-white\",\n};\n\nexport function AnnouncementBar({\n message,\n linkText,\n linkUrl = \"#\",\n variant = \"primary\",\n icon = \"sparkles\",\n dismissible = true,\n storageKey = \"announcement-bar-dismissed\",\n className,\n}: AnnouncementBarProps) {\n const { t } = useTranslation(\"announcement-bar\");\n const [isVisible, setIsVisible] = useState(() => {\n if (typeof window === \"undefined\") return false;\n if (dismissible) {\n return !localStorage.getItem(storageKey);\n }\n return true;\n });\n\n const displayMessage = message || t(\"message\", \"Exciting news! Check out our latest features.\");\n const displayLinkText = linkText || t(\"linkText\", \"Learn more\");\n\n const handleDismiss = () => {\n if (dismissible) {\n localStorage.setItem(storageKey, \"true\");\n }\n setIsVisible(false);\n };\n\n const IconComponent = icons[icon];\n\n return (\n <AnimatePresence>\n {isVisible && (\n <motion.div\n initial={{ height: 0, opacity: 0 }}\n animate={{ height: \"auto\", opacity: 1 }}\n exit={{ height: 0, opacity: 0 }}\n transition={{ duration: 0.3 }}\n className={cn(\n \"relative overflow-hidden\",\n variantStyles[variant],\n className\n )}\n >\n <div className=\"w-full max-w-[var(--container-max-width)] mx-auto px-4\">\n <div className=\"flex items-center justify-center gap-2 py-2.5 text-sm font-medium\">\n {IconComponent && (\n <IconComponent className=\"h-4 w-4 flex-shrink-0\" />\n )}\n <span className=\"text-center\">{displayMessage}</span>\n {linkUrl && (\n <Link\n to={linkUrl}\n className=\"inline-flex items-center gap-1 font-semibold hover:underline underline-offset-2\"\n >\n {displayLinkText}\n <ArrowRight className=\"h-3 w-3\" />\n </Link>\n )}\n {dismissible && (\n <button\n onClick={handleDismiss}\n className=\"absolute right-4 p-1 rounded hover:bg-black/10 transition-colors\"\n aria-label={t(\"dismiss\", \"Dismiss\")}\n >\n <X className=\"h-4 w-4\" />\n </button>\n )}\n </div>\n </div>\n </motion.div>\n )}\n </AnimatePresence>\n );\n}\n"
|
|
22
|
+
"content": "import { useState } from \"react\";\r\nimport { Link } from \"react-router\";\r\nimport { useTranslation } from \"react-i18next\";\r\nimport { X, ArrowRight, Sparkles, Megaphone, Gift, Zap } from \"lucide-react\";\r\nimport { cn } from \"@/lib/utils\";\r\nimport { motion, AnimatePresence } from \"motion/react\";\r\n\r\ntype BarVariant = \"default\" | \"primary\" | \"warning\" | \"success\" | \"gradient\";\r\n\r\ninterface AnnouncementBarProps {\r\n message?: string;\r\n linkText?: string;\r\n linkUrl?: string;\r\n variant?: BarVariant;\r\n icon?: \"sparkles\" | \"megaphone\" | \"gift\" | \"zap\" | \"none\";\r\n dismissible?: boolean;\r\n storageKey?: string;\r\n className?: string;\r\n}\r\n\r\nconst icons = {\r\n sparkles: Sparkles,\r\n megaphone: Megaphone,\r\n gift: Gift,\r\n zap: Zap,\r\n none: null,\r\n};\r\n\r\nconst variantStyles: Record<BarVariant, string> = {\r\n default: \"bg-muted text-muted-foreground\",\r\n primary: \"bg-primary text-primary-foreground\",\r\n warning: \"bg-yellow-500 text-yellow-950\",\r\n success: \"bg-green-500 text-white\",\r\n gradient: \"bg-gradient-to-r from-primary via-purple-500 to-pink-500 text-white\",\r\n};\r\n\r\nexport function AnnouncementBar({\r\n message,\r\n linkText,\r\n linkUrl = \"#\",\r\n variant = \"primary\",\r\n icon = \"sparkles\",\r\n dismissible = true,\r\n storageKey = \"announcement-bar-dismissed\",\r\n className,\r\n}: AnnouncementBarProps) {\r\n const { t } = useTranslation(\"announcement-bar\");\r\n const [isVisible, setIsVisible] = useState(() => {\r\n if (typeof window === \"undefined\") return false;\r\n if (dismissible) {\r\n return !localStorage.getItem(storageKey);\r\n }\r\n return true;\r\n });\r\n\r\n const displayMessage = message || t(\"message\", \"Exciting news! Check out our latest features.\");\r\n const displayLinkText = linkText || t(\"linkText\", \"Learn more\");\r\n\r\n const handleDismiss = () => {\r\n if (dismissible) {\r\n localStorage.setItem(storageKey, \"true\");\r\n }\r\n setIsVisible(false);\r\n };\r\n\r\n const IconComponent = icons[icon];\r\n\r\n return (\r\n <AnimatePresence>\r\n {isVisible && (\r\n <motion.div\r\n initial={{ height: 0, opacity: 0 }}\r\n animate={{ height: \"auto\", opacity: 1 }}\r\n exit={{ height: 0, opacity: 0 }}\r\n transition={{ duration: 0.3 }}\r\n className={cn(\r\n \"relative overflow-hidden\",\r\n variantStyles[variant],\r\n className\r\n )}\r\n >\r\n <div className=\"w-full max-w-[var(--container-max-width)] mx-auto px-4\">\r\n <div className=\"flex items-center justify-center gap-2 py-2.5 text-sm font-medium\">\r\n {IconComponent && (\r\n <IconComponent className=\"h-4 w-4 flex-shrink-0\" />\r\n )}\r\n <span className=\"text-center\">{displayMessage}</span>\r\n {linkUrl && (\r\n <Link\r\n to={linkUrl}\r\n className=\"inline-flex items-center gap-1 font-semibold hover:underline underline-offset-2\"\r\n >\r\n {displayLinkText}\r\n <ArrowRight className=\"h-3 w-3\" />\r\n </Link>\r\n )}\r\n {dismissible && (\r\n <button\r\n onClick={handleDismiss}\r\n className=\"absolute right-4 p-1 rounded hover:bg-black/10 transition-colors\"\r\n aria-label={t(\"dismiss\", \"Dismiss\")}\r\n >\r\n <X className=\"h-4 w-4\" />\r\n </button>\r\n )}\r\n </div>\r\n </div>\r\n </motion.div>\r\n )}\r\n </AnimatePresence>\r\n );\r\n}\r\n"
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
25
|
"path": "announcement-bar/lang/en.json",
|
|
26
26
|
"type": "registry:lang",
|
|
27
27
|
"target": "$modules$/announcement-bar/lang/en.json",
|
|
28
|
-
"content": "{\n \"message\": \"Important announcement: Limited time offer - Learn more →\",\n \"linkText\": \"Learn more\",\n \"dismiss\": \"Dismiss\"\n}"
|
|
28
|
+
"content": "{\r\n \"message\": \"Important announcement: Limited time offer - Learn more →\",\r\n \"linkText\": \"Learn more\",\r\n \"dismiss\": \"Dismiss\"\r\n}"
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
31
|
"path": "announcement-bar/lang/tr.json",
|
|
32
32
|
"type": "registry:lang",
|
|
33
33
|
"target": "$modules$/announcement-bar/lang/tr.json",
|
|
34
|
-
"content": "{\n \"message\": \"Önemli duyuru: Sınırlı süreli kampanya - Detaylar →\",\n \"linkText\": \"Daha fazla\",\n \"dismiss\": \"Kapat\"\n}"
|
|
34
|
+
"content": "{\r\n \"message\": \"Önemli duyuru: Sınırlı süreli kampanya - Detaylar →\",\r\n \"linkText\": \"Daha fazla\",\r\n \"dismiss\": \"Kapat\"\r\n}"
|
|
35
35
|
}
|
|
36
36
|
],
|
|
37
37
|
"exports": {
|
package/dist/registry/api.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"path": "api/index.ts",
|
|
14
14
|
"type": "registry:index",
|
|
15
15
|
"target": "$modules$/api/index.ts",
|
|
16
|
-
"content": "export { customerClient } from \"./customer-client\";\nexport type { ApiClient } from \"./customer-client\";\nexport { getErrorMessage } from \"./get-error-message\";\n"
|
|
16
|
+
"content": "export { customerClient } from \"./customer-client\";\r\nexport type { ApiClient } from \"./customer-client\";\r\nexport { getErrorMessage } from \"./get-error-message\";\r\n"
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
"path": "api/customer-client.ts",
|
|
@@ -15,19 +15,19 @@
|
|
|
15
15
|
"path": "auth-core/index.ts",
|
|
16
16
|
"type": "registry:index",
|
|
17
17
|
"target": "$modules$/auth-core/index.ts",
|
|
18
|
-
"content": "// Store\nexport { useAuthStore } from \"./auth-store\";\nexport type { User, AuthTokens } from \"./auth-store\";\n\n// Hook\nexport { useAuth } from \"./use-auth\";\n"
|
|
18
|
+
"content": "// Store\r\nexport { useAuthStore } from \"./auth-store\";\r\nexport type { User, AuthTokens } from \"./auth-store\";\r\n\r\n// Hook\r\nexport { useAuth } from \"./use-auth\";\r\n"
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
"path": "auth-core/auth-store.ts",
|
|
22
22
|
"type": "registry:store",
|
|
23
23
|
"target": "$modules$/auth-core/auth-store.ts",
|
|
24
|
-
"content": "import { create } from \"zustand\";\nimport { persist } from \"zustand/middleware\";\n\nexport interface User {\n username: string;\n email?: string;\n}\n\nexport interface AuthTokens {\n accessToken: string;\n refreshToken?: string;\n idToken?: string;\n encryptionKey?: string;\n expiresAt?: number; // Unix timestamp in milliseconds\n}\n\ninterface AuthState {\n user: User | null;\n tokens: AuthTokens | null;\n isAuthenticated: boolean;\n setAuth: (user: User, tokens: AuthTokens) => void;\n updateTokens: (tokens: AuthTokens) => void;\n clearAuth: () => void;\n isTokenExpired: () => boolean;\n getTimeUntilExpiry: () => number | null;\n}\n\nexport const useAuthStore = create<AuthState>()(\n persist(\n (set, get) => ({\n user: null,\n tokens: null,\n isAuthenticated: false,\n\n setAuth: (user, tokens) => set({ user, tokens, isAuthenticated: true }),\n\n updateTokens: (tokens) => set({ tokens }),\n\n clearAuth: () =>\n set({ user: null, tokens: null, isAuthenticated: false }),\n\n isTokenExpired: () => {\n const { tokens } = get();\n if (!tokens?.expiresAt) return false;\n // Consider token expired 30 seconds before actual expiry for safety margin\n return Date.now() >= tokens.expiresAt - 30000;\n },\n\n getTimeUntilExpiry: () => {\n const { tokens } = get();\n if (!tokens?.expiresAt) return null;\n return tokens.expiresAt - Date.now();\n },\n }),\n { name: \"auth-storage\" },\n ),\n);\n"
|
|
24
|
+
"content": "import { create } from \"zustand\";\r\nimport { persist } from \"zustand/middleware\";\r\n\r\nexport interface User {\r\n username: string;\r\n email?: string;\r\n}\r\n\r\nexport interface AuthTokens {\r\n accessToken: string;\r\n refreshToken?: string;\r\n idToken?: string;\r\n encryptionKey?: string;\r\n expiresAt?: number; // Unix timestamp in milliseconds\r\n}\r\n\r\ninterface AuthState {\r\n user: User | null;\r\n tokens: AuthTokens | null;\r\n isAuthenticated: boolean;\r\n setAuth: (user: User, tokens: AuthTokens) => void;\r\n updateTokens: (tokens: AuthTokens) => void;\r\n clearAuth: () => void;\r\n isTokenExpired: () => boolean;\r\n getTimeUntilExpiry: () => number | null;\r\n}\r\n\r\nexport const useAuthStore = create<AuthState>()(\r\n persist(\r\n (set, get) => ({\r\n user: null,\r\n tokens: null,\r\n isAuthenticated: false,\r\n\r\n setAuth: (user, tokens) => set({ user, tokens, isAuthenticated: true }),\r\n\r\n updateTokens: (tokens) => set({ tokens }),\r\n\r\n clearAuth: () =>\r\n set({ user: null, tokens: null, isAuthenticated: false }),\r\n\r\n isTokenExpired: () => {\r\n const { tokens } = get();\r\n if (!tokens?.expiresAt) return false;\r\n // Consider token expired 30 seconds before actual expiry for safety margin\r\n return Date.now() >= tokens.expiresAt - 30000;\r\n },\r\n\r\n getTimeUntilExpiry: () => {\r\n const { tokens } = get();\r\n if (!tokens?.expiresAt) return null;\r\n return tokens.expiresAt - Date.now();\r\n },\r\n }),\r\n { name: \"auth-storage\" },\r\n ),\r\n);\r\n"
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
"path": "auth-core/use-auth.ts",
|
|
28
28
|
"type": "registry:hook",
|
|
29
29
|
"target": "$modules$/auth-core/use-auth.ts",
|
|
30
|
-
"content": "import { useCallback, useEffect, useRef } from \"react\";\nimport {\n useAuthStore,\n type User,\n type AuthTokens,\n} from \"./auth-store\";\nimport { customerClient } from \"@/modules/api\";\n\n// Refresh token 1 minute before expiry\nconst REFRESH_BUFFER_MS = 60 * 1000;\n\nexport function useAuth() {\n const {\n user,\n tokens,\n isAuthenticated,\n setAuth,\n updateTokens,\n clearAuth,\n isTokenExpired,\n getTimeUntilExpiry,\n } = useAuthStore();\n\n const refreshTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const isRefreshingRef = useRef(false);\n\n // Refresh token using the refresh token\n const refreshAccessToken = useCallback(async (): Promise<boolean> => {\n const currentTokens = useAuthStore.getState().tokens;\n\n // Don't refresh if no refresh token exists\n if (!currentTokens?.refreshToken || isRefreshingRef.current) {\n console.log(\"⚠️ No refresh token available, skipping refresh\");\n return false;\n }\n\n isRefreshingRef.current = true;\n\n try {\n // Make a refresh request using the axios instance directly\n const response = await customerClient.axios.post<{\n accessToken: string;\n refreshToken?: string;\n expiresIn?: number;\n }>(\"/auth/refresh\", {\n refreshToken: currentTokens.refreshToken,\n });\n\n const { accessToken, refreshToken, expiresIn } = response.data;\n\n // Validate response has required data\n if (!accessToken) {\n console.error(\"❌ Refresh response missing accessToken\");\n return false;\n }\n\n const newTokens: AuthTokens = {\n accessToken,\n refreshToken: refreshToken || currentTokens.refreshToken,\n idToken: currentTokens.idToken, // Preserve existing idToken\n encryptionKey: currentTokens.encryptionKey, // Preserve existing encryptionKey\n expiresAt: expiresIn ? Date.now() + expiresIn * 1000 : undefined,\n };\n\n customerClient.setToken(accessToken);\n updateTokens(newTokens);\n\n console.log(\"✅ Token refreshed successfully\");\n return true;\n } catch (error) {\n console.error(\"❌ Token refresh failed:\", error);\n // DON'T clear auth on refresh failure - just return false\n // User can still use their existing token until it expires\n return false;\n } finally {\n isRefreshingRef.current = false;\n }\n }, [updateTokens]);\n\n // Schedule automatic token refresh\n const scheduleTokenRefresh = useCallback(() => {\n // Clear any existing timeout\n if (refreshTimeoutRef.current) {\n clearTimeout(refreshTimeoutRef.current);\n refreshTimeoutRef.current = null;\n }\n\n const timeUntilExpiry = getTimeUntilExpiry();\n\n // Only schedule if we have an expiry time and a refresh token\n if (timeUntilExpiry === null || !tokens?.refreshToken) {\n return;\n }\n\n // Calculate when to refresh (REFRESH_BUFFER_MS before expiry)\n const refreshIn = Math.max(timeUntilExpiry - REFRESH_BUFFER_MS, 0);\n\n // Don't schedule if expiry is too far in the future (> 24 hours)\n if (refreshIn > 24 * 60 * 60 * 1000) {\n return;\n }\n\n refreshTimeoutRef.current = setTimeout(async () => {\n const success = await refreshAccessToken();\n if (success) {\n // Reschedule for the new token\n scheduleTokenRefresh();\n }\n }, refreshIn);\n }, [getTimeUntilExpiry, tokens?.refreshToken, refreshAccessToken]);\n\n // Sync token with API client and set up refresh on mount and token changes\n useEffect(() => {\n if (tokens?.accessToken) {\n console.log(\"🔑 Setting token in API client\");\n customerClient.setToken(tokens.accessToken);\n\n // Only try to refresh if we have a refresh token AND token is expired\n if (isTokenExpired() && tokens.refreshToken) {\n console.log(\"⏰ Token expired, attempting refresh...\");\n refreshAccessToken().then((success) => {\n if (success) {\n scheduleTokenRefresh();\n } else {\n console.log(\"⚠️ Refresh failed, but keeping existing token\");\n }\n });\n } else if (tokens.refreshToken) {\n // Only schedule refresh if we have a refresh token\n scheduleTokenRefresh();\n }\n } else if (tokens && Object.keys(tokens).length === 0) {\n // tokens is empty object {} - this shouldn't happen, log it\n console.warn(\"⚠️ Tokens object is empty, this may indicate a bug\");\n } else {\n customerClient.setToken(null);\n }\n\n // Cleanup timeout on unmount\n return () => {\n if (refreshTimeoutRef.current) {\n clearTimeout(refreshTimeoutRef.current);\n }\n };\n }, [\n tokens?.accessToken,\n tokens?.refreshToken,\n isTokenExpired,\n refreshAccessToken,\n scheduleTokenRefresh,\n ]);\n\n // Set up axios interceptor for 401 responses (token expired during request)\n useEffect(() => {\n const interceptorId = customerClient.axios.interceptors.response.use(\n (response) => response,\n async (error) => {\n const originalRequest = error.config;\n\n // Skip refresh for auth endpoints to prevent infinite loops\n const isAuthEndpoint = originalRequest?.url?.includes(\"/auth/\");\n\n // If we get a 401 and haven't retried yet, try to refresh\n if (\n error.response?.status === 401 &&\n !originalRequest._retry &&\n tokens?.refreshToken &&\n !isAuthEndpoint\n ) {\n originalRequest._retry = true;\n\n const success = await refreshAccessToken();\n if (success) {\n // Retry the original request with new token\n const newTokens = useAuthStore.getState().tokens;\n if (newTokens?.accessToken) {\n originalRequest.headers.Authorization = `Bearer ${newTokens.accessToken}`;\n return customerClient.axios(originalRequest);\n }\n }\n }\n\n return Promise.reject(error);\n },\n );\n\n return () => {\n customerClient.axios.interceptors.response.eject(interceptorId);\n };\n }, [tokens?.refreshToken, refreshAccessToken]);\n\n const login = useCallback(async (username: string, password: string) => {\n const response = await customerClient.auth.login({ username, password });\n\n console.log(\"🔐 Login response:\", response);\n console.log(\"🔐 accessToken:\", response.accessToken);\n console.log(\"🔐 refreshToken:\", response.refreshToken);\n console.log(\"🔐 encryptionKey:\", response.encryptionKey);\n\n const newTokens: AuthTokens = {\n accessToken: response.accessToken,\n refreshToken: response.refreshToken,\n idToken: response.idToken,\n encryptionKey: response.encryptionKey,\n expiresAt: response.expiresIn\n ? Date.now() + response.expiresIn * 1000\n : undefined,\n };\n\n console.log(\"🔐 newTokens object:\", newTokens);\n\n const newUser: User = {\n username,\n email: (response as any).email || (response as any).user?.email,\n };\n\n customerClient.setToken(newTokens.accessToken);\n setAuth(newUser, newTokens);\n\n console.log(\n \"🔐 Auth set complete, checking store:\",\n useAuthStore.getState().tokens,\n );\n }, []);\n\n const register = useCallback(\n async (username: string, email: string, password: string) => {\n await customerClient.auth.register({ username, email, password });\n },\n [],\n );\n\n const confirmEmail = useCallback(async (username: string, code: string) => {\n await customerClient.auth.confirm({ username, code });\n }, []);\n\n const forgotPassword = useCallback(async (username: string) => {\n await customerClient.auth.forgotPassword({ username });\n }, []);\n\n const resetPassword = useCallback(\n async (username: string, code: string, newPassword: string) => {\n await customerClient.auth.resetPassword({ username, code, newPassword });\n },\n [],\n );\n\n const logout = useCallback(() => {\n // Clear any scheduled refresh\n if (refreshTimeoutRef.current) {\n clearTimeout(refreshTimeoutRef.current);\n refreshTimeoutRef.current = null;\n }\n\n customerClient.setToken(null);\n clearAuth();\n }, [clearAuth]);\n\n return {\n user,\n token: tokens?.accessToken ?? null,\n tokens,\n isAuthenticated,\n api: customerClient,\n login,\n register,\n confirmEmail,\n forgotPassword,\n resetPassword,\n logout,\n refreshAccessToken,\n };\n}\n"
|
|
30
|
+
"content": "import { useCallback, useEffect, useRef } from \"react\";\r\nimport {\r\n useAuthStore,\r\n type User,\r\n type AuthTokens,\r\n} from \"./auth-store\";\r\nimport { customerClient } from \"@/modules/api\";\r\n\r\n// Refresh token 1 minute before expiry\r\nconst REFRESH_BUFFER_MS = 60 * 1000;\r\n\r\nexport function useAuth() {\r\n const {\r\n user,\r\n tokens,\r\n isAuthenticated,\r\n setAuth,\r\n updateTokens,\r\n clearAuth,\r\n isTokenExpired,\r\n getTimeUntilExpiry,\r\n } = useAuthStore();\r\n\r\n const refreshTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\r\n const isRefreshingRef = useRef(false);\r\n\r\n // Refresh token using the refresh token\r\n const refreshAccessToken = useCallback(async (): Promise<boolean> => {\r\n const currentTokens = useAuthStore.getState().tokens;\r\n\r\n // Don't refresh if no refresh token exists\r\n if (!currentTokens?.refreshToken || isRefreshingRef.current) {\r\n console.log(\"⚠️ No refresh token available, skipping refresh\");\r\n return false;\r\n }\r\n\r\n isRefreshingRef.current = true;\r\n\r\n try {\r\n // Make a refresh request using the axios instance directly\r\n const response = await customerClient.axios.post<{\r\n accessToken: string;\r\n refreshToken?: string;\r\n expiresIn?: number;\r\n }>(\"/auth/refresh\", {\r\n refreshToken: currentTokens.refreshToken,\r\n });\r\n\r\n const { accessToken, refreshToken, expiresIn } = response.data;\r\n\r\n // Validate response has required data\r\n if (!accessToken) {\r\n console.error(\"❌ Refresh response missing accessToken\");\r\n return false;\r\n }\r\n\r\n const newTokens: AuthTokens = {\r\n accessToken,\r\n refreshToken: refreshToken || currentTokens.refreshToken,\r\n idToken: currentTokens.idToken, // Preserve existing idToken\r\n encryptionKey: currentTokens.encryptionKey, // Preserve existing encryptionKey\r\n expiresAt: expiresIn ? Date.now() + expiresIn * 1000 : undefined,\r\n };\r\n\r\n customerClient.setToken(accessToken);\r\n updateTokens(newTokens);\r\n\r\n console.log(\"✅ Token refreshed successfully\");\r\n return true;\r\n } catch (error) {\r\n console.error(\"❌ Token refresh failed:\", error);\r\n // DON'T clear auth on refresh failure - just return false\r\n // User can still use their existing token until it expires\r\n return false;\r\n } finally {\r\n isRefreshingRef.current = false;\r\n }\r\n }, [updateTokens]);\r\n\r\n // Schedule automatic token refresh\r\n const scheduleTokenRefresh = useCallback(() => {\r\n // Clear any existing timeout\r\n if (refreshTimeoutRef.current) {\r\n clearTimeout(refreshTimeoutRef.current);\r\n refreshTimeoutRef.current = null;\r\n }\r\n\r\n const timeUntilExpiry = getTimeUntilExpiry();\r\n\r\n // Only schedule if we have an expiry time and a refresh token\r\n if (timeUntilExpiry === null || !tokens?.refreshToken) {\r\n return;\r\n }\r\n\r\n // Calculate when to refresh (REFRESH_BUFFER_MS before expiry)\r\n const refreshIn = Math.max(timeUntilExpiry - REFRESH_BUFFER_MS, 0);\r\n\r\n // Don't schedule if expiry is too far in the future (> 24 hours)\r\n if (refreshIn > 24 * 60 * 60 * 1000) {\r\n return;\r\n }\r\n\r\n refreshTimeoutRef.current = setTimeout(async () => {\r\n const success = await refreshAccessToken();\r\n if (success) {\r\n // Reschedule for the new token\r\n scheduleTokenRefresh();\r\n }\r\n }, refreshIn);\r\n }, [getTimeUntilExpiry, tokens?.refreshToken, refreshAccessToken]);\r\n\r\n // Sync token with API client and set up refresh on mount and token changes\r\n useEffect(() => {\r\n if (tokens?.accessToken) {\r\n console.log(\"🔑 Setting token in API client\");\r\n customerClient.setToken(tokens.accessToken);\r\n\r\n // Only try to refresh if we have a refresh token AND token is expired\r\n if (isTokenExpired() && tokens.refreshToken) {\r\n console.log(\"⏰ Token expired, attempting refresh...\");\r\n refreshAccessToken().then((success) => {\r\n if (success) {\r\n scheduleTokenRefresh();\r\n } else {\r\n console.log(\"⚠️ Refresh failed, but keeping existing token\");\r\n }\r\n });\r\n } else if (tokens.refreshToken) {\r\n // Only schedule refresh if we have a refresh token\r\n scheduleTokenRefresh();\r\n }\r\n } else if (tokens && Object.keys(tokens).length === 0) {\r\n // tokens is empty object {} - this shouldn't happen, log it\r\n console.warn(\"⚠️ Tokens object is empty, this may indicate a bug\");\r\n } else {\r\n customerClient.setToken(null);\r\n }\r\n\r\n // Cleanup timeout on unmount\r\n return () => {\r\n if (refreshTimeoutRef.current) {\r\n clearTimeout(refreshTimeoutRef.current);\r\n }\r\n };\r\n }, [\r\n tokens?.accessToken,\r\n tokens?.refreshToken,\r\n isTokenExpired,\r\n refreshAccessToken,\r\n scheduleTokenRefresh,\r\n ]);\r\n\r\n // Set up axios interceptor for 401 responses (token expired during request)\r\n useEffect(() => {\r\n const interceptorId = customerClient.axios.interceptors.response.use(\r\n (response) => response,\r\n async (error) => {\r\n const originalRequest = error.config;\r\n\r\n // Skip refresh for auth endpoints to prevent infinite loops\r\n const isAuthEndpoint = originalRequest?.url?.includes(\"/auth/\");\r\n\r\n // If we get a 401 and haven't retried yet, try to refresh\r\n if (\r\n error.response?.status === 401 &&\r\n !originalRequest._retry &&\r\n tokens?.refreshToken &&\r\n !isAuthEndpoint\r\n ) {\r\n originalRequest._retry = true;\r\n\r\n const success = await refreshAccessToken();\r\n if (success) {\r\n // Retry the original request with new token\r\n const newTokens = useAuthStore.getState().tokens;\r\n if (newTokens?.accessToken) {\r\n originalRequest.headers.Authorization = `Bearer ${newTokens.accessToken}`;\r\n return customerClient.axios(originalRequest);\r\n }\r\n }\r\n }\r\n\r\n return Promise.reject(error);\r\n },\r\n );\r\n\r\n return () => {\r\n customerClient.axios.interceptors.response.eject(interceptorId);\r\n };\r\n }, [tokens?.refreshToken, refreshAccessToken]);\r\n\r\n const login = useCallback(async (username: string, password: string) => {\r\n const response = await customerClient.auth.login({ username, password });\r\n\r\n console.log(\"🔐 Login response:\", response);\r\n console.log(\"🔐 accessToken:\", response.accessToken);\r\n console.log(\"🔐 refreshToken:\", response.refreshToken);\r\n console.log(\"🔐 encryptionKey:\", response.encryptionKey);\r\n\r\n const newTokens: AuthTokens = {\r\n accessToken: response.accessToken,\r\n refreshToken: response.refreshToken,\r\n idToken: response.idToken,\r\n encryptionKey: response.encryptionKey,\r\n expiresAt: response.expiresIn\r\n ? Date.now() + response.expiresIn * 1000\r\n : undefined,\r\n };\r\n\r\n console.log(\"🔐 newTokens object:\", newTokens);\r\n\r\n const newUser: User = {\r\n username,\r\n email: (response as any).email || (response as any).user?.email,\r\n };\r\n\r\n customerClient.setToken(newTokens.accessToken);\r\n setAuth(newUser, newTokens);\r\n\r\n console.log(\r\n \"🔐 Auth set complete, checking store:\",\r\n useAuthStore.getState().tokens,\r\n );\r\n }, []);\r\n\r\n const register = useCallback(\r\n async (username: string, email: string, password: string) => {\r\n await customerClient.auth.register({ username, email, password });\r\n },\r\n [],\r\n );\r\n\r\n const confirmEmail = useCallback(async (username: string, code: string) => {\r\n await customerClient.auth.confirm({ username, code });\r\n }, []);\r\n\r\n const forgotPassword = useCallback(async (username: string) => {\r\n await customerClient.auth.forgotPassword({ username });\r\n }, []);\r\n\r\n const resetPassword = useCallback(\r\n async (username: string, code: string, newPassword: string) => {\r\n await customerClient.auth.resetPassword({ username, code, newPassword });\r\n },\r\n [],\r\n );\r\n\r\n const logout = useCallback(() => {\r\n // Clear any scheduled refresh\r\n if (refreshTimeoutRef.current) {\r\n clearTimeout(refreshTimeoutRef.current);\r\n refreshTimeoutRef.current = null;\r\n }\r\n\r\n customerClient.setToken(null);\r\n clearAuth();\r\n }, [clearAuth]);\r\n\r\n return {\r\n user,\r\n token: tokens?.accessToken ?? null,\r\n tokens,\r\n isAuthenticated,\r\n api: customerClient,\r\n login,\r\n register,\r\n confirmEmail,\r\n forgotPassword,\r\n resetPassword,\r\n logout,\r\n refreshAccessToken,\r\n };\r\n}\r\n"
|
|
31
31
|
}
|
|
32
32
|
],
|
|
33
33
|
"exports": {
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "auth",
|
|
3
|
+
"type": "registry:module",
|
|
4
|
+
"title": "Authentication Module",
|
|
5
|
+
"description": "Complete authentication system with Zustand store, JWT token management with auto-refresh, login/register/forgot-password pages, and header menu component. Includes secure token storage, automatic 401 handling, and seamless API integration.",
|
|
6
|
+
"dependencies": [
|
|
7
|
+
"zustand"
|
|
8
|
+
],
|
|
9
|
+
"registryDependencies": [
|
|
10
|
+
"api"
|
|
11
|
+
],
|
|
12
|
+
"files": [
|
|
13
|
+
{
|
|
14
|
+
"path": "auth/index.ts",
|
|
15
|
+
"type": "registry:index",
|
|
16
|
+
"target": "$modules$/auth/index.ts",
|
|
17
|
+
"content": "// Store\r\nexport { useAuthStore } from \"./auth-store\";\r\nexport type { User, AuthTokens } from \"./auth-store\";\r\n\r\n// Hook\r\nexport { useAuth } from \"./use-auth\";\r\n\r\n// Components\r\nexport { AuthHeaderMenu } from \"./auth-header-menu\";\r\nexport { default as LoginPage } from \"./login-page\";\r\nexport { default as RegisterPage } from \"./register-page\";\r\nexport { default as ForgotPasswordPage } from \"./forgot-password-page\";\r\n"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"path": "auth/auth-store.ts",
|
|
21
|
+
"type": "registry:store",
|
|
22
|
+
"target": "$modules$/auth/auth-store.ts",
|
|
23
|
+
"content": "import { create } from \"zustand\";\nimport { persist } from \"zustand/middleware\";\n\nexport interface User {\n username: string;\n email?: string;\n}\n\nexport interface AuthTokens {\n accessToken: string;\n refreshToken?: string;\n idToken?: string;\n encryptionKey?: string;\n expiresAt?: number; // Unix timestamp in milliseconds\n}\n\ninterface AuthState {\n user: User | null;\n tokens: AuthTokens | null;\n isAuthenticated: boolean;\n setAuth: (user: User, tokens: AuthTokens) => void;\n updateTokens: (tokens: AuthTokens) => void;\n clearAuth: () => void;\n isTokenExpired: () => boolean;\n getTimeUntilExpiry: () => number | null;\n}\n\nexport const useAuthStore = create<AuthState>()(\n persist(\n (set, get) => ({\n user: null,\n tokens: null,\n isAuthenticated: false,\n\n setAuth: (user, tokens) => set({ user, tokens, isAuthenticated: true }),\n\n updateTokens: (tokens) => set({ tokens }),\n\n clearAuth: () =>\n set({ user: null, tokens: null, isAuthenticated: false }),\n\n isTokenExpired: () => {\n const { tokens } = get();\n if (!tokens?.expiresAt) return false;\n // Consider token expired 30 seconds before actual expiry for safety margin\n return Date.now() >= tokens.expiresAt - 30000;\n },\n\n getTimeUntilExpiry: () => {\n const { tokens } = get();\n if (!tokens?.expiresAt) return null;\n return tokens.expiresAt - Date.now();\n },\n }),\n { name: \"auth-storage\" },\n ),\n);\n"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"path": "auth/use-auth.ts",
|
|
27
|
+
"type": "registry:hook",
|
|
28
|
+
"target": "$modules$/auth/use-auth.ts",
|
|
29
|
+
"content": "import { useCallback, useEffect, useRef } from \"react\";\nimport {\n useAuthStore,\n type User,\n type AuthTokens,\n} from \"@/modules/auth/auth-store\";\nimport { customerClient } from \"@/modules/api/customer-client\";\n\n// Refresh token 1 minute before expiry\nconst REFRESH_BUFFER_MS = 60 * 1000;\n\nexport function useAuth() {\n const {\n user,\n tokens,\n isAuthenticated,\n setAuth,\n updateTokens,\n clearAuth,\n isTokenExpired,\n getTimeUntilExpiry,\n } = useAuthStore();\n\n const refreshTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const isRefreshingRef = useRef(false);\n\n // Refresh token using the refresh token\n const refreshAccessToken = useCallback(async (): Promise<boolean> => {\n const currentTokens = useAuthStore.getState().tokens;\n\n // Don't refresh if no refresh token exists\n if (!currentTokens?.refreshToken || isRefreshingRef.current) {\n console.log(\"⚠️ No refresh token available, skipping refresh\");\n return false;\n }\n\n isRefreshingRef.current = true;\n\n try {\n // Make a refresh request using the axios instance directly\n const response = await customerClient.axios.post<{\n accessToken: string;\n refreshToken?: string;\n expiresIn?: number;\n }>(\"/auth/refresh\", {\n refreshToken: currentTokens.refreshToken,\n });\n\n const { accessToken, refreshToken, expiresIn } = response.data;\n\n // Validate response has required data\n if (!accessToken) {\n console.error(\"❌ Refresh response missing accessToken\");\n return false;\n }\n\n const newTokens: AuthTokens = {\n accessToken,\n refreshToken: refreshToken || currentTokens.refreshToken,\n idToken: currentTokens.idToken, // Preserve existing idToken\n encryptionKey: currentTokens.encryptionKey, // Preserve existing encryptionKey\n expiresAt: expiresIn ? Date.now() + expiresIn * 1000 : undefined,\n };\n\n customerClient.setToken(accessToken);\n updateTokens(newTokens);\n\n console.log(\"✅ Token refreshed successfully\");\n return true;\n } catch (error) {\n console.error(\"❌ Token refresh failed:\", error);\n // DON'T clear auth on refresh failure - just return false\n // User can still use their existing token until it expires\n return false;\n } finally {\n isRefreshingRef.current = false;\n }\n }, [updateTokens]);\n\n // Schedule automatic token refresh\n const scheduleTokenRefresh = useCallback(() => {\n // Clear any existing timeout\n if (refreshTimeoutRef.current) {\n clearTimeout(refreshTimeoutRef.current);\n refreshTimeoutRef.current = null;\n }\n\n const timeUntilExpiry = getTimeUntilExpiry();\n\n // Only schedule if we have an expiry time and a refresh token\n if (timeUntilExpiry === null || !tokens?.refreshToken) {\n return;\n }\n\n // Calculate when to refresh (REFRESH_BUFFER_MS before expiry)\n const refreshIn = Math.max(timeUntilExpiry - REFRESH_BUFFER_MS, 0);\n\n // Don't schedule if expiry is too far in the future (> 24 hours)\n if (refreshIn > 24 * 60 * 60 * 1000) {\n return;\n }\n\n refreshTimeoutRef.current = setTimeout(async () => {\n const success = await refreshAccessToken();\n if (success) {\n // Reschedule for the new token\n scheduleTokenRefresh();\n }\n }, refreshIn);\n }, [getTimeUntilExpiry, tokens?.refreshToken, refreshAccessToken]);\n\n // Sync token with API client and set up refresh on mount and token changes\n useEffect(() => {\n if (tokens?.accessToken) {\n console.log(\"🔑 Setting token in API client\");\n customerClient.setToken(tokens.accessToken);\n\n // Only try to refresh if we have a refresh token AND token is expired\n if (isTokenExpired() && tokens.refreshToken) {\n console.log(\"⏰ Token expired, attempting refresh...\");\n refreshAccessToken().then((success) => {\n if (success) {\n scheduleTokenRefresh();\n } else {\n console.log(\"⚠️ Refresh failed, but keeping existing token\");\n }\n });\n } else if (tokens.refreshToken) {\n // Only schedule refresh if we have a refresh token\n scheduleTokenRefresh();\n }\n } else if (tokens && Object.keys(tokens).length === 0) {\n // tokens is empty object {} - this shouldn't happen, log it\n console.warn(\"⚠️ Tokens object is empty, this may indicate a bug\");\n } else {\n customerClient.setToken(null);\n }\n\n // Cleanup timeout on unmount\n return () => {\n if (refreshTimeoutRef.current) {\n clearTimeout(refreshTimeoutRef.current);\n }\n };\n }, [\n tokens?.accessToken,\n tokens?.refreshToken,\n isTokenExpired,\n refreshAccessToken,\n scheduleTokenRefresh,\n ]);\n\n // Set up axios interceptor for 401 responses (token expired during request)\n useEffect(() => {\n const interceptorId = customerClient.axios.interceptors.response.use(\n (response) => response,\n async (error) => {\n const originalRequest = error.config;\n\n // Skip refresh for auth endpoints to prevent infinite loops\n const isAuthEndpoint = originalRequest?.url?.includes(\"/auth/\");\n\n // If we get a 401 and haven't retried yet, try to refresh\n if (\n error.response?.status === 401 &&\n !originalRequest._retry &&\n tokens?.refreshToken &&\n !isAuthEndpoint\n ) {\n originalRequest._retry = true;\n\n const success = await refreshAccessToken();\n if (success) {\n // Retry the original request with new token\n const newTokens = useAuthStore.getState().tokens;\n if (newTokens?.accessToken) {\n originalRequest.headers.Authorization = `Bearer ${newTokens.accessToken}`;\n return customerClient.axios(originalRequest);\n }\n }\n }\n\n return Promise.reject(error);\n },\n );\n\n return () => {\n customerClient.axios.interceptors.response.eject(interceptorId);\n };\n }, [tokens?.refreshToken, refreshAccessToken]);\n\n const login = useCallback(async (username: string, password: string) => {\n const response = await customerClient.auth.login({ username, password });\n\n console.log(\"🔐 Login response:\", response);\n console.log(\"🔐 accessToken:\", response.accessToken);\n console.log(\"🔐 refreshToken:\", response.refreshToken);\n console.log(\"🔐 encryptionKey:\", response.encryptionKey);\n\n const newTokens: AuthTokens = {\n accessToken: response.accessToken,\n refreshToken: response.refreshToken,\n idToken: response.idToken,\n encryptionKey: response.encryptionKey,\n expiresAt: response.expiresIn\n ? Date.now() + response.expiresIn * 1000\n : undefined,\n };\n\n console.log(\"🔐 newTokens object:\", newTokens);\n\n const newUser: User = {\n username,\n email: (response as any).email || (response as any).user?.email,\n };\n\n customerClient.setToken(newTokens.accessToken);\n setAuth(newUser, newTokens);\n\n console.log(\n \"🔐 Auth set complete, checking store:\",\n useAuthStore.getState().tokens,\n );\n }, []);\n\n const register = useCallback(\n async (username: string, email: string, password: string) => {\n await customerClient.auth.register({ username, email, password });\n },\n [],\n );\n\n const confirmEmail = useCallback(async (username: string, code: string) => {\n await customerClient.auth.confirm({ username, code });\n }, []);\n\n const forgotPassword = useCallback(async (username: string) => {\n await customerClient.auth.forgotPassword({ username });\n }, []);\n\n const resetPassword = useCallback(\n async (username: string, code: string, newPassword: string) => {\n await customerClient.auth.resetPassword({ username, code, newPassword });\n },\n [],\n );\n\n const logout = useCallback(() => {\n // Clear any scheduled refresh\n if (refreshTimeoutRef.current) {\n clearTimeout(refreshTimeoutRef.current);\n refreshTimeoutRef.current = null;\n }\n\n customerClient.setToken(null);\n clearAuth();\n }, [clearAuth]);\n\n return {\n user,\n token: tokens?.accessToken ?? null,\n tokens,\n isAuthenticated,\n api: customerClient,\n login,\n register,\n confirmEmail,\n forgotPassword,\n resetPassword,\n logout,\n refreshAccessToken,\n };\n}\n"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"path": "auth/auth-header-menu.tsx",
|
|
33
|
+
"type": "registry:component",
|
|
34
|
+
"target": "$modules$/auth/auth-header-menu.tsx",
|
|
35
|
+
"content": "import type { ReactNode } from \"react\";\nimport { Link } from \"react-router\";\nimport { User, LogOut } from \"lucide-react\";\nimport { useAuth } from \"@/modules/auth/use-auth\";\nimport { Button } from \"@/components/ui/button\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from \"@/components/ui/dropdown-menu\";\nimport { useTranslation } from \"react-i18next\";\nimport { toast } from \"sonner\";\n\ninterface AuthHeaderMenuProps {\n children?: ReactNode;\n variant: \"desktop\" | \"mobile\";\n onMenuClose?: () => void;\n}\n\nexport function AuthHeaderMenu({\n children,\n variant,\n onMenuClose,\n}: AuthHeaderMenuProps) {\n const { isAuthenticated, user, logout } = useAuth();\n const { t } = useTranslation(\"header\");\n\n const handleLogout = () => {\n logout();\n toast.success(t(\"logoutToastTitle\", \"Goodbye!\"), {\n description: t(\n \"logoutToastDesc\",\n \"You have been logged out successfully.\",\n ),\n });\n onMenuClose?.();\n };\n\n if (variant === \"desktop\") {\n if (isAuthenticated) {\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button variant=\"ghost\" size=\"icon\" className=\"h-10 w-10\">\n <User className=\"h-5 w-5\" />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" className=\"w-56\">\n <DropdownMenuLabel className=\"font-normal\">\n <div className=\"flex flex-col space-y-1\">\n <p className=\"text-sm font-medium\">{user?.username}</p>\n {user?.email && (\n <p className=\"text-xs text-muted-foreground\">{user.email}</p>\n )}\n </div>\n </DropdownMenuLabel>\n <DropdownMenuSeparator />\n {children}\n {children && <DropdownMenuSeparator />}\n <DropdownMenuItem\n onClick={handleLogout}\n className=\"text-red-600 focus:text-red-600 focus:bg-red-50 cursor-pointer\"\n >\n <LogOut className=\"mr-2 h-4 w-4\" />\n {t(\"logout\", \"Logout\")}\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n );\n }\n\n return (\n <Link to=\"/login\">\n <Button variant=\"ghost\" size=\"icon\" className=\"h-10 w-10\">\n <User className=\"h-5 w-5\" />\n </Button>\n </Link>\n );\n }\n\n // Mobile variant\n if (isAuthenticated) {\n return (\n <div className=\"space-y-3\">\n <div className=\"flex items-center space-x-3 p-3 bg-muted/50 rounded-lg\">\n <div className=\"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center\">\n <User className=\"h-5 w-5 text-primary\" />\n </div>\n <div className=\"flex-1 min-w-0\">\n <p className=\"text-sm font-medium truncate\">{user?.username}</p>\n {user?.email && (\n <p className=\"text-xs text-muted-foreground truncate\">\n {user.email}\n </p>\n )}\n </div>\n </div>\n {children}\n <button\n onClick={handleLogout}\n className=\"flex items-center space-x-2 text-lg font-medium text-red-600 hover:text-red-700 transition-colors w-full\"\n >\n <LogOut className=\"h-5 w-5\" />\n <span>{t(\"logout\", \"Logout\")}</span>\n </button>\n </div>\n );\n }\n\n return (\n <Link\n to=\"/login\"\n className=\"flex items-center space-x-2 text-lg font-medium hover:text-primary transition-colors\"\n onClick={onMenuClose}\n >\n <User className=\"h-5 w-5\" />\n <span>{t(\"login\", \"Login\")}</span>\n </Link>\n );\n}\n"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"path": "auth/login-page.tsx",
|
|
39
|
+
"type": "registry:page",
|
|
40
|
+
"target": "$modules$/auth/login-page.tsx",
|
|
41
|
+
"content": "import { useState, useEffect } from \"react\";\nimport { Link, useNavigate } from \"react-router\";\nimport { toast } from \"sonner\";\nimport { Layout } from \"@/components/Layout\";\nimport { usePageTitle } from \"@/hooks/use-page-title\";\nimport { useTranslation } from \"react-i18next\";\nimport { useAuth } from \"@/modules/auth/use-auth\";\nimport { getErrorMessage } from \"@/modules/api/get-error-message\";\nimport { Button } from \"@/components/ui/button\";\nimport { Input } from \"@/components/ui/input\";\nimport { Label } from \"@/components/ui/label\";\nimport { Card, CardContent, CardHeader, CardTitle } from \"@/components/ui/card\";\nimport { LogIn, Eye, EyeOff } from \"lucide-react\";\n\nexport default function LoginPage() {\n const { t } = useTranslation(\"login\");\n usePageTitle({ title: t(\"title\") });\n\n const navigate = useNavigate();\n const { login, isAuthenticated } = useAuth();\n\n const [formData, setFormData] = useState({\n username: \"\",\n password: \"\",\n });\n const [showPassword, setShowPassword] = useState(false);\n const [isSubmitting, setIsSubmitting] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n // Redirect when authenticated (works for both initial load and after login)\n useEffect(() => {\n if (isAuthenticated) {\n navigate(\"/\", { replace: true });\n }\n }, [isAuthenticated, navigate]);\n\n const handleSubmit = async (e: React.FormEvent) => {\n e.preventDefault();\n setIsSubmitting(true);\n setError(null);\n\n try {\n await login(formData.username, formData.password);\n toast.success(t(\"toastSuccessTitle\", \"Welcome back!\"), {\n description: t(\"toastSuccessDesc\", \"You have successfully logged in.\"),\n });\n navigate(\"/\", { replace: true });\n } catch (err) {\n const errorMessage = getErrorMessage(err, t(\"errorGeneric\"));\n setError(errorMessage);\n toast.error(t(\"toastErrorTitle\", \"Login failed\"), {\n description: errorMessage,\n });\n } finally {\n setIsSubmitting(false);\n }\n };\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n setFormData((prev) => ({\n ...prev,\n [e.target.name]: e.target.value,\n }));\n };\n\n return (\n <Layout>\n <div className=\"min-h-screen bg-muted/30 py-12\">\n <div className=\"w-full max-w-[var(--container-max-width)] mx-auto px-4\">\n {/* Hero Section */}\n <div className=\"text-center mb-12\">\n <h1 className=\"text-4xl font-bold text-foreground mb-4\">\n {t(\"title\")}\n </h1>\n <div className=\"w-16 h-1 bg-primary mx-auto mb-6\"></div>\n <p className=\"text-lg text-muted-foreground max-w-xl mx-auto\">\n {t(\"description\")}\n </p>\n </div>\n\n <div className=\"max-w-md mx-auto\">\n <Card>\n <CardHeader>\n <CardTitle className=\"flex items-center gap-2\">\n <LogIn className=\"w-5 h-5 text-primary\" />\n {t(\"cardTitle\")}\n </CardTitle>\n </CardHeader>\n <CardContent>\n <form onSubmit={handleSubmit} className=\"space-y-6\">\n <div>\n <Label htmlFor=\"username\">{t(\"username\")} *</Label>\n <Input\n id=\"username\"\n name=\"username\"\n type=\"text\"\n value={formData.username}\n onChange={handleChange}\n placeholder={t(\"usernamePlaceholder\")}\n required\n className=\"mt-1\"\n autoComplete=\"username\"\n />\n </div>\n\n <div>\n <div className=\"flex items-center justify-between\">\n <Label htmlFor=\"password\">{t(\"password\")} *</Label>\n <Link\n to=\"/forgot-password\"\n className=\"text-sm text-primary hover:underline\"\n >\n {t(\"forgotPassword\", \"Forgot password?\")}\n </Link>\n </div>\n <div className=\"relative\">\n <Input\n id=\"password\"\n name=\"password\"\n type={showPassword ? \"text\" : \"password\"}\n value={formData.password}\n onChange={handleChange}\n placeholder={t(\"passwordPlaceholder\")}\n required\n className=\"mt-1 pr-10\"\n autoComplete=\"current-password\"\n />\n <button\n type=\"button\"\n onClick={() => setShowPassword(!showPassword)}\n className=\"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground\"\n >\n {showPassword ? (\n <EyeOff className=\"w-4 h-4\" />\n ) : (\n <Eye className=\"w-4 h-4\" />\n )}\n </button>\n </div>\n </div>\n\n {error && (\n <div className=\"p-4 bg-red-50 border border-red-200 rounded-lg\">\n <p className=\"text-red-800 text-sm font-medium\">\n {error}\n </p>\n </div>\n )}\n\n <Button\n type=\"submit\"\n size=\"lg\"\n className=\"w-full\"\n disabled={isSubmitting}\n >\n {isSubmitting ? (\n <>\n <div className=\"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin mr-2\" />\n {t(\"submitting\")}\n </>\n ) : (\n t(\"submit\")\n )}\n </Button>\n\n <div className=\"text-center text-sm text-muted-foreground\">\n {t(\"noAccount\")}{\" \"}\n <Link\n to=\"/register\"\n className=\"text-primary hover:underline font-medium\"\n >\n {t(\"registerLink\")}\n </Link>\n </div>\n </form>\n </CardContent>\n </Card>\n </div>\n </div>\n </div>\n </Layout>\n );\n}\n"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"path": "auth/register-page.tsx",
|
|
45
|
+
"type": "registry:page",
|
|
46
|
+
"target": "$modules$/auth/register-page.tsx",
|
|
47
|
+
"content": "import { useState, useEffect } from \"react\";\nimport { Link, useNavigate } from \"react-router\";\nimport { toast } from \"sonner\";\nimport { Layout } from \"@/components/Layout\";\nimport { usePageTitle } from \"@/hooks/use-page-title\";\nimport { useTranslation } from \"react-i18next\";\nimport { useAuth } from \"@/modules/auth/use-auth\";\nimport { getErrorMessage } from \"@/modules/api/get-error-message\";\nimport { Button } from \"@/components/ui/button\";\nimport { Input } from \"@/components/ui/input\";\nimport { Label } from \"@/components/ui/label\";\nimport { Card, CardContent, CardHeader, CardTitle } from \"@/components/ui/card\";\nimport { UserPlus, Eye, EyeOff, CheckCircle } from \"lucide-react\";\n\nexport default function RegisterPage() {\n const { t } = useTranslation(\"register\");\n usePageTitle({ title: t(\"title\") });\n\n const navigate = useNavigate();\n const { register, isAuthenticated } = useAuth();\n\n const [formData, setFormData] = useState({\n username: \"\",\n email: \"\",\n password: \"\",\n confirmPassword: \"\",\n });\n const [showPassword, setShowPassword] = useState(false);\n const [isSubmitting, setIsSubmitting] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const [success, setSuccess] = useState(false);\n\n // Redirect if already authenticated\n useEffect(() => {\n if (isAuthenticated) {\n navigate(\"/\", { replace: true });\n }\n }, [isAuthenticated, navigate]);\n\n const handleSubmit = async (e: React.FormEvent) => {\n e.preventDefault();\n setIsSubmitting(true);\n setError(null);\n\n // Validate passwords match\n if (formData.password !== formData.confirmPassword) {\n setError(t(\"passwordMismatch\"));\n toast.error(t(\"toastErrorTitle\", \"Registration failed\"), {\n description: t(\"passwordMismatch\"),\n });\n setIsSubmitting(false);\n return;\n }\n\n try {\n await register(formData.username, formData.email, formData.password);\n setSuccess(true);\n toast.success(t(\"toastSuccessTitle\", \"Account created!\"), {\n description: t(\n \"toastSuccessDesc\",\n \"Please check your email to verify your account.\",\n ),\n });\n } catch (err) {\n const errorMessage = getErrorMessage(err, t(\"errorGeneric\"));\n setError(errorMessage);\n toast.error(t(\"toastErrorTitle\", \"Registration failed\"), {\n description: errorMessage,\n });\n } finally {\n setIsSubmitting(false);\n }\n };\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n setFormData((prev) => ({\n ...prev,\n [e.target.name]: e.target.value,\n }));\n };\n\n if (success) {\n return (\n <Layout>\n <div className=\"min-h-screen bg-muted/30 py-12\">\n <div className=\"w-full max-w-[var(--container-max-width)] mx-auto px-4\">\n <div className=\"max-w-md mx-auto\">\n <Card>\n <CardContent className=\"pt-6\">\n <div className=\"text-center space-y-4\">\n <CheckCircle className=\"w-16 h-16 text-green-500 mx-auto\" />\n <h2 className=\"text-2xl font-bold text-foreground\">\n {t(\"successTitle\")}\n </h2>\n <p className=\"text-muted-foreground\">\n {t(\"successMessage\")}\n </p>\n <Button asChild className=\"mt-4\">\n <Link to=\"/login\">{t(\"goToLogin\")}</Link>\n </Button>\n </div>\n </CardContent>\n </Card>\n </div>\n </div>\n </div>\n </Layout>\n );\n }\n\n return (\n <Layout>\n <div className=\"min-h-screen bg-muted/30 py-12\">\n <div className=\"w-full max-w-[var(--container-max-width)] mx-auto px-4\">\n {/* Hero Section */}\n <div className=\"text-center mb-12\">\n <h1 className=\"text-4xl font-bold text-foreground mb-4\">\n {t(\"title\")}\n </h1>\n <div className=\"w-16 h-1 bg-primary mx-auto mb-6\"></div>\n <p className=\"text-lg text-muted-foreground max-w-xl mx-auto\">\n {t(\"description\")}\n </p>\n </div>\n\n <div className=\"max-w-md mx-auto\">\n <Card>\n <CardHeader>\n <CardTitle className=\"flex items-center gap-2\">\n <UserPlus className=\"w-5 h-5 text-primary\" />\n {t(\"cardTitle\")}\n </CardTitle>\n </CardHeader>\n <CardContent>\n <form onSubmit={handleSubmit} className=\"space-y-6\">\n <div>\n <Label htmlFor=\"username\">{t(\"username\")} *</Label>\n <Input\n id=\"username\"\n name=\"username\"\n type=\"text\"\n value={formData.username}\n onChange={handleChange}\n placeholder={t(\"usernamePlaceholder\")}\n required\n className=\"mt-1\"\n autoComplete=\"username\"\n />\n </div>\n\n <div>\n <Label htmlFor=\"email\">{t(\"email\")} *</Label>\n <Input\n id=\"email\"\n name=\"email\"\n type=\"email\"\n value={formData.email}\n onChange={handleChange}\n placeholder={t(\"emailPlaceholder\")}\n required\n className=\"mt-1\"\n autoComplete=\"email\"\n />\n </div>\n\n <div>\n <Label htmlFor=\"password\">{t(\"password\")} *</Label>\n <div className=\"relative\">\n <Input\n id=\"password\"\n name=\"password\"\n type={showPassword ? \"text\" : \"password\"}\n value={formData.password}\n onChange={handleChange}\n placeholder={t(\"passwordPlaceholder\")}\n required\n className=\"mt-1 pr-10\"\n autoComplete=\"new-password\"\n />\n <button\n type=\"button\"\n onClick={() => setShowPassword(!showPassword)}\n className=\"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground\"\n >\n {showPassword ? (\n <EyeOff className=\"w-4 h-4\" />\n ) : (\n <Eye className=\"w-4 h-4\" />\n )}\n </button>\n </div>\n </div>\n\n <div>\n <Label htmlFor=\"confirmPassword\">\n {t(\"confirmPassword\")} *\n </Label>\n <Input\n id=\"confirmPassword\"\n name=\"confirmPassword\"\n type={showPassword ? \"text\" : \"password\"}\n value={formData.confirmPassword}\n onChange={handleChange}\n placeholder={t(\"confirmPasswordPlaceholder\")}\n required\n className=\"mt-1\"\n autoComplete=\"new-password\"\n />\n </div>\n\n {error && (\n <div className=\"p-4 bg-red-50 border border-red-200 rounded-lg\">\n <p className=\"text-red-800 text-sm font-medium\">\n {error}\n </p>\n </div>\n )}\n\n <Button\n type=\"submit\"\n size=\"lg\"\n className=\"w-full\"\n disabled={isSubmitting}\n >\n {isSubmitting ? (\n <>\n <div className=\"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin mr-2\" />\n {t(\"submitting\")}\n </>\n ) : (\n t(\"submit\")\n )}\n </Button>\n\n <div className=\"text-center text-sm text-muted-foreground\">\n {t(\"hasAccount\")}{\" \"}\n <Link\n to=\"/login\"\n className=\"text-primary hover:underline font-medium\"\n >\n {t(\"loginLink\")}\n </Link>\n </div>\n </form>\n </CardContent>\n </Card>\n </div>\n </div>\n </div>\n </Layout>\n );\n}\n"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"path": "auth/forgot-password-page.tsx",
|
|
51
|
+
"type": "registry:page",
|
|
52
|
+
"target": "$modules$/auth/forgot-password-page.tsx",
|
|
53
|
+
"content": "import { useState } from \"react\";\nimport { Link } from \"react-router\";\nimport { toast } from \"sonner\";\nimport { Layout } from \"@/components/Layout\";\nimport { usePageTitle } from \"@/hooks/use-page-title\";\nimport { useTranslation } from \"react-i18next\";\nimport { useAuth } from \"@/modules/auth/use-auth\";\nimport { getErrorMessage } from \"@/modules/api/get-error-message\";\nimport { Button } from \"@/components/ui/button\";\nimport { Input } from \"@/components/ui/input\";\nimport { Label } from \"@/components/ui/label\";\nimport {\n Card,\n CardContent,\n CardHeader,\n CardTitle,\n CardDescription,\n} from \"@/components/ui/card\";\nimport { KeyRound, ArrowLeft, Eye, EyeOff, CheckCircle2 } from \"lucide-react\";\n\ntype Step = \"request\" | \"reset\" | \"success\";\n\nexport default function ForgotPasswordPage() {\n const { t } = useTranslation(\"forgotPassword\");\n usePageTitle({ title: t(\"title\", \"Forgot Password\") });\n\n const { forgotPassword, resetPassword } = useAuth();\n\n const [step, setStep] = useState<Step>(\"request\");\n const [username, setUsername] = useState(\"\");\n const [code, setCode] = useState(\"\");\n const [newPassword, setNewPassword] = useState(\"\");\n const [confirmPassword, setConfirmPassword] = useState(\"\");\n const [showPassword, setShowPassword] = useState(false);\n const [isSubmitting, setIsSubmitting] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n const handleRequestCode = async (e: React.FormEvent) => {\n e.preventDefault();\n setIsSubmitting(true);\n setError(null);\n\n try {\n await forgotPassword(username);\n toast.success(t(\"codeSentTitle\", \"Code Sent!\"), {\n description: t(\n \"codeSentDesc\",\n \"A password reset code has been sent to your email.\",\n ),\n });\n setStep(\"reset\");\n } catch (err) {\n const errorMessage = getErrorMessage(\n err,\n t(\"errorGeneric\", \"Failed to send reset code. Please try again.\"),\n );\n setError(errorMessage);\n toast.error(t(\"errorTitle\", \"Error\"), {\n description: errorMessage,\n });\n } finally {\n setIsSubmitting(false);\n }\n };\n\n const handleResetPassword = async (e: React.FormEvent) => {\n e.preventDefault();\n setError(null);\n\n // Validate passwords match\n if (newPassword !== confirmPassword) {\n setError(t(\"passwordMismatch\", \"Passwords do not match\"));\n return;\n }\n\n setIsSubmitting(true);\n\n try {\n await resetPassword(username, code, newPassword);\n toast.success(t(\"resetSuccessTitle\", \"Password Reset!\"), {\n description: t(\n \"resetSuccessDesc\",\n \"Your password has been successfully reset.\",\n ),\n });\n setStep(\"success\");\n } catch (err) {\n const errorMessage = getErrorMessage(\n err,\n t(\"errorResetGeneric\", \"Failed to reset password. Please try again.\"),\n );\n setError(errorMessage);\n toast.error(t(\"errorTitle\", \"Error\"), {\n description: errorMessage,\n });\n } finally {\n setIsSubmitting(false);\n }\n };\n\n // Success step\n if (step === \"success\") {\n return (\n <Layout>\n <div className=\"min-h-screen bg-muted/30 py-12\">\n <div className=\"w-full max-w-[var(--container-max-width)] mx-auto px-4\">\n <div className=\"max-w-md mx-auto\">\n <Card>\n <CardContent className=\"pt-8 pb-8 text-center\">\n <CheckCircle2 className=\"w-16 h-16 text-green-500 mx-auto mb-4\" />\n <h1 className=\"text-2xl font-bold mb-2\">\n {t(\"successTitle\", \"Password Reset Successfully!\")}\n </h1>\n <p className=\"text-muted-foreground mb-6\">\n {t(\n \"successDescription\",\n \"Your password has been changed. You can now login with your new password.\",\n )}\n </p>\n <Button asChild className=\"w-full\">\n <Link to=\"/login\">{t(\"goToLogin\", \"Go to Login\")}</Link>\n </Button>\n </CardContent>\n </Card>\n </div>\n </div>\n </div>\n </Layout>\n );\n }\n\n return (\n <Layout>\n <div className=\"min-h-screen bg-muted/30 py-12\">\n <div className=\"w-full max-w-[var(--container-max-width)] mx-auto px-4\">\n {/* Hero Section */}\n <div className=\"text-center mb-12\">\n <h1 className=\"text-4xl font-bold text-foreground mb-4\">\n {t(\"title\", \"Forgot Password\")}\n </h1>\n <div className=\"w-16 h-1 bg-primary mx-auto mb-6\"></div>\n <p className=\"text-lg text-muted-foreground max-w-xl mx-auto\">\n {step === \"request\"\n ? t(\n \"descriptionRequest\",\n \"Enter your username and we'll send you a code to reset your password.\",\n )\n : t(\n \"descriptionReset\",\n \"Enter the code sent to your email and your new password.\",\n )}\n </p>\n </div>\n\n <div className=\"max-w-md mx-auto\">\n <Card>\n <CardHeader>\n <CardTitle className=\"flex items-center gap-2\">\n <KeyRound className=\"w-5 h-5 text-primary\" />\n {step === \"request\"\n ? t(\"cardTitleRequest\", \"Request Reset Code\")\n : t(\"cardTitleReset\", \"Reset Password\")}\n </CardTitle>\n <CardDescription>\n {step === \"request\"\n ? t(\"cardDescRequest\", \"Step 1 of 2: Request a reset code\")\n : t(\n \"cardDescReset\",\n \"Step 2 of 2: Enter code and new password\",\n )}\n </CardDescription>\n </CardHeader>\n <CardContent>\n {step === \"request\" ? (\n // Step 1: Request Code\n <form onSubmit={handleRequestCode} className=\"space-y-6\">\n <div>\n <Label htmlFor=\"username\">\n {t(\"username\", \"Username\")} *\n </Label>\n <Input\n id=\"username\"\n type=\"text\"\n value={username}\n onChange={(e) => setUsername(e.target.value)}\n placeholder={t(\n \"usernamePlaceholder\",\n \"Enter your username\",\n )}\n required\n className=\"mt-1\"\n autoComplete=\"username\"\n />\n </div>\n\n {error && (\n <div className=\"p-4 bg-red-50 border border-red-200 rounded-lg\">\n <p className=\"text-red-800 text-sm font-medium\">\n {error}\n </p>\n </div>\n )}\n\n <Button\n type=\"submit\"\n size=\"lg\"\n className=\"w-full\"\n disabled={isSubmitting}\n >\n {isSubmitting ? (\n <>\n <div className=\"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin mr-2\" />\n {t(\"sending\", \"Sending...\")}\n </>\n ) : (\n t(\"sendCode\", \"Send Reset Code\")\n )}\n </Button>\n\n <div className=\"text-center\">\n <Link\n to=\"/login\"\n className=\"text-sm text-muted-foreground hover:text-primary inline-flex items-center gap-1\"\n >\n <ArrowLeft className=\"w-4 h-4\" />\n {t(\"backToLogin\", \"Back to Login\")}\n </Link>\n </div>\n </form>\n ) : (\n // Step 2: Reset Password\n <form onSubmit={handleResetPassword} className=\"space-y-6\">\n <div className=\"p-3 bg-muted rounded-lg text-sm\">\n <span className=\"text-muted-foreground\">\n {t(\"codeFor\", \"Reset code for:\")}{\" \"}\n </span>\n <span className=\"font-medium\">{username}</span>\n </div>\n\n <div>\n <Label htmlFor=\"code\">{t(\"code\", \"Reset Code\")} *</Label>\n <Input\n id=\"code\"\n type=\"text\"\n value={code}\n onChange={(e) => setCode(e.target.value)}\n placeholder={t(\"codePlaceholder\", \"Enter 6-digit code\")}\n required\n className=\"mt-1\"\n maxLength={6}\n />\n </div>\n\n <div>\n <Label htmlFor=\"newPassword\">\n {t(\"newPassword\", \"New Password\")} *\n </Label>\n <div className=\"relative\">\n <Input\n id=\"newPassword\"\n type={showPassword ? \"text\" : \"password\"}\n value={newPassword}\n onChange={(e) => setNewPassword(e.target.value)}\n placeholder={t(\n \"newPasswordPlaceholder\",\n \"Enter new password\",\n )}\n required\n className=\"mt-1 pr-10\"\n autoComplete=\"new-password\"\n />\n <button\n type=\"button\"\n onClick={() => setShowPassword(!showPassword)}\n className=\"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground\"\n >\n {showPassword ? (\n <EyeOff className=\"w-4 h-4\" />\n ) : (\n <Eye className=\"w-4 h-4\" />\n )}\n </button>\n </div>\n <p className=\"text-xs text-muted-foreground mt-1\">\n {t(\n \"passwordRequirements\",\n \"At least 8 characters, 1 letter and 1 number\",\n )}\n </p>\n </div>\n\n <div>\n <Label htmlFor=\"confirmPassword\">\n {t(\"confirmPassword\", \"Confirm Password\")} *\n </Label>\n <Input\n id=\"confirmPassword\"\n type={showPassword ? \"text\" : \"password\"}\n value={confirmPassword}\n onChange={(e) => setConfirmPassword(e.target.value)}\n placeholder={t(\n \"confirmPasswordPlaceholder\",\n \"Confirm new password\",\n )}\n required\n className=\"mt-1\"\n autoComplete=\"new-password\"\n />\n </div>\n\n {error && (\n <div className=\"p-4 bg-red-50 border border-red-200 rounded-lg\">\n <p className=\"text-red-800 text-sm font-medium\">\n {error}\n </p>\n </div>\n )}\n\n <Button\n type=\"submit\"\n size=\"lg\"\n className=\"w-full\"\n disabled={isSubmitting}\n >\n {isSubmitting ? (\n <>\n <div className=\"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin mr-2\" />\n {t(\"resetting\", \"Resetting...\")}\n </>\n ) : (\n t(\"resetPassword\", \"Reset Password\")\n )}\n </Button>\n\n <div className=\"flex justify-between\">\n <button\n type=\"button\"\n onClick={() => {\n setStep(\"request\");\n setCode(\"\");\n setNewPassword(\"\");\n setConfirmPassword(\"\");\n setError(null);\n }}\n className=\"text-sm text-muted-foreground hover:text-primary\"\n >\n {t(\"changeUsername\", \"Change username\")}\n </button>\n <button\n type=\"button\"\n onClick={() =>\n handleRequestCode({\n preventDefault: () => {},\n } as React.FormEvent)\n }\n className=\"text-sm text-primary hover:underline\"\n disabled={isSubmitting}\n >\n {t(\"resendCode\", \"Resend code\")}\n </button>\n </div>\n </form>\n )}\n </CardContent>\n </Card>\n </div>\n </div>\n </div>\n </Layout>\n );\n}\n"
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
"exports": {
|
|
57
|
+
"types": [
|
|
58
|
+
"AuthTokens",
|
|
59
|
+
"User"
|
|
60
|
+
],
|
|
61
|
+
"variables": [
|
|
62
|
+
"AuthHeaderMenu",
|
|
63
|
+
"ForgotPasswordPage",
|
|
64
|
+
"LoginPage",
|
|
65
|
+
"RegisterPage",
|
|
66
|
+
"useAuth",
|
|
67
|
+
"useAuthStore"
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -10,25 +10,25 @@
|
|
|
10
10
|
"path": "bento-grid-section/index.ts",
|
|
11
11
|
"type": "registry:index",
|
|
12
12
|
"target": "$modules$/bento-grid-section/index.ts",
|
|
13
|
-
"content": "export * from './bento-grid-section';\n"
|
|
13
|
+
"content": "export * from './bento-grid-section';\r\n"
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
16
|
"path": "bento-grid-section/bento-grid-section.tsx",
|
|
17
17
|
"type": "registry:component",
|
|
18
18
|
"target": "$modules$/bento-grid-section/bento-grid-section.tsx",
|
|
19
|
-
"content": "import type { ReactNode } from \"react\";\nimport { cn } from \"@/lib/utils\";\n\n// Bento Grid Components\nexport function BentoGrid({\n className,\n children,\n}: {\n className?: string;\n children?: ReactNode;\n}) {\n return (\n <div\n className={cn(\n \"grid md:auto-rows-[18rem] grid-cols-1 md:grid-cols-3 gap-4 max-w-7xl mx-auto\",\n className\n )}\n >\n {children}\n </div>\n );\n}\n\nexport function BentoGridItem({\n className,\n title,\n description,\n header,\n icon,\n}: {\n className?: string;\n title?: string | ReactNode;\n description?: string | ReactNode;\n header?: ReactNode;\n icon?: ReactNode;\n}) {\n return (\n <div\n className={cn(\n \"row-span-1 rounded-xl group/bento hover:shadow-xl transition duration-200 shadow-input dark:shadow-none p-4 dark:bg-black dark:border-white/[0.2] bg-white border border-transparent justify-between flex flex-col space-y-4\",\n className\n )}\n >\n {header}\n <div className=\"group-hover/bento:translate-x-2 transition duration-200\">\n {icon}\n <div className=\"font-sans font-bold text-neutral-600 dark:text-neutral-200 mb-2 mt-2\">\n {title}\n </div>\n <div className=\"font-sans font-normal text-neutral-600 text-xs dark:text-neutral-300\">\n {description}\n </div>\n </div>\n </div>\n );\n}\n\n// Section Component\ninterface BentoGridSectionProps {\n title?: string;\n items: Array<{\n title: string;\n description: string;\n header?: ReactNode;\n icon?: ReactNode;\n className?: string;\n }>;\n className?: string;\n}\n\nexport function BentoGridSection({\n title,\n items,\n className,\n}: BentoGridSectionProps) {\n return (\n <section className={cn(\"py-16 md:py-24\", className)}>\n <div className=\"w-full max-w-[var(--container-max-width)] mx-auto px-4\">\n {title && (\n <h2 className=\"text-3xl md:text-4xl font-bold text-center mb-12\">\n {title}\n </h2>\n )}\n <BentoGrid>\n {items.map((item, i) => (\n <BentoGridItem\n key={i}\n title={item.title}\n description={item.description}\n header={item.header}\n icon={item.icon}\n className={item.className}\n />\n ))}\n </BentoGrid>\n </div>\n </section>\n );\n}\n"
|
|
19
|
+
"content": "import type { ReactNode } from \"react\";\r\nimport { cn } from \"@/lib/utils\";\r\n\r\n// Bento Grid Components\r\nexport function BentoGrid({\r\n className,\r\n children,\r\n}: {\r\n className?: string;\r\n children?: ReactNode;\r\n}) {\r\n return (\r\n <div\r\n className={cn(\r\n \"grid md:auto-rows-[18rem] grid-cols-1 md:grid-cols-3 gap-4 max-w-7xl mx-auto\",\r\n className\r\n )}\r\n >\r\n {children}\r\n </div>\r\n );\r\n}\r\n\r\nexport function BentoGridItem({\r\n className,\r\n title,\r\n description,\r\n header,\r\n icon,\r\n}: {\r\n className?: string;\r\n title?: string | ReactNode;\r\n description?: string | ReactNode;\r\n header?: ReactNode;\r\n icon?: ReactNode;\r\n}) {\r\n return (\r\n <div\r\n className={cn(\r\n \"row-span-1 rounded-xl group/bento hover:shadow-xl transition duration-200 shadow-input dark:shadow-none p-4 dark:bg-black dark:border-white/[0.2] bg-white border border-transparent justify-between flex flex-col space-y-4\",\r\n className\r\n )}\r\n >\r\n {header}\r\n <div className=\"group-hover/bento:translate-x-2 transition duration-200\">\r\n {icon}\r\n <div className=\"font-sans font-bold text-neutral-600 dark:text-neutral-200 mb-2 mt-2\">\r\n {title}\r\n </div>\r\n <div className=\"font-sans font-normal text-neutral-600 text-xs dark:text-neutral-300\">\r\n {description}\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n\r\n// Section Component\r\ninterface BentoGridSectionProps {\r\n title?: string;\r\n items: Array<{\r\n title: string;\r\n description: string;\r\n header?: ReactNode;\r\n icon?: ReactNode;\r\n className?: string;\r\n }>;\r\n className?: string;\r\n}\r\n\r\nexport function BentoGridSection({\r\n title,\r\n items,\r\n className,\r\n}: BentoGridSectionProps) {\r\n return (\r\n <section className={cn(\"py-16 md:py-24\", className)}>\r\n <div className=\"w-full max-w-[var(--container-max-width)] mx-auto px-4\">\r\n {title && (\r\n <h2 className=\"text-3xl md:text-4xl font-bold text-center mb-12\">\r\n {title}\r\n </h2>\r\n )}\r\n <BentoGrid>\r\n {items.map((item, i) => (\r\n <BentoGridItem\r\n key={i}\r\n title={item.title}\r\n description={item.description}\r\n header={item.header}\r\n icon={item.icon}\r\n className={item.className}\r\n />\r\n ))}\r\n </BentoGrid>\r\n </div>\r\n </section>\r\n );\r\n}\r\n"
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
22
|
"path": "bento-grid-section/lang/en.json",
|
|
23
23
|
"type": "registry:lang",
|
|
24
24
|
"target": "$modules$/bento-grid-section/lang/en.json",
|
|
25
|
-
"content": "{\n \"title\": \"Features\"\n}\n"
|
|
25
|
+
"content": "{\r\n \"title\": \"Features\"\r\n}\r\n"
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
28
|
"path": "bento-grid-section/lang/tr.json",
|
|
29
29
|
"type": "registry:lang",
|
|
30
30
|
"target": "$modules$/bento-grid-section/lang/tr.json",
|
|
31
|
-
"content": "{\n \"title\": \"Özellikler\"\n}\n"
|
|
31
|
+
"content": "{\r\n \"title\": \"Özellikler\"\r\n}\r\n"
|
|
32
32
|
}
|
|
33
33
|
],
|
|
34
34
|
"exports": {
|