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

Feature - Marketplace Pages #535

Merged
merged 34 commits into from
Sep 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
f1c5050
Add marketplace page with its search section
LuanEdCosta Sep 2, 2021
fe813b8
Create the MarketplaceTaskItem component
LuanEdCosta Sep 2, 2021
dc64d0b
Create other MarketplaceTaskItem pieces
LuanEdCosta Sep 3, 2021
718082e
FInish marketplace initial screen
LuanEdCosta Sep 3, 2021
b2c7230
Fix marketplace search placeholder casing
LuanEdCosta Sep 3, 2021
13d2b38
Create the marketplace store with types, reducer and selectors
LuanEdCosta Sep 3, 2021
bb883e2
Create the marketplace api
LuanEdCosta Sep 3, 2021
5718c50
Create marketplace store actions with tests
LuanEdCosta Sep 3, 2021
70bbc51
Create marketplace search page basic structure
LuanEdCosta Sep 8, 2021
0669739
Create the marketplace task details page
LuanEdCosta Sep 8, 2021
f0babc0
Fix errors and implement the login in the marketplace task details page
LuanEdCosta Sep 8, 2021
86e13cc
Fix details and add skeleton for loading in the marketplace task deta…
LuanEdCosta Sep 9, 2021
bbae392
Use task category in marketplace task details changes section
LuanEdCosta Sep 9, 2021
eedc024
Format the marketplace task details changes date
LuanEdCosta Sep 9, 2021
df075d1
Create the marketplace author page
LuanEdCosta Sep 9, 2021
b15ca20
Finish marketplace author page skeletons
LuanEdCosta Sep 9, 2021
5353c81
Improve marketplace task details avatar styles
LuanEdCosta Sep 9, 2021
317e8ce
Create the marketplace search page base structure
LuanEdCosta Sep 10, 2021
6347447
Create the marketplace task item header
LuanEdCosta Sep 10, 2021
de5df8e
Open marketplae search page with filters
LuanEdCosta Sep 13, 2021
14e78bb
Create list type and order enums
LuanEdCosta Sep 13, 2021
ee9e8a9
Make marketplace search page responsive
LuanEdCosta Sep 13, 2021
1aa101d
Create marketplace search page skeletons
LuanEdCosta Sep 13, 2021
5a5e2d7
Add search input in marketplace pages
LuanEdCosta Sep 13, 2021
55549e6
Create usePersistentState and add tag filters in the marketplace sear…
LuanEdCosta Sep 13, 2021
975ad28
Use debouce hook in all search inputs
LuanEdCosta Sep 13, 2021
698e071
Use debouce in the marketplace initial page
LuanEdCosta Sep 14, 2021
8d891c2
Redirect and make request to API only if the filters change
LuanEdCosta Sep 14, 2021
ce1338a
Create useDebouce tests
LuanEdCosta Sep 14, 2021
80ed854
Fix useDebouce hook test suite name
LuanEdCosta Sep 14, 2021
ccc7fbb
Create tests for the usePersistentState hook
LuanEdCosta Sep 14, 2021
65337a7
Add search text in the marketplace search page results component
LuanEdCosta Sep 14, 2021
d86e331
FIx some details in the search and initial marketplace pages
LuanEdCosta Sep 14, 2021
905178e
Hide marketplace from main menu
LuanEdCosta Sep 14, 2021
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
14 changes: 14 additions & 0 deletions src/assets/MarketplaceColorful.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/assets/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ export {
ReactComponent as MarketplaceComponent,
} from './Marketplace.svg';

export {
default as MarketplaceColorful,
ReactComponent as MarketplaceColorfulComponent,
} from './MarketplaceColorful.svg';

export { default as Flow } from './Flow.svg';
export { default as FlowHover } from './FlowHover.svg';
export { default as LoadingJupyter } from './LoadingJupyter.gif';
Expand Down
38 changes: 24 additions & 14 deletions src/components/MainSider/MainMenu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,37 @@ import { Menu } from 'antd';
import PropTypes from 'prop-types';

