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 && (
<div
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",
css`
&:hover {
border: 1px solid #1c4ed8;
outline: 1px solid #1c4ed8;
// border: 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");
}}
>
{content}
<div className="h-[30px] flex flex-row items-center">{content}</div>
<div className="text-xs filename">{file?.name}</div>
<div className="ml-2">
<ExternalLink size="12px" />
</div>
@ -287,6 +293,7 @@ const getFileName = (url: string) => {
}
const fileName = url.substring(url.lastIndexOf("/") + 1);
console.log({ fileName });
const dotIndex = fileName.lastIndexOf(".");
const fullname = fileName;
if (dotIndex === -1) {

View File

@ -7,9 +7,12 @@ export const userToken = async () => {
const w = window as any;
w.user = JSON.parse(user);
} 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;
console.log({jwt})
console.log({ jwt });
if (!jwt) return;
try {
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`
);
const us = user.data.data;
console.log({us})
console.log({ us });
if (us) {
localStorage.setItem("user", JSON.stringify(user.data.data));
const roles = await userRoleMe();
}
} catch (e) {
}
console.log({res})
} catch (e) {}
} catch (ex) {}
}
};

View File

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