diff --git a/.env.example b/.env.example index bf07f5b..a204f83 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,3 @@ NEXT_PUBLIC_API_URL=http://api.mana-collection.com:3002/api/v1 -NEXT_PUBLIC_STORE_URL=http://store.mana-collection.com:3000 +NEXT_PUBLIC_STORE_URL=http://store.mana-collection.com:3001 NEXT_PUBLIC_SITE_URL=http://mana-collection.com:3000 diff --git a/README.md b/README.md index 3264764..faffbc8 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,9 @@ Shared Next.js app for **store admin** and **customer** account UI. | URL | App | |-----|-----| -| http://store.mana-collection.com:3000 | Store dashboard | -| http://customer.mana-collection.com:3000 | Customer (same app) | +| http://mana-collection.com:3000 | Website (coming soon) | +| http://store.mana-collection.com:3001 | Store dashboard | +| http://customer.mana-collection.com:3001 | Customer (same app) | | http://api.mana-collection.com:3002/api/v1 | Backend API | ```bash diff --git a/package.json b/package.json index b52eafa..b2cab91 100644 --- a/package.json +++ b/package.json @@ -3,9 +3,9 @@ "version": "0.1.0", "private": true, "scripts": { - "dev": "next dev -H 0.0.0.0 -p 3000", + "dev": "next dev -H 0.0.0.0 -p 3001", "build": "next build", - "start": "next start -H 0.0.0.0 -p 3000", + "start": "next start -H 0.0.0.0 -p 3001", "lint": "eslint" }, "dependencies": { diff --git a/src/app/coming-soon/page.tsx b/src/app/coming-soon/page.tsx deleted file mode 100644 index 2eb9f82..0000000 --- a/src/app/coming-soon/page.tsx +++ /dev/null @@ -1,87 +0,0 @@ -import type { Metadata } from "next"; -import Image from "next/image"; -import ManaLogo from "@/components/ui/ManaLogo"; - -export const metadata: Metadata = { - title: "به‌زودی | مانا کالکشن", - description: "فروشگاه آنلاین مانا کالکشن به‌زودی در دسترس خواهد بود.", -}; - -const STORE_LOGIN = - process.env.NEXT_PUBLIC_STORE_URL?.replace(/\/$/, "") || - "http://store.mana-collection.com:3000"; - -export default function ComingSoonPage() { - return ( -
- {/* dir=ltr keeps content on visual left, image on visual right */} -
- {/* Content — left */} -
-
- -
-
- -
- -
-
-

- Coming soon -

-

- به‌زودی -

-

- در این آدرس میزبان شما خواهیم بود. -