const MainMenu = ({ className, itemsList, selectedItems, handleItemClick }) => {
// ! The code below may be changing a prop value. We should fix this
const selectedItem = selectedItems[0];
if (selectedItem === '/' || selectedItem.includes('/projetos')) {
selectedItems[0] = '/projetos';
} else if (selectedItem.includes('/tarefas')) {
selectedItems[0] = '/tarefas';
}
const getSelectedItems = () => {
const [firstItem] = selectedItems;

if (firstItem === '/' || firstItem.includes('/projetos')) {
return ['/projetos'];
} else if (firstItem.includes('/marketplace')) {
return ['/marketplace'];
} else if (firstItem.includes('/tarefas')) {
return ['/tarefas'];
}

return selectedItems;
};

return (
<Menu
theme='dark'
className={className}
selectedKeys={selectedItems}
selectedKeys={getSelectedItems()}
onClick={(e) => handleItemClick(e.key)}
>
{itemsList.map(({ icon, title, path }) => (
<Menu.Item key={path} style={{ color: '#ffffff' }}>
{icon}
<span>{title}</span>
</Menu.Item>
))}
{itemsList.map(({ icon, title, path, visible }) => {
if (!visible) return null;

return (
<Menu.Item key={path} style={{ color: '#ffffff' }}>
{icon}
<span>{title}</span>
</Menu.Item>
);
})}
</Menu>
);
};
Expand Down
11 changes: 11 additions & 0 deletions src/components/MainSider/MainMenu/itemsMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,39 @@ import {
BuildOutlined,
ExperimentOutlined,
PartitionOutlined,
ShoppingOutlined,
} from '@ant-design/icons';

const itemsMenu = [
{
icon: <AppstoreOutlined />,
title: 'Meus projetos',
path: '/projetos',
visible: true,
},
{
icon: <BuildOutlined />,
title: 'Tarefas',
path: '/tarefas',
visible: true,
},
{
icon: <PartitionOutlined />,
title: 'Fluxo de Tarefas',
path: '/fluxo-tarefas',
visible: true,
},
{
icon: <ExperimentOutlined />,
title: 'JupyterLab',
path: '/jupyterlab',
visible: true,
},
{
icon: <ShoppingOutlined />,
title: 'Marketplace',
path: '/marketplace',
visible: false,
},
];

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import React from 'react';
import PropTypes from 'prop-types';

import { MARKETPLACE_TASK_CATEGORIES } from 'configs';

import './MarketplaceTaskItemBox.style.less';

const MarketplaceTaskItemBox = ({
header,
footer,
onClick,
children,
tabIndex,
className,
taskCategory,
borderDirection,
}) => {
const borderDirectionClass = `marketplace-task-item-box-${borderDirection}`;

const getColor = () => {
return (
MARKETPLACE_TASK_CATEGORIES[taskCategory]?.color ||
MARKETPLACE_TASK_CATEGORIES.DATASETS.color
);
};

return (
<div
className={`marketplace-task-item-box ${className} ${borderDirectionClass}`}
role='button'
onKeyPress={null}
onClick={onClick}
tabIndex={tabIndex}
>
<div
style={{ background: getColor() }}
className='marketplace-task-item-box-border'
/>

<div className='marketplace-task-item-box-content'>
<div className='marketplace-task-item-box-content-header'>{header}</div>
<div className='marketplace-task-item-box-content-body'>{children}</div>
<div className='marketplace-task-item-box-content-footer'>{footer}</div>
</div>
</div>
);
};

MarketplaceTaskItemBox.propTypes = {
header: PropTypes.node,
footer: PropTypes.node,
onClick: PropTypes.func,
children: PropTypes.node,
tabIndex: PropTypes.number,
className: PropTypes.string,
taskCategory: PropTypes.oneOf(Object.keys(MARKETPLACE_TASK_CATEGORIES)),
borderDirection: PropTypes.oneOf(['left', 'top']),
};

