Commit 6279caaa authored by Darrick Yong's avatar Darrick Yong

fix styling and search

parent d0251490
No preview for this file type
...@@ -11,6 +11,12 @@ ...@@ -11,6 +11,12 @@
font-weight: 700; font-weight: 700;
} }
.nisum-logo {
margin-right: 10px;
width: 100px;
height: 50px;
}
.header-module { .header-module {
position: absolute; position: absolute;
top: 0; top: 0;
...@@ -27,12 +33,6 @@ ...@@ -27,12 +33,6 @@
align-items: center; align-items: center;
} }
.header img {
margin-right: 10px;
width: 32px;
height: 32px;
}
.user { .user {
cursor: pointer; cursor: pointer;
position: relative; position: relative;
...@@ -46,6 +46,13 @@ ...@@ -46,6 +46,13 @@
color: #CCCDCF; color: #CCCDCF;
} }
.user img {
margin-right: 10px;
width: 32px;
width: 32px;
border-radius: 50%;
}
.dropdown { .dropdown {
cursor: auto; cursor: auto;
width: 100%; width: 100%;
......
const Image = ({ src }) => ( const Image = ({ className, src }) => (
<img src={src} alt=""/> <img className={className} src={src} alt=""/>
) )
export default Image; export default Image;
\ No newline at end of file
...@@ -27,17 +27,13 @@ const Search = ({ orders, setOrdersToShow, setFiltersOn }) => { ...@@ -27,17 +27,13 @@ const Search = ({ orders, setOrdersToShow, setFiltersOn }) => {
setByError(true); setByError(true);
} else { } else {
const searchResult = { allIds: [], byId: {} }; const searchResult = { allIds: [], byId: {} };
const searchedOrder = orders.allIds.map(id => {
searchBy === searchOptions[0] const order = orders.byId[id];
? orders.byId[searchInput] if (order.orderId.toLowerCase().includes(searchInput.toLowerCase())) {
: searchBy === searchOptions[1] searchResult.allIds.push(id);
? orders.byOrderId[searchInput] searchResult.byId[id] = orders.byId[id];
: null;
if (searchedOrder) {
searchResult.allIds.push(searchedOrder.id);
searchResult.byId[searchedOrder.id] = searchedOrder;
} }
})
if (searchBy.length) { if (searchBy.length) {
setOrdersToShow(searchResult); setOrdersToShow(searchResult);
} }
......
...@@ -6,9 +6,11 @@ import User from "./User"; ...@@ -6,9 +6,11 @@ import User from "./User";
const Header = ({ isLoggedIn, user, logout }) => { const Header = ({ isLoggedIn, user, logout }) => {
return ( return (
<div className="header"> <div className="header">
<div>Ascend</div> <div>
<Image className="nisum-logo" src="./nisum.jpeg" />
</div>
{/* <div>Ascend</div> */}
<div className="header-module"> <div className="header-module">
{/* <Image src="./logo.svg" /> */}
<div>Warehouse Management</div> <div>Warehouse Management</div>
</div> </div>
<div>{isLoggedIn ? <User user={user.user} /> : null}</div> <div>{isLoggedIn ? <User user={user.user} /> : null}</div>
......
...@@ -11,6 +11,7 @@ const OrderIndexItem = ({ ...@@ -11,6 +11,7 @@ const OrderIndexItem = ({
setExpandAll, setExpandAll,
}) => { }) => {
const { orderId, status } = order; const { orderId, status } = order;
const idToShow = orderId.slice(-7).toUpperCase();
const [showDetails, setShowDetails] = useState(false); const [showDetails, setShowDetails] = useState(false);
...@@ -44,7 +45,7 @@ const OrderIndexItem = ({ ...@@ -44,7 +45,7 @@ const OrderIndexItem = ({
className={`oii-drop ${showDetails ? "rotate" : ""}`} className={`oii-drop ${showDetails ? "rotate" : ""}`}
onClick={handleDropDown} onClick={handleDropDown}
/> />
<div className="oii-num">{`Order #: ${orderId}`}</div> <div className="oii-num">{`Order #: ${idToShow}`}</div>
</div> </div>
{actions} {actions}
</div> </div>
......
...@@ -17,12 +17,10 @@ const OrdersReducer = (oldState = initialState, action) => { ...@@ -17,12 +17,10 @@ const OrdersReducer = (oldState = initialState, action) => {
const orderState = { const orderState = {
byId: {}, byId: {},
allIds: [], allIds: [],
byOrderId: {},
}; };
action.orders.forEach( order => { action.orders.forEach( order => {
orderState.allIds.push(order.id); orderState.allIds.push(order.id);
orderState.byId[order.id] = order; orderState.byId[order.id] = order;
orderState.byOrderId[order.orderId] = order;
}) })
return orderState; return orderState;
case UPDATE_ORDER: case UPDATE_ORDER:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment