replace checkboxes with icons with hover

This commit is contained in:
Florian Scholdei
2019-06-12 15:29:53 +02:00
parent d8d1513f3c
commit d50f6e0ec9
11 changed files with 64 additions and 34 deletions

View File

@@ -6,6 +6,7 @@
"lastModified": "Zuletzt bearbeitet", "lastModified": "Zuletzt bearbeitet",
"type": "Typ", "type": "Typ",
"external": "Extern", "external": "Extern",
"internal": "Intern",
"members": "Mitglieder" "members": "Mitglieder"
}, },
"groups": { "groups": {

View File

@@ -5,6 +5,7 @@
"mail": "E-Mail", "mail": "E-Mail",
"password": "Passwort", "password": "Passwort",
"active": "Aktiv", "active": "Aktiv",
"inactive": "Inaktiv",
"type": "Typ", "type": "Typ",
"creationDate": "Erstellt", "creationDate": "Erstellt",
"lastModified": "Zuletzt bearbeitet" "lastModified": "Zuletzt bearbeitet"

View File

@@ -6,6 +6,7 @@
"lastModified": "Last Modified", "lastModified": "Last Modified",
"type": "Type", "type": "Type",
"external": "External", "external": "External",
"internal": "Internal",
"members": "Members" "members": "Members"
}, },
"groups": { "groups": {

View File

@@ -5,6 +5,7 @@
"mail": "E-Mail", "mail": "E-Mail",
"password": "Password", "password": "Password",
"active": "Active", "active": "Active",
"inactive": "Inactive",
"type": "Type", "type": "Type",
"creationDate": "Creation Date", "creationDate": "Creation Date",
"lastModified": "Last Modified" "lastModified": "Last Modified"

View File

@@ -9,6 +9,7 @@ import {
InputField, InputField,
SubmitButton, SubmitButton,
Textarea, Textarea,
Icon,
Checkbox Checkbox
} from "@scm-manager/ui-components"; } from "@scm-manager/ui-components";
import type { Group, SelectValue } from "@scm-manager/ui-types"; import type { Group, SelectValue } from "@scm-manager/ui-types";
@@ -113,9 +114,16 @@ class GroupForm extends React.Component<Props, State> {
if (this.isExistingGroup()) { if (this.isExistingGroup()) {
return null; return null;
} }
const iconType = group && group.external ? (
<Icon title={t("group.external")} name="sign-out-alt fa-rotate-270" />
) : (
<Icon title={t("group.internal")} name="sign-in-alt fa-rotate-90" />
);
return ( return (
<Checkbox <Checkbox
label={t("group.external")} label={<>{iconType} {t("group.external")}</>}
checked={group.external} checked={group.external}
helpText={t("groupForm.help.externalHelpText")} helpText={t("groupForm.help.externalHelpText")}
onChange={this.handleExternalChange} onChange={this.handleExternalChange}

View File

@@ -1,29 +1,38 @@
// @flow // @flow
import React from "react"; import React from "react";
import { translate } from "react-i18next";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import type { Group } from "@scm-manager/ui-types"; import type { Group } from "@scm-manager/ui-types";
import { Checkbox } from "@scm-manager/ui-components"; import { Icon } from "@scm-manager/ui-components";
type Props = { type Props = {
group: Group group: Group,
// context props
t: string => string
}; };
export default class GroupRow extends React.Component<Props> { class GroupRow extends React.Component<Props> {
renderLink(to: string, label: string) { renderLink(to: string, label: string) {
return <Link to={to}>{label}</Link>; return <Link to={to}>{label}</Link>;
} }
render() { render() {
const { group } = this.props; const { group, t } = this.props;
const to = `/group/${group.name}`; const to = `/group/${group.name}`;
const iconType = group.external ? (
<Icon title={t("group.external")} name="sign-out-alt fa-rotate-270" />
) : (
<Icon title={t("group.internal")} name="sign-in-alt fa-rotate-90" />
);
return ( return (
<tr> <tr>
<td>{this.renderLink(to, group.name)}</td> <td>{iconType} {this.renderLink(to, group.name)}</td>
<td className="is-hidden-mobile">{group.description}</td> <td className="is-hidden-mobile">{group.description}</td>
<td>
<Checkbox checked={group.external} />
</td>
</tr> </tr>
); );
} }
} }
export default translate("groups")(GroupRow);

View File

@@ -18,7 +18,6 @@ class GroupTable extends React.Component<Props> {
<tr> <tr>
<th>{t("group.name")}</th> <th>{t("group.name")}</th>
<th className="is-hidden-mobile">{t("group.description")}</th> <th className="is-hidden-mobile">{t("group.description")}</th>
<th>{t("group.external")}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>

View File

@@ -11,7 +11,7 @@ import {
} from "../modules/permissions"; } from "../modules/permissions";
import { connect } from "react-redux"; import { connect } from "react-redux";
import type { History } from "history"; import type { History } from "history";
import { Button } from "@scm-manager/ui-components"; import { Button, Icon } from "@scm-manager/ui-components";
import DeletePermissionButton from "../components/buttons/DeletePermissionButton"; import DeletePermissionButton from "../components/buttons/DeletePermissionButton";
import RoleSelector from "../components/RoleSelector"; import RoleSelector from "../components/RoleSelector";
import AdvancedPermissionsDialog from "./AdvancedPermissionsDialog"; import AdvancedPermissionsDialog from "./AdvancedPermissionsDialog";
@@ -49,9 +49,6 @@ type State = {
}; };
const styles = { const styles = {
iconColor: {
color: "#9a9a9a"
},
centerMiddle: { centerMiddle: {
display: "table-cell", display: "table-cell",
verticalAlign: "middle !important" verticalAlign: "middle !important"
@@ -148,15 +145,9 @@ class SinglePermission extends React.Component<Props, State> {
const iconType = const iconType =
permission && permission.groupPermission ? ( permission && permission.groupPermission ? (
<i <Icon title={t("permission.group")} name="user-friends" />
title={t("permission.group")}
className={classNames("fas fa-user-friends", classes.iconColor)}
/>
) : ( ) : (
<i <Icon title={t("permission.user")} name="user" />
title={t("permission.user")}
className={classNames("fas fa-user", classes.iconColor)}
/>
); );
return ( return (
@@ -171,7 +162,7 @@ class SinglePermission extends React.Component<Props, State> {
action={this.handleDetailedPermissionsPressed} action={this.handleDetailedPermissionsPressed}
/> />
</td> </td>
<td className={classes.centerMiddle}> <td className={classNames("is-darker", classes.centerMiddle)}>
<DeletePermissionButton <DeletePermissionButton
permission={permission} permission={permission}
namespace={namespace} namespace={namespace}

View File

@@ -5,6 +5,7 @@ import type { User } from "@scm-manager/ui-types";
import { import {
Subtitle, Subtitle,
Checkbox, Checkbox,
Icon,
InputField, InputField,
PasswordConfirmation, PasswordConfirmation,
SubmitButton, SubmitButton,
@@ -136,6 +137,13 @@ class UserForm extends React.Component<Props, State> {
// edit existing user // edit existing user
subtitle = <Subtitle subtitle={t("userForm.subtitle")} />; subtitle = <Subtitle subtitle={t("userForm.subtitle")} />;
} }
const iconType = user && user.active ? (
<Icon title={t("user.active")} name="user" />
) : (
<Icon title={t("user.inactive")} name="user-slash" />
);
return ( return (
<> <>
{subtitle} {subtitle}
@@ -167,7 +175,7 @@ class UserForm extends React.Component<Props, State> {
<div className="column"> <div className="column">
{passwordChangeField} {passwordChangeField}
<Checkbox <Checkbox
label={t("user.active")} label={<>{iconType} {t("user.active")}</>}
onChange={this.handleActiveChange} onChange={this.handleActiveChange}
checked={user ? user.active : false} checked={user ? user.active : false}
helpText={t("help.activeHelpText")} helpText={t("help.activeHelpText")}

View File

@@ -1,31 +1,43 @@
// @flow // @flow
import React from "react"; import React from "react";
import { translate } from "react-i18next";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import type { User } from "@scm-manager/ui-types"; import type { User } from "@scm-manager/ui-types";
import { Icon } from "@scm-manager/ui-components";
type Props = { type Props = {
user: User user: User,
// context props
t: string => string
}; };
export default class UserRow extends React.Component<Props> { class UserRow extends React.Component<Props> {
renderLink(to: string, label: string) { renderLink(to: string, label: string) {
return <Link to={to}>{label}</Link>; return <Link to={to}>{label}</Link>;
} }
render() { render() {
const { user } = this.props; const { user, t } = this.props;
const to = `/user/${user.name}`; const to = `/user/${user.name}`;
const iconType = user.active ? (
<Icon title={t("user.active")} name="user" />
) : (
<Icon title={t("user.inactive")} name="user-slash" />
);
return ( return (
<tr> <tr className={user.active ? "border-is-green" : "border-is-yellow"}>
<td className="is-hidden-mobile">{this.renderLink(to, user.name)}</td> <td>{iconType} {this.renderLink(to, user.name)}</td>
<td>{this.renderLink(to, user.displayName)}</td> <td className="is-hidden-mobile">
{this.renderLink(to, user.displayName)}
</td>
<td> <td>
<a href={`mailto:${user.mail}`}>{user.mail}</a> <a href={`mailto:${user.mail}`}>{user.mail}</a>
</td> </td>
<td className="is-hidden-mobile">
<input type="checkbox" id="active" checked={user.active} readOnly />
</td>
</tr> </tr>
); );
} }
} }
export default translate("users")(UserRow);

View File

@@ -19,7 +19,6 @@ class UserTable extends React.Component<Props> {
<th className="is-hidden-mobile">{t("user.name")}</th> <th className="is-hidden-mobile">{t("user.name")}</th>
<th>{t("user.displayName")}</th> <th>{t("user.displayName")}</th>
<th>{t("user.mail")}</th> <th>{t("user.mail")}</th>
<th className="is-hidden-mobile">{t("user.active")}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>