Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions src/components/AccountSettings/MyAccount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -238,20 +238,18 @@ export class MyAccount extends Component<Props, State, {}> {
const { status } = responseJSON;
// old passwrod entered correctly
if (status === 'AUTH_SUCCESS') {
this.handleCancelPassword();
alert.show('Successfully updated password');
} else if (status === 'PASSWORD_UNCHANGED') {
// new password is the same as the old password
if (enteredPassword === newPassword) {
this.setState({
passwordError: PasswordError.NewPasswordSameAsOld,
});
} else { // no error - password changed succesfully
this.handleCancelPassword();
alert.show('Successfully updated password');
}
this.setState({
passwordError: PasswordError.NewPasswordSameAsOld,
});
} else if (status === 'AUTH_FAILURE') { // wrong old password
this.setState({
passwordError: PasswordError.OldPasswordWrong,
});
} else if (status === 'INVALID_PARAMETER') {
} else if (status === 'INVALID_PARAMETER') { // invalid password
this.setState({
passwordError: PasswordError.NewPasswordInvalid,
});
Expand Down
45 changes: 29 additions & 16 deletions src/components/BaseComponents/BaseActivityCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,44 @@ interface ActivityProps {
activity: any;
}

export default function (props: ActivityProps): React.ReactElement {
const { activity } = props;
const uploaderUsername = activity.username;
export default function ActivityCard({ activity }: ActivityProps): React.ReactElement {
const uploaderUsername = activity.invokerUsername;
const objectName = activity.objectName;
const { type } = activity;
if (uploaderUsername !== '' && type !== '') {
const displayType = type.split('Activity');

if (uploaderUsername && type) {
const displayType = type.replace('Activity', '');
const newDate = new Date(Date.parse(activity.occurredAt));
// return mm/dd/yyyy version of date
const dateString = newDate.toLocaleDateString();
// return difference number of days between current date and dateString for activity
const daysDifference = Math.round(
(new Date().getTime() - newDate.getTime()) / (1000 * 3600 * 24),
);
// eslint-disable-next-line no-underscore-dangle

return (
<div key={activity.id} className="ml-2 activities-card-container">
<h6 id="activities-card-title">
{displayType}
Activity
</h6>
<p id="activities-card-date">
{`Completed by ${uploaderUsername}, ${dateString}, ${daysDifference} days ago`}
</p>
<div
key={activity.id}
className="activities-card-container flex flex-row justify-between items-center bg-gray-50 rounded-md"
style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', padding: '12px 8px' }} // forces flex row
>
{/* Column 1: Activity type */}
<div style={{ flex: '1', textAlign: 'left', display: 'flex', alignItems: 'center', justifyContent: 'flex-start' }}>
<h6 className="text-gray-600 font-semibold m-0">{displayType}Activity</h6>
</div>

{/* Column 2: Object name */}
<div style={{ flex: '2', textAlign: 'center', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
<h6 className="text-gray-800 truncate m-0">{objectName}</h6>
</div>

{/* Column 3: Metadata */}
<div style={{ flex: '2', textAlign: 'right', display: 'flex', alignItems: 'center', justifyContent: 'flex-end' }}>
<p className="text-gray-500 text-sm m-0">
Completed by {uploaderUsername}, {dateString}, {daysDifference} days ago
</p>
</div>
</div>
);
}

return <div />;
}
8 changes: 4 additions & 4 deletions src/components/LandingPages/ClientLanding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@ class ClientLanding extends Component<Props, State, {}> {
</div>
</div>
</div>
<div className="d-flex p-2 mt-5">
<h3>Recent Activity</h3>
<div className="tw-mx-auto tw-py-4 tw-mt-5">
<h3 className="tw-text-center lg:tw-text-left">Recent Activity</h3>
</div>
{isLoading ? <div className="ld ld-ring ld-spin ml-2" /> : <div />}
<ul className="tw-list-none tw-mb-20">
{isLoading ? <div className="ld ld-ring ld-spin ml-0" /> : <div />}
<ul className="tw-list-none tw-mb-20 tw-pl-0 tw-ml-0">
{this.renderActivitiesCard(activities)}
</ul>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/static/styles/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ $theme-colors: (

.app {
background-color: white;
padding-bottom: 3.75rem;
padding-bottom: 0.01rem;
}

.input-group-text {
Expand Down
Loading