Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
361 commits
Select commit Hold shift + click to select a range
45bb425
Update VideoFarmById.jsx
thanhnt0208 Jul 8, 2025
b0a77c0
videolistlike users
Tie902 Jul 8, 2025
7829098
Update LikeButton.jsx
Tie902 Jul 8, 2025
a114c58
naf
Tie902 Jul 8, 2025
ffe7847
naf
Tie902 Jul 8, 2025
e2efe4f
naf
Tie902 Jul 8, 2025
cd50106
Update LikeButton.jsx
thanhnt0208 Jul 8, 2025
3abca21
khoqua
Tie902 Jul 8, 2025
904741e
khoqua
Tie902 Jul 8, 2025
7745f36
Update LikeButton.jsx
thanhnt0208 Jul 8, 2025
b6039e8
up code video continue
Longvu003 Jul 8, 2025
5d2ad8c
.
Longvu003 Jul 8, 2025
3097943
.
Longvu003 Jul 8, 2025
a7e6ea5
.
Longvu003 Jul 8, 2025
3b9eb5c
.
Longvu003 Jul 8, 2025
cc626a9
.
Longvu003 Jul 8, 2025
38fee4c
thanh
thanhnt0208 Jul 9, 2025
fd5580f
thanh
thanhnt0208 Jul 9, 2025
b0b6447
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
thanhnt0208 Jul 9, 2025
e277468
Update App.jsx
thanhnt0208 Jul 9, 2025
e79cf24
1
trongquy1213 Jul 9, 2025
a43f5fe
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
trongquy1213 Jul 9, 2025
527e06f
Update VideoLikeList.jsx
Tie902 Jul 9, 2025
e8f5a25
upcode layout video Farm
Longvu003 Jul 9, 2025
a40f581
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
Tie902 Jul 9, 2025
07a77c0
thanh
thanhnt0208 Jul 9, 2025
851dc9f
.
Longvu003 Jul 9, 2025
6223693
t
thanhnt0208 Jul 9, 2025
b579724
up code layout video Farm
Longvu003 Jul 9, 2025
f89d2e3
thanh
thanhnt0208 Jul 9, 2025
5b25f50
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
thanhnt0208 Jul 9, 2025
fd085b2
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
Tie902 Jul 9, 2025
1781ee3
quy
trongquy1213 Jul 9, 2025
318f3a8
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
trongquy1213 Jul 9, 2025
96a23ac
adminrepostvatoiuucodeusrs
Tie902 Jul 9, 2025
eb98bb3
thanh
thanhnt0208 Jul 9, 2025
7377672
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
thanhnt0208 Jul 9, 2025
fd43862
code
Tie902 Jul 9, 2025
e9571a7
code
Tie902 Jul 9, 2025
f92a862
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
Tie902 Jul 9, 2025
19b3bfa
code
Tie902 Jul 9, 2025
96bf9ff
code
Tie902 Jul 9, 2025
a79c87b
Merge branch 'test' into tien
Tie902 Jul 9, 2025
fa8dacd
thanh
thanhnt0208 Jul 9, 2025
05d7e80
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
thanhnt0208 Jul 9, 2025
7404100
t
thanhnt0208 Jul 9, 2025
ac26337
users
Tie902 Jul 9, 2025
c1c58c6
goproi
Tie902 Jul 9, 2025
091b68c
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
Tie902 Jul 9, 2025
ac128f5
gopusersthanhcong
Tie902 Jul 9, 2025
a72d9f1
Update routes.jsx
thanhnt0208 Jul 10, 2025
a2fc32e
Merge branch 'tien' into test
Tie902 Jul 10, 2025
64302a9
adminreports
Tie902 Jul 10, 2025
4dc970f
admin repost
Tie902 Jul 10, 2025
7033903
thanh
thanhnt0208 Jul 10, 2025
f94af68
quý
trongquy1213 Jul 10, 2025
414330d
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
trongquy1213 Jul 10, 2025
aad32af
thanh
thanhnt0208 Jul 10, 2025
30dcedf
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
thanhnt0208 Jul 10, 2025
6337c5e
upcode comment
Longvu003 Jul 10, 2025
ab29072
quy
trongquy1213 Jul 10, 2025
c49bc4b
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
trongquy1213 Jul 10, 2025
2b0791c
Long__test
Longvu003 Jul 10, 2025
be0e695
thanh
thanhnt0208 Jul 10, 2025
66cce0f
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
thanhnt0208 Jul 10, 2025
f9ae6c4
Update users.jsx
thanhnt0208 Jul 10, 2025
e213f70
Update sidenav.jsx
thanhnt0208 Jul 10, 2025
1341d5b
sidenav
thanhnt0208 Jul 10, 2025
c17b000
fix F5
Longvu003 Jul 10, 2025
4167372
Merge branch 'Long' into test
Longvu003 Jul 10, 2025
36335dd
thanh
thanhnt0208 Jul 10, 2025
5f968f0
Merge branch 'thanh' into test
thanhnt0208 Jul 10, 2025
a426eca
quý
trongquy1213 Jul 10, 2025
dcdd616
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
trongquy1213 Jul 10, 2025
8ef54cf
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
trongquy1213 Jul 10, 2025
8b0e7b7
.
Longvu003 Jul 10, 2025
4820bc4
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
Longvu003 Jul 10, 2025
1f734f5
thanh
thanhnt0208 Jul 11, 2025
16ef83e
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
thanhnt0208 Jul 11, 2025
6547ca2
Update ipconfig.jsx
thanhnt0208 Jul 11, 2025
c2075da
thanh
thanhnt0208 Jul 11, 2025
2a42f4b
dashboar
Tie902 Jul 11, 2025
621de37
quy
trongquy1213 Jul 11, 2025
7a1701a
Update Post.jsx
thanhnt0208 Jul 11, 2025
2b74b50
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
thanhnt0208 Jul 11, 2025
b871845
fix link api
Longvu003 Jul 11, 2025
476a1ab
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
Longvu003 Jul 11, 2025
5be5013
.
Longvu003 Jul 11, 2025
8d62fd5
thanh
thanhnt0208 Jul 11, 2025
d3d432a
updateusers
Tie902 Jul 11, 2025
56c6edd
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
thanhnt0208 Jul 11, 2025
c8b8859
quy
trongquy1213 Jul 11, 2025
4c765ed
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
trongquy1213 Jul 11, 2025
c2e6ea4
Update Post.jsx
thanhnt0208 Jul 11, 2025
f6bba3b
Merge branch 'test' into tien
Tie902 Jul 11, 2025
48a6752
userschinhlai
Tie902 Jul 11, 2025
a476031
Merge branch 'test' into tien
Tie902 Jul 11, 2025
a685e49
Update Post.jsx
thanhnt0208 Jul 11, 2025
22351cf
quy
trongquy1213 Jul 11, 2025
8c7b620
Update Post.jsx
thanhnt0208 Jul 11, 2025
f85c082
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
trongquy1213 Jul 11, 2025
e0a2618
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
trongquy1213 Jul 11, 2025
81b2c78
thanh
thanhnt0208 Jul 11, 2025
9084ef6
ccc
Tie902 Jul 11, 2025
22c7f85
cc
Tie902 Jul 11, 2025
61f6708
Merge branch 'test' into tien
Tie902 Jul 11, 2025
674a5d8
pushlaitien
Tie902 Jul 11, 2025
4b955f4
Update users.jsx
thanhnt0208 Jul 11, 2025
9f58607
cc
Tie902 Jul 11, 2025
ba4b586
fix video
Longvu003 Jul 11, 2025
ea932a4
fix vieo
Longvu003 Jul 11, 2025
a039301
thanh
thanhnt0208 Jul 11, 2025
cf97bd6
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
thanhnt0208 Jul 11, 2025
53ad035
dasaa
Tie902 Jul 11, 2025
f8d5c81
thanh
thanhnt0208 Jul 11, 2025
afe7b3f
.
Longvu003 Jul 11, 2025
b12fe52
thanh
thanhnt0208 Jul 12, 2025
207daaf
Update Post.jsx
thanhnt0208 Jul 12, 2025
0893dc2
quy
trongquy1213 Jul 12, 2025
b46ef87
Update FarmForm.jsx
thanhnt0208 Jul 12, 2025
ff8fe56
quy
trongquy1213 Jul 12, 2025
e501e55
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
trongquy1213 Jul 12, 2025
9af416a
thanh
thanhnt0208 Jul 12, 2025
fdc7d74
quy
trongquy1213 Jul 12, 2025
02f0f25
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
trongquy1213 Jul 12, 2025
ff60e30
codemoi
Tie902 Jul 12, 2025
476243b
Merge branch 'test' into tien
Tie902 Jul 12, 2025
c39ddce
code usermoi
Tie902 Jul 12, 2025
a773524
Merge branch 'tien' into test
Tie902 Jul 12, 2025
99e7aec
thanh
thanhnt0208 Jul 12, 2025
ee2087b
cc
Tie902 Jul 12, 2025
c425f63
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
Tie902 Jul 12, 2025
6e35545
quy
trongquy1213 Jul 12, 2025
8ee1bfc
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
trongquy1213 Jul 12, 2025
f36c383
quy
trongquy1213 Jul 12, 2025
d25790f
quỳarm
trongquy1213 Jul 12, 2025
0216e4a
quy
trongquy1213 Jul 12, 2025
f07541c
.
Longvu003 Jul 12, 2025
826b20a
fix layout video continue
Longvu003 Jul 12, 2025
9db1418
Long__fix video Farm
Longvu003 Jul 12, 2025
a9ce946
.
Longvu003 Jul 12, 2025
aba68ad
quy
trongquy1213 Jul 12, 2025
716c8d2
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
trongquy1213 Jul 12, 2025
2a6cba2
thanh
thanhnt0208 Jul 12, 2025
11a2a11
thanh
thanhnt0208 Jul 12, 2025
6d6fbb6
thanh
thanhnt0208 Jul 12, 2025
64555d8
thanh
thanhnt0208 Jul 12, 2025
d1c0ba0
thanh
thanhnt0208 Jul 12, 2025
70d7456
Update PostDetail.jsx
thanhnt0208 Jul 12, 2025
89630d5
Update PostDetail.jsx
thanhnt0208 Jul 12, 2025
fca6728
Update PostDetail.jsx
thanhnt0208 Jul 12, 2025
eddbb0b
Update PostDetail.jsx
thanhnt0208 Jul 12, 2025
b397365
Update PostDetail.jsx
thanhnt0208 Jul 12, 2025
122d8fb
timkiemloc
Tie902 Jul 12, 2025
61e81aa
chi tiết video
thanhnt0208 Jul 12, 2025
fe2107b
quy
trongquy1213 Jul 13, 2025
213cfa9
Update Post.jsx
thanhnt0208 Jul 13, 2025
2846980
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
thanhnt0208 Jul 13, 2025
49c50cb
.
Longvu003 Jul 13, 2025
d4b648b
thanh
thanhnt0208 Jul 14, 2025
9b4ef82
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
thanhnt0208 Jul 14, 2025
0de6544
quy
trongquy1213 Jul 14, 2025
0d273cb
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
trongquy1213 Jul 14, 2025
65cfbb6
fix layout answer
Longvu003 Jul 14, 2025
3923f0f
Merge branch 'Long' into test
Longvu003 Jul 14, 2025
4981a4d
thanh
thanhnt0208 Jul 14, 2025
05b0199
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
thanhnt0208 Jul 14, 2025
8f1364b
Update routes.jsx
thanhnt0208 Jul 14, 2025
a354c4b
fixtimkiemfixpost
Tie902 Jul 14, 2025
fd0f130
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
Tie902 Jul 14, 2025
d209e50
Long
Longvu003 Jul 14, 2025
462e94b
Update UserDetail.jsx
thanhnt0208 Jul 14, 2025
10756b0
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
thanhnt0208 Jul 14, 2025
4fac2ab
quyvideo
trongquy1213 Jul 14, 2025
20c3ff1
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
trongquy1213 Jul 14, 2025
61bdf59
quy
trongquy1213 Jul 14, 2025
e95a8c3
quy
trongquy1213 Jul 14, 2025
26c191c
Update Post.jsx
thanhnt0208 Jul 14, 2025
2252593
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
trongquy1213 Jul 14, 2025
711e562
Update PostDetail.jsx
thanhnt0208 Jul 14, 2025
c1ff83c
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
thanhnt0208 Jul 14, 2025
30a5ec9
timkiemfix
Tie902 Jul 14, 2025
55ffa49
thanh
thanhnt0208 Jul 14, 2025
2df9900
quy
trongquy1213 Jul 14, 2025
e367aed
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
trongquy1213 Jul 14, 2025
d419a47
ccc
Tie902 Jul 14, 2025
c1e01de
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
Tie902 Jul 14, 2025
697c929
Update Post.jsx
thanhnt0208 Jul 14, 2025
adbb215
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
thanhnt0208 Jul 14, 2025
8843c7c
quy
trongquy1213 Jul 14, 2025
110dfd0
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
trongquy1213 Jul 14, 2025
6dec608
Update Post.jsx
thanhnt0208 Jul 14, 2025
b3df22e
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
thanhnt0208 Jul 14, 2025
84383e2
quý
trongquy1213 Jul 15, 2025
b295a43
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
trongquy1213 Jul 15, 2025
59f72a2
codfixsua
Tie902 Jul 15, 2025
cdb9a62
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
Tie902 Jul 15, 2025
965cff3
thanh
thanhnt0208 Jul 15, 2025
0c226fd
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
thanhnt0208 Jul 15, 2025
c7aaa00
Update UserDetail.jsx
thanhnt0208 Jul 15, 2025
f9bb021
.
Longvu003 Jul 15, 2025
b042d07
thanh
thanhnt0208 Jul 15, 2025
dbe4740
Merge branch 'Long' into test
Longvu003 Jul 15, 2025
6cf08ac
.
Longvu003 Jul 15, 2025
623d43d
thanh
thanhnt0208 Jul 15, 2025
54df5fb
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
thanhnt0208 Jul 15, 2025
314518d
thanh
thanhnt0208 Jul 15, 2025
2e914ea
quy
trongquy1213 Jul 15, 2025
6ca495e
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
trongquy1213 Jul 15, 2025
f800890
cc
Tie902 Jul 15, 2025
6973e65
.
Longvu003 Jul 15, 2025
fccb44e
Merge branch 'Long' into test
Longvu003 Jul 15, 2025
32ad443
thanh
thanhnt0208 Jul 15, 2025
605a602
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
thanhnt0208 Jul 15, 2025
aa181c2
nah
Tie902 Jul 15, 2025
7ebf855
nah
Tie902 Jul 15, 2025
461c4b6
Update UserDetail.jsx
thanhnt0208 Jul 15, 2025
7f91f59
Update UserDetail.jsx
thanhnt0208 Jul 15, 2025
ccba67f
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
thanhnt0208 Jul 15, 2025
35d44aa
quy
trongquy1213 Jul 15, 2025
5d5bc02
quy
trongquy1213 Jul 15, 2025
86d0183
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
trongquy1213 Jul 15, 2025
c5a738a
Longvu003 Jul 15, 2025
c3330b4
Merge branch 'Long' into test
Longvu003 Jul 15, 2025
05795f3
.
Longvu003 Jul 15, 2025
c3fcc31
Merge branch 'Long' into test
Longvu003 Jul 15, 2025
4f8a149
codeusersedit
Tie902 Jul 16, 2025
71b119c
Update UserDetail.jsx
thanhnt0208 Jul 16, 2025
734945f
Update UserDetail.jsx
thanhnt0208 Jul 16, 2025
f7ef413
quy
trongquy1213 Jul 16, 2025
591f09c
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
trongquy1213 Jul 16, 2025
1503c7b
.
Longvu003 Jul 16, 2025
434eef0
thanh
thanhnt0208 Jul 16, 2025
0d55f03
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
thanhnt0208 Jul 16, 2025
bf1265f
.
Longvu003 Jul 16, 2025
1b633de
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
Longvu003 Jul 16, 2025
86b9085
quy
trongquy1213 Jul 16, 2025
7d7a7e3
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
trongquy1213 Jul 16, 2025
c83a82c
thanh
thanhnt0208 Jul 16, 2025
94eb055
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
thanhnt0208 Jul 16, 2025
ecd8039
fixsoleusailech
Tie902 Jul 16, 2025
94b23d5
.
Longvu003 Jul 16, 2025
96ba08d
.
Longvu003 Jul 16, 2025
da8656d
-0,5
Tie902 Jul 16, 2025
1509944
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
Tie902 Jul 16, 2025
76999e1
cc
Tie902 Jul 16, 2025
5dc0e68
ac
Tie902 Jul 16, 2025
4304935
quy
trongquy1213 Jul 16, 2025
43144a5
Merge branch 'test' of https://github.com/thanhnt0208/material-tailwi…
trongquy1213 Jul 16, 2025
2e615fd
quy
trongquy1213 Jul 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion jsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"compilerOptions": {
"jsx": "react-jsx",

"baseUrl": ".",
"paths": {
"@/*": ["src/*"],
},
},
}
}
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,19 @@
"dependencies": {
"@heroicons/react": "2.0.18",
"@material-tailwind/react": "2.1.4",
"@tanstack/react-query": "^5.83.0",
"apexcharts": "3.44.0",
"axios": "^1.10.0",
"prop-types": "15.8.1",
"react": "18.2.0",
"react-apexcharts": "1.4.1",
"react-dom": "18.2.0",
"react-router-dom": "6.17.0"
"react-loader-spinner": "^6.1.6",
"react-router-dom": "6.17.0",
"react-select": "^5.10.2"
},
"devDependencies": {
"@tailwindcss/line-clamp": "^0.4.4",
"@types/react": "18.2.31",
"@types/react-dom": "18.2.14",
"@vitejs/plugin-react": "4.1.0",
Expand All @@ -27,6 +32,6 @@
"prettier": "3.0.3",
"prettier-plugin-tailwindcss": "0.5.6",
"tailwindcss": "3.3.4",
"vite": "4.5.0"
"vite": "^4.5.0"
}
}
}
61 changes: 56 additions & 5 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,65 @@
import { Routes, Route, Navigate } from "react-router-dom";
import React, {useEffect} from "react";
import { Routes, Route, Navigate, useNavigate } from "react-router-dom";
import { Dashboard, Auth } from "@/layouts";

