-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Differentiate between card per app and card per role
- Loading branch information
Showing
23 changed files
with
186 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import React from "react"; | ||
import "./RoleCard.scss"; | ||
import Logo from "./Logo"; | ||
import I18n from "../locale/I18n"; | ||
import {MoreLessText} from "./MoreLessText"; | ||
import {Button, Card, CardType, Checkbox, Chip, ChipType} from "@surfnet/sds"; | ||
import {isEmpty, splitListSemantically} from "../utils/Utils"; | ||
import {roleName} from "../utils/Manage"; | ||
import {ReactComponent as MultipleIcon} from "../icons/multi-role.svg"; | ||
import {useNavigate} from "react-router-dom"; | ||
|
||
export const InvitationRoleCard = ({ | ||
role, | ||
applicationMaps, | ||
index, | ||
invitationSelected, | ||
invitationSelectCallback, | ||
isNew = false | ||
}) => { | ||
const navigate = useNavigate(); | ||
|
||
const multiApp = applicationMaps.length > 1; | ||
const application = applicationMaps[0]; | ||
const logo = multiApp ?<MultipleIcon/> : application.logo; | ||
const name = multiApp ? splitListSemantically(applicationMaps.map(app => roleName(app, I18n.locale)), I18n.t("forms.and")) : | ||
roleName(application, I18n.locale); | ||
|
||
const children = | ||
<div key={index} className="user-role"> | ||
{!isEmpty(invitationSelected) && | ||
<Checkbox name={`invitationSelected-${index}-${role.value}`} | ||
value={invitationSelected} | ||
onChange={e => invitationSelectCallback(e, role.value)}/> | ||
} | ||
|
||
<Logo src={logo} alt={"provider"} className={"provider"}/> | ||
<section className={"user-role-info"}> | ||
<p>{name}</p> | ||
<h3>{role.name}</h3> | ||
<MoreLessText txt={role.description} cutOffNumber={80}/> | ||
</section> | ||
{isEmpty(invitationSelected) && <div className={"launch"}> | ||
<Button txt={I18n.t("inviter.details")} onClick={() => navigate(`/roles/${role.id}`)}/> | ||
</div>} | ||
|
||
</div>; | ||
|
||
const inviterCard = invitationSelected ? "inviter-selected" : "inviter" | ||
const className = `card-container ${isNew ? "is-new" : ""} ${inviterCard}`; | ||
return ( | ||
<div className={className}> | ||
{isNew && | ||
<Chip label={I18n.t("proceed.new")} type={ChipType.Status_error}/> | ||
} | ||
{isEmpty(inviterCard) && <Card key={index} cardType={CardType.Big} children={children}/>} | ||
{!isEmpty(inviterCard) && | ||
<label htmlFor={`invitationSelected-${index}-${role.value}`}> <Card key={index} cardType={CardType.Big} | ||
children={children}/></label>} | ||
</div> | ||
); | ||
} |
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 was deleted.
Oops, something went wrong.
Empty file.
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
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
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
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
1 change: 1 addition & 0 deletions
1
server/src/main/resources/db/mysql/migration/V24_0__remove_landing_page_from_role.sql
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 @@ | ||
ALTER TABLE `roles` DROP `landing_page`; |
Oops, something went wrong.