fix(FE): resolve merge conflict checkbox and constant

This commit is contained in:
randy-ar
2025-12-10 10:09:56 +07:00
24 changed files with 1733 additions and 525 deletions
+15
View File
@@ -10,6 +10,8 @@ export const sleep = (ms: number = 1000) =>
new Promise((resolve) => setTimeout(resolve, ms));
export const formatDate = (date: moment.MomentInput, format?: string) => {
if (!date) return '-';
return moment(date).format(format);
};
@@ -127,3 +129,16 @@ export const convertRowSelectionObjToArr = (
return result;
};
export const isPathActive = (pathname: string, link?: string) => {
if (!link) return false;
const splittedPathname = pathname.split('/');
const splittedLink = link.split('/');
const isActiveLinkValid = splittedLink.every((linkChunk, idx) => {
return linkChunk === splittedPathname[idx];
});
return pathname.startsWith(link) && isActiveLinkValid;
};