-
-
- - -
-
- - {/* Image — right */} - -
-
- ); -} diff --git a/src/app/globals.css b/src/app/globals.css index 2ac1e14..a5514fb 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -35,129 +35,6 @@ body { font-family: var(--font-montserrat), system-ui, sans-serif; } -/* Soft paper atmosphere + scattered random dots */ -@keyframes coming-soon-rise { - from { - opacity: 0; - transform: translateY(22px); - filter: blur(6px); - } - to { - opacity: 1; - transform: translateY(0); - filter: blur(0); - } -} - -@keyframes coming-soon-panel { - from { - opacity: 0; - transform: translateX(24px); - } - to { - opacity: 1; - transform: translateX(0); - } -} - -@keyframes coming-soon-drift { - 0% { - transform: scale(1) translate3d(0, 0, 0); - } - 100% { - transform: scale(1.06) translate3d(-0.8%, 0.5%, 0); - } -} - -@keyframes coming-soon-line { - from { - transform: scaleX(0); - opacity: 0; - } - to { - transform: scaleX(1); - opacity: 1; - } -} - -@keyframes coming-soon-glow { - 0%, - 100% { - box-shadow: 0 0 0 0 rgba(10, 10, 10, 0); - } - 50% { - box-shadow: 0 0 0 4px rgba(10, 10, 10, 0.06); - } -} - -.coming-soon-seq { - opacity: 0; - animation: coming-soon-rise 0.95s cubic-bezier(0.16, 1, 0.3, 1) forwards; -} - -.coming-soon-seq-1 { - animation-delay: 0.12s; -} - -.coming-soon-seq-2 { - animation-delay: 0.38s; -} - -.coming-soon-seq-3 { - animation-delay: 0.58s; -} - -.coming-soon-seq-4 { - animation-delay: 0.78s; -} - -.coming-soon-seq-5 { - animation-delay: 1s; -} - -.coming-soon-seq-5 { - position: relative; -} - -.coming-soon-seq-5::before { - content: ""; - position: absolute; - top: 0; - inset-inline: 0; - height: 1px; - background: var(--line); - transform-origin: center; - animation: coming-soon-line 0.7s cubic-bezier(0.16, 1, 0.3, 1) 1.05s both; -} - -.coming-soon-seq-image { - opacity: 0; - animation: coming-soon-panel 1.1s ease-out 0.05s forwards; -} - -.coming-soon-image { - transform: scale(1); - animation: coming-soon-drift 20s ease-in-out 1.2s alternate infinite both; - will-change: transform; -} - -.coming-soon-login { - animation: coming-soon-glow 2.4s ease-in-out 1.6s 2; -} - -@media (prefers-reduced-motion: reduce) { - .coming-soon-seq, - .coming-soon-seq-image, - .coming-soon-image, - .coming-soon-seq-5::before, - .coming-soon-login { - animation: none !important; - opacity: 1 !important; - filter: none !important; - transform: none !important; - } -} - .mana-canvas, .auth-canvas { background: diff --git a/src/components/RequireStoreAuth.tsx b/src/components/RequireStoreAuth.tsx index 1701e0b..55be136 100644 --- a/src/components/RequireStoreAuth.tsx +++ b/src/components/RequireStoreAuth.tsx @@ -4,12 +4,7 @@ import { useEffect } from "react"; import { usePathname, useRouter } from "next/navigation"; import { useAuth } from "@/lib/auth"; -const PUBLIC_PATHS = ["/login", "/coming-soon"]; - -const WEBSITE_HOSTS = new Set([ - "mana-collection.com", - "www.mana-collection.com", -]); +const PUBLIC_PATHS = ["/login"]; export default function RequireStoreAuth({ children, @@ -20,14 +15,9 @@ export default function RequireStoreAuth({ const pathname = usePathname(); const router = useRouter(); - const host = - typeof window !== "undefined" - ? window.location.hostname.toLowerCase() - : ""; - const onWebsite = WEBSITE_HOSTS.has(host); - const isPublic = - onWebsite || - PUBLIC_PATHS.some((p) => pathname === p || pathname.startsWith(`${p}/`)); + const isPublic = PUBLIC_PATHS.some( + (p) => pathname === p || pathname.startsWith(`${p}/`), + ); useEffect(() => { if (loading || isPublic) return; diff --git a/src/middleware.ts b/src/middleware.ts index d712e92..4878742 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -5,6 +5,10 @@ const WEBSITE_HOSTS = new Set([ "www.mana-collection.com", ]); +const SITE_ORIGIN = + process.env.NEXT_PUBLIC_SITE_URL?.replace(/\/$/, "") || + "http://mana-collection.com:3000"; + export function middleware(request: NextRequest) { const host = request.headers.get("host")?.split(":")[0]?.toLowerCase() ?? ""; if (!WEBSITE_HOSTS.has(host)) { @@ -21,15 +25,11 @@ export function middleware(request: NextRequest) { return NextResponse.next(); } - if (pathname === "/coming-soon") { - return NextResponse.next(); - } - - const url = request.nextUrl.clone(); - url.pathname = "/coming-soon"; - return NextResponse.redirect(url); + return NextResponse.redirect(new URL(pathname || "/", SITE_ORIGIN)); } export const config = { - matcher: ["/((?!_next/static|_next/image|.*\\.(?:svg|png|jpg|jpeg|gif|webp|woff|woff2|otf|ttf)$).*)"], + matcher: [ + "/((?!_next/static|_next/image|.*\\.(?:svg|png|jpg|jpeg|gif|webp|woff|woff2|otf|ttf)$).*)", + ], };