Skip to content

Commit

Permalink
feat(workflows): ui review
Browse files Browse the repository at this point in the history
  • Loading branch information
Xaviju committed Sep 29, 2023
1 parent ee5255d commit 143386e
Show file tree
Hide file tree
Showing 9 changed files with 99 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@
<tg-ui-breadcrumb
*ngIf="workflows.length > 1"
[hideLastCrumb]="editStatusFormOpened"
[crumbs]="[t('commons.kanban'), t('kanban.workflows'), workflow.name]"
[crumbs]="[
t('commons.kanban'),
t('kanban.workflows').charAt(0).toLocaleUpperCase() +
t('kanban.workflows').slice(1),
workflow.name
]"
[accent]="true">
</tg-ui-breadcrumb>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,5 @@ Copyright (c) 2023-present Kaleidos INC
}

tg-kanban-header {
margin-block-end: var(--spacing-20);
min-block-size: var(--spacing-40);
}
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ ul {
margin-block: 0;
margin-inline-end: var(--spacing-8);
margin-inline-start: var(--spacing-16);
padding-block: var(--spacing-4);
padding-inline-start: var(--spacing-8);
}

Expand All @@ -201,8 +200,9 @@ ul {
@mixin ellipsis;

block-size: var(--spacing-28);
display: inline-block;
display: flex;
inline-size: 100%;
padding-block: 0;

&:hover {
background: var(--color-gray90);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
[@mainNavContainer]="menuState"
class="main-nav-container-inner">
<!-- visibility: hidden prevent focus in the project menu when the setting menu is visible -->

<tg-project-navigation-menu
[collapsed]="collapsed"
[class.collapsed]="collapsed"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,20 @@ import {
transition,
trigger,
} from '@angular/animations';
import { CommonModule } from '@angular/common';
import {
AfterViewInit,
ChangeDetectionStrategy,
Component,
DestroyRef,
ElementRef,
HostBinding,
HostListener,
inject,
Input,
OnInit,
DestroyRef,
} from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import {
ActivatedRoute,
ActivatedRouteSnapshot,
Expand All @@ -37,10 +39,8 @@ import { RxState } from '@rx-angular/state';
import { Project } from '@taiga/data';
import { Subject } from 'rxjs';
import { LocalStorageService } from '~/app/shared/local-storage/local-storage.service';
import { ProjectNavigationSettingsComponent } from './components/project-navigation-settings/project-navigation-settings.component';
import { CommonModule } from '@angular/common';
import { ProjectNavigationMenuComponent } from './components/project-navigation-menu/project-navigation-menu.component';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { ProjectNavigationSettingsComponent } from './components/project-navigation-settings/project-navigation-settings.component';

const collapseMenuAnimation = '200ms ease-out';
const openMenuAnimation = '200ms ease-in';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { Actions, ofType } from '@ngrx/effects';
import { Store } from '@ngrx/store';
import { RxState } from '@rx-angular/state';
import { Project, Workflow } from '@taiga/data';
import { TuiNotification } from '@taiga-ui/core';
import { Membership, Project, Workflow } from '@taiga/data';
import { AppService } from '~/app/services/app.service';
import { WsService } from '~/app/services/ws';
import { RouteHistoryService } from '~/app/shared/route-history/route-history.service';
import { filterNil } from '~/app/shared/utils/operators';
import {
Expand All @@ -39,7 +42,9 @@ export class ProjectFeatureNewWorkflowComponent {
private store: Store,
private router: Router,
private actions$: Actions,
private routeHistoryService: RouteHistoryService
private routeHistoryService: RouteHistoryService,
private wsService: WsService,
private appService: AppService
) {
this.state.connect(
'project',
Expand All @@ -50,6 +55,8 @@ export class ProjectFeatureNewWorkflowComponent {
.subscribe(() => {
this.cancelCreateWorkflow();
});

this.events();
}

public createWorkflow(workflow: Workflow['name']) {
Expand All @@ -71,4 +78,32 @@ export class ProjectFeatureNewWorkflowComponent {
? [previousUrl]
: [`/project/${project.id}${project.slug}/overview`];
}

public events() {
this.wsService
.userEvents<{ membership: Membership }>('projectmemberships.update')
.pipe(untilDestroyed(this))
.subscribe((eventResponse) => {
const response = eventResponse.event.content;
if (!response.membership.role.isAdmin) {
this.userLoseAdminRole();
}
});
}

public userLoseAdminRole() {
this.appService.toastNotification({
message: 'errors.admin_permission',
paramsMessage: {
project: this.state.get('project').name,
},
status: TuiNotification.Warning,
closeOnNavigation: false,
});
void this.router.navigate([
`/project/${this.state.get('project').id}/${
this.state.get('project').slug
}/overview`,
]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,63 +21,15 @@ const routes: Routes = [
project: ProjectFeatureShellResolverService,
},
children: [
{
path: '',
loadChildren: () =>
import(
'~/app/modules/project/feature-overview/project-feature-overview.module'
).then((m) => m.ProjectFeatureOverviewModule),
},
{
path: 'overview',
loadChildren: () =>
import(
'~/app/modules/project/feature-overview/project-feature-overview.module'
).then((m) => m.ProjectFeatureOverviewModule),
data: {
overview: true,
},
},
{
path: ':slug/overview',
loadChildren: () =>
import(
'~/app/modules/project/feature-overview/project-feature-overview.module'
).then((m) => m.ProjectFeatureOverviewModule),
data: {
overview: true,
},
},
{
path: 'kanban',
loadChildren: () =>
import(
'~/app/modules/project/feature-view-setter/project-feature-view-setter.module'
).then((m) => m.ProjectFeatureViewSetterModule),
canDeactivate: [CanDeactivateGuard],
},
{
path: ':slug',
loadChildren: () =>
import(
'~/app/modules/project/feature-overview/project-feature-overview.module'
).then((m) => m.ProjectFeatureOverviewModule),
},
{
path: ':slug/kanban',
redirectTo: ':slug/kanban/main',
pathMatch: 'full',
},
{
path: ':slug/new-workflow',
loadChildren: () =>
import(
'~/app/modules/project/feature-new-workflow/project-feature-new-workflow.module'
).then((m) => m.ProjectFeatureNewWorkflowModule),
canDeactivate: [CanDeactivateGuard],
data: {
newKanban: true,
},
path: 'kanban',
redirectTo: '/kanban/main',
pathMatch: 'full',
},
{
path: ':slug/kanban/:workflow',
Expand All @@ -88,22 +40,21 @@ const routes: Routes = [
canDeactivate: [CanDeactivateGuard],
data: {
kanban: true,
reuseComponent: false,
},
},
{
path: 'stories/:storyRef',
path: ':slug/stories/:storyRef',
loadChildren: () =>
import(
'~/app/modules/project/feature-view-setter/project-feature-view-setter.module'
).then((m) => m.ProjectFeatureViewSetterModule),
canDeactivate: [CanDeactivateGuard],
data: {
kanban: true,
stories: true,
},
},
{
path: ':slug/stories/:storyRef',
path: 'stories/:storyRef',
loadChildren: () =>
import(
'~/app/modules/project/feature-view-setter/project-feature-view-setter.module'
Expand All @@ -114,7 +65,7 @@ const routes: Routes = [
},
},
{
path: 'settings',
path: ':slug/settings',
loadChildren: () =>
import(
'~/app/modules/project/settings/feature-settings/feature-settings.module'
Expand All @@ -127,7 +78,7 @@ const routes: Routes = [
},
},
{
path: ':slug/settings',
path: 'settings',
loadChildren: () =>
import(
'~/app/modules/project/settings/feature-settings/feature-settings.module'
Expand All @@ -139,6 +90,39 @@ const routes: Routes = [
project: ProjectAdminResolver,
},
},
{
path: 'overview',
loadChildren: () =>
import(
'~/app/modules/project/feature-overview/project-feature-overview.module'
).then((m) => m.ProjectFeatureOverviewModule),
data: {
overview: true,
},
},
{
path: ':slug/overview',
loadChildren: () =>
import(
'~/app/modules/project/feature-overview/project-feature-overview.module'
).then((m) => m.ProjectFeatureOverviewModule),
data: {
overview: true,
},
},
{
path: ':slug/new-workflow',
loadChildren: () =>
import(
'~/app/modules/project/feature-new-workflow/project-feature-new-workflow.module'
).then((m) => m.ProjectFeatureNewWorkflowModule),
resolve: {
project: ProjectAdminResolver,
},
data: {
newKanban: true,
},
},
],
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ Copyright (c) 2023-present Kaleidos INC
}

.crumb {
padding: var(--spacing4);
padding: var(--spacing-4);
}

.crumb-divider {
block-size: var(--spacing-8);
inline-size: var(--spacing-8);
}

.accent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@
[class.accent]="isLast && accent">
{{ crumb }}
</span>
<span
<tui-svg
class="crumb-divider"
*ngIf="!(hideLastCrumb && i === crumbs.length - 2) && !isLast">
&gt;
</span>
*ngIf="!(hideLastCrumb && i === crumbs.length - 2) && !isLast"
src="chevron-right"></tui-svg>
</ng-container>
</ng-container>
<ng-container *ngIf="type === 'collapsed'">
Expand Down

0 comments on commit 143386e

Please sign in to comment.