From cf880f573f5da6b0020fc251f2be7ca8f67ce457 Mon Sep 17 00:00:00 2001 From: bokhonglo Date: Sat, 9 May 2026 16:22:22 +0700 Subject: [PATCH] quick question, answer --- src/app/user/quick-qa/page.tsx | 82 ++++++++++++++++++++++++++++++++++ src/layout/AppSidebar.tsx | 68 +++++++++++++++------------- 2 files changed, 119 insertions(+), 31 deletions(-) create mode 100644 src/app/user/quick-qa/page.tsx diff --git a/src/app/user/quick-qa/page.tsx b/src/app/user/quick-qa/page.tsx new file mode 100644 index 0000000..c4a4c0d --- /dev/null +++ b/src/app/user/quick-qa/page.tsx @@ -0,0 +1,82 @@ +'use client'; + +import { useState } from 'react'; + +const faqData = [ + { + id: 1, + question: "1. Phần mềm này tương thích với những hệ điều hành nào?", + answer: "Hệ thống tương thích hoàn toàn với Windows 10/11, macOS 12 trở lên. Đối với môi trường máy chủ, chúng tôi hỗ trợ các bản phân phối Linux phổ biến như Ubuntu và Debian." + }, + { + id: 2, + question: "2. Sự khác biệt giữa phiên bản Miễn phí và Trả phí là gì?", + answer: "Phiên bản trả phí cung cấp băng thông không giới hạn, hỗ trợ kỹ thuật ưu tiên 24/7, và quyền truy cập sớm vào các tính năng nâng cao. Bản miễn phí sẽ giới hạn một số tính năng xuất dữ liệu." + }, + { + id: 3, + question: "3. Hệ thống hỗ trợ những phương thức kết nối nào?", + answer: "Chúng tôi hỗ trợ kết nối qua REST API, WebSocket cho dữ liệu thời gian thực và cung cấp sẵn SDK cho các ngôn ngữ phổ biến như TypeScript, Go." + }, + { + id: 4, + question: "4. Làm thế nào để tôi có thể tích hợp vào dự án Next.js hiện tại?", + answer: "Bạn chỉ cần cài đặt package qua npm/yarn, thêm API Key vào file .env và gọi component Provider ở file layout.tsx gốc. Tài liệu chi tiết có sẵn trong mục Developer Docs." + }, + { + id: 5, + question: "5. Dữ liệu của tôi được bảo mật như thế nào?", + answer: "Toàn bộ dữ liệu được mã hóa đầu cuối (End-to-End Encryption). Chúng tôi tuân thủ nghiêm ngặt các tiêu chuẩn bảo mật quốc tế và thường xuyên rà soát hệ thống để phòng chống các lỗ hổng bảo mật." + } +]; + +export default function Page() { + // Lưu index của câu hỏi đang được mở. Mặc định mở câu đầu tiên (index 0). + const [openIndex, setOpenIndex] = useState(0); + + const toggleFAQ = (index: number) => { + // Nếu click lại vào câu đang mở thì đóng nó, ngược lại thì mở câu mới + setOpenIndex(openIndex === index ? null : index); + }; + + return ( +
+
+

FAQs

+ +
+ {faqData.map((faq, index) => { + const isOpen = openIndex === index; + + return ( +
+ + + {/* Phần nội dung có hiệu ứng trượt */} +
+

+ {faq.answer} +

+
+
+ ); + })} +
+
+
+ ); +} \ No newline at end of file diff --git a/src/layout/AppSidebar.tsx b/src/layout/AppSidebar.tsx index a6352c3..17a0d6c 100644 --- a/src/layout/AppSidebar.tsx +++ b/src/layout/AppSidebar.tsx @@ -54,41 +54,47 @@ const ALL_NAV_ITEMS: NavItem[] = [ name: "Tài Khoản", path: "/user/account", }, + +]; + +const OTHERS_ITEMS: NavItem[] = [ + // { + // icon: , + // name: "Charts", + // subItems: [ + // { name: "Line Chart", path: "/line-chart", pro: false }, + // { name: "Bar Chart", path: "/bar-chart", pro: false }, + // ], + // }, + // { + // icon: , + // name: "UI Elements", + // subItems: [ + // { name: "Alerts", path: "/alerts", pro: false }, + // { name: "Avatar", path: "/avatars", pro: false }, + // { name: "Badge", path: "/badge", pro: false }, + // { name: "Buttons", path: "/buttons", pro: false }, + // { name: "Images", path: "/images", pro: false }, + // { name: "Videos", path: "/videos", pro: false }, + // ], + // }, + // { + // icon: , + // name: "Authentication", + // subItems: [ + // { name: "Sign In", path: "/signin", pro: false }, + // { name: "Sign Up", path: "/signup", pro: false }, + // ], + // }, { icon: , name: "Về Chúng Tôi", path: "/user/about-us", }, -]; - -const OTHERS_ITEMS: NavItem[] = [ { - icon: , - name: "Charts", - subItems: [ - { name: "Line Chart", path: "/line-chart", pro: false }, - { name: "Bar Chart", path: "/bar-chart", pro: false }, - ], - }, - { - icon: , - name: "UI Elements", - subItems: [ - { name: "Alerts", path: "/alerts", pro: false }, - { name: "Avatar", path: "/avatars", pro: false }, - { name: "Badge", path: "/badge", pro: false }, - { name: "Buttons", path: "/buttons", pro: false }, - { name: "Images", path: "/images", pro: false }, - { name: "Videos", path: "/videos", pro: false }, - ], - }, - { - icon: , - name: "Authentication", - subItems: [ - { name: "Sign In", path: "/signin", pro: false }, - { name: "Sign Up", path: "/signup", pro: false }, - ], + icon: , + name: "Hỗ trợ", + path: "/user/quick-qa", }, ]; @@ -286,12 +292,12 @@ const AppSidebar: React.FC = () => { {renderMenuItems(ALL_NAV_ITEMS, "main")} - {/*
+

{isExpanded || isHovered || isMobileOpen ? "Others" : }

{renderMenuItems(OTHERS_ITEMS, "others")} -
*/} +