Skip to content

Commit ce4a51e

Browse files
committed
feat(contributors): updated routes
1 parent 5b9c9e9 commit ce4a51e

File tree

15 files changed

+128
-141
lines changed

15 files changed

+128
-141
lines changed

src/app/app.routes.ts

Lines changed: 36 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import { provideStates } from '@ngxs/store';
22

33
import { Routes } from '@angular/router';
44

5-
import { RegistryOverviewState } from '@osf/features/registry/store/registry-overview';
6-
75
import { MyProfileResourceFiltersOptionsState } from './features/my-profile/components/filters/store';
86
import { MyProfileResourceFiltersState } from './features/my-profile/components/my-profile-resource-filters/store';
97
import { MyProfileState } from './features/my-profile/store';
@@ -22,78 +20,52 @@ export const routes: Routes = [
2220
redirectTo: 'home',
2321
},
2422
{
25-
path: 'sign-up',
26-
loadComponent: () =>
27-
import('./features/auth/pages/sign-up/sign-up.component').then((mod) => mod.SignUpComponent),
28-
data: { skipBreadcrumbs: true },
29-
},
30-
{
31-
path: 'forgot-password',
32-
loadComponent: () =>
33-
import('./features/auth/pages/forgot-password/forgot-password.component').then(
34-
(mod) => mod.ForgotPasswordComponent
35-
),
23+
path: 'home',
24+
loadComponent: () => import('./features/home/home.component').then((mod) => mod.HomeComponent),
3625
data: { skipBreadcrumbs: true },
3726
},
3827
{
39-
path: 'reset-password',
28+
path: 'home-logged-out',
4029
loadComponent: () =>
41-
import('./features/auth/pages/reset-password/reset-password.component').then(
42-
(mod) => mod.ResetPasswordComponent
30+
import('@osf/features/home/pages/home-logged-out/home-logged-out.component').then(
31+
(mod) => mod.HomeLoggedOutComponent
4332
),
4433
data: { skipBreadcrumbs: true },
4534
},
4635
{
47-
path: 'home',
36+
path: 'confirm/:userId/:token',
4837
loadComponent: () => import('./features/home/home.component').then((mod) => mod.HomeComponent),
4938
data: { skipBreadcrumbs: true },
5039
},
5140
{
52-
path: 'home-logged-out',
41+
path: 'sign-up',
5342
loadComponent: () =>
54-
import('@osf/features/home/pages/home-logged-out/home-logged-out.component').then(
55-
(mod) => mod.HomeLoggedOutComponent
56-
),
43+
import('./features/auth/pages/sign-up/sign-up.component').then((mod) => mod.SignUpComponent),
5744
data: { skipBreadcrumbs: true },
5845
},
5946
{
60-
path: 'support',
61-
loadComponent: () => import('./features/support/support.component').then((mod) => mod.SupportComponent),
62-
},
63-
{
64-
path: 'terms-of-use',
47+
path: 'forgot-password',
6548
loadComponent: () =>
66-
import('./features/static/terms-of-use/terms-of-use.component').then((mod) => mod.TermsOfUseComponent),
49+
import('./features/auth/pages/forgot-password/forgot-password.component').then(
50+
(mod) => mod.ForgotPasswordComponent
51+
),
52+
data: { skipBreadcrumbs: true },
6753
},
6854
{
69-
path: 'privacy-policy',
55+
path: 'reset-password',
7056
loadComponent: () =>
71-
import('./features/static/privacy-policy/privacy-policy.component').then((mod) => mod.PrivacyPolicyComponent),
57+
import('./features/auth/pages/reset-password/reset-password.component').then(
58+
(mod) => mod.ResetPasswordComponent
59+
),
60+
data: { skipBreadcrumbs: true },
7261
},
7362
{
7463
path: 'collections',
7564
loadChildren: () => import('./features/collections/collections.routes').then((mod) => mod.collectionsRoutes),
7665
},
7766
{
7867
path: 'meetings',
79-
loadComponent: () => import('./features/meetings/meetings.component').then((mod) => mod.MeetingsComponent),
80-
children: [
81-
{
82-
path: '',
83-
pathMatch: 'full',
84-
loadComponent: () =>
85-
import('@osf/features/meetings/pages/meetings-landing/meetings-landing.component').then(
86-
(mod) => mod.MeetingsLandingComponent
87-
),
88-
},
89-
{
90-
path: ':id',
91-
loadComponent: () =>
92-
import('@osf/features/meetings/pages/meeting-details/meeting-details.component').then(
93-
(mod) => mod.MeetingDetailsComponent
94-
),
95-
},
96-
],
68+
loadChildren: () => import('./features/meetings/meetings.routes').then((mod) => mod.meetingsRoutes),
9769
},
9870
{
9971
path: 'my-projects',
@@ -104,11 +76,6 @@ export const routes: Routes = [
10476
path: 'my-projects/:id',
10577
loadChildren: () => import('./features/project/project.routes').then((mod) => mod.projectRoutes),
10678
},
107-
{
108-
path: 'registries',
109-
loadChildren: () => import('./features/registries/registries.routes').then((mod) => mod.registriesRoutes),
110-
},
111-
11279
{
11380
path: 'settings',
11481
loadChildren: () => import('./features/settings/settings.routes').then((mod) => mod.settingsRoutes),
@@ -134,9 +101,22 @@ export const routes: Routes = [
134101
loadChildren: () => import('./features/institutions/institutions.routes').then((r) => r.routes),
135102
},
136103
{
137-
path: 'confirm/:userId/:token',
138-
loadComponent: () => import('./features/home/home.component').then((mod) => mod.HomeComponent),
139-
data: { skipBreadcrumbs: true },
104+
path: 'registries',
105+
loadChildren: () => import('./features/registries/registries.routes').then((mod) => mod.registriesRoutes),
106+
},
107+
{
108+
path: 'registries/:id',
109+
loadChildren: () => import('./features/registry/registry.routes').then((mod) => mod.registryRoutes),
110+
},
111+
{
112+
path: 'terms-of-use',
113+
loadComponent: () =>
114+
import('./features/static/terms-of-use/terms-of-use.component').then((mod) => mod.TermsOfUseComponent),
115+
},
116+
{
117+
path: 'privacy-policy',
118+
loadComponent: () =>
119+
import('./features/static/privacy-policy/privacy-policy.component').then((mod) => mod.PrivacyPolicyComponent),
140120
},
141121
{
142122
path: 'forbidden',
@@ -145,20 +125,11 @@ export const routes: Routes = [
145125
data: { skipBreadcrumbs: true },
146126
},
147127
{
148-
path: 'request-access/:projectId',
128+
path: 'request-access/:id',
149129
loadComponent: () =>
150130
import('./core/components/request-access/request-access.component').then((mod) => mod.RequestAccessComponent),
151131
data: { skipBreadcrumbs: true },
152132
},
153-
{
154-
path: 'registries',
155-
loadChildren: () => import('./features/registries/registries.routes').then((mod) => mod.registriesRoutes),
156-
},
157-
{
158-
path: 'registries/my-registrations/:registrationId',
159-
loadChildren: () => import('./features/registry/registry.routes').then((mod) => mod.registryRoutes),
160-
providers: [provideStates([RegistryOverviewState])],
161-
},
162133
{
163134
path: '**',
164135
loadComponent: () =>

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@
2424
}
2525
</a>
2626

27-
@if (item.label === 'navigation.myProjects' && isProjectRoute()) {
27+
@if (item.label === 'navigation.myProjects' && !isRegistryRoute() && isProjectRoute()) {
2828
<div class="ml-4">
2929
<p-panelMenu [model]="myProjectMenuItems" [multiple]="false">
3030
<ng-template #item let-item>
3131
<a
32-
[routerLink]="item.routerLink ? ['/my-projects', currentProjectId(), item.routerLink] : null"
32+
[routerLink]="item.routerLink ? ['/my-projects', currentResourceId(), item.routerLink] : null"
3333
[routerLinkActive]="item.routerLink ? 'active' : ''"
3434
[routerLinkActiveOptions]="{ exact: true }"
3535
class="nav-link flex align-items-center"
@@ -56,7 +56,7 @@
5656
<p-panelMenu [model]="registrationMenuItems" [multiple]="false" class="border-none">
5757
<ng-template #item let-item>
5858
<a
59-
[routerLink]="item.routerLink ? ['/my-projects', currentProjectId(), item.routerLink] : null"
59+
[routerLink]="item.routerLink ? ['/registries', currentResourceId(), item.routerLink] : null"
6060
[routerLinkActive]="item.routerLink ? 'active' : ''"
6161
[routerLinkActiveOptions]="{ exact: true }"
6262
class="nav-link flex align-items-center"

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ export class NavMenuComponent {
3838
}
3939
);
4040

41-
protected readonly currentProjectId = computed(() => this.currentRoute().projectId);
42-
protected readonly isProjectRoute = computed(() => !!this.currentProjectId());
41+
protected readonly currentResourceId = computed(() => this.currentRoute().resourceId);
42+
protected readonly isProjectRoute = computed(() => !!this.currentResourceId());
4343
protected readonly isCollectionsRoute = computed(() => this.currentRoute().isCollectionsWithId);
4444
protected readonly isRegistryRoute = computed(() => this.currentRoute().isRegistryRoute);
4545

@@ -71,15 +71,14 @@ export class NavMenuComponent {
7171
const url = this.router.url;
7272
const urlSegments = url.split('/').filter((segment) => segment);
7373

74-
const projectId = this.route.firstChild?.snapshot.params['id'] || null;
74+
const resourceId = this.route.firstChild?.snapshot.params['id'] || null;
7575
const section = this.route.firstChild?.firstChild?.snapshot.url[0]?.path || 'overview';
7676

7777
const isCollectionsWithId = urlSegments[0] === 'collections' && urlSegments[1] && urlSegments[1] !== '';
78-
const isRegistryRoute =
79-
urlSegments[0] === 'registries' && urlSegments[1] === 'my-registrations' && !!urlSegments[2];
78+
const isRegistryRoute = urlSegments[0] === 'registries' && !!urlSegments[2];
8079

8180
return {
82-
projectId,
81+
resourceId,
8382
section,
8483
isCollectionsWithId,
8584
isRegistryRoute,

src/app/core/components/request-access/request-access.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class RequestAccessComponent {
2727
comment = model('');
2828

2929
private readonly route = inject(ActivatedRoute);
30-
private readonly projectId = toSignal(this.route?.params.pipe(map((params) => params['projectId'])) ?? of(undefined));
30+
private readonly id = toSignal(this.route?.params.pipe(map((params) => params['id'])) ?? of(undefined));
3131

3232
private readonly requestAccessService = inject(RequestAccessService);
3333
private readonly router = inject(Router);
@@ -36,7 +36,7 @@ export class RequestAccessComponent {
3636

3737
requestAccess() {
3838
this.loaderService.show();
39-
this.requestAccessService.requestAccessToProject(this.projectId(), this.comment()).subscribe({
39+
this.requestAccessService.requestAccessToProject(this.id(), this.comment()).subscribe({
4040
next: () => {
4141
this.loaderService.hide();
4242
this.router.navigate(['/']);

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

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,6 @@ export const NAV_ITEMS: NavItem[] = [
1515
icon: 'search',
1616
useExactMatch: true,
1717
},
18-
// [NS] TODO: Hidden until development
19-
// {
20-
// path: '/support',
21-
// label: 'navigation.support',
22-
// icon: 'support',
23-
// useExactMatch: true,
24-
// },
2518
{
2619
path: '/my-projects',
2720
label: 'navigation.myProjects',
@@ -83,7 +76,6 @@ export const NAV_ITEMS: NavItem[] = [
8376
icon: 'institutions',
8477
useExactMatch: true,
8578
},
86-
8779
{
8880
path: '/collections',
8981
label: 'navigation.collections',
@@ -135,14 +127,6 @@ export const NAV_ITEMS: NavItem[] = [
135127
},
136128
],
137129
},
138-
139-
//[NS] TODO: Hidden until development
140-
// {
141-
// path: '/donate',
142-
// label: 'navigation.donate',
143-
// icon: 'donate',
144-
// useExactMatch: true,
145-
// },
146130
];
147131

148132
export const PROJECT_MENU_ITEMS: MenuItem[] = [
@@ -188,6 +172,7 @@ export const REGISTRATION_MENU_ITEMS: MenuItem[] = [
188172
{ label: 'navigation.registration.resources', routerLink: 'resources' },
189173
{ label: 'navigation.registration.wiki', routerLink: 'wiki' },
190174
{ label: 'navigation.registration.components', routerLink: 'components' },
175+
{ label: 'navigation.registration.contributors', routerLink: 'contributors' },
191176
{ label: 'navigation.registration.links', routerLink: 'links' },
192177
{ label: 'navigation.registration.analytics', routerLink: 'analytics' },
193178
],
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { Routes } from '@angular/router';
2+
3+
import { MeetingsComponent } from './meetings.component';
4+
5+
export const meetingsRoutes: Routes = [
6+
{
7+
path: '',
8+
component: MeetingsComponent,
9+
children: [
10+
{
11+
path: '',
12+
pathMatch: 'full',
13+
loadComponent: () =>
14+
import('@osf/features/meetings/pages/meetings-landing/meetings-landing.component').then(
15+
(mod) => mod.MeetingsLandingComponent
16+
),
17+
},
18+
{
19+
path: ':id',
20+
loadComponent: () =>
21+
import('@osf/features/meetings/pages/meeting-details/meeting-details.component').then(
22+
(mod) => mod.MeetingDetailsComponent
23+
),
24+
},
25+
],
26+
},
27+
];

src/app/features/registries/registries.routes.ts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@ import { Routes } from '@angular/router';
44

55
import { RegistriesComponent } from '@osf/features/registries/registries.component';
66
import { RegistriesState } from '@osf/features/registries/store';
7-
import { ResourceType } from '@osf/shared/enums';
87
import { ContributorsState, SubjectsState } from '@osf/shared/stores';
98
import { SUBJECTS_SERVICE } from '@osf/shared/tokens';
109

1110
import { ModerationState } from '../moderation/store';
12-
import { AnalyticsState } from '../project/analytics/store';
1311

1412
import { LicensesHandlers, ProjectsHandlers, ProvidersHandlers, SubjectsHandlers } from './store/handlers';
1513
import { LicensesService, RegistrationSubjectsService } from './services';
@@ -76,25 +74,6 @@ export const registriesRoutes: Routes = [
7674
},
7775
],
7876
},
79-
{
80-
path: ':id',
81-
children: [
82-
{
83-
path: 'contributors',
84-
loadComponent: () =>
85-
import('../project/contributors/contributors.component').then((mod) => mod.ContributorsComponent),
86-
data: { resourceType: ResourceType.Registration },
87-
providers: [provideStates([ContributorsState])],
88-
},
89-
{
90-
path: 'analytics',
91-
loadComponent: () =>
92-
import('../project/analytics/analytics.component').then((mod) => mod.AnalyticsComponent),
93-
data: { resourceType: ResourceType.Registration },
94-
providers: [provideStates([AnalyticsState])],
95-
},
96-
],
97-
},
9877
],
9978
},
10079
];

src/app/features/registry/pages/registry-overview/registry-overview.component.ts

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,25 @@ import { ActivatedRoute, Router, RouterLink } from '@angular/router';
77

88
import { GetBookmarksCollectionId } from '@osf/features/collections/store';
99
import { OverviewToolbarComponent } from '@osf/features/project/overview/components';
10-
import { RegistryRevisionsComponent, RegistryStatusesComponent } from '@osf/features/registry/components';
11-
import { MapViewSchemaBlock } from '@osf/features/registry/mappers';
12-
import { RegistrationQuestions } from '@osf/features/registry/models';
13-
import {
14-
GetRegistryById,
15-
GetRegistryInstitutions,
16-
GetRegistrySubjects,
17-
RegistryOverviewSelectors,
18-
} from '@osf/features/registry/store/registry-overview';
1910
import {
2011
DataResourcesComponent,
2112
LoadingSpinnerComponent,
2213
ResourceMetadataComponent,
2314
SubHeaderComponent,
24-
} from '@shared/components';
25-
import { ResourceType } from '@shared/enums';
26-
import { MapRegistryOverview } from '@shared/mappers';
27-
import { ToolbarResource } from '@shared/models';
15+
} from '@osf/shared/components';
16+
import { ResourceType } from '@osf/shared/enums';
17+
import { MapRegistryOverview } from '@osf/shared/mappers';
18+
import { ToolbarResource } from '@osf/shared/models';
19+
20+
import { RegistryRevisionsComponent, RegistryStatusesComponent } from '../../components';
21+
import { MapViewSchemaBlock } from '../../mappers';
22+
import { RegistrationQuestions } from '../../models';
23+
import {
24+
GetRegistryById,
25+
GetRegistryInstitutions,
26+
GetRegistrySubjects,
27+
RegistryOverviewSelectors,
28+
} from '../../store/registry-overview';
2829

2930
@Component({
3031
selector: 'osf-registry-overview',
@@ -107,7 +108,7 @@ export class RegistryOverviewComponent {
107108

108109
constructor() {
109110
this.route.parent?.params.subscribe((params) => {
110-
const id = params['registrationId'];
111+
const id = params['id'];
111112
if (id) {
112113
this.actions.getRegistryById(id);
113114
this.actions.getSubjects(id);

0 commit comments

Comments
 (0)