Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Projects in the sidebar #414

Merged
merged 172 commits into from
Dec 19, 2023
Merged

Projects in the sidebar #414

merged 172 commits into from
Dec 19, 2023

Conversation

jeffdaley
Copy link
Contributor

@jeffdaley jeffdaley commented Nov 8, 2023

Adds a Projects section to the document sidebar along with "add document to project" functionality.

@@ -11,15 +11,15 @@

{{#unless @isCollapsed}}
<div
class="sidebar-body scrollable-container"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused class

@jeffdaley jeffdaley marked this pull request as ready for review December 18, 2023 18:48
@jeffdaley jeffdaley requested a review from a team as a code owner December 18, 2023 18:48
@jeffdaley jeffdaley changed the title WIP: Projects in the sidebar P\rojects in the sidebar Dec 18, 2023
@jeffdaley jeffdaley changed the title P\rojects in the sidebar Projects in the sidebar Dec 18, 2023
@jeffdaley jeffdaley marked this pull request as draft December 18, 2023 22:02
@jeffdaley jeffdaley marked this pull request as ready for review December 18, 2023 23:00
Copy link
Collaborator

@jfreda jfreda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple questions, but nothing blocking!

Comment on lines +510 to +526
/**
* The action to show the Projects modal.
* Triggered by clicking the "+" button in the Projects section.
*/
@action protected showProjectsModal() {
this.projectsModalIsShown = true;
}

/**
* The action to hide the Projects modal.
* Passed to the Projects modal component and
* triggered on modal close.
*/
@action protected hideProjectsModal() {
this.projectsModalIsShown = false;
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: maybe could simplify to a toggleProjectsModall() that does this.projectsModalIsShown = !this.projectsModalIsShown?

Copy link
Contributor Author

@jeffdaley jeffdaley Dec 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I usually reserve the toggle construction for actual toggles, e.g., "Show more/Show fewer" or check/uncheck controls. Here, because the show and hide actions are separate, I like the clarity of being specific:
Using <button {{on "click" this.showProjectsModal}}> and <Hds::Modal @onClose={{this.hideProjectsModal}}> feels more precise to me than if we were to pass toggleProjectsModal to both.

Also, it's not the case here, but show/hide actions often have specific setup or teardown, so I might also be in the habit of separating them from the jump.

@@ -107,6 +122,31 @@ export default class NewProjectFormComponent extends Component<NewProjectFormCom
}),
})
.then((response) => response?.json());

/**
* Create the project with a minimum duration.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 fast 2 furious

* Will exist if the issue is a full Jira issue.
* Determines if the type is shown in the widget.
*/
protected get issueType() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious why we need these getters and can't just do conditionals in the template based on if the issue's properties are undefined or not?

Copy link
Contributor Author

@jeffdaley jeffdaley Dec 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason Glint has trouble when using union types like this

{{! this.issue: PickedJiraIssue | JiraIssue }}

{{#if this.issue.issueType}}
   {{!-- if this passes, it means this.issue is type: JiraIssue --}}
   {{!-- however Glint thinks it still might be a PickedJiraIssue --}}
   
   {{this.issue.issueType}}
   {{!-- this gets underlined by Glint --}}
{{/if}}

But the getter works.

@jeffdaley jeffdaley merged commit 198482c into main Dec 19, 2023
2 checks passed
@jeffdaley jeffdaley deleted the jeffdaley/projects-in-sidebar branch December 19, 2023 22:22
@jeffdaley jeffdaley mentioned this pull request Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants