1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import React from 'react';
6 import { RootState } from 'store/store';
7 import { connect } from 'react-redux';
8 import { getResource } from 'store/resources/resources';
9 import { ProjectResource } from 'models/project';
10 import { ResourceKind } from 'models/resource';
11 import { UserResource } from 'models/user';
12 import { UserCard } from './user-details-card';
13 import { ProjectCard } from './project-details-card';
15 const mapStateToProps = ({ resources, properties }: RootState) => {
16 const currentResource = getResource(properties.currentRouteUuid)(resources);
23 type DetailsCardProps = {
24 currentResource: ProjectResource | UserResource;
27 export const RootDetailsCard = connect(mapStateToProps)(({ currentResource }: DetailsCardProps) => {
28 if (!currentResource) {
31 switch (currentResource.kind as string) {
32 case ResourceKind.USER:
34 case ResourceKind.PROJECT:
35 return <ProjectCard />;