Skip to content

Commit

Permalink
refactor: standardize naming convention
Browse files Browse the repository at this point in the history
  • Loading branch information
ddaoxuan committed Oct 17, 2024
1 parent 0f62987 commit 9a1a932
Show file tree
Hide file tree
Showing 185 changed files with 373 additions and 335 deletions.
2 changes: 1 addition & 1 deletion starters/shopify-meilisearch/app/actions/cart.actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { revalidateTag, unstable_cache } from "next/cache"
import { cookies } from "next/headers"
import { storefrontClient } from "clients/storefrontClient"
import { COOKIE_CART_ID, TAGS } from "constants/index"
import { isDemoMode } from "utils/demoUtils"
import { isDemoMode } from "utils/demo-utils"

export const getCart = unstable_cache(async (cartId: string) => storefrontClient.getCart(cartId), [TAGS.CART], { revalidate: 60 * 15, tags: [TAGS.CART] })

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import { unstable_cache } from "next/cache"
import { meilisearch } from "clients/search"
import { ComparisonOperators, FilterBuilder } from "lib/meilisearch/filterBuilder"
import { getDemoSingleCategory, isDemoMode } from "utils/demoUtils"
import { ComparisonOperators, FilterBuilder } from "lib/meilisearch/filter-builder"
import { getDemoSingleCategory, isDemoMode } from "utils/demo-utils"
import type { PlatformCollection } from "lib/shopify/types"
import { env } from "env.mjs"

Expand Down
4 changes: 2 additions & 2 deletions starters/shopify-meilisearch/app/actions/product.actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { env } from "env.mjs"
import { meilisearch } from "clients/search"
import type { Review } from "lib/reviews/types"

import { ComparisonOperators, FilterBuilder } from "lib/meilisearch/filterBuilder"
import { getDemoProductReviews, getDemoSingleProduct, isDemoMode } from "utils/demoUtils"
import { ComparisonOperators, FilterBuilder } from "lib/meilisearch/filter-builder"
import { getDemoProductReviews, getDemoSingleProduct, isDemoMode } from "utils/demo-utils"
import type { CommerceProduct } from "types"
import { notifyOptIn } from "utils/opt-in"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { env } from "env.mjs"
import { authenticate } from "utils/authenticate-api-route"
import { isOptIn, notifyOptIn } from "utils/opt-in"
import { unstable_noStore } from "next/cache"
import { isDemoMode } from "utils/demoUtils"
import { isDemoMode } from "utils/demo-utils"

