Skip to content

Commit 92e02c1

Browse files
committed
Merge remote-tracking branch 'origin/main' into feat/left-menu-updates
2 parents 2fcc86f + aae524d commit 92e02c1

File tree

35 files changed

+722
-5585
lines changed

35 files changed

+722
-5585
lines changed

.github/scripts/check-coverage-thresholds.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ for (const key of ['branches', 'functions', 'lines', 'statements']) {
1414
if (current > threshold) {
1515
errors.push(
1616
`Coverage for ${key} (${current}%) is above the threshold (${threshold}%).\n\tPlease update the coverageThreshold.global.${key} in the jest.config.js to ${current}!`
17-
)
17+
);
1818
failed = true;
1919
}
2020
}
@@ -26,6 +26,6 @@ if (failed) {
2626
console.log('Please update the coverage thresholds in jest.config.js.');
2727
console.log('You will need to commit again once you have updated the jst.config.js file.');
2828
console.log('This is only necessary until we hit 100% coverage.\n\n');
29-
errors.forEach(err => console.error(`${err}\n`));
29+
errors.forEach((err) => console.error(`${err}\n`));
3030
process.exit(1);
31-
}
31+
}

jest.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ module.exports = {
5353
'<rootDir>/src/app/features/project/',
5454
'<rootDir>/src/app/features/registries/',
5555
'<rootDir>/src/app/features/settings/addons/',
56-
'<rootDir>/src/app/features/settings/developer-apps/',
5756
'<rootDir>/src/app/features/settings/notifications/',
5857
'<rootDir>/src/app/features/settings/settings-container.component.ts',
5958
'<rootDir>/src/app/features/settings/tokens/components/',

package-lock.json

Lines changed: 368 additions & 5454 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/app.routes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export const routes: Routes = [
4343
},
4444
{
4545
path: 'register',
46+
canActivate: [redirectIfLoggedInGuard],
4647
loadComponent: () =>
4748
import('./features/auth/pages/sign-up/sign-up.component').then((mod) => mod.SignUpComponent),
4849
data: { skipBreadcrumbs: true },

src/app/core/components/header/header.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export class HeaderComponent {
4242
command: () => {
4343
this.loaderService.show();
4444
this.actions.logout();
45-
this.router.navigate(['/home']).then(() => window.location.reload());
45+
this.router.navigate(['/']).then(() => window.location.reload());
4646
},
4747
},
4848
];

src/app/core/components/nav-menu/nav-menu.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
<span>{{ item.label | translate }}</span>
1616

17-
@if (item.items) {
17+
@if (hasVisibleChildren | wrapFn: item) {
1818
<osf-icon
1919
class="ml-auto pt-1"
2020
[iconClass]="item.expanded ? `fas fa-chevron-down fa-sm` : `fas fa-chevron-right fa-sm`"

src/app/core/components/nav-menu/nav-menu.component.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@ import { RouteContext } from '@osf/core/models';
1717
import { ProviderSelectors } from '@osf/core/store/provider';
1818
import { AuthSelectors } from '@osf/features/auth/store';
1919
import { IconComponent } from '@osf/shared/components';
20+
import { WrapFnPipe } from '@osf/shared/pipes';
2021

2122
@Component({
2223
selector: 'osf-nav-menu',
23-
imports: [RouterLinkActive, RouterLink, PanelMenuModule, TranslatePipe, IconComponent],
24+
imports: [RouterLinkActive, RouterLink, PanelMenuModule, TranslatePipe, IconComponent, WrapFnPipe],
2425
templateUrl: './nav-menu.component.html',
2526
styleUrl: './nav-menu.component.scss',
2627
})
@@ -92,4 +93,7 @@ export class NavMenuComponent {
9293
this.closeMenu.emit();
9394
}
9495
}
96+
97+
protected readonly hasVisibleChildren = (item: MenuItem): boolean =>
98+
Array.isArray(item.items) && item.items.some((child) => !!child.visible);
9599
}

src/app/core/constants/nav-items.constant.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ export const MENU_ITEMS: MenuItem[] = [
303303
items: [
304304
{
305305
id: 'collections-moderation',
306-
routerLink: '/collections/ibdgc/moderation',
306+
routerLink: 'moderation',
307307
label: 'navigation.moderation',
308308
visible: false,
309309
routerLinkActiveOptions: { exact: true },

src/app/core/helpers/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ export * from './http.helper';
22
export * from './i18n.helper';
33
export * from './nav-menu.helper';
44
export * from './types.helper';
5+
export * from './url-param.helper';

src/app/core/helpers/nav-menu.helper.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,15 @@ export function filterMenuItems(items: MenuItem[], isAuthenticated: boolean): Me
1212
return items.map((item) => {
1313
const isAuthenticatedItem = AUTHENTICATED_MENU_ITEMS.includes(item.id || '');
1414

15-
const updatedItem = { ...item, visible: isAuthenticatedItem ? isAuthenticated : item.visible };
15+
let updatedItem: MenuItem = { ...item, visible: isAuthenticatedItem ? isAuthenticated : item.visible };
16+
17+
if (item.id === 'home') {
18+
updatedItem = {
19+
...updatedItem,
20+
routerLink: isAuthenticated ? '/dashboard' : '/',
21+
routerLinkActiveOptions: isAuthenticated ? { exact: false } : { exact: true },
22+
};
23+
}
1624

1725
if (item.items) {
1826
updatedItem.items = filterMenuItems(item.items, isAuthenticated);

0 commit comments

Comments
 (0)