import VideoFarmById from "./pages/dashboard/VideoFarms/VideoById";
import VideoLikeList from "./pages/dashboard/VideoFarms/VideoLikeList";
import PostDetail from "./pages/dashboard/post/PostDetail";
import CommentPostbyId from "./pages/dashboard/AdminCommentPost/CommentPostbyId";
import CommentPostbyIdPost from "./pages/dashboard/AdminCommentPost/CommentPostbyIdPost";
import CommentPostByIdUser from "./pages/dashboard/AdminCommentPost/CommentPostByIdUser";
import FarmDetail from "./pages/dashboard/farm/FarmDetail";
import { Farms } from "./pages/dashboard/farm/farms";
import UserDetail from "./pages/dashboard/user/UserDetail";
import VideoById from "./pages/dashboard/VideoFarms/VideoById";
function App() {
const navigate = useNavigate();
useEffect(() => {
const token = localStorage.getItem("token");
if (!token) {
navigate("/auth/sign-in");
}

const handleUnload = () => {
if (performance.getEntriesByType("navigation")[0].type !== "reload") {
localStorage.removeItem("token");
localStorage.removeItem("refreshToken");
localStorage.removeItem("apiBaseUrl");
}
};

window.addEventListener("beforeunload", handleUnload);


return () => {
window.removeEventListener("beforeunload", handleUnload);
}
}, [navigate]);

return (
<Routes>
<Route path="/dashboard/*" element={<Dashboard />} />
<Routes>
<Route path="/dashboard/*" element={<Dashboard />}>
<Route path="VideoFarmById/:farmId" element={<VideoFarmById />} />
<Route path="video-like/:videoId" element={<VideoLikeList />} />
<Route path="post/:id" element={<PostDetail />} />
<Route path="CommentPostbyId/:id" element={<CommentPostbyId />} />
<Route path="CommentPostbyIdPost/:postId" element={<CommentPostbyIdPost />} />
<Route path="CommentPostByIdUser/:id" element={<CommentPostByIdUser />} />
<Route path="VideoFarms/VideoById/:id" element={<VideoById />} />
<Route path="users/:id" element={<UserDetail />} />
{/* <Route path="/dashboard/users/:id" element={<UserDetail />} /> */}
</Route>
<Route path="/auth/*" element={<Auth />} />
<Route path="/admin/Farms" element={<Farms />} />
<Route path="/admin/farms/:id" element={<FarmDetail />} />
<Route path="*" element={<Navigate to="/dashboard/home" replace />} />

</Routes>
);
}

