Skip to content

Commit

Permalink
feat(workflows): fix navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
cocotime committed Sep 27, 2023
1 parent 55679f5 commit bc5c400
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ export class ProjectFeatureNewWorkflowComponent {
public get getPreviousUrl(): string[] {
const previousUrl = this.routeHistoryService.getPreviousUrl();
const project = this.state.get('project');
console.log({ previousUrl });
return previousUrl
? [previousUrl]
: [`/project/${project.id}${project.slug}/overview`];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import {
} from '@angular/router';
import { RxState } from '@rx-angular/state';
import { CommonModule } from '@angular/common';
import { StoryDetail, StoryView, Project, Story } from '@taiga/data';
import { StoryDetail, StoryView, Project, Story, Workflow } from '@taiga/data';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';

interface ProjectFeatureViewSetterComponentState {
Expand Down Expand Up @@ -99,11 +99,6 @@ export class ProjectFeatureViewSetterComponent implements OnDestroy {
)
);

this.state.connect(
'isKanban',
this.state.select('url').pipe(map((url) => url.endsWith('/kanban')))
);

this.state.hold(
this.state.select('kanbanHost').pipe(distinctUntilChanged(), filterNil()),
(host) => {
Expand All @@ -128,7 +123,21 @@ export class ProjectFeatureViewSetterComponent implements OnDestroy {
])
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe(([url, data, params]) => {
if (!url.endsWith('/kanban') && !!data.stories) {
this.state.connect(
'isKanban',
this.state
.select('url')
.pipe(
map((url) =>
url.endsWith(`/kanban/${params.workflow as Workflow['slug']}`)
)
)
);

if (
!url.endsWith(`/kanban/${params.workflow as Workflow['slug']}`) &&
!!data.stories
) {
const storyParams = params as StoryParams;
const needRedirect = params.slug !== (data.project as Project).slug;
if (needRedirect) {
Expand Down

0 comments on commit bc5c400

Please sign in to comment.