MarketplaceTaskItemBox.defaultProps = {
header: null,
footer: null,
onClick: null,
children: null,
tabIndex: -1,
className: '',
taskCategory: MARKETPLACE_TASK_CATEGORIES.DATASETS.key,
borderDirection: 'top',
};

export default MarketplaceTaskItemBox;
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
.marketplace-task-item-box {
border-radius: 5px;
border: 1px solid #595959;
background: white;
overflow: hidden;
outline: none;
transition: box-shadow 0.2s ease-in-out;

&:hover {
box-shadow: 0px 4px 4px 0px #00000040;
}

.marketplace-task-item-box-border {
overflow: hidden;
}

.marketplace-task-item-box-content {
display: flex;
flex-direction: column;
padding: 16px;
height: 100%;

.marketplace-task-item-box-content-header {
margin-bottom: 16px;
}

.marketplace-task-item-box-content-body {
flex: 1;
margin-bottom: 16px;
}
}

&.marketplace-task-item-box-top {
display: flex;
flex-direction: column;

.marketplace-task-item-box-border {
height: 6px;
min-height: 6px;
max-height: 6px;
width: 100%;
border-bottom: 1px solid #595959;
}
}

&.marketplace-task-item-box-left {
display: flex;
align-items: stretch;

.marketplace-task-item-box-border {
width: 6px;
min-width: 6px;
max-width: 6px;
border-right: 1px solid #595959;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import MarketplaceTaskItemBox from './MarketplaceTaskItemBox.component';

export default MarketplaceTaskItemBox;
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react';
import PropTypes from 'prop-types';

import './MarketplaceTaskItemDescription.style.less';

const MarketplaceTaskItemDescription = ({ children }) => {
return <div className='marketplace-task-item-description'>{children}</div>;
};

MarketplaceTaskItemDescription.propTypes = {
children: PropTypes.node,
};

MarketplaceTaskItemDescription.defaultProps = {
children: null,
};

export default MarketplaceTaskItemDescription;
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.marketplace-task-item-description {
font-size: 14px;
line-height: 22px;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import MarketplaceTaskItemDescription from './MarketplaceTaskItemDescription.component';

export default MarketplaceTaskItemDescription;
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';
import { Avatar, Typography } from 'antd';

import './MarketplaceTaskItemHeader.style.less';

const MarketplaceTaskItemHeader = ({
name,
userId,
userName,
imageSrc,
avatarColor,
}) => {
const handleClick = (e) => {
e.stopPropagation();
};

return (
<div className='marketplace-task-item-header'>
<Avatar
className='marketplace-task-item-header-avatar'
style={{ backgroundColor: avatarColor }}
src={imageSrc}
alt={name}
size={48}
>
{name.charAt(0)}
</Avatar>

<div className='marketplace-task-item-header-data'>
<Typography.Title level={5}>{name}</Typography.Title>

<Link
onClick={handleClick}
to={`/marketplace/autor/${userId}`}
component={Typography.Link}
>
{userName}
</Link>
</div>
</div>
);
};

MarketplaceTaskItemHeader.propTypes = {
name: PropTypes.string,
userId: PropTypes.string,
userName: PropTypes.string,
imageSrc: PropTypes.string,
avatarColor: PropTypes.string,
};

MarketplaceTaskItemHeader.defaultProps = {
name: '',
userId: '',
userName: '',
imageSrc: '',
avatarColor: undefined,
};

export default MarketplaceTaskItemHeader;
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.marketplace-task-item-header {
display: flex;
flex-wrap: wrap;
align-items: flex-start;

.marketplace-task-item-header-data {
padding: 0 16px;

> * {
margin: 0;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import MarketplaceTaskItemHeader from './MarketplaceTaskItemHeader.component';

export default MarketplaceTaskItemHeader;
Loading