Skip to content

Commit

Permalink
[FT] - Sorting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
NishalJohn committed Mar 16, 2024
1 parent 7bb16b3 commit d78b240
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 65 deletions.
93 changes: 44 additions & 49 deletions src/pages/AssetLibrary/AssetLibrary.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import React, { useState, useEffect } from 'react';
import { AssetLibraryModal } from "./AssetLibraryModal"
import { MarketplaceAssetLibraryModal } from "./MarketplaceAssetLibraryModal"
import { AnimationAssetLibraryModal } from "./AnimationAssetLibraryModal"
import { Typography, Tag, Button, Input } from 'antd';
import { LinkOutlined, CheckCircleOutlined, DollarOutlined, HddOutlined } from '@ant-design/icons';
import { Typography, Button, Input } from 'antd';
import { LinkOutlined, CheckCircleOutlined, DollarOutlined, DeleteOutlined, FolderOpenOutlined, EditOutlined } from '@ant-design/icons';
import { db, auth } from "../../config/firebase";
import { getDocs, collection } from 'firebase/firestore'
import { Navigate } from 'react-router-dom';
import { sort } from 'fast-sort';

const { Title, Text } = Typography;
const { Search } = Input;
Expand All @@ -22,12 +23,16 @@ export const AssetLibrary = () => {


const filterAllData = (allRefData) => {

allRefData.forEach(list => {
list.forEach(asset => {
setAssetData(allAssetData => [...allAssetData, asset]);
setSearchData(assetSearchData => [...assetSearchData, asset]);
});
});
// let sortedFilteredData = sort(assetSearchData).desc(u => u["date-updated"])
setSearchData(assetSearchData => sort(assetSearchData).desc(u => u["date-updated"]));

}


Expand Down Expand Up @@ -157,9 +162,6 @@ export const AssetLibrary = () => {
<>
{asset.group == "Market" ? (
<div key={asset.id} className='asset-list-item'>
<div className='asset-icon-wrapper'>
{/* <MessageOutlined style={{ fontSize: '75px' }} /> */}
</div>
<div className='asset-name-wrapper'>
<a href={asset.assetLink} target='_blank'>
<Title level={5}>{asset.assetName} </Title>
Expand All @@ -185,15 +187,13 @@ export const AssetLibrary = () => {
))}
</div> */}
<div className='asset-actions-wrapper'>
<Button>View</Button>
<Button type="link">Edit</Button>
<Button type="link"><FolderOpenOutlined /></Button>
<Button type="link"><EditOutlined /></Button>
<Button type="link"><DeleteOutlined /></Button>
</div>
</div>
) : asset.group == "Animation" ? (
<div key={asset.id} className='asset-list-item'>
<div className='asset-icon-wrapper'>
{/* <ClockCircleOutlined style={{ fontSize: '75px' }} /> */}
</div>
<div className='asset-name-wrapper'>
<div className='asset-name-inner-wrapper'>
<a href='#'>
Expand All @@ -206,8 +206,8 @@ export const AssetLibrary = () => {
<div className='asset-type-wrapper'>
<Title level={5}>Animation</Title>
<div className='asset-type-inner-wrapper'>
<Text type="secondary">{asset.currentProgress.step} <CheckCircleOutlined /></Text>
<Text type="secondary">{asset.currentProgress.assignee} </Text>
<Text type="secondary">{asset.currentProgress?.step} <CheckCircleOutlined /></Text>
<Text type="secondary">{asset.currentProgress?.assignee} </Text>

</div>
</div>
Expand All @@ -223,48 +223,43 @@ export const AssetLibrary = () => {
))}
</div> */}
<div className='asset-actions-wrapper'>
<Button>View</Button>
<Button type="link">Edit</Button>
<Button type="link"><FolderOpenOutlined /></Button>
<Button type="link"><EditOutlined /></Button>
<Button type="link"><DeleteOutlined /></Button>
</div>
</div>
) : (
<div key={asset.id} className='asset-list-item'>
<div className='asset-icon-wrapper'>
{/* <ClockCircleOutlined style={{ fontSize: '75px' }} /> */}
</div>
<div className='asset-name-wrapper'>
<div className='asset-name-inner-wrapper'>
<a href={asset.assetLink} target='_blank'>
<Title level={5}>{asset.assetName} </Title>
</a>
<a href={asset.conceptArtUrl} target='_blank'><LinkOutlined /></a>
)
: (
<div key={asset.id} className='asset-list-item'>
<div className='asset-name-wrapper'>
<div className='asset-name-inner-wrapper'>
<a href={asset.assetLink} target='_blank'>
<Title level={5}>{asset.assetName} </Title>
</a>
<a href={asset.conceptArtUrl} target='_blank'><LinkOutlined /></a>
</div>
<Text type="secondary">{asset.assettype}</Text>
</div>
<Text type="secondary">{asset.assettype}</Text>
</div>
<div className='asset-type-wrapper'>
<Title level={5}>3D Model</Title>
<div className='asset-type-inner-wrapper'>
<Text type="secondary">{asset.currentProgress.step} <CheckCircleOutlined /></Text>
<Text type="secondary">{asset.currentProgress.assignee} </Text>
<div className='asset-type-wrapper'>
<Title level={5}>3D Model</Title>
<div className='asset-type-inner-wrapper'>
<Text type="secondary">{asset.currentProgress?.step} <CheckCircleOutlined /></Text>
<Text type="secondary">{asset.currentProgress?.assignee} </Text>
</div>
</div>
<div className='asset-project-wrapper'>
<Title level={5}>{asset.project}</Title>
<Text type="secondary">{asset.client}</Text>
</div>

<div className='asset-actions-wrapper'>
<Button type="link"><FolderOpenOutlined /></Button>
<Button type="link"><EditOutlined /></Button>
<Button type="link"><DeleteOutlined /></Button>
</div>
</div>
<div className='asset-project-wrapper'>
<Title level={5}>{asset.project}</Title>
<Text type="secondary">{asset.client}</Text>
</div>
{/* <div className='asset-tags-wrapper'>
{asset.tags.map((tag) => (
<Tag key={tag} bordered={false} color="processing">
{tag}
</Tag>
))}
</div> */}
<div className='asset-actions-wrapper'>
<Button>View</Button>
<Button type="link">Edit</Button>
</div>
</div>
)}
)
}
</>
))}
</div>
Expand Down
53 changes: 40 additions & 13 deletions src/pages/AssetLibrary/MarketplaceAssetLibraryModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export const MarketplaceAssetLibraryModal = ({ onAddResource }) => {
const tagsData = ["Architecture",
"System",
"Sci-Fi",
"Sci-Fi",
"Realistic",
"Low-Poly",
"Modern",
Expand Down Expand Up @@ -79,7 +78,7 @@ export const MarketplaceAssetLibraryModal = ({ onAddResource }) => {
try {
await addDoc(resourceListRef, {
'assetName': values.assetName,
'description': values.description,
'project': values.project,
'assettype': values.assettype,
'source': values.source,
'assetLink': values.assetURL,
Expand All @@ -103,11 +102,29 @@ export const MarketplaceAssetLibraryModal = ({ onAddResource }) => {

//--------------

const onDescriptionorSpecialNotesAdd = (e) => {
// console.log('Change:', e.target.value);
};


const onProjectChange = (e) => {
switch (e) {
case "Internal":
setCurrentClient("Revox")
break;
case "Spiral":
setCurrentClient("Revox")
break;
case "Starwalker":
setCurrentClient("Marius")
break;
case "Goodness Game":
setCurrentClient("Foundation of Goodness")
break;
case "Other":
setCurrentClient("Unknown")
break;
default:
setCurrentClient("Unknown")
break;
}
};


//----------------------
Expand Down Expand Up @@ -178,7 +195,8 @@ export const MarketplaceAssetLibraryModal = ({ onAddResource }) => {
assettype: "Prop",
source: "epic",
project: "Internal",
assetCategory: "3D Animation"
assetCategory: "3D Animation",
specialnotes:"-"
}}
>
<div className='modal-inner'>
Expand All @@ -197,11 +215,20 @@ export const MarketplaceAssetLibraryModal = ({ onAddResource }) => {
<Input />
</Form.Item>

{/* Asset Description */}
<Form.Item name={'description'} label="Description">
<TextArea showCount maxLength={100} onChange={onDescriptionorSpecialNotesAdd} />
</Form.Item>


<Form.Item
name="project"
label="Project"
>
<Select placeholder="Select a project" defaultValue={'Internal'} onChange={onProjectChange}>
<Option value="Internal">Internal</Option>
<Option value="Spiral">Spiral</Option>
<Option value="Starwalker">Starwalker</Option>
<Option value="Goodnessgame">Goodness Game</Option>
<Option value="Other">Other</Option>
</Select>
</Form.Item>
{/* ====================In House Items ======================== */}
<Form.Item
name="source"
Expand Down Expand Up @@ -297,8 +324,8 @@ export const MarketplaceAssetLibraryModal = ({ onAddResource }) => {
<Empty />

{/* Asset Description */}
<Form.Item name={'specialnotes'} label="Special Notes">
<TextArea showCount maxLength={100} onChange={onDescriptionorSpecialNotesAdd} />
<Form.Item name="specialnotes" label="Special Notes">
<TextArea showCount maxLength={100} />
</Form.Item>

</div>
Expand Down
7 changes: 4 additions & 3 deletions src/styles/assetBrowser.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@
border: 1px solid black; */
min-height: 75px;
padding: 10px 20px;
border-bottom: 2px solid #cccc;
}

.asset-list-item:nth-child(odd) {
/* .asset-list-item:nth-child(odd) {
background-color: rgb(255, 239, 233);
}
.asset-list-item:nth-child(even) {
background-color: rgb(251, 255, 251);
}
} */

.asset-list-item h5 {
margin-top: 0px;
Expand All @@ -36,7 +37,7 @@
}

.asset-name-wrapper {
width: 20%;
width: 40%;
display: flex;
flex-direction: column;
align-items: baseline;
Expand Down

0 comments on commit d78b240

Please sign in to comment.