Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENG-6191] Improve Styling and Add Total Users Label #2327

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ interface Column {
interface InstitutionalUsersListArgs {
institution: InstitutionModel;
departmentMetrics: InstitutionDepartmentsModel[];
totalUsers: number;
}

export default class InstitutionalUsersList extends Component<InstitutionalUsersListArgs> {
Expand All @@ -29,6 +30,7 @@ export default class InstitutionalUsersList extends Component<InstitutionalUsers
institution?: InstitutionModel;

departmentMetrics?: InstitutionDepartmentsModel[];
totalUsers?: number;

// Properties
@tracked department = this.defaultDepartment;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@
color: $color-select;
}

.table-wrapper {
overflow-x: auto;
display: block;
}

.table {
margin-bottom: 45px;

table {
width: 100%;
margin-bottom: 15px;
table-layout: fixed;
table-layout: auto;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
border-collapse: collapse;
}
Expand All @@ -21,6 +26,7 @@
td {
padding: 10px;
text-overflow: ellipsis;
white-space: nowrap;
}

:global(.text-center) {
Expand All @@ -33,7 +39,6 @@
}

.header {
width: 100%;
background: #365063;
color: #fff;
}
Expand Down Expand Up @@ -119,7 +124,7 @@

.filter-container {
display: flex;
justify-content: flex-end;
justify-content: flex-start;
align-items: center;
width: 100%;
}
Expand All @@ -142,6 +147,11 @@
margin-bottom: 10px;
}

.dropdown-trigger {
padding: 9px;
color: $color-select;
}

.dropdown-content label {
display: flex;
align-items: center;
Expand Down Expand Up @@ -237,7 +247,7 @@ input:checked + .slider:hover::before {
}

input:checked + .slider::before {
transform: translateX(26px);
transform: translateX(30px);
}

.slider.round {
Expand All @@ -247,3 +257,21 @@ input:checked + .slider::before {
.slider.round::before {
border-radius: 50%;
}

.total-users {
margin-right: auto; /* Aligns text to the left */
display: flex; /* Allows for consistent alignment with other elements */
align-items: center;
}

.total-users label {
font-size: 18px;
margin-bottom: 0;
font-weight: normal;
}

.total-users-count {
font-size: 24px;
margin-right: 5px;
font-weight: bold;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
<LoadingIndicator data-test-loading-indicator @dark={{true}} />
{{else}}
<div local-class='filter-container'>
<div local-class='total-users'>
<span local-class='total-users-count'>
{{@totalUsers}}
</span>
{{t 'institutions.dashboard.users_list.total_users'}}
</div>
<div local-class='orcid-switch'>
<label for='switches-container' local-class='orcid-toggle-label'>{{t 'institutions.dashboard.users_list.has_orcid'}}</label>
<label local-class='switch'>
Expand Down Expand Up @@ -51,71 +57,73 @@
<Button @type='secondary' {{on 'click' dd.actions.close}}>
{{t 'general.cancel'}}
</Button>
<Button @type='primary' {{on 'click' this.applyColumnSelection}}>
<Button @type='primary' {{on 'click' this.applyColumnSelection}} {{on 'click' dd.actions.close}}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for future reference, if you want to have a click even do multiple actions in sequence, you can use either the pipe or queue helper like
{{on 'click' (queue this.firstAction this.secondAction)}}

Docs for those can be found here: https://github.com/DockYard/ember-composable-helpers?tab=readme-ov-file#queue

{{t 'general.apply'}}
</Button>
</div>
</div>
{{/if}}
</BasicDropdown>
</div>
<PaginatedList::HasMany
local-class='table'
@isTable={{true}}
@model={{@institution}}
@usePlaceholders={{false}}
@relationshipName='userMetrics'
@bindReload={{this.reloadUserList}}
@query={{this.queryUsers}}
as |list|
>
<list.header local-class='header'>
{{#let (component 'sort-arrow'
class=(local-class 'sort-arrow')
sortAction=this.sortInstitutionalUsers
sort=this.sort
) as |SortArrow|}}
<tr>
{{#each this.columns as |column|}}
{{#if (includes column.key this.selectedColumns)}}
<th data-test-header='{{column.key}}'>
<div local-class='header-content'>
<span local-class='header-text'>{{column.label}}</span>
{{#if column.sort_key}}
<span local-class='sort-arrow-container'>
<SortArrow @sortBy='{{column.sort_key}}' />
</span>
{{/if}}
</div>
</th>
{{/if}}
{{/each}}
</tr>
{{/let}}
</list.header>
<list.item local-class='item' as |institutionalUser|>
{{#each this.columns as |column|}}
{{#if (includes column.key this.selectedColumns)}}
<td data-test-item={{column.key}}>
{{#if (eq column.type 'user_name')}}
<OsfLink @href={{concat '/' institutionalUser.userGuid '/'}}>
{{institutionalUser.userName}}
</OsfLink>
{{else if (eq column.type 'osf_link')}}
<OsfLink @href={{concat '/' institutionalUser.userGuid '/'}}>
{{institutionalUser.userGuid}}
</OsfLink>
{{else if (eq column.type 'date_by_month')}}
{{moment-format (get institutionalUser column.key) 'MM/YYYY'}}
{{else}}
{{get institutionalUser column.key}}
{{/if}}
</td>
{{/if}}
{{/each}}
</list.item>
<list.empty local-class='empty'>
{{t 'institutions.dashboard.users_list.empty'}}
</list.empty>
</PaginatedList::HasMany>
<div local-class='table-wrapper'>
<PaginatedList::HasMany
local-class='table'
@isTable={{true}}
@model={{@institution}}
@usePlaceholders={{false}}
@relationshipName='userMetrics'
@bindReload={{this.reloadUserList}}
@query={{this.queryUsers}}
as |list|
>
<list.header local-class='header'>
{{#let (component 'sort-arrow'
class=(local-class 'sort-arrow')
sortAction=this.sortInstitutionalUsers
sort=this.sort
) as |SortArrow|}}
<tr>
{{#each this.columns as |column|}}
{{#if (includes column.key this.selectedColumns)}}
<th data-test-header='{{column.key}}'>
<div local-class='header-content'>
<span local-class='header-text'>{{column.label}}</span>
{{#if column.sort_key}}
<span local-class='sort-arrow-container'>
<SortArrow @sortBy='{{column.sort_key}}' />
</span>
{{/if}}
</div>
</th>
{{/if}}
{{/each}}
</tr>
{{/let}}
</list.header>
<list.item local-class='item' as |institutionalUser|>
{{#each this.columns as |column|}}
{{#if (includes column.key this.selectedColumns)}}
<td data-test-item={{column.key}}>
{{#if (eq column.type 'user_name')}}
<OsfLink @href={{concat '/' institutionalUser.userGuid '/'}}>
{{institutionalUser.userName}}
</OsfLink>
{{else if (eq column.type 'osf_link')}}
<OsfLink @href={{concat '/' institutionalUser.userGuid '/'}}>
{{institutionalUser.userGuid}}
</OsfLink>
{{else if (eq column.type 'date_by_month')}}
{{moment-format (get institutionalUser column.key) 'MM/YYYY'}}
{{else}}
{{get institutionalUser column.key}}
{{/if}}
</td>
{{/if}}
{{/each}}
</list.item>
<list.empty local-class='empty'>
{{t 'institutions.dashboard.users_list.empty'}}
</list.empty>
</PaginatedList::HasMany>
</div>
{{/if}}
1 change: 1 addition & 0 deletions app/institutions/dashboard/users/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<Institutions::Dashboard::-Components::InstitutionalUsersList
@institution={{this.model.institution}}
@departmentMetrics={{this.model.departmentMetrics}}
@totalUsers={{this.model.totalUsers}}
/>
</div>
</wrapper.main>
Expand Down
1 change: 1 addition & 0 deletions translations/en-us.yml
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,7 @@ institutions:
month_last_active: 'Last Action'
has_orcid: 'Has ORCID'
select_columns: 'Customize'
total_users: 'total users'
panel:
users: 'Total Users'
projects: 'OSF Public and Private Projects'
Expand Down
Loading