Skip to content

Commit

Permalink
Merge pull request #135 from Aletheia-Data/fix/issue-129-fix-category…
Browse files Browse the repository at this point in the history
…-link

fix category link and remove link actions on broken links
  • Loading branch information
aletheiadata authored Jul 4, 2022
2 parents 2885114 + 33e09fd commit 0649846
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 48 deletions.
45 changes: 31 additions & 14 deletions src/_start/helpers/GetCollectionPageColumns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ export const getCollectionPageColumns = (
className={`text-gray-800 fw-bolder text-hover-primary fs-6 ${
recordItem.cid ? "" : "disabled"
}`}
to={recordItem.cid ? `/${type}/${entity}/${recordItem.cid}?assetId=${recordItem.id}` : "#"}
to={
recordItem.cid
? `/${type}/${entity}/${recordItem.cid}?assetId=${recordItem.id}`
: "#"
}
>
{recordItem.name || recordItem.title}
</Link>
Expand Down Expand Up @@ -87,18 +91,27 @@ export const getCollectionPageColumns = (
},
{
title: "Action",
cells: data?.map((recordItem: Record) => (
<Link
key={`record-alexandria-${recordItem.cid}`}
className="btn btn-icon btn-bg-light btn-color-muted btn-active-color-primary btn-sm"
to={`/${type}/${entity}/${recordItem.cid}?assetId=${recordItem.id}`}
>
<Ktsvg
className="svg-icon-4"
path="/media/icons/duotone/General/Attachment1.svg"
/>
</Link>
)),
cells: data?.map((recordItem: Record) => {
console.log(recordItem);

if (
recordItem.status === "on_line" ||
recordItem.status === "under_review"
) {
return (
<Link
key={`record-alexandria-${recordItem.cid}`}
className="btn btn-icon btn-bg-light btn-color-muted btn-active-color-primary btn-sm"
to={`/${type}/${entity}/${recordItem.cid}?assetId=${recordItem.id}`}
>
<Ktsvg
className="svg-icon-4"
path="/media/icons/duotone/General/Attachment1.svg"
/>
</Link>
);
}
}),
},
];
} else {
Expand All @@ -111,7 +124,11 @@ export const getCollectionPageColumns = (
className={`text-gray-800 fw-bolder text-hover-primary fs-6 ${
recordItem.cid ? "" : "disabled"
}`}
to={recordItem.cid ? `/${type}/${entity}/${recordItem.cid}?assetId=${recordItem.id}` : "#"}
to={
recordItem.cid
? `/${type}/${entity}/${recordItem.cid}?assetId=${recordItem.id}`
: "#"
}
>
{recordItem.name || recordItem.title}
</Link>
Expand Down
78 changes: 44 additions & 34 deletions src/_start/partials/widgets/engage/EngageWidget6.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,30 +126,36 @@ const EngageWidget6: React.FC<Props> = ({
{/*begin::Info*/}
<table className="table table-borderless align-middle fw-bold">
<tbody>
<tr>
<td className="text-gray-600 ps-0">Fuente</td>
<td className="text-dark pe-0">
<Link to={`/collection/src/${data.source.id}`}>
{data.source?.name}
</Link>
</td>
</tr>
<tr>
<td className="text-gray-600 ps-0">Ministerio</td>
<td className="text-dark pe-0">
<Link to={`/collection/dep/${data.department.id}`}>
{data.department?.name}
</Link>
</td>
</tr>
<tr>
<td className="text-gray-600 ps-0">Categoria</td>
<td className="text-dark pe-0">
<Link to={`/collection/cat/${data.category.id}`}>
{data.category?.title}
</Link>
</td>
</tr>
{data?.source?.id && (
<tr>
<td className="text-gray-600 ps-0">Fuente</td>
<td className="text-dark pe-0">
<Link to={`/collection/src/${data.source.id}`}>
{data.source?.name}
</Link>
</td>
</tr>
)}
{data?.department?.id && (
<tr>
<td className="text-gray-600 ps-0">Ministerio</td>
<td className="text-dark pe-0">
<Link to={`/collection/dep/${data.department.id}`}>
{data.department?.name}
</Link>
</td>
</tr>
)}
{data?.category?.id && (
<tr>
<td className="text-gray-600 ps-0">Categoria</td>
<td className="text-dark pe-0">
<Link to={`/collection/cat/${data.category.id}`}>
{data.category?.title}
</Link>
</td>
</tr>
)}
{proof && (
<tr>
<td className="text-gray-600 ps-0">Prueba</td>
Expand All @@ -164,16 +170,20 @@ const EngageWidget6: React.FC<Props> = ({
</td>
</tr>
)}
<tr>
<td className="text-gray-600 ps-0">Formato</td>
<td className="text-dark pe-0">{data.type}</td>
</tr>
<tr>
<td className="text-gray-600 ps-0">Ultimo Archivo</td>
<td className="text-dark pe-0">
{moment(data.updatedAt).format("DD/MM/YYYY")}
</td>
</tr>
{data.type && (
<tr>
<td className="text-gray-600 ps-0">Formato</td>
<td className="text-dark pe-0">{data.type}</td>
</tr>
)}
{data.updatedAt && (
<tr>
<td className="text-gray-600 ps-0">Ultimo Archivo</td>
<td className="text-dark pe-0">
{moment(data.updatedAt).format("DD/MM/YYYY")}
</td>
</tr>
)}
<tr>
<td className="text-gray-600 ps-0">Deals</td>
<td className="text-dark pe-0">
Expand Down

0 comments on commit 0649846

Please sign in to comment.