update FilePreview.tsx, TypeUploadSingle.tsx, user.ts and package.json

This commit is contained in:
faisolavolut 2025-01-24 14:18:21 +07:00
parent 34fdaa0cf5
commit 98598fa984
3 changed files with 34 additions and 23 deletions

View File

@ -211,12 +211,16 @@ export const FilePreview = ({ url }: { url: any }) => {
{file.extension && ( {file.extension && (
<div <div
className={cx( className={cx(
"flex border rounded items-center px-1 bg-white cursor-pointer flex-grow", "flex rounded items-center px-1 bg-white cursor-pointer flex-grow hover:bg-gray-100 gap-x-1",
"pr-2", "pr-2",
css` css`
&:hover { &:hover {
border: 1px solid #1c4ed8; // border: 1px solid #1c4ed8;
outline: 1px solid #1c4ed8; // outline: 1px solid #1c4ed8;
}
&:hover {
// border-bottom: 1px solid #1c4ed8;
// outline: 1px solid #1c4ed8;
} }
` `
)} )}
@ -227,7 +231,9 @@ export const FilePreview = ({ url }: { url: any }) => {
window.open(_url, "_blank"); window.open(_url, "_blank");
}} }}
> >
{content} <div className="h-[30px] flex flex-row items-center">{content}</div>
<div className="text-xs filename">{file?.name}</div>
<div className="ml-2"> <div className="ml-2">
<ExternalLink size="12px" /> <ExternalLink size="12px" />
</div> </div>
@ -287,6 +293,7 @@ const getFileName = (url: string) => {
} }
const fileName = url.substring(url.lastIndexOf("/") + 1); const fileName = url.substring(url.lastIndexOf("/") + 1);
console.log({ fileName });
const dotIndex = fileName.lastIndexOf("."); const dotIndex = fileName.lastIndexOf(".");
const fullname = fileName; const fullname = fileName;
if (dotIndex === -1) { if (dotIndex === -1) {

View File

@ -7,9 +7,12 @@ export const userToken = async () => {
const w = window as any; const w = window as any;
w.user = JSON.parse(user); w.user = JSON.parse(user);
} else { } else {
const res = await api.get(`${process.env.NEXT_PUBLIC_API_PORTAL}/api/check-jwt-token`); try {
const res = await api.get(
`${process.env.NEXT_PUBLIC_API_PORTAL}/api/check-jwt-token`
);
const jwt = res.data.data; const jwt = res.data.data;
console.log({jwt}) console.log({ jwt });
if (!jwt) return; if (!jwt) return;
try { try {
await api.post(process.env.NEXT_PUBLIC_BASE_URL + "/api/cookies", { await api.post(process.env.NEXT_PUBLIC_BASE_URL + "/api/cookies", {
@ -19,13 +22,12 @@ export const userToken = async () => {
`${process.env.NEXT_PUBLIC_API_PORTAL}/api/users/me` `${process.env.NEXT_PUBLIC_API_PORTAL}/api/users/me`
); );
const us = user.data.data; const us = user.data.data;
console.log({us}) console.log({ us });
if (us) { if (us) {
localStorage.setItem("user", JSON.stringify(user.data.data)); localStorage.setItem("user", JSON.stringify(user.data.data));
const roles = await userRoleMe(); const roles = await userRoleMe();
} }
} catch (e) { } catch (e) {}
} } catch (ex) {}
console.log({res})
} }
}; };

View File

@ -48,6 +48,7 @@
"lodash.uniqby": "^4.7.0", "lodash.uniqby": "^4.7.0",
"lucide-react": "^0.462.0", "lucide-react": "^0.462.0",
"next": "15.0.3", "next": "15.0.3",
"react-beautiful-dnd": "^13.1.1",
"react-colorful": "^5.6.1", "react-colorful": "^5.6.1",
"react-icons": "^5.3.0", "react-icons": "^5.3.0",
"react-resizable": "^3.0.5", "react-resizable": "^3.0.5",
@ -61,6 +62,7 @@
"devDependencies": { "devDependencies": {
"@types/node": "^20", "@types/node": "^20",
"@types/react": "^18", "@types/react": "^18",
"@types/react-beautiful-dnd": "^13.1.8",
"@types/react-dom": "^18", "@types/react-dom": "^18",
"@types/react-resizable": "^3.0.8", "@types/react-resizable": "^3.0.8",
"@types/react-slick": "^0.23.13", "@types/react-slick": "^0.23.13",