Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve editing timeline UI #6356

Merged
merged 1 commit into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
.file-display-wrapper {
display: flex;
flex-direction: column;

&.outdated {
padding: 0.5em;
background-image: repeating-linear-gradient(-45deg, $pastel-gray 0 2px, $white 3px 15px);
border: 1px solid $pastel-gray;
border-radius: 0.2em;
}
}

.file-display {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ import {Button, Icon, Label, Popup} from 'semantic-ui-react';

import {TooltipIfTruncated} from 'indico/react/components';
import {Translate} from 'indico/react/i18n';
import {toClasses} from 'indico/react/util';

import {fileTypePropTypes, filePropTypes, mapFileTypes} from '../FileManager/util';

import './FileDisplay.module.scss';

function FileListDisplay({files}) {
Expand Down Expand Up @@ -74,9 +76,14 @@ FileTypeDisplay.propTypes = {
fileType: PropTypes.shape(fileTypePropTypes).isRequired,
};

export default function FileDisplay({downloadURL, fileTypes, files, tags}) {
export default function FileDisplay({downloadURL, fileTypes, files, tags, outdated}) {
return (
<div styleName="file-display-wrapper">
<div
styleName={toClasses({
'file-display-wrapper': true,
'outdated': outdated && files.length > 0,
})}
>
{files.length !== 0 && (
<div styleName="file-display">
{mapFileTypes(fileTypes, files).map(fileType => (
Expand Down Expand Up @@ -122,4 +129,9 @@ FileDisplay.propTypes = {
verboseTitle: PropTypes.string.isRequired,
})
).isRequired,
outdated: PropTypes.bool,
};

FileDisplay.defaultProps = {
outdated: false,
};
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@ export default function TimelineItem({block, index}) {
const {fileTypes} = useSelector(selectors.getStaticData);
const isLastBlock = lastTimelineBlock.id === block.id;
const isLastValidBlock = lastValidTimelineBlock.id === block.id;
const isLastTimelineBlockWithFiles = lastTimelineBlockWithFiles.id === block.id;
const canEdit = isLastValidBlock && canEditLastRevision;
const hasContent =
block.commentHtml ||
!!block.files.length ||
!!block.tags.length ||
!!block.customActions.length;
const isAlwaysVisible = isLastValidBlock || lastTimelineBlockWithFiles.id === block.id;
const isAlwaysVisible = isLastValidBlock || isLastTimelineBlockWithFiles;
const [visibilityToggle, setVisibilityToggle] = useState(false);
const visible = visibilityToggle || isAlwaysVisible;
const user = block.type.name === RevisionType.replacement ? INDICO_BOT_USER : block.user;
Expand Down Expand Up @@ -124,6 +125,7 @@ export default function TimelineItem({block, index}) {
files={block.files}
downloadURL={block.downloadFilesURL}
tags={block.tags}
outdated={!isLastTimelineBlockWithFiles}
/>
{canPerformSubmitterActions && needsSubmitterConfirmation && isLastValidBlock && (
<ChangesConfirmation />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ function TagInput({onChange, value, placeholder, options}) {
<Dropdown
placeholder={placeholder}
styleName="tag-input"
upward={false}
fluid
multiple
search
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
// modify it under the terms of the MIT License; see the
// LICENSE file for more details.

.tag-input {
.tag-input:global(.ui.dropdown) {
margin-bottom: 1em;

:global(.visible.menu.transition) {
max-height: 50vh;
}
}
Loading