Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Commit

Permalink
Add Institution name to Publications. Status notification updates bas…
Browse files Browse the repository at this point in the history
…ed on user feedback.
  • Loading branch information
meissadia committed Aug 5, 2020
1 parent bd71f60 commit 159430e
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 26 deletions.
7 changes: 4 additions & 3 deletions src/publications/PublicationRow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ const regenMsg = (label) => 'Begin the regeneration process for ' + label + '?'
export const PublicationRow = ({
notFound,
fetched,
lei,
institution,
token,
type,
url,
year,
}) => {
const label = LABELS[type]
const topic = TOPICS[type]
const { lei, respondentName, activityYear: year } = institution

const [state, setState] = useState(defaultState)
const updateState = newState => setState((oldState) => ({...oldState, ...newState }))
Expand Down Expand Up @@ -53,6 +53,7 @@ export const PublicationRow = ({
return (
<tr>
<td>{year}</td>
<td>{respondentName}</td>
<td>{label}</td>
<td>
{!fetched ? (
Expand All @@ -68,8 +69,8 @@ export const PublicationRow = ({
onClick={handleRegeneration}
error={state.error}
message={state.message}
waiting={state.waiting}
/>
{state.waiting && <LoadingIcon className="LoadingInline" />}
</td>
</tr>
)
Expand Down
6 changes: 2 additions & 4 deletions src/publications/PublicationRows.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,13 @@ const PublicationRows = ({ institution, token }) => {
<>
<PublicationRow
type="mlar"
year={activityYear}
lei={institution.lei}
institution={institution}
token={token}
{...mlar}
/>
<PublicationRow
type="irs"
year={activityYear}
lei={institution.lei}
institution={institution}
token={token}
{...irs}
/>
Expand Down
17 changes: 11 additions & 6 deletions src/publications/PublicationTable.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,31 @@

#publications .message {
position: relative;
padding: 1rem 0 1rem 1.5rem;
background: rgb(212, 247, 212);
display: block;
padding: 1rem 1.5rem;
background: rgb(212, 235, 247);
display: inline-block;
margin-top: 1rem;
}

#publications .message::before {
content: '';
height: 100%;
width: 1rem;
background-color: green;
background-color: #0071bc;
position: absolute;
left: 0;
top: 0;
}

#publications .message.error {
background-color: rgb(247, 217, 222);
background-color: rgb(249, 229, 216);
}

#publications .message.error::before {
background-color: red;
background-color: rgb(237, 119, 29);
}

#publications .inputSubmit.disabled {
pointer-events: none;
background-color: rgb(164, 160, 160);
}
3 changes: 2 additions & 1 deletion src/publications/PublicationTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const PublicationTable = ({ institutions, token }) => {
return null

institutions.sort((a, b) => (b.activityYear > a.activityYear ? 1 : -1))
const colWidth = 90 / 3
const colWidth = 90 / 4

return (
<section id="publications" className="SearchResults">
Expand All @@ -16,6 +16,7 @@ const PublicationTable = ({ institutions, token }) => {
<thead>
<tr>
<th width="10%">Year</th>
<th width={colWidth}>Name</th>
<th width={colWidth}>Publication</th>
<th width={colWidth}>File</th>
<th width={colWidth}>Actions</th>
Expand Down
31 changes: 19 additions & 12 deletions src/publications/RegenerateButton.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
import React from 'react'
import Message from './Message'
import LoadingIcon from '../Loading'

export const RegenerateButton = ({ onClick, error, message }) => (
<>
<span
onClick={onClick}
className="inputSubmit"
style={{ margin: '0 auto' }}
>
Regenerate
</span>
<Message isError={error} message={message} />
</>
)
export const RegenerateButton = ({ onClick, error, message, waiting }) => {
let cname = 'inputSubmit'
if(waiting) cname += ' disabled'

return (
<div className="regenerate-container">
<span
onClick={onClick}
className={cname}
style={{ margin: '0 auto' }}
>
Regenerate
</span>
{waiting && <LoadingIcon className="LoadingInline" />}
<Message isError={error} message={message} />
</div>
)
}

0 comments on commit 159430e

Please sign in to comment.