diff --git a/src/app/user/projects/page.tsx b/src/app/user/projects/page.tsx
index 5063532..e9f29d9 100644
--- a/src/app/user/projects/page.tsx
+++ b/src/app/user/projects/page.tsx
@@ -131,6 +131,7 @@ export default function ProjectsPage() {
setFormData({ title: "", description: "", project_status: "PRIVATE" });
setImportSnapshot(null);
setImportSnapshotName(null);
+ if (importJsonInputRef.current) importJsonInputRef.current.value = "";
fetchProjects();
router.push(`/editor/${projectId}`);
} catch (error) {
@@ -199,15 +200,17 @@ export default function ProjectsPage() {
return 0;
});
- // Helper format ngày
const formatDate = (dateString: string | null | undefined) => {
if (!dateString) return "-";
const date = new Date(dateString);
- return `Updated on ${date.toLocaleDateString("vi-VN", {
+ if (isNaN(date.getTime())) return "-";
+ return date.toLocaleDateString("vi-VN", {
day: "2-digit",
month: "short",
year: "numeric",
- })}`;
+ hour: "2-digit",
+ minute: "2-digit",
+ });
};
const getStatusBadge = (status: string) => {
@@ -228,17 +231,16 @@ export default function ProjectsPage() {
return (
);
};
- console.log(projects);
-
const importLabel = useMemo(() => {
if (!importSnapshotName) return "Chưa chọn JSON snapshot";
return `JSON: ${importSnapshotName}`;
@@ -266,137 +268,134 @@ export default function ProjectsPage() {
{!isLoading && sortedProjects.length > 0 ? (
-
-
-
-
-
Sắp xếp:
-
-
+
+
+
+
+
+
Trạng thái
+
Thành viên
+
+
Thao tác
{sortedProjects.map((project: any) => (
-
-
router.push(`/user/projects/${project.id}`)}
- className="flex items-center gap-2 mb-2 cursor-pointer hover:underline"
- >
-
+
+
+
router.push(`/user/projects/${project.id}`)}
+ className="font-semibold text-blue-600 dark:text-[#58a6ff] truncate cursor-pointer hover:underline"
+ >
+ {project.title}
+
+
+
+
+
{project.user?.avatar_url ? (
-
-
-
+
) : (
-
-
+
+
{project.user?.display_name?.charAt(0)?.toUpperCase() || "U"}
)}
+ {project.user?.display_name || "Unknown"}
-
-
-
- {project.user?.display_name || "Unknown"}
-
-
-
-
/
-
-
- {project.title}
-
-
-
- {getStatusBadge(project.project_status)}
-
-
-
-
- {formatDate(project.updated_at)}
-
-
-
-
-
-
+
+
+ {getStatusBadge(project.project_status)}
+
+
+
{project.members && project.members.length > 0 ? (
<>
{project.members.slice(0, 4).map((m: any, index: number) =>
m.avatar_url ? (
-
+
) : (
-
-
- {m.display_name?.charAt(0)?.toUpperCase() || "U"}
-
+
+ {m.display_name?.charAt(0)?.toUpperCase() || "U"}
)
)}
-
{project.members.length > 4 && (
-
-
- +{project.members.length - 4}
-
+
+ +{project.members.length - 4}
)}
>
) : (
-
+
)}
+
+
+ {formatDate(project.updated_at)}
+
+
+
+
+
+
+ Editor
+
+
+
+
+
+
+ Export JSON
+
+
+
+
+
+
+ Wiki Editor
+
+
+
))}
@@ -414,7 +413,6 @@ export default function ProjectsPage() {
- {/* Modal Tạo Dự án */}
Tạo dự án mới
@@ -484,7 +482,6 @@ export default function ProjectsPage() {
disabled={isSubmitting}
className="bg-gray-900 hover:bg-gray-800 text-white"
onClick={handleCreateProjectWithJson}
- // title="Tạo dự án và tạo commit đầu tiên từ JSON snapshot"
>
Tạo với JSON
diff --git a/src/components/ui/button/Button.tsx b/src/components/ui/button/Button.tsx
index 9d9593a..e09fb78 100644
--- a/src/components/ui/button/Button.tsx
+++ b/src/components/ui/button/Button.tsx
@@ -5,6 +5,7 @@ type ButtonProps = React.ButtonHTMLAttributes & {
variant?: "primary" | "outline"; // Button variant
startIcon?: ReactNode; // Icon before the text
endIcon?: ReactNode; // Icon after the text
+ title?: string; // Title text
};
const Button: React.FC = ({
@@ -16,6 +17,7 @@ const Button: React.FC = ({
className = "",
disabled = false,
type = "button",
+ title,
...rest
}) => {
// Size Classes
@@ -39,6 +41,7 @@ const Button: React.FC = ({
} ${variantClasses[variant]} ${
disabled ? "cursor-not-allowed opacity-50" : ""
}`}
+ title={title}
disabled={disabled}
type={type}
{...rest}