Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
lmmrssa committed Jun 17, 2021
1 parent 1dd42cd commit 8376107
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 44 deletions.
1 change: 1 addition & 0 deletions api/src/controllers/collectionUserController.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const getControllerUser = (req, res) => {
})
.catch((err) => res.json({ err }).status(400))
}

// @desc Add individual collection user
const addCollectionUser = async (req, res) => {
const { userId, collectionId } = req.body
Expand Down
2 changes: 1 addition & 1 deletion api/src/helpers/filehelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const upload = multer({
}
})

const multipleUpload = upload.fields([{ name: 'file' }, { name: 'attachment' }])
const multipleUpload = upload.fields([{ name: 'file' }, { name: 'attachment' }, { name: 'avatar' }])

const uploadArray = multer({ storage }).array('files')

Expand Down
1 change: 0 additions & 1 deletion api/src/models/collectionModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ const Collection = db.define(

Collection.associate = function (models) {
Collection.hasMany(models.CollectionUser, {
as: 'collectionInfo',
foreignKey: 'collectionId'
})
}
Expand Down
2 changes: 0 additions & 2 deletions api/src/models/collectionUserModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@ const CollectionUser = db.define('collection_user',

CollectionUser.associate = (models) => {
CollectionUser.belongsTo(models.User, {
as: 'userfollower',
foreignKey: 'userId'
})
CollectionUser.belongsTo(models.Collection, {
as: 'collectionInfo',
foreignKey: 'collectionId'
})
}
Expand Down
2 changes: 0 additions & 2 deletions api/src/models/resourceModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,7 @@ const Resources = db.define('resources',

Resources.associate = function (models) {
Resources.hasMany(models.ResourceUser, {
as: 'resourceInfo',
foreignKey: 'resourceId'

})
}

Expand Down
2 changes: 0 additions & 2 deletions api/src/models/userModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@ const User = db.define('users', {

User.associate = function (models) {
User.hasMany(models.CollectionUser, {
as: 'userfollower',
foreignKey: 'userId'
})
}
User.associate = function (models) {
User.hasMany(models.ResourceUser, {
as: 'userfollower',
foreignKey: 'userId'
})
}
Expand Down
21 changes: 2 additions & 19 deletions src/components/collectionModal/CollectionModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,30 +71,13 @@ const CollectionModal = ({ setActive, openAddCollection, name }) => {
</>
: <>
<div className='collection-input-container'>
<input className='default-input-variation' placeholder='Collection title' /> <br />
<input className='default-input-variation' error={collectionTitleError} onChange={(e) => collectionTitleChange(e)} placeholder='Collection title' /> <br />
<SimpleFilter data={collectionFilterData} />
</div>
<div className='add-collection' onClick={() => openAddCollection()}><img src='/img/plus.svg' alt='Add Files' /><button>{name || 'Add files'}</button></div>
<button className='default-btn btn-size' onClick={() => openAddCollection()}>Create new collection</button>
<button className='default-btn btn-size' onClick={handleAddCollection}>Create new collection</button>
</>}
</div>
<DragDrop onChange={setFiles} />
{pathname === '/library'
? <>
<div className='collection-input-container'>
<input className='default-input-variation' error={resourceTitleError} onChange={(e) => resourceTitleChange(e)} placeholder='Resource title' /><br />
<input className='default-input-variation text-area-variation' error={resourceDescriptionError} onChange={(e) => resourceDescriptionChange(e)} placeholder='Resource description' /><br />
</div>
<button className='default-btn btn-size' onClick={handleAddResource}>Submit</button>
</>
: <>
<div className='collection-input-container'>
<input className='default-input-variation' error={collectionTitleError} onChange={(e) => collectionTitleChange(e)} placeholder='Collection title' /> <br />
<SimpleFilter data={collectionFilterData} />
</div>
<div className='add-collection' onClick={() => openAddCollection()}><img src='/img/plus.svg' alt='Add Files' /><button>{name || 'Add files'}</button></div>
<button className='default-btn btn-size' onClick={handleAddCollection}>Create new collection</button>
</>}
</div>
</div>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
}

.collection-modal-container > div {
/* width: 100%; */
height: 80%;
width: 100%;
height: 100%;
position: relative;
overflow-y: scroll;
margin-bottom: 100px;
Expand Down Expand Up @@ -58,7 +58,7 @@

.drag-drop-container {
width: 100%;
height: 30%;
height: 100%;
position: relative;
margin-bottom: 40px;
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/groupUsers/GroupUsers.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ const GroupUsers = ({ data }) => {
<>
{

data && data.map(d => (
data && data.map(user => (
<div className='group-user-container'>
<div>
<div className='img-wrapper'>
<img src='/img/avatar-msg.svg' alt='users' />
<img src={user.image} alt='users' />
</div>
<h4>{d.name && d.name}</h4>
<h4>{user.name && user.name}</h4>
</div>
<Radiobox />
</div>
Expand Down
3 changes: 1 addition & 2 deletions src/components/libraryCard/LibraryCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@ const LibraryCard = ({ data }) => {
return (
<div
key={item.id} className='libraryCard-inner-container' style={{
backgroundImage: 'url(/img/man-cap.svg)',
backgroundImage: `url(${item.img})`,
backgroundPosition: 'center',
backgroundSize: 'cover',
backgroundRepeat: 'no-repeat'
}}
>

<button className='trasnsparent-btn positioning'><img src='/img/trash-outline.svg' alt='trash-icon' /> <span>Remove from library</span></button>
<div className='libraryCard-content'>
<h6>{item.category}</h6>
Expand Down
10 changes: 5 additions & 5 deletions src/screens/library/collection/Collection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import LibraryCard from '../../../components/libraryCard/LibraryCard'
import LibraryHeader from '../../../components/libraryHeader/LibraryHeader'
import SimpleModal from '../../../components/simpleModal/SimpleModal'
import DashboardLayout from '../../../layout/dashboardLayout/DashboardLayout'
import { groupCollection, collections } from '../CollectionData'
import { groupCollection, collections, library } from '../CollectionData'
import { useSelector, useDispatch } from 'react-redux'
import { listResourceUser } from '../../../actions/resourceUserAction'
import Pagination from '../../../Components/Paginations/Paginations'
import Pagination from '../../../Components/pagination/Pagination'
import { listResources } from '../../../actions/resourceActions'

import './collection.css'
import './Collection.css'

const Collection = () => {
const [newCollection, setNewCollection] = useState(false)
Expand Down Expand Up @@ -63,13 +63,13 @@ const Collection = () => {
<div className='library-collection'>
<h4>My library (files)</h4>

<LibraryCard />
<LibraryCard data={library} />

{/* <Pagination pageNumber={pageNumber} setPageNumber={setPageNumber} resourceList={resourceList} /> */}
</div>
<div className='library-collection'>
<h4>My Collections</h4>
<LibraryCard />
<LibraryCard data={collections}/>
</div>
</DashboardLayout>
</>
Expand Down
4 changes: 2 additions & 2 deletions src/screens/library/savedCollection/SavedCollection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ const SavedCollection = () => {
</div>
<div className='library-collection'>
<h4>Farming Collections</h4>
<LibraryCard />
<LibraryCard data={library} />
</div>
<div className='library-collection'>
<h4>Branding Collections</h4>
<LibraryCard />
<LibraryCard data={collections} />
</div>
</DashboardLayout>
</>
Expand Down
4 changes: 2 additions & 2 deletions src/screens/library/userCollection/UserCollection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import GroupModal from '../../../components/groupModal/GroupModal'
import CardLayout from '../../../layout/cardLayout/CardLayout'
import { listCollections, updateCollection } from '../../../actions/collectionActions'
import { createCollectionUser } from '../../../actions/collectionUserActions'
import Pagination from '../../../Components/Paginations/Paginations'
import Pagination from '../../../Components/pagination/Pagination'

const UserCollection = () => {
const [active, setActive] = useState(true)
Expand Down Expand Up @@ -72,7 +72,7 @@ const UserCollection = () => {
{
data && data.map(item => {
return (
<div key={item.id} className='farming-inner-container' style={{ backgroundImage: 'url(/img/farming.svg)' }}>
<div key={item.id} className='farming-inner-container' style={{ backgroundImage: `url(${item.img})` }}>
<button className='trasnsparent-btn btn-positioning'>
<b>{item.users}</b> <span>users saved</span>
</button>
Expand Down

0 comments on commit 8376107

Please sign in to comment.