+export const ResourceRestore =
+ connect((state: RootState, props: { uuid: string, dispatch?: Dispatch<any> }) => {
+ const resource = getResource<TrashableResource>(props.uuid)(state.resources);
+ return { resource, dispatch: props.dispatch };
+ })((props: { resource?: TrashableResource, dispatch?: Dispatch<any> }) =>
+ <IconButton onClick={() => {
+ if (props.resource && props.dispatch) {
+ const ctxRes = {
+ name: '',
+ uuid: props.resource.uuid,
+ isTrashed: props.resource.isTrashed,
+ ownerUuid: props.resource.ownerUuid
+ };
+
+ if (props.resource.kind === ResourceKind.PROJECT) {
+ props.dispatch(toggleProjectTrashed(ctxRes));
+ } else if (props.resource.kind === ResourceKind.COLLECTION) {
+ props.dispatch(toggleCollectionTrashed(ctxRes));
+ }
+ }
+ }}>
+ <RestoreFromTrashIcon/>
+ </IconButton>
+ );
+