This repository has been archived by the owner on Jun 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 549
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update vc and group experience for user (#4800)
* Add group vc to user-profile * update * update webportal * update rest-server * update * add groups to vc card * update * update * update * update * update * update * fix
- Loading branch information
Showing
6 changed files
with
342 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
import { FontClassNames } from '@uifabric/styling'; | ||
import c from 'classnames'; | ||
import PropTypes from 'prop-types'; | ||
import React, { useState } from 'react'; | ||
import { | ||
Dialog, | ||
DetailsList, | ||
DetailsListLayoutMode, | ||
SelectionMode, | ||
} from 'office-ui-fabric-react'; | ||
import CopyButton from '../../components/copy-button'; | ||
|
||
import t from '../../components/tachyons.scss'; | ||
|
||
const CopySucceeded = props => | ||
props.copied ? <p style={{ color: 'green' }}>Copied succeeded!</p> : null; | ||
|
||
CopySucceeded.propTypes = { | ||
copied: PropTypes.bool, | ||
}; | ||
|
||
export default function GroupDetailDialog(props) { | ||
const { groupDetails, setGroupDetails } = props; | ||
const [copiedName, setCopiedName] = useState(null); | ||
|
||
return ( | ||
<Dialog | ||
minWidth='50%' | ||
hidden={groupDetails.hideDialog} | ||
onDismiss={() => { | ||
setGroupDetails({ ...groupDetails, ...{ hideDialog: true } }); | ||
}} | ||
styles={{ borderStyle: 'solid' }} | ||
dialogContentProps={{ | ||
title: `Granted group of VC '${groupDetails.vc.name}'`, | ||
}} | ||
> | ||
<DetailsList | ||
columns={[ | ||
{ | ||
key: 'name', | ||
minWidth: 100, | ||
maxWidth: 150, | ||
name: 'Group name', | ||
isResizable: true, | ||
onRender(group) { | ||
return ( | ||
<div | ||
className={c( | ||
t.flex, | ||
t.itemsCenter, | ||
t.h100, | ||
FontClassNames.medium, | ||
)} | ||
> | ||
{group.groupname} | ||
</div> | ||
); | ||
}, | ||
}, | ||
{ | ||
key: 'alias', | ||
minWidth: 180, | ||
maxWidth: 250, | ||
name: 'Group alias', | ||
isResizable: true, | ||
onRender(group) { | ||
return ( | ||
<div className={c(t.flex, t.itemsCenter, t.h100)}> | ||
<div className={FontClassNames.medium}> | ||
{group.externalName} | ||
</div> | ||
<div className={c(t.flex, t.itemsCenter, t.h100)}> | ||
<CopyButton | ||
value={group.externalName} | ||
hideTooltip={true} | ||
callback={() => { | ||
setCopiedName(group.externalName); | ||
}} | ||
/> | ||
<CopySucceeded copied={copiedName === group.externalName} /> | ||
</div> | ||
</div> | ||
); | ||
}, | ||
}, | ||
{ | ||
key: 'description', | ||
minWidth: 180, | ||
name: 'Description', | ||
isResizable: true, | ||
onRender(group) { | ||
return ( | ||
<div | ||
className={c( | ||
t.flex, | ||
t.itemsCenter, | ||
t.h100, | ||
FontClassNames.medium, | ||
)} | ||
> | ||
{group.description} | ||
</div> | ||
); | ||
}, | ||
}, | ||
]} | ||
disableSelectionZone | ||
items={groupDetails.groups} | ||
layoutMode={DetailsListLayoutMode.justified} | ||
selectionMode={SelectionMode.none} | ||
/> | ||
</Dialog> | ||
); | ||
} | ||
|
||
GroupDetailDialog.propTypes = { | ||
groupDetails: PropTypes.object.isRequired, | ||
setGroupDetails: PropTypes.func.isRequired, | ||
}; |
Oops, something went wrong.