Merge pull request #2503 from openvinotoolkit/dk/projects-view-fix

Projects layout fix
main
Boris Sekachev 5 years ago committed by GitHub
commit 3bd06603c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -33,6 +33,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Exception: "Value must be a user instance" (<https://github.com/openvinotoolkit/cvat/pull/2441>) - Exception: "Value must be a user instance" (<https://github.com/openvinotoolkit/cvat/pull/2441>)
- Reset zoom option doesn't work in tag annotation mode (<https://github.com/openvinotoolkit/cvat/pull/2443>) - Reset zoom option doesn't work in tag annotation mode (<https://github.com/openvinotoolkit/cvat/pull/2443>)
- Canvas is busy error (<https://github.com/openvinotoolkit/cvat/pull/2437>) - Canvas is busy error (<https://github.com/openvinotoolkit/cvat/pull/2437>)
- Projects view layout fix (<https://github.com/openvinotoolkit/cvat/pull/2503>)
### Security ### Security

@ -1,6 +1,6 @@
{ {
"name": "cvat-ui", "name": "cvat-ui",
"version": "1.10.7", "version": "1.10.8",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

@ -1,6 +1,6 @@
{ {
"name": "cvat-ui", "name": "cvat-ui",
"version": "1.10.7", "version": "1.10.8",
"description": "CVAT single-page application", "description": "CVAT single-page application",
"main": "src/index.tsx", "main": "src/index.tsx",
"scripts": { "scripts": {

@ -15,7 +15,7 @@ export default function ProjectListComponent(): JSX.Element {
const dispatch = useDispatch(); const dispatch = useDispatch();
const projectsCount = useSelector((state: CombinedState) => state.projects.count); const projectsCount = useSelector((state: CombinedState) => state.projects.count);
const { page } = useSelector((state: CombinedState) => state.projects.gettingQuery); const { page } = useSelector((state: CombinedState) => state.projects.gettingQuery);
const projectInstances = useSelector((state: CombinedState) => state.projects.current); let projectInstances = useSelector((state: CombinedState) => state.projects.current);
const gettingQuery = useSelector((state: CombinedState) => state.projects.gettingQuery); const gettingQuery = useSelector((state: CombinedState) => state.projects.gettingQuery);
function changePage(p: number): void { function changePage(p: number): void {
@ -27,19 +27,30 @@ export default function ProjectListComponent(): JSX.Element {
); );
} }
projectInstances = projectInstances.reduce((rows, key, index) => {
if (index % 4 === 0) {
rows.push([key]);
} else {
rows[rows.length - 1].push(key);
}
return rows;
}, []);
return ( return (
<> <>
<Row type='flex' justify='center' align='middle'> <Row type='flex' justify='center' align='middle'>
<Col className='cvat-projects-list' md={22} lg={18} xl={16} xxl={14}> <Col className='cvat-projects-list' md={22} lg={18} xl={16} xxl={14}>
<Row gutter={[8, 8]}> {projectInstances.map(
{projectInstances.map( (row: any[]): JSX.Element => (
(instance: any): JSX.Element => ( <Row gutter={[8, 8]}>
<Col xs={8} sm={8} xl={6} key={instance.id}> {row.map((instance: any) => (
<ProjectItem projectInstance={instance} /> <Col span={6} key={instance.id}>
</Col> <ProjectItem projectInstance={instance} />
), </Col>
)} ))}
</Row> </Row>
),
)}
</Col> </Col>
</Row> </Row>
<Row type='flex' justify='center' align='middle'> <Row type='flex' justify='center' align='middle'>

@ -109,11 +109,11 @@
.cvat-projects-project-item-card { .cvat-projects-project-item-card {
.ant-empty { .ant-empty {
margin: $grid-unit-size; margin: $grid-unit-size;
height: $grid-unit-size * 16;
} }
img { img {
height: 100%; height: $grid-unit-size * 18;
max-height: $grid-unit-size * 18;
object-fit: cover; object-fit: cover;
} }
} }

Loading…
Cancel
Save