const summarySchema = z.object({
products: z.array(
Expand Down
2 changes: 1 addition & 1 deletion starters/shopify-meilisearch/app/api/reviews/sync/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { authenticate } from "utils/authenticate-api-route"
import { isOptIn, notifyOptIn } from "utils/opt-in"
import type { Review } from "lib/reviews/types"
import type { CommerceProduct } from "types"
import { isDemoMode } from "utils/demoUtils"
import { isDemoMode } from "utils/demo-utils"

export const maxDuration = 60

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Metadata } from "next"
import { CategoryView } from "views/Category/CategoryView"
import { CategoryView } from "views/category/category-view"

export const revalidate = 86400
export const dynamic = "force-static"
Expand Down
4 changes: 2 additions & 2 deletions starters/shopify-meilisearch/app/category/clp/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { PlatformCollection } from "lib/shopify/types"
import { meilisearch } from "clients/search"
import { env } from "env.mjs"
import type { Metadata } from "next"
import { isDemoMode } from "utils/demoUtils"
import { CategoryView } from "views/Category/CategoryView"
import { isDemoMode } from "utils/demo-utils"
import { CategoryView } from "views/category/category-view"

export const revalidate = 86400
export const dynamic = "force-static"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Metadata } from "next"
import { SearchParamsType } from "types"
import { CategoryView } from "views/Category/CategoryView"
import { CategoryView } from "views/category/category-view"

export const runtime = "nodejs"

Expand Down
4 changes: 2 additions & 2 deletions starters/shopify-meilisearch/app/error.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client"

import { Button } from "components/Button/Button"
import { isDemoMode } from "utils/demoUtils"
import { Button } from "components/ui/button-old"
import { isDemoMode } from "utils/demo-utils"

export default function Error({ error, reset }: { error: Error & { digest?: string }; reset: () => void }) {
return (
Expand Down
4 changes: 2 additions & 2 deletions starters/shopify-meilisearch/app/favorites/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { cookies } from "next/headers"
import { Suspense } from "react"
import { getProduct } from "app/actions/product.actions"
import { ProductCard } from "components/ProductCard/ProductCard"
import { Skeleton } from "components/Skeleton/Skeleton"
import { ProductCard } from "components/product-card"
import { Skeleton } from "components/ui/skeleton"
import { COOKIE_FAVORITES } from "constants/index"

export const revalidate = 86400
Expand Down
2 changes: 1 addition & 1 deletion starters/shopify-meilisearch/app/global-error.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client"

import { Button } from "components/Button/Button"
import { Button } from "components/ui/button-old"

export default function GlobalError({ error, reset }: { error: Error & { digest?: string }; reset: () => void }) {
return (
Expand Down
12 changes: 6 additions & 6 deletions starters/shopify-meilisearch/app/home/[bucket]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Suspense } from "react"
import { BUCKETS } from "constants/index"
import { BestOffersSection } from "views/Homepage/BestOffersSection"
import { CarouselSectionSkeleton } from "views/Homepage/CarouselSection"
import { CategoriesSection, CategoriesSectionSkeleton } from "views/Homepage/CategoriesSection"
import { EverythingUnderSection } from "views/Homepage/EverythingUnderSection"
import { AnnouncementBar } from "components/AnnouncementBar/AnnouncementBar"
import { HeroSection } from "views/Homepage/HeroSection"
import { BestOffersSection } from "views/homepage/best-offers-skeleton"
import { CarouselSectionSkeleton } from "views/homepage/carousel-section"
import { CategoriesSection, CategoriesSectionSkeleton } from "views/homepage/categories-section"
import { EverythingUnderSection } from "views/homepage/everything-under-section"
import { AnnouncementBar } from "components/announcement-bar"
import { HeroSection } from "views/homepage/hero-section"

export const revalidate = 86400

Expand Down
24 changes: 12 additions & 12 deletions starters/shopify-meilisearch/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ import nextDynamic from "next/dynamic"
import Script from "next/script"
import { Suspense } from "react"
import { Toaster } from "sonner"
import { CallToAction } from "components/CallToAction/CallToAction"
import { Footer } from "components/Footer/Footer"
import { Modals } from "components/Modals/Modals"
import { mobileInlineScript } from "components/NavigationBar/mobileInlineScript"
import { NavigationBar } from "components/NavigationBar/NavigationBar"
import { NavItem } from "components/NavigationBar/types"
import { FlagValues } from "views/FlagValues"
import { ThirdParties } from "views/ThirdParties"
import { FlagValues } from "views/flag-values"
import { ThirdParties } from "views/third-parties"
import { env } from "env.mjs"
import { Metadata } from "next"
import { GithubBadge } from "views/GithubBadge"
import { DemoModeAlert } from "views/DemoModeAlert"
import { CartView } from "views/Cart/CartView"
import { GithubBadge } from "views/github-badge"
import { DemoModeAlert } from "views/demo-mode-alert"
import { CartView } from "views/cart/cart-view"
import type { NavItem } from "components/navigation-bar/types"
import { NavigationBar } from "components/navigation-bar/navigation-bar"
import { mobileInlineScript } from "components/navigation-bar/mobile-inline-script"
import { CallToAction } from "components/call-to-action"
import { Footer } from "components/footer"
import { Modals } from "components/modals/modals"

const DraftToolbar = nextDynamic(() => import("views/DraftToolbar"), { ssr: false })
const DraftToolbar = nextDynamic(() => import("views/draft-toolbar"), { ssr: false })

export const revalidate = 86400

Expand Down
26 changes: 13 additions & 13 deletions starters/shopify-meilisearch/app/product/[slug]/draft/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ import { Suspense } from "react"
import { storefrontClient } from "clients/storefrontClient"
import type { CommerceProduct } from "types"

import { Breadcrumbs } from "components/Breadcrumbs/Breadcrumbs"
import { Breadcrumbs } from "components/breadcrumbs"

import type { PlatformProduct } from "lib/shopify/types"
import { getCombination, getOptionsFromUrl, hasValidOption, removeOptionsFromUrl } from "utils/productOptionsUtils"
import { BackButton } from "views/Product/BackButton"
import { SimilarProductsSection } from "views/Product/SimilarProductsSection"
import { SimilarProductsSectionSkeleton } from "views/Product/SimilarProductsSectionSkeleton"
import { VariantsSection } from "views/Product/VariantsSection"
import { ProductTitle } from "views/Product/ProductTitle"
import { CurrencyType, mapCurrencyToSign } from "utils/mapCurrencyToSign"
import { ProductImages } from "views/Product/ProductImages"
import { RightSection } from "views/Product/RightSection"
import { AddToCartButton } from "views/Product/AddToCartButton"
import { FavoriteMarker } from "views/Product/FavoriteMarker"
import { FaqSection } from "views/Product/FaqSection"
import { getCombination, getOptionsFromUrl, hasValidOption, removeOptionsFromUrl } from "utils/product-options-utils"
import { BackButton } from "views/product/back-button"
import { SimilarProductsSection } from "views/product/similar-products-section"
import { SimilarProductsSectionSkeleton } from "views/product/similar-product-section-skeleton"
import { VariantsSection } from "views/product/variants-section"
import { ProductTitle } from "views/product/product-title"
import { CurrencyType, mapCurrencyToSign } from "utils/map-currency-to-sign"
import { ProductImages } from "views/product/product-images"
import { RightSection } from "views/product/right-section"
import { AddToCartButton } from "views/product/add-to-cart-button"
import { FavoriteMarker } from "views/product/favorite-marker"
import { FaqSection } from "views/product/faq-section"

import { slugToName } from "utils/slug-name"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PageSkeleton } from "views/Product/PageSkeleton"
import { PageSkeleton } from "views/product/page-skeleton"

export default function Loading() {
return <PageSkeleton />
Expand Down
4 changes: 2 additions & 2 deletions starters/shopify-meilisearch/app/product/[slug]/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { Metadata } from "next"
import { Product, WithContext } from "schema-dts"
import { getProduct } from "app/actions/product.actions"
import { env } from "env.mjs"
import { makeKeywords } from "utils/makeKeywords"
import { removeOptionsFromUrl } from "utils/productOptionsUtils"
import { makeKeywords } from "utils/make-keywords"
import { removeOptionsFromUrl } from "utils/product-options-utils"
import type { CommerceProduct } from "types"
import { slugToName } from "utils/slug-name"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import { ImageResponse } from "next/og"
import { getProduct } from "app/actions/product.actions"
import { removeOptionsFromUrl } from "utils/productOptionsUtils"
import { removeOptionsFromUrl } from "utils/product-options-utils"
import { env } from "env.mjs"

export const revalidate = 86400
Expand Down
32 changes: 16 additions & 16 deletions starters/shopify-meilisearch/app/product/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
import { notFound } from "next/navigation"
import { Suspense } from "react"
import { getProduct, getProductReviews } from "app/actions/product.actions"
import { Breadcrumbs } from "components/Breadcrumbs/Breadcrumbs"

import { getCombination, getOptionsFromUrl, hasValidOption, removeOptionsFromUrl } from "utils/productOptionsUtils"
import { BackButton } from "views/Product/BackButton"
import { FavoriteMarker } from "views/Product/FavoriteMarker"
import { SimilarProductsSection } from "views/Product/SimilarProductsSection"
import { SimilarProductsSectionSkeleton } from "views/Product/SimilarProductsSectionSkeleton"
import { VariantsSection } from "views/Product/VariantsSection"
import { Breadcrumbs } from "components/breadcrumbs"

import { getCombination, getOptionsFromUrl, hasValidOption, removeOptionsFromUrl } from "utils/product-options-utils"
import { BackButton } from "views/product/back-button"
import { FavoriteMarker } from "views/product/favorite-marker"
import { SimilarProductsSection } from "views/product/similar-products-section"
import { SimilarProductsSectionSkeleton } from "views/product/similar-product-section-skeleton"
import { VariantsSection } from "views/product/variants-section"
import { slugToName } from "utils/slug-name"

import { generateJsonLd } from "./metadata"
import { ReviewsSection } from "views/Product/ReviewsSection"
import { ReviewsSection } from "views/product/reviews-section"

import type { CommerceProduct } from "types"
import { isDemoMode } from "utils/demoUtils"
import { isDemoMode } from "utils/demo-utils"
import { meilisearch } from "clients/search"
import { env } from "env.mjs"
import { ProductTitle } from "views/Product/ProductTitle"
import { CurrencyType, mapCurrencyToSign } from "utils/mapCurrencyToSign"
import { ProductImages } from "views/Product/ProductImages"
import { RightSection } from "views/Product/RightSection"
import { FaqSection } from "views/Product/FaqSection"
import { AddToCartButton } from "views/Product/AddToCartButton"
import { ProductTitle } from "views/product/product-title"
import { CurrencyType, mapCurrencyToSign } from "utils/map-currency-to-sign"
import { ProductImages } from "views/product/product-images"
import { RightSection } from "views/product/right-section"
import { FaqSection } from "views/product/faq-section"
import { AddToCartButton } from "views/product/add-to-cart-button"

export const revalidate = 86400
export const dynamic = "force-static"
Expand Down
4 changes: 2 additions & 2 deletions starters/shopify-meilisearch/app/reviews/[slug]/metadata.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getProduct } from "app/actions/product.actions"
import { env } from "process"
import { makeKeywords } from "utils/makeKeywords"
import { removeOptionsFromUrl } from "utils/productOptionsUtils"
import { makeKeywords } from "utils/make-keywords"
import { removeOptionsFromUrl } from "utils/product-options-utils"
import type { ProductReviewsPageProps } from "./page"
import { Metadata } from "next"

Expand Down
10 changes: 5 additions & 5 deletions starters/shopify-meilisearch/app/reviews/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { notFound, redirect } from "next/navigation"
import { getProduct, getProductReviews } from "app/actions/product.actions"
import { Breadcrumbs } from "components/Breadcrumbs/Breadcrumbs"
import { Breadcrumbs } from "components/breadcrumbs"

import { BackButton } from "views/Product/BackButton"
import { StarRating } from "views/Product/StarRating"
import { PaginationSection } from "views/Listing/PaginationSection"
import { BackButton } from "views/product/back-button"
import { StarRating } from "views/product/star-rating"
import { PaginationSection } from "views/listing/pagination-section"

import { removeOptionsFromUrl } from "utils/productOptionsUtils"
import { removeOptionsFromUrl } from "utils/product-options-utils"
import type { CommerceProduct } from "types"

export { generateMetadata } from "./metadata"
Expand Down
4 changes: 2 additions & 2 deletions starters/shopify-meilisearch/app/search/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Metadata } from "next"
import { Suspense } from "react"
import type { SearchParamsType } from "types"
import { PageSkeleton } from "views/Category/PageSkeleton"
import { SearchView } from "views/Search/SearchView"
import { PageSkeleton } from "views/category/page-skeleton"
import { SearchView } from "views/search/search-view"

export const metadata: Metadata = {
title: "Search | Enterprise Commerce",
Expand Down
2 changes: 1 addition & 1 deletion starters/shopify-meilisearch/app/settings/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SettingsView } from "views/Settings/SettingsView"
import { SettingsView } from "views/settings/settings-view"

export default function Settings() {
return <SettingsView />
Expand Down
2 changes: 1 addition & 1 deletion starters/shopify-meilisearch/app/sitemap.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { env } from "env.mjs"
import { MetadataRoute } from "next"
import { meilisearch } from "clients/search"
import { getDemoCategories, getDemoProducts, isDemoMode } from "utils/demoUtils"
import { getDemoCategories, getDemoProducts, isDemoMode } from "utils/demo-utils"
import type { PlatformCollection } from "lib/shopify/types"
import type { CommerceProduct } from "types"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client"

import { Button } from "components/Button/Button"
import { useModalStore } from "stores/modalStore"
import { Button } from "components/ui/button-old"
import { useModalStore } from "stores/modal-store"

export function AuthActions() {
const openModal = useModalStore((s) => s.openModal)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbSeparator } from "components/Breadcrumb/Breadcrumb"
import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbSeparator } from "components/ui/breadcrumb"
import React from "react"
import { cn } from "utils/cn"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Button } from "components/Button/Button"
import { Input } from "components/Input/Input"
import { Label } from "components/Label/Label"
import { Button } from "components/ui/button-old"
import { Input } from "components/ui/input"
import { Label } from "components/ui/label"

export function CallToAction() {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client"

import { ChevronIcon } from "components/Icons/ChevronIcon"
import { ChevronIcon } from "components/icons/chevron-icon"
import { type ReactNode, useEffect, useRef, useState } from "react"
import { cn } from "utils/cn"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Dialog, DialogClose, DialogContent, DialogHeader, DialogTitle } from "components/Dialog/Dialog"
import { CloseIcon } from "components/Icons/CloseIcon"
import { Dialog, DialogClose, DialogContent, DialogHeader, DialogTitle } from "components/ui/dialog"
import { CloseIcon } from "components/icons/close-icon"
import { cn } from "utils/cn"

interface FacetsModalProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { useForm } from "react-hook-form"
import { toast } from "sonner"
import { z } from "zod"
import { getCurrentUser, loginUser } from "app/actions/user.actions"
import { Button } from "components/Button/Button"
import { DialogFooter } from "components/Dialog/Dialog"
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "components/Form/Form"
import { GenericModal } from "components/GenericModal/GenericModal"
import { Input } from "components/Input/Input"
import { Logo } from "components/Logo/Logo"
import { useModalStore } from "stores/modalStore"
import { useUserStore } from "stores/userStore"
import { Button } from "components/ui/button-old"
import { DialogFooter } from "components/ui/dialog"
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "components/ui/form"
import { GenericModal } from "components/generic-modal"
import { Input } from "components/ui/input"
import { Logo } from "components/logo"
import { useModalStore } from "stores/modal-store"
import { useUserStore } from "stores/user-store"

const passwordRegexp = new RegExp(/(?=.*\d)(?=.*\W)(?=.*[a-z])(?=.*[A-Z]).{8,20}$/)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import dynamic from "next/dynamic"
import React from "react"
import { type Modal, useModalStore } from "stores/modalStore"
import { ReviewModal } from "./ReviewModal"
import { type Modal, useModalStore } from "stores/modal-store"
import { ReviewModal } from "./review-modal"

const LoginModal = dynamic(() => import("./LoginModal").then((m) => m.LoginModal), { loading: Placeholder })
const SignupModal = dynamic(() => import("./SignupModal").then((m) => m.SignupModal), { loading: Placeholder })
const SearchModal = dynamic(() => import("./SearchModal").then((m) => m.SearchModal), { loading: Placeholder })
const LoginModal = dynamic(() => import("./login-modal").then((m) => m.LoginModal), { loading: Placeholder })
const SignupModal = dynamic(() => import("./signup-modal").then((m) => m.SignupModal), { loading: Placeholder })
const SearchModal = dynamic(() => import("./search-modal").then((m) => m.SearchModal), { loading: Placeholder })

export function Modals() {
const modals = useModalStore((s) => s.modals)
Expand Down
Loading

0 comments on commit 9a1a932

Please sign in to comment.