Skip to content

Commit

Permalink
* add css styles for pending invitations display
Browse files Browse the repository at this point in the history
  • Loading branch information
CalamityC committed Apr 5, 2024
1 parent f3deecf commit c7e7af0
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 27 deletions.
41 changes: 16 additions & 25 deletions rdmo/projects/assets/js/components/helper/PendingInvitations.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,26 @@
import React from 'react'
import PropTypes from 'prop-types'

const columnStyle = { color: '#666', width: '25%', paddingLeft: '10px' }
const tableStyle = { width: '100%' }

const PendingInvitations = ({ invitations }) => {
const baseUrl = window.location.origin

return (
<table style={tableStyle}>
<tbody>
{invitations?.map(item => (
<tr key={item.id}>
<td style={columnStyle}>
<b>{item.project_title}</b>
{/* <a href={`${baseUrl}/projects/${item.project}`} target="_blank" rel="noopener noreferrer">{item.project_title}</a>
{' '.repeat(maxProjectTitleLength - item.project_title.length)} */}
{/* <a href={`${baseUrl}/projects/join/${item.project}`} target="_blank" rel="noopener noreferrer"><b>{item.project_title}</b></a> */}
</td>
{/* <td style={columnStyle}>{gettext(item.role)}</td> */}
<td style={columnStyle}>{gettext(item.role).charAt(0).toUpperCase() + gettext(item.role).slice(1)}</td>
<td style={columnStyle}>
<button className="btn btn-link" onClick={() => { window.location.href = `${baseUrl}/projects/join/${item.project}` }}>{gettext('Accept')}</button>
</td>
<td style={columnStyle}>
<button className="btn btn-link" onClick={() => { window.location.href = `${baseUrl}/projects/cancel/${item.project}` }}>{gettext('Decline')}</button>
</td>
</tr>
))}
</tbody>
</table>
<ul>
{invitations?.map(item => (
<div key={item.id} className="row-container">
<div className="w-100 mb-5">
<b>{item.project_title}</b>
</div>
<div className="w-50">
{gettext(item.role).charAt(0).toUpperCase() + gettext(item.role).slice(1)}
</div>
<div className="w-25">
<button className="btn btn-xs btn-success ml-10" onClick={() => { window.location.href = `${baseUrl}/projects/join/${item.project}` }}>{gettext('Accept')}</button>
<button className="btn btn-xs btn-danger ml-10" onClick={() => { window.location.href = `${baseUrl}/projects/cancel/${item.project}` }}>{gettext('Decline')}</button>
</div>
</div>
))}
</ul>
)
}

Expand Down
4 changes: 2 additions & 2 deletions rdmo/projects/assets/js/components/main/Projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ const Projects = ({ config, configActions, currentUserObject, projectsActions, p

if (myProjects) {
visibleColumns.splice(2, 0, 'role')
columnWidths = ['25%', '20%', '20%', '20%', '5%']
columnWidths = ['35%', '20%', '20%', '20%', '5%']
} else {
visibleColumns.splice(2, 0, 'created')
visibleColumns.splice(2, 0, 'owner')
columnWidths = ['25%', '10%', '20%', '20%', '20%', '5%']
columnWidths = ['35%', '10%', '20%', '20%', '20%', '5%']
}

const cellFormatters = {
Expand Down
24 changes: 24 additions & 0 deletions rdmo/projects/assets/scss/projects.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ a.disabled {
.w-100 {
width: 100%;
}
.w-25 {
width: 25%;
}
.mt-0 {
margin-top: 0;
}
Expand Down Expand Up @@ -222,3 +225,24 @@ a.disabled {
text-decoration: none;
background-color: #eeeeee;
}

.row-container {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
}

.row-container > div {
color: #666;
padding-left: 10px;
}

.row-container:not(:last-child):after { /* Add line between each container element */
content: '';
width: 100%;
height: 1px;
background-color: #ccc;
margin-top: 10px;
margin-bottom: 10px;
}
25 changes: 25 additions & 0 deletions rdmo/projects/static/projects/css/projects.css
Original file line number Diff line number Diff line change
Expand Up @@ -9464,6 +9464,10 @@ a.disabled {
width: 100%;
}

.w-25 {
width: 25%;
}

.mt-0 {
margin-top: 0;
}
Expand Down Expand Up @@ -9688,3 +9692,24 @@ a.disabled {
text-decoration: none;
background-color: #eeeeee;
}

.row-container {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
}

.row-container > div {
color: #666;
padding-left: 10px;
}

.row-container:not(:last-child):after { /* Add line between each container element */
content: "";
width: 100%;
height: 1px;
background-color: #ccc;
margin-top: 10px;
margin-bottom: 10px;
}

0 comments on commit c7e7af0

Please sign in to comment.