export default App;





export default App;
55 changes: 55 additions & 0 deletions src/components/AnswerDetailDialog.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// src/components/AnswerDetailDialog.jsx
import React from "react";
import {
Dialog,
DialogHeader,
DialogBody,
DialogFooter,
Typography,
Button,
} from "@material-tailwind/react";

const AnswerDetailDialog = ({ open, onClose, data }) => {
if (!data) return null;
return (
<Dialog open={open} handler={onClose} size="md">
<DialogHeader>Chi tiết câu trả lời</DialogHeader>
<DialogBody className="space-y-4">
<Typography variant="small"><strong>Farm ID:</strong> {data.farmId}</Typography>
<Typography variant="small"><strong>Question ID:</strong> {data.questionId}</Typography>
<Typography variant="small">
<strong>Selected Options:</strong> {data.selectedOptions?.join(", ") || "—"}
</Typography>
<Typography variant="small"><strong>Other Text:</strong> {data.otherText || "—"}</Typography>
<Typography variant="small"><strong>User ID:</strong> {data.userId || "—"}</Typography>
<div>
<strong>Tệp đính kèm:</strong>
<div className="mt-1">
{data.uploadedFiles?.length > 0 ? (
data.uploadedFiles.map((file, idx) => (
<a
key={idx}
href={file}
target="_blank"
rel="noopener noreferrer"
className="block text-blue-600 underline"
>
File {idx + 1}
</a>
))
) : (
<Typography variant="small">Không có</Typography>
)}
</div>
</div>
</DialogBody>
<DialogFooter>
<Button variant="outlined" onClick={onClose}>
Đóng
</Button>
</DialogFooter>
</Dialog>
);
};

export default AnswerDetailDialog;
69 changes: 69 additions & 0 deletions src/components/LikeButton.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// src/components/LikeButton.jsx

import React, { useState } from 'react';
import axios from 'axios';
import { BaseUrl } from '@/ipconfig';
import { useNavigate } from 'react-router-dom';

export default function LikeButton({ videoId }) {
const [liked, setLiked] = useState(false);
const [loading, setLoading] = useState(false);
const token = localStorage.getItem('token');
const navigate = useNavigate();

const handleLikeToggle = async () => {
if (!videoId || !token) return;
setLoading(true);

try {
if (liked) {
// ✅ GỌI API UNLIKE CHUẨN BE
await axios.post(
`${BaseUrl}/video-like/${videoId}/unlike`,
{},
{ headers: { Authorization: `Bearer ${token}` } }
);
} else {
// ✅ GỌI API LIKE CHUẨN BE
await axios.post(
`${BaseUrl}/video-like/${videoId}/like`,
{},
{ headers: { Authorization: `Bearer ${token}` } }
);
}

// Toggle trạng thái
setLiked(!liked);
} catch (error) {
console.error('Lỗi khi Like/Unlike video:', error);
} finally {
setLoading(false);
}
};

const handleViewLikes = () => {
// Điều hướng đến trang hiển thị danh sách users đã Like
navigate(`/dashboard/video-like/${videoId}`);
};

return (
<div className="flex gap-2">
<button
onClick={handleLikeToggle}
disabled={loading}
className={`px-3 py-1 rounded text-white text-sm font-semibold shadow ${
liked ? 'bg-red-500 hover:bg-red-600' : 'bg-gray-600 hover:bg-gray-700'
}`}
>
{loading ? '...' : liked ? 'Bỏ Like' : 'Like'}
</button>

<button
onClick={handleViewLikes}
className="px-3 py-1 rounded text-blue-700 bg-blue-100 hover:bg-blue-200 text-sm font-semibold shadow"
>
👥 Xem Like
</button>
</div>
);
}
57 changes: 57 additions & 0 deletions src/components/VideoLikeBox.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// src/components/VideoLikeBox.jsx
import React, { useEffect, useState } from 'react';
import axios from 'axios';
import { BaseUrl } from '@/ipconfig';

export default function VideoLikeBox({ videoId, refreshKey }) {
const [users, setUsers] = useState([]);
const [loading, setLoading] = useState(true);
const [error, setError] = useState('');
const token = localStorage.getItem('token');

const fetchLikes = async () => {
if (!videoId || videoId === ':videoId') return;
setLoading(true);
try {
const res = await axios.get(`${BaseUrl}/video-like/${videoId}/users`, {
headers: { Authorization: `Bearer ${token}` },
});

const usersList = Array.isArray(res.data.data)
? res.data.data
: res.data?.users || [];

setUsers(usersList);
} catch (err) {
console.error('Lỗi khi lấy danh sách like:', err);
setError('Không thể lấy danh sách người like.');
} finally {
setLoading(false);
}
};

useEffect(() => {
fetchLikes();
}, [videoId, refreshKey]);

return (
<div className="mt-2 px-3 py-2 bg-gray-50 rounded border border-blue-100">
<p className="text-sm font-semibold text-gray-700">Người đã like:</p>
{loading ? (
<span className="text-xs italic text-gray-400">Đang tải...</span>
) : error ? (
<span className="text-xs text-red-500">{error}</span>
) : users.length === 0 ? (
<span className="text-xs italic text-gray-400">Chưa có ai like</span>
) : (
<ul className="list-disc pl-4 text-sm text-gray-800">
{users.map((user, idx) => (
<li key={idx}>
{user.fullName || user.username || 'Ẩn danh'}
</li>
))}
</ul>
)}
</div>
);
}
8 changes: 7 additions & 1 deletion src/context/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ export function reducer(state, action) {
case "OPEN_CONFIGURATOR": {
return { ...state, openConfigurator: action.value };
}
case "AUTH_STATUS": {
return { ...state, isAuthenticated: action.value}
}
default: {
throw new Error(`Unhandled action type: ${action.type}`);
}
Expand All @@ -33,11 +36,12 @@ export function reducer(state, action) {
export function MaterialTailwindControllerProvider({ children }) {
const initialState = {
openSidenav: false,
sidenavColor: "dark",
sidenavColor: "blue-gray",
sidenavType: "white",
transparentNavbar: true,
fixedNavbar: false,
openConfigurator: false,
isAuthenticated: Boolean(localStorage.getItem("token")),
};

const [controller, dispatch] = React.useReducer(reducer, initialState);
Expand Down Expand Up @@ -83,3 +87,5 @@ export const setFixedNavbar = (dispatch, value) =>
dispatch({ type: "FIXED_NAVBAR", value });
export const setOpenConfigurator = (dispatch, value) =>
dispatch({ type: "OPEN_CONFIGURATOR", value });
export const setAuthStatus = (dispatch, value) =>
dispatch({type: "AUTH_STATUS", value})
1 change: 1 addition & 0 deletions src/ipconfig.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const BaseUrl= `https://api-ndolv2.nongdanonline.cc`
2 changes: 1 addition & 1 deletion src/layouts/auth.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function Auth() {
icon: ChartPieIcon,
},
{
name: "profile",
name: "User",
path: "/dashboard/home",
icon: UserIcon,
},
Expand Down
16 changes: 14 additions & 2 deletions src/layouts/dashboard.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { Routes, Route } from "react-router-dom";
import { useState } from "react";
import { Cog6ToothIcon } from "@heroicons/react/24/solid";
import { IconButton } from "@material-tailwind/react";
import { Outlet } from "react-router-dom";

import {
Sidenav,
DashboardNavbar,
Expand All @@ -14,15 +17,22 @@ export function Dashboard() {
const [controller, dispatch] = useMaterialTailwindController();
const { sidenavType } = controller;

const [collapsed, setCollapsed] = useState(false);

return (
<div className="min-h-screen bg-blue-gray-50/50">
<div className="min-h-screen bg-blue-gray-50/50 flex">
<Sidenav
routes={routes}
brandImg={
sidenavType === "dark" ? "/img/logo-ct.png" : "/img/logo-ct-dark.png"
}
onCollapse={(value) => setCollapsed(value)}
/>
<div className="p-4 xl:ml-80">
<div
className={`p-4 transition-all duration-300 w-full ${
collapsed ? "xl:ml-24" : "xl:ml-64"
}`}
>
<DashboardNavbar />
<Configurator />
<IconButton
Expand All @@ -34,6 +44,7 @@ export function Dashboard() {
>
<Cog6ToothIcon className="h-5 w-5" />
</IconButton>

<Routes>
{routes.map(
({ layout, pages }) =>
Expand All @@ -43,6 +54,7 @@ export function Dashboard() {
))
)}
</Routes>
<Outlet />
<div className="text-blue-gray-600">
<Footer />
</div>
Expand Down
Loading