Skip to content

Commit

Permalink
fix(app-trash-bin): move TrashBinConfigs to higher level
Browse files Browse the repository at this point in the history
  • Loading branch information
leopuleo authored and Pavel910 committed Jun 18, 2024
1 parent 4ae4eb4 commit 4746eff
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useMemo } from "react";
import React, { useMemo, useCallback } from "react";
import { useApolloClient, useModel, usePermission } from "~/admin/hooks";
import { TrashBin as BaseTrashBin } from "@webiny/app-trash-bin";
import {
Expand Down Expand Up @@ -36,6 +36,13 @@ export const TrashBin = () => {
return new TrashBinItemMapper();
}, []);

const handleItemAfterRestore = useCallback(
async (item: { location: { folderId: string | undefined } }) => {
navigateToFolder(item.location.folderId);
},
[navigateToFolder]
);

if (!canDeleteEntries("cms.contentEntry")) {
return null;
}
Expand All @@ -49,7 +56,7 @@ export const TrashBin = () => {
deleteGateway={deleteGateway}
restoreGateway={restoreGateway}
itemMapper={itemMapper}
onItemAfterRestore={async item => navigateToFolder(item.location.folderId)}
onItemAfterRestore={handleItemAfterRestore}
nameColumnId={model.titleFieldId || "id"}
title={`Trash - ${model.name}`}
/>
Expand Down
1 change: 1 addition & 0 deletions packages/app-serverless-cms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"@webiny/app-security-access-management": "0.0.0",
"@webiny/app-tenancy": "0.0.0",
"@webiny/app-tenant-manager": "0.0.0",
"@webiny/app-trash-bin": "0.0.0",
"@webiny/app-websockets": "0.0.0",
"@webiny/lexical-editor-actions": "0.0.0",
"@webiny/lexical-editor-pb-element": "0.0.0",
Expand Down
2 changes: 2 additions & 0 deletions packages/app-serverless-cms/src/Admin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { Module as MailerSettings } from "@webiny/app-mailer";
import { Folders } from "@webiny/app-aco";
import { Websockets } from "@webiny/app-websockets";
import { RecordLocking } from "@webiny/app-record-locking";
import { TrashBinConfigs } from "@webiny/app-trash-bin";

export interface AdminProps extends Omit<BaseAdminProps, "createApolloClient"> {
createApolloClient?: BaseAdminProps["createApolloClient"];
Expand Down Expand Up @@ -67,6 +68,7 @@ const App = (props: AdminProps) => {
<TenantManager />
<AuditLogs />
<MailerSettings />
<TrashBinConfigs />
{props.children}
</BaseAdmin>
);
Expand Down
1 change: 1 addition & 0 deletions packages/app-serverless-cms/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
{ "path": "../app-security-access-management/tsconfig.build.json" },
{ "path": "../app-tenancy/tsconfig.build.json" },
{ "path": "../app-tenant-manager/tsconfig.build.json" },
{ "path": "../app-trash-bin/tsconfig.build.json" },
{ "path": "../app-websockets/tsconfig.build.json" },
{ "path": "../lexical-editor-actions/tsconfig.build.json" },
{ "path": "../lexical-editor-pb-element/tsconfig.build.json" },
Expand Down
3 changes: 3 additions & 0 deletions packages/app-serverless-cms/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
{ "path": "../app-security-access-management" },
{ "path": "../app-tenancy" },
{ "path": "../app-tenant-manager" },
{ "path": "../app-trash-bin" },
{ "path": "../app-websockets" },
{ "path": "../lexical-editor-actions" },
{ "path": "../lexical-editor-pb-element" },
Expand Down Expand Up @@ -74,6 +75,8 @@
"@webiny/app-tenancy": ["../app-tenancy/src"],
"@webiny/app-tenant-manager/*": ["../app-tenant-manager/src/*"],
"@webiny/app-tenant-manager": ["../app-tenant-manager/src"],
"@webiny/app-trash-bin/*": ["../app-trash-bin/src/*"],
"@webiny/app-trash-bin": ["../app-trash-bin/src"],
"@webiny/app-websockets/*": ["../app-websockets/src/*"],
"@webiny/app-websockets": ["../app-websockets/src"],
"@webiny/lexical-editor-actions/*": ["../lexical-editor-actions/src/*"],
Expand Down

0 comments on commit 4746eff

Please sign in to comment.