Skip to content
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
4 changes: 1 addition & 3 deletions src/app/core/components/breadcrumb/breadcrumb.component.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
@use "styles/variables" as var;

.breadcrumbs {
color: var(--header-color, var.$dark-blue-1);
color: var(--header-color, var(--dark-blue-1));
font-weight: 600;
text-transform: capitalize;
background-color: var(--header-background-color);
Expand Down
5 changes: 2 additions & 3 deletions src/app/core/components/footer/footer.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</div>
</div>

<div class="footer-socials flex justify-content-center align-items-center" [class]="isWeb() ? 'my-3' : 'my-4'">
<div class="footer-socials flex justify-content-center align-items-center my-4">
@for (icon of socialIcons; track icon.name) {
<a
class="social-link flex align-items-center justify-content-center"
Expand All @@ -20,8 +20,7 @@
</div>

<div
class="footer-secondary-nav flex flex-column justify-content-center align-items-center md:flex-row md:justify-content-between"
[class.mt-4]="!isWeb()"
class="footer-secondary-nav flex flex-column justify-content-center align-items-center mt-4 md:flex-row md:justify-content-between xl:mt-0"
>
<div class="footer-links flex flex-wrap justify-content-center mt-1">
<a routerLink="/terms-of-use">{{ 'footer.links.termsOfUse' | translate }}</a>
Expand Down
8 changes: 1 addition & 7 deletions src/app/core/components/footer/footer.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,21 @@
import { TranslatePipe, TranslateService } from '@ngx-translate/core';
import { MockComponent, MockPipe, MockProvider } from 'ng-mocks';

import { BehaviorSubject } from 'rxjs';

import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ActivatedRoute } from '@angular/router';

import { IS_WEB } from '@osf/shared/helpers';
import { IconComponent } from '@shared/components';

import { FooterComponent } from './footer.component';

describe('FooterComponent', () => {
let component: FooterComponent;
let fixture: ComponentFixture<FooterComponent>;
let isWebSubject: BehaviorSubject<boolean>;

beforeEach(async () => {
isWebSubject = new BehaviorSubject<boolean>(true);

await TestBed.configureTestingModule({
imports: [FooterComponent, MockComponent(IconComponent), MockPipe(TranslatePipe)],
providers: [MockProvider(TranslateService), MockProvider(ActivatedRoute), MockProvider(IS_WEB, isWebSubject)],
providers: [MockProvider(TranslateService), MockProvider(ActivatedRoute)],
}).compileComponents();

fixture = TestBed.createComponent(FooterComponent);
Expand Down
6 changes: 1 addition & 5 deletions src/app/core/components/footer/footer.component.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { TranslatePipe } from '@ngx-translate/core';

import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
import { toSignal } from '@angular/core/rxjs-interop';
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { RouterLink } from '@angular/router';

import { SOCIAL_ICONS } from '@osf/core/constants';
import { IconComponent } from '@osf/shared/components';
import { IS_WEB } from '@osf/shared/helpers';

@Component({
selector: 'osf-footer',
Expand All @@ -16,7 +14,5 @@ import { IS_WEB } from '@osf/shared/helpers';
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class FooterComponent {
isWeb = toSignal(inject(IS_WEB));

readonly socialIcons = SOCIAL_ICONS;
}
27 changes: 6 additions & 21 deletions src/app/core/components/root/root.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import { BehaviorSubject } from 'rxjs';

import { ComponentFixture, TestBed } from '@angular/core/testing';

import { BreadcrumbComponent } from '@core/components/breadcrumb/breadcrumb.component';
import { FooterComponent } from '@core/components/footer/footer.component';
import { HeaderComponent } from '@core/components/header/header.component';
import { TopnavComponent } from '@core/components/topnav/topnav.component';
import { IS_WEB, IS_XSMALL } from '@osf/shared/helpers';
import { IS_WEB } from '@osf/shared/helpers';

import { BreadcrumbComponent } from '../breadcrumb/breadcrumb.component';
import { FooterComponent } from '../footer/footer.component';
import { HeaderComponent } from '../header/header.component';
import { OSFBannerComponent } from '../osf-banners/osf-banner.component';
import { SidenavComponent } from '../sidenav/sidenav.component';
import { TopnavComponent } from '../topnav/topnav.component';

import { RootComponent } from './root.component';

Expand All @@ -24,11 +24,9 @@ describe('Component: Root', () => {
let component: RootComponent;
let fixture: ComponentFixture<RootComponent>;
let isWebSubject: BehaviorSubject<boolean>;
let isMobileSubject: BehaviorSubject<boolean>;

beforeEach(async () => {
isWebSubject = new BehaviorSubject<boolean>(true);
isMobileSubject = new BehaviorSubject<boolean>(false);

await TestBed.configureTestingModule({
imports: [
Expand All @@ -44,11 +42,7 @@ describe('Component: Root', () => {
OSFBannerComponent
),
],
providers: [
MockProvider(IS_WEB, isWebSubject),
MockProvider(IS_XSMALL, isMobileSubject),
MockProvider(ConfirmationService),
],
providers: [MockProvider(IS_WEB, isWebSubject), MockProvider(ConfirmationService)],
}).compileComponents();

fixture = TestBed.createComponent(RootComponent);
Expand Down Expand Up @@ -82,15 +76,6 @@ describe('Component: Root', () => {
expect(tabletLayout).toBeTruthy();
});

it('should hide breadcrumb in tablet layout when mobile', () => {
isWebSubject.next(false);
isMobileSubject.next(true);
fixture.detectChanges();

const breadcrumb = fixture.nativeElement.querySelector('osf-breadcrumb');
expect(breadcrumb).toBeFalsy();
});

it('should contain confirm dialog component', () => {
const confirmDialog = fixture.nativeElement.querySelector('p-confirm-dialog');
expect(confirmDialog).toBeTruthy();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
@use "styles/variables" as var;
@use "styles/mixins" as mix;

:host {
width: 100%;
}

.kpi-container {
border: 1px solid var.$grey-2;
border-radius: 12px;
color: var.$dark-blue-1;
border: 1px solid var(--grey-2);
border-radius: 0.75rem;
color: var(--dark-blue-1);
width: 100%;
height: 100%;
min-height: 180px;

.value {
color: var.$blue-1;
font-size: 2.285rem;
color: var(--blue-1);
font-size: 2rem;
font-weight: 700;
margin: 1rem 0 1.7rem;
margin: 1rem 0 1.5rem;
}

.value-skeleton {
margin: 1rem 0 1.7rem;
margin: 1rem 0 1.5rem;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { ActivatedRoute, Router } from '@angular/router';
import { ProjectOverviewSelectors } from '@osf/features/project/overview/store';
import { RegistryOverviewSelectors } from '@osf/features/registry/store/registry-overview';
import { ResourceType } from '@osf/shared/enums';
import { IS_SMALL } from '@osf/shared/helpers';
import { DuplicatesSelectors } from '@osf/shared/stores';
import {
ContributorsListComponent,
Expand Down Expand Up @@ -74,7 +73,6 @@ describe('Component: View Duplicates', () => {
MockProvider(CustomDialogService, mockCustomDialogService),
MockProvider(Router, routerMock),
MockProvider(ActivatedRoute, activatedRouteMock),
{ provide: IS_SMALL, useValue: of(false) },
],
}).compileComponents();

Expand All @@ -88,31 +86,7 @@ describe('Component: View Duplicates', () => {
expect(component).toBeTruthy();
});

it('should open ForkDialog with width 95vw and refresh on success', () => {
const openSpy = jest
.spyOn(mockCustomDialogService, 'open')
.mockReturnValue({ onClose: of({ success: true }) } as any);
(component as any).actions = { ...component.actions, getDuplicates: jest.fn() };

component.handleForkResource();

expect(openSpy).toHaveBeenCalledWith(
expect.any(Function),
expect.objectContaining({
width: '95vw',
header: 'project.overview.dialog.fork.headerProject',
data: expect.objectContaining({
resource: expect.any(Object),
resourceType: ResourceType.Project,
}),
})
);

expect((component as any).actions.getDuplicates).toHaveBeenCalled();
});

it('should open ForkDialog with width 450px when small and not refresh on failure', () => {
(component as any).isSmall = () => true;
(component as any).actions = { ...component.actions, getDuplicates: jest.fn() };

const openSpy = jest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import {
TruncatedTextComponent,
} from '@osf/shared/components';
import { ResourceType, UserPermissions } from '@osf/shared/enums';
import { IS_SMALL } from '@osf/shared/helpers';
import { ToolbarResource } from '@osf/shared/models';
import { Duplicate } from '@osf/shared/models/duplicates';
import { CustomDialogService } from '@osf/shared/services';
Expand Down Expand Up @@ -83,7 +82,6 @@ export class ViewDuplicatesComponent {
readonly UserPermissions = UserPermissions;

currentPage = signal<string>('1');
isSmall = toSignal(inject(IS_SMALL));
firstIndex = computed(() => (parseInt(this.currentPage()) - 1) * this.pageSize);

readonly forkActionItems = (resourceId: string) => [
Expand Down Expand Up @@ -194,13 +192,12 @@ export class ViewDuplicatesComponent {

handleForkResource(): void {
const toolbarResource = this.toolbarResource();
const dialogWidth = !this.isSmall() ? '95vw' : '450px';

if (toolbarResource) {
this.customDialogService
.open(ForkDialogComponent, {
header: 'project.overview.dialog.fork.headerProject',
width: dialogWidth,
width: '450px',
data: {
resource: toolbarResource,
resourceType: this.resourceType(),
Expand Down Expand Up @@ -233,12 +230,10 @@ export class ViewDuplicatesComponent {
}

private handleDeleteFork(id: string): void {
const dialogWidth = !this.isSmall() ? '95vw' : '650px';

this.customDialogService
.open(DeleteComponentDialogComponent, {
header: 'project.overview.dialog.deleteComponent.header',
width: dialogWidth,
width: '650px',
data: {
componentId: id,
resourceType: this.resourceType(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
@use "styles/variables" as var;
@use "styles/mixins" as mix;

:host {
width: 100%;
flex: 1;

.card {
border: 1px solid var.$grey-2;
border: 1px solid var(--grey-2);
border-radius: mix.rem(8px);

.card-title {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</div>
} @else {
<div class="flex flex-column gap-2">
<h2 class="font-normal">{{ storageName }}</h2>
<h2 class="font-normal">{{ storageName | translate }}</h2>

<div class="files-table flex flex-column">
@if (previousFolder()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ export class MoveFileDialogComponent {
readonly isFilesUpdating = signal(false);
readonly rootFolders = select(FilesSelectors.getRootFolders);

readonly storageName =
this.config.data.storageName || this.translateService.instant('files.dialogs.moveFile.osfStorage');
readonly storageName = this.config.data.storageName || 'files.dialogs.moveFile.osfStorage';

readonly provider = select(FilesSelectors.getProvider);

Expand Down
10 changes: 3 additions & 7 deletions src/app/features/files/pages/files/files.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
signal,
viewChild,
} from '@angular/core';
import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';

Expand All @@ -57,7 +57,7 @@ import {
} from '@osf/features/files/store';
import { ALL_SORT_OPTIONS, FILE_SIZE_LIMIT } from '@osf/shared/constants';
import { FileMenuType, ResourceType, SupportedFeature, UserPermissions } from '@osf/shared/enums';
import { getViewOnlyParamFromUrl, hasViewOnlyParam, IS_MEDIUM } from '@osf/shared/helpers';
import { getViewOnlyParamFromUrl, hasViewOnlyParam } from '@osf/shared/helpers';
import { CurrentResourceSelectors, GetResourceDetails } from '@osf/shared/stores';
import {
FilesTreeComponent,
Expand Down Expand Up @@ -152,8 +152,6 @@ export class FilesComponent {
readonly isConfiguredStorageAddonsLoading = select(FilesSelectors.isConfiguredStorageAddonsLoading);
readonly supportedFeatures = select(FilesSelectors.getStorageSupportedFeatures);

isMedium = toSignal(inject(IS_MEDIUM));

readonly isGoogleDrive = signal<boolean>(false);
readonly accountId = signal<string>('');
readonly selectedRootFolder = signal<StorageItem>({});
Expand Down Expand Up @@ -478,11 +476,9 @@ export class FilesComponent {
}

showInfoDialog() {
const dialogWidth = this.isMedium() ? '850px' : '95vw';

this.customDialogService.open(FileBrowserInfoComponent, {
header: 'files.filesBrowserDialog.title',
width: dialogWidth,
width: '850px',
data: this.resourceType(),
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<section class="home-container flex-1 xl:mt-6" [class.medium]="isMedium()">
<section class="home-container flex-1 xl:mt-6">
@if (areProjectsLoading()) {
<osf-loading-spinner />
} @else {
Expand Down
9 changes: 2 additions & 7 deletions src/app/features/home/pages/dashboard/dashboard.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { TablePageEvent } from 'primeng/table';
import { debounceTime, distinctUntilChanged, filter, tap } from 'rxjs';

import { Component, computed, DestroyRef, effect, inject, OnInit, signal } from '@angular/core';
import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { FormControl } from '@angular/forms';
import { ActivatedRoute, Router, RouterLink } from '@angular/router';

Expand All @@ -23,7 +23,6 @@ import {
} from '@osf/shared/components';
import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants';
import { SortOrder } from '@osf/shared/enums';
import { IS_MEDIUM } from '@osf/shared/helpers';
import { MyResourcesItem, MyResourcesSearchFilters, TableParameters } from '@osf/shared/models';
import { CustomDialogService, ProjectRedirectDialogService } from '@osf/shared/services';
import { ClearMyResources, GetMyProjects, MyResourcesSelectors } from '@osf/shared/stores';
Expand All @@ -50,8 +49,6 @@ export class DashboardComponent implements OnInit {
private readonly customDialogService = inject(CustomDialogService);
private readonly projectRedirectDialogService = inject(ProjectRedirectDialogService);

readonly isMedium = toSignal(inject(IS_MEDIUM));

readonly searchControl = new FormControl<string>('');
readonly activeProject = signal<MyResourcesItem | null>(null);
readonly sortColumn = signal<string | undefined>(undefined);
Expand Down Expand Up @@ -188,10 +185,8 @@ export class DashboardComponent implements OnInit {
}

createProject(): void {
const dialogWidth = this.isMedium() ? '850px' : '95vw';

this.customDialogService
.open(CreateProjectDialogComponent, { header: 'myProjects.header.createProject', width: dialogWidth })
.open(CreateProjectDialogComponent, { header: 'myProjects.header.createProject', width: '850px' })
.onClose.pipe(
filter((result) => result?.project.id),
tap((result) => this.projectRedirectDialogService.showProjectRedirectDialog(result.project.id)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
filterBy="label"
[showClear]="true"
[loading]="fundersLoading()"
[emptyFilterMessage]="filterMessage()"
[emptyFilterMessage]="filterMessage() | translate"
[emptyMessage]="filterMessage()"
[autoOptionFocus]="false"
(onChange)="onFunderSelected($event.value, $index)"
Expand Down
Loading
Loading