Skip to content

Commit

Permalink
Fixing batch of minor appearance issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
krulis-martin committed Nov 27, 2024
1 parent 71d5632 commit 4c0c2ca
Show file tree
Hide file tree
Showing 14 changed files with 128 additions and 126 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const SolutionsTableRow = ({
<tbody
onClick={!selected && onSelect ? () => onSelect(id) : null}
onDoubleClick={
!onSelect && doubleclickAction && (() => doubleclickAction(SOLUTION_DETAIL_URI_FACTORY(assignmentId, id)))
!onSelect && doubleclickAction ? () => doubleclickAction(SOLUTION_DETAIL_URI_FACTORY(assignmentId, id)) : null
}>
<tr
id={id}
Expand Down
48 changes: 23 additions & 25 deletions src/components/forms/Fields/TabbedArrayField.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,31 +54,29 @@ class TabbedArrayField extends Component {
{fields.length > 0 && (
<Tab.Container id={id} defaultActiveKey={defaultIndex}>
<Card className="mb-3">
<Card.Header>
<Nav variant="tabs" className="nav-tabs-custom" id="localized-texts">
{indices.map((fieldIdx, tabIdx) => {
const fieldData = fields.get(fieldIdx);
return (
<Nav.Item key={tabIdx}>
<Nav.Link eventKey={tabIdx}>
{renderTitle(fieldData)}
{removableTabs && (
<Confirm
id={`${id}-remove-${fieldIdx}`}
question={removeQuestion}
onConfirmed={() => {
fields.remove(fieldIdx);
this.changeTab(Math.min(tabIdx, fields.length - 2));
}}>
<CloseIcon gapLeft={2} />
</Confirm>
)}
</Nav.Link>
</Nav.Item>
);
})}
</Nav>
</Card.Header>
<Nav variant="tabs" className="nav-tabs-custom px-2 pt-2" id="localized-texts">
{indices.map((fieldIdx, tabIdx) => {
const fieldData = fields.get(fieldIdx);
return (
<Nav.Item key={tabIdx}>
<Nav.Link eventKey={tabIdx} onClick={ev => ev.currentTarget.blur()}>
{renderTitle(fieldData)}
{removableTabs && (
<Confirm
id={`${id}-remove-${fieldIdx}`}
question={removeQuestion}
onConfirmed={() => {
fields.remove(fieldIdx);
this.changeTab(Math.min(tabIdx, fields.length - 2));
}}>
<CloseIcon gapLeft={2} />
</Confirm>
)}
</Nav.Link>
</Nav.Item>
);
})}
</Nav>

<Tab.Content>
{indices.map((fieldIdx, tabIdx) => {
Expand Down
1 change: 0 additions & 1 deletion src/components/forms/NiceCheckbox/NiceCheckbox.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,5 @@
vertical-align: top;
margin: 0.1rem 0.5rem;
white-space: normal;
font-weight: 700;
line-height: 1.15;
}
34 changes: 17 additions & 17 deletions src/components/helpers/LocalizedTexts/LocalizedTexts.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,23 @@ const LocalizedTexts = ({ locales = [], noLocalesMessage = null }) => {
}
id="localized-texts">
<Card className="mb-3">
<Card.Header>
<Nav
variant="tabs"
defaultActiveKey={
localeTabs.find(({ locale }) => locale === lang) || localeTabs.length === 0
? lang
: localeTabs[0].locale
}
className="nav-tabs-custom"
id="localized-texts">
{localeTabs.map(({ locale }) => (
<Nav.Item key={locale}>
<Nav.Link eventKey={locale}>{locale}</Nav.Link>
</Nav.Item>
))}
</Nav>
</Card.Header>
<Nav
variant="tabs"
defaultActiveKey={
localeTabs.find(({ locale }) => locale === lang) || localeTabs.length === 0
? lang
: localeTabs[0].locale
}
className="nav-tabs-custom px-2 pt-2"
id="localized-texts">
{localeTabs.map(({ locale }) => (
<Nav.Item key={locale}>
<Nav.Link eventKey={locale} onClick={ev => ev.currentTarget.blur()}>
{locale}
</Nav.Link>
</Nav.Item>
))}
</Nav>
<Tab.Content>
{localeTabs.map(({ locale, text, link = '', studentHint = null }) => (
<Tab.Pane key={locale} eventKey={locale}>
Expand Down
2 changes: 1 addition & 1 deletion src/components/layout/Header/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Header extends Component {
</a>
</li>
{fetchManyGroupsStatus && (
<li className="nav-item memberGroupsDropdownContainer">
<li className="nav-item memberGroupsDropdownContainer" data-bs-theme="light">
<FetchManyResourceRenderer
fetchManyStatus={fetchManyGroupsStatus}
loading={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { FormattedMessage } from 'react-intl';
import { knownLocalesNames } from '../../../helpers/localizedData.js';

const HeaderLanguageSwitching = ({ currentLang, availableLangs, setLang }) => (
<Dropdown as="li" align="end" className="nav-item">
<Dropdown as="li" align="end" className="nav-item" data-bs-theme="light">
<Dropdown.Toggle as="a" id="dropdown-header-lang-switch" bsPrefix="nav-link">
{currentLang}&nbsp;
</Dropdown.Toggle>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const HeaderNotificationsDropdown = ({
newNotifications,
oldNotifications,
}) => (
<Dropdown as="li" align="end" navbar className="nav-item">
<Dropdown as="li" align="end" navbar className="nav-item" data-bs-theme="light">
<Dropdown.Toggle as="a" id="dropdown-header-notifications" bsPrefix="nav-link">
{newNotifications.size === 0 ? (
<Icon icon={['far', 'bell']} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const HeaderSystemMessagesDropdown = ({
acceptActiveMessages,
unacceptActiveMessages,
}) => (
<Dropdown as="li" align="end" navbar className="nav-item">
<Dropdown as="li" align="end" navbar className="nav-item" data-bs-theme="light">
<Dropdown.Toggle as="a" id="dropdown-header-system-messages" bsPrefix="nav-link">
<MailIcon />
{systemMessages.length > 0 && (
Expand Down
17 changes: 12 additions & 5 deletions src/components/layout/Sidebar/Sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import { FormattedMessage } from 'react-intl';
import { lruMemoize } from 'reselect';
import { Link } from 'react-router-dom';

import Admin from './Admin.js';
import UserPanelContainer from '../../../containers/UserPanelContainer';
import UserSwitchingContainer from '../../../containers/UserSwitchingContainer';

import MenuTitle from '../../widgets/Sidebar/MenuTitle';
import MenuItem from '../../widgets/Sidebar/MenuItem';
import { LoadingIcon } from '../../icons';
Expand All @@ -15,6 +16,7 @@ import { isSupervisorRole, isEmpoweredSupervisorRole, isSuperadminRole } from '.
import withLinks from '../../../helpers/withLinks.js';
import { getExternalIdForCAS } from '../../../helpers/cas.js';
import { getConfigVar } from '../../../helpers/config.js';
import Admin from './Admin.js';

import * as styles from './sidebar.less';

Expand Down Expand Up @@ -47,12 +49,12 @@ const Sidebar = ({
return (
<aside className={`app-sidebar bg-body-secondary shadow ${styles.mainSidebar}`} data-bs-theme="dark">
<div className="sidebar-brand">
<Link to={HOME_URI} className="brand-link shadow me-5">
<Link to={HOME_URI} className="brand-link me-5">
<>
<img
src={`${URL_PREFIX}/public/logo-bare.png`}
alt="ReCodEx Logo"
className="pt-1 me-2 brand-image opacity-75 shadow"
className="pt-1 me-2 brand-image opacity-75"
/>
<span className="brand-text">
{pendingFetchOperations && (
Expand All @@ -66,7 +68,11 @@ const Sidebar = ({
</Link>
</div>

<div className="sidebar-wrapper" data-overlayscrollbars="host">
<div className="sticky-top shadow border-bottom bg-body-secondary py-2">
<UserPanelContainer small={small} />
</div>

<div className="sidebar-wrapper">
<div data-overlayscrollbars-viewport="scrollbarHidden">
<nav className="mt-2">
{!user && (
Expand Down Expand Up @@ -94,7 +100,8 @@ const Sidebar = ({

{Boolean(user) && (
<>
<UserPanelContainer small={small} />
<UserSwitchingContainer open={true} />

<ul
className="nav nav-pills sidebar-menu flex-column"
data-lte-toggle="treeview"
Expand Down
110 changes: 54 additions & 56 deletions src/components/widgets/Sidebar/UserPanel/UserPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,77 +43,75 @@ class UserPanel extends Component {

return (
<>
<div className="user-panel mt-2 pb-2 mb-2">
<div className="text-center text-light">
{small ? (
<AvatarContainer
avatarUrl={user.avatarUrl}
fullName={user.fullName}
firstName={user.name.firstName}
size={small ? 32 : 42}
/>
) : (
<UserName currentUserId={user.id} {...user} />
)}
</div>
<div className="text-center text-light">
{small ? (
<AvatarContainer
avatarUrl={user.avatarUrl}
fullName={user.fullName}
firstName={user.name.firstName}
size={small ? 32 : 42}
/>
) : (
<UserName currentUserId={user.id} {...user} />
)}
</div>

<div className="small text-center mt-1">
<Link to={EDIT_USER_URI_FACTORY(user.id)}>
<Icon icon="edit" className="text-warning" gapRight={!small} />
{!small && <FormattedMessage id="generic.settings" defaultMessage="Settings" />}
</Link>
<div className="small text-center mt-1">
<Link to={EDIT_USER_URI_FACTORY(user.id)}>
<Icon icon="edit" className="text-warning" gapRight={small ? 0 : 1} />
{!small && <FormattedMessage id="generic.settings" defaultMessage="Settings" />}
</Link>

{small && <br />}
{small && <br />}

<OverlayTrigger
placement="bottom"
overlay={
<Tooltip id="tokenExpiration">
<FormattedMessage id="app.badge.sessionExpiration" defaultMessage="Session expiration:" />{' '}
<FormattedRelativeTime
value={(expiration - Date.now()) / 1000}
numeric="auto"
updateIntervalInSeconds={1000000}
/>
</Tooltip>
}>
<a
href="#"
onClick={e => {
e.preventDefault();
logout();
}}>
<Icon icon="sign-out-alt" className="text-danger" gapLeft={small ? 0 : 2} gapRight={small ? 0 : 1} />
{!small && <FormattedMessage id="app.logout" defaultMessage="Logout" />}
</a>
</OverlayTrigger>
{small && <br />}
{isSuperadminRole(user.privateData.role) && (
<OverlayTrigger
placement="bottom"
overlay={
<Tooltip id="tokenExpiration">
<FormattedMessage id="app.badge.sessionExpiration" defaultMessage="Session expiration:" />{' '}
<FormattedRelativeTime
value={(expiration - Date.now()) / 1000}
numeric="auto"
updateIntervalInSeconds={1000000}
/>
<Tooltip id="effectiveRole">
<FormattedMessage id="generic.effectiveRole" defaultMessage="Effective Role" />:{' '}
{roleLabels[effectiveRole]}
</Tooltip>
}>
<a
href="#"
onClick={e => {
e.preventDefault();
logout();
this.openEffectiveRoleDialog();
}}>
<Icon icon="sign-out-alt" className="text-danger" gapLeft={small ? 0 : 3} gapRight={!small} />
{!small && <FormattedMessage id="app.logout" defaultMessage="Logout" />}
<UserRoleIcon
role={effectiveRole}
className="text-primary"
gapLeft={small ? 0 : 2}
gapRight={small ? 0 : 1}
/>
{!small && <FormattedMessage id="generic.role" defaultMessage="Role" />}
</a>
</OverlayTrigger>
{small && <br />}
{isSuperadminRole(user.privateData.role) && (
<OverlayTrigger
placement="bottom"
overlay={
<Tooltip id="effectiveRole">
<FormattedMessage id="generic.effectiveRole" defaultMessage="Effective Role" />:{' '}
{roleLabels[effectiveRole]}
</Tooltip>
}>
<a
href="#"
onClick={e => {
e.preventDefault();
this.openEffectiveRoleDialog();
}}>
<UserRoleIcon
role={effectiveRole}
className="text-primary"
gapLeft={small ? 0 : 3}
gapRight={!small}
/>
{!small && <FormattedMessage id="generic.role" defaultMessage="Role" />}
</a>
</OverlayTrigger>
)}
</div>
)}
</div>

{isSuperadminRole(user.privateData.role) && (
Expand Down
4 changes: 2 additions & 2 deletions src/components/widgets/Sidebar/UserPanel/UserPanelFailed.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { FormattedMessage } from 'react-intl';
import { FailedAvatar } from '../../Avatar';

const UserPanelFailed = props => (
<div className="user-panel mt-2 pb-2 mb-2">
<>
<div className="float-start me-2">
<FailedAvatar {...props} />
</div>
Expand All @@ -12,7 +12,7 @@ const UserPanelFailed = props => (
<br />
<FormattedMessage id="app.badge.failedLoadingInfo" defaultMessage="Please check your Internet connection." />
</div>
</div>
</>
);

export default UserPanelFailed;
4 changes: 2 additions & 2 deletions src/components/widgets/Sidebar/UserPanel/UserPanelLoading.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { FormattedMessage } from 'react-intl';
import { LoadingAvatar } from '../../Avatar';

const UserPanelLoading = props => (
<div className="user-panel mt-2 mb-2">
<>
<div className="float-start me-3">
<LoadingAvatar {...props} />
</div>
Expand All @@ -12,7 +12,7 @@ const UserPanelLoading = props => (
<FormattedMessage id="generic.loading" defaultMessage="Loading..." />
</p>
</div>
</div>
</>
);

export default UserPanelLoading;
5 changes: 5 additions & 0 deletions src/containers/App/recodex.css
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ table.table.tbody-hover tbody:hover th.selected {
border: 1px solid #ccc;
border-radius: 4px;
background-color: rgba(128, 128, 128, 0.1);
padding: 0.5rem;
}

/*
Expand All @@ -142,6 +143,10 @@ table.table.tbody-hover tbody:hover th.selected {
top: 0;
}

.sidebar-wrapper {
height: auto! important;
}

.img-circle { /* removed in 3.2->4.0 migration, back patch */
border-radius:50%;
}
Expand Down
Loading

0 comments on commit 4c0c2ca

Please sign in to comment.