diff --git a/apps/lms/next.config.ts b/apps/lms/next.config.ts index b57985b..445d54e 100644 --- a/apps/lms/next.config.ts +++ b/apps/lms/next.config.ts @@ -1,9 +1,7 @@ import type { NextConfig } from "next"; const apiBaseUrl = - process.env.NEXT_PUBLIC_API_BASE_URL || - process.env.NEXT_PUBLIC_API_URL || - "https://api.beewise.vn"; + process.env.NEXT_PUBLIC_API_BASE_URL || process.env.NEXT_PUBLIC_API_URL; const nextConfig: NextConfig = { transpilePackages: ["@workspace/ui", "@workspace/core"], diff --git a/apps/sale/app/(guest)/tutors/[id]/page.tsx b/apps/sale/app/(guest)/tutors/[id]/page.tsx index 3cd3d8a..a8e850b 100644 --- a/apps/sale/app/(guest)/tutors/[id]/page.tsx +++ b/apps/sale/app/(guest)/tutors/[id]/page.tsx @@ -1,6 +1,5 @@ import type { Metadata } from "next"; import { Footer } from '@workspace/ui/components/layout/Footer'; -import { Header } from '@workspace/ui/components/layout/Header'; import { TutorProfilePage } from '@/features/tutor-profile/components/TutorProfilePage'; export const metadata: Metadata = { @@ -12,11 +11,11 @@ export const metadata: Metadata = { export default function TutorProfileRoutePage() { return (
-
-
+
); } + diff --git a/apps/sale/app/layout.tsx b/apps/sale/app/layout.tsx index 4322fba..932b441 100644 --- a/apps/sale/app/layout.tsx +++ b/apps/sale/app/layout.tsx @@ -4,6 +4,7 @@ import "@workspace/ui/globals.css"; import { Metadata } from "next"; import { GuestFavoriteModal } from "@/features/favorite-tutors/components/GuestFavoriteModal"; import { NotificationDrawer } from "@/features/notifications/components/NotificationDrawer"; +import { MessageFAB } from "@/features/messages"; import { saleSeoConfig } from "@/configs/seo"; export const metadata: Metadata = { @@ -27,6 +28,7 @@ export default function RootLayout({ {children} + diff --git a/apps/sale/features/favorite-tutors/components/GuestFavoriteModal.tsx b/apps/sale/features/favorite-tutors/components/GuestFavoriteModal.tsx index ce1bd8c..4651a00 100644 --- a/apps/sale/features/favorite-tutors/components/GuestFavoriteModal.tsx +++ b/apps/sale/features/favorite-tutors/components/GuestFavoriteModal.tsx @@ -33,9 +33,6 @@ export function GuestFavoriteModal() { {/* Heart icon with badge */}
-
- -
diff --git a/apps/sale/features/messages/components/MessageFAB.tsx b/apps/sale/features/messages/components/MessageFAB.tsx new file mode 100644 index 0000000..7b3228f --- /dev/null +++ b/apps/sale/features/messages/components/MessageFAB.tsx @@ -0,0 +1,60 @@ +"use client"; + +import Link from "next/link"; +import Image from "next/image"; +import { usePathname } from "next/navigation"; +import { useAuthStore } from "@workspace/core/store/useAuthStore"; + +/** + * Floating message button shown at the bottom-right of the screen. + * Only visible for authenticated LEARNER users. + * Excluded on the messages page itself. + */ +export function MessageFAB() { + const pathname = usePathname(); + const user = useAuthStore((state) => state.user); + const isAuthenticated = useAuthStore((state) => state.isAuthenticated); + const isAuthLoading = useAuthStore((state) => state.isAuthLoading); + + const unreadChatCount = Math.max(0, user?.unreadChatCount ?? 0); + const isLearner = user?.role?.trim().toUpperCase() === "LEARNER"; + + // Hide when: loading, unauthenticated, not learner, or already on messages page + const isOnMessagesPage = + pathname?.startsWith("/learner/messages") ?? false; + + if (isAuthLoading || !isAuthenticated || !isLearner || isOnMessagesPage) { + return null; + } + + return ( + + {/* Icon */} + Tin nhắn + + {/* Unread badge */} + {unreadChatCount > 0 && ( + + {unreadChatCount > 99 ? "99+" : unreadChatCount} + + )} + + ); +} diff --git a/apps/sale/features/messages/index.ts b/apps/sale/features/messages/index.ts index b44ccdb..1a0afef 100644 --- a/apps/sale/features/messages/index.ts +++ b/apps/sale/features/messages/index.ts @@ -4,6 +4,7 @@ export * from "./components/ChatRoomScreen"; export * from "./components/ChatRoomPanel"; export * from "./components/ChatSidebar"; export * from "./components/LearnerMessagesRoute"; +export * from "./components/MessageFAB"; export * from "./hooks/useMessages"; export * from "./hooks/useChatRoom"; diff --git a/apps/sale/features/tutor-list/components/SearchBar.tsx b/apps/sale/features/tutor-list/components/SearchBar.tsx index 035b325..272db80 100644 --- a/apps/sale/features/tutor-list/components/SearchBar.tsx +++ b/apps/sale/features/tutor-list/components/SearchBar.tsx @@ -57,7 +57,7 @@ export function SearchBar({ ? "bg-background text-foreground shadow-sm border border-border" : "text-foreground/50 hover:text-foreground/80" }`} - style={{ fontFamily: "var(--font-nunito-family)" }} + style={{ fontFamily: "var(--font-google-sans)" }} aria-selected={!isAI} role="tab" id="search-mode-manual" @@ -73,7 +73,7 @@ export function SearchBar({ ? "bg-primary text-primary-foreground shadow-sm" : "text-foreground/50 hover:text-foreground/80" }`} - style={{ fontFamily: "var(--font-nunito-family)" }} + style={{ fontFamily: "var(--font-google-sans)" }} aria-selected={isAI} role="tab" id="search-mode-ai" @@ -162,8 +162,19 @@ export function SearchBar({ aria-label={isAI ? "Tìm với AI" : "Tìm kiếm"} > {isLoading && isAI ? ( - <>