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

Conditionally hide the "add project resource" button #523

Merged
merged 40 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
d7cf69d
Set `isReadOnly` conditions
jeffdaley Dec 20, 2023
d596652
Add isReadOnly conditions to project resources
jeffdaley Dec 20, 2023
c9cca1d
Merge branch 'jeffdaley/disable-inputs' into jeffdaley/project-resources
jeffdaley Dec 20, 2023
3d08399
Add tests
jeffdaley Dec 20, 2023
6c431d8
Conditionally disable plus button
jeffdaley Dec 20, 2023
7af1775
Merge branch 'main' into jeffdaley/project-resources-button
jeffdaley Dec 20, 2023
f19ae6f
Merge branch 'main' into jeffdaley/project-resources-button
jeffdaley Dec 21, 2023
43d1a31
Update project-test.ts
jeffdaley Dec 21, 2023
9293f04
Add read-only styles to Jira
jeffdaley Dec 21, 2023
a02e0a0
Start of animations
jeffdaley Dec 21, 2023
d0a52e3
Merge branch 'jeffdaley/jira-read-only' into jeffdaley/project-resour…
jeffdaley Dec 21, 2023
7734c69
Animation styles
jeffdaley Dec 21, 2023
54b2d39
Merge branch 'main' into jeffdaley/project-resources-button
jeffdaley Dec 21, 2023
44d9923
Animation progress
jeffdaley Dec 22, 2023
89d067a
Improved animation logic
jeffdaley Dec 22, 2023
1a1aa6d
Start of improved PlusButton
jeffdaley Dec 22, 2023
3a1e10d
Smoother transition
jeffdaley Dec 22, 2023
0fdc015
More smoothness
jeffdaley Dec 22, 2023
656678f
Update index.ts
jeffdaley Dec 22, 2023
ebf5706
Update index.hbs
jeffdaley Dec 22, 2023
d29ce95
Update index.hbs
jeffdaley Dec 22, 2023
eb08a6a
Update project-test.ts
jeffdaley Dec 22, 2023
ac7cf18
Update index.hbs
jeffdaley Jan 2, 2024
7c40102
Design tweaks
jeffdaley Jan 3, 2024
9d41632
Better saving/saved states
jeffdaley Jan 3, 2024
a5844bf
Remove saved message
jeffdaley Jan 3, 2024
c3c7424
Add counts back
jeffdaley Jan 3, 2024
b3a73d0
Cleanup
jeffdaley Jan 3, 2024
b016950
Reduce diff
jeffdaley Jan 3, 2024
c094109
Update index.ts
jeffdaley Jan 3, 2024
3f2b036
Animated transform
jeffdaley Jan 4, 2024
b982c3b
Cleanup
jeffdaley Jan 4, 2024
97bd3a1
Rename some variables
jeffdaley Jan 4, 2024
98ae964
Move hide-dropdown handling to LinkTo
jeffdaley Jan 4, 2024
f6986e6
Fix action, improve docs
jeffdaley Jan 4, 2024
2e43bf1
Merge branch 'jeffdaley/x-dropdown-links' into jeffdaley/project-reso…
jeffdaley Jan 4, 2024
4e95fc9
Post-merge fix
jeffdaley Jan 4, 2024
9aa6b39
Merge branch 'main' into jeffdaley/project-resources-button
jeffdaley Jan 12, 2024
55cc953
Fix merge errors
jeffdaley Jan 12, 2024
71b0b1d
Merge branch 'main' into jeffdaley/project-resources-button
jeffdaley Jan 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions web/app/components/doc/tile-medium.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
@route="authenticated.documents"
@query={{hash owners=(array (get @doc.owners 0))}}
disabled={{not (get @doc.owners 0)}}
class="underlined-link"
class="underline-on-hover"
>
{{or (get @doc.owners 0) "Unknown"}}
</LinkTo>
Expand All @@ -78,7 +78,7 @@
<ProductLink
@product={{@doc.product}}
tabindex="-1"
class="underlined-link"
class="underline-on-hover"
>
<:default>
{{@doc.product}}
Expand All @@ -88,7 +88,7 @@
|
</span>
{{! Created time }}
<span class="text-color-foreground-disabled">
<span>
{{time-ago @doc.createdTime}}
</span>
</div>
Expand Down
2 changes: 1 addition & 1 deletion web/app/components/header/nav.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<LinkTo
data-test-nav-link="projects"
@route="authenticated.projects"
@current-when="authenticated.projects"
@current-when="authenticated.projects.index"
@query={{this.defaultProjectsScreenQueryParams}}
>
Projects
Expand Down
280 changes: 150 additions & 130 deletions web/app/components/project/index.hbs
Original file line number Diff line number Diff line change
@@ -1,144 +1,160 @@
<div class="project-header mt-1 flex w-full justify-between">
<div class="relative">

<div class="flex h-9 items-center gap-1">
<div class="flex w-9 justify-center">
{{! Placeholder until we have ProductAvatars }}
<FlightIcon @name="grid" @size="24" />
<div class="project-header mt-1 flex w-full">
<div class="flex h-9 w-full justify-between">
<div class="flex items-center gap-1.5 text-color-foreground-faint">
<LinkTo
@route="authenticated.projects"
@query={{hash status="active"}}
{{tooltip "View all projects"}}
class="flex rounded-button-md p-1 hover:bg-color-surface-interactive-hover focus:bg-color-surface-interactive-hover"
>
<FlightIcon @name="grid" />
</LinkTo>
<h5 class="hermes-h4 mr-1.5">Project</h5>
</div>
<div class="flex items-center gap-2">
<span class="font-bold">Status:</span>
<X::DropdownList
@items={{this.statuses}}
@placement="bottom-end"
@selected={{this.status}}
@onItemClick={{this.changeStatus}}
class="theme--neutral"
>
<:anchor as |dd|>
<dd.ToggleAction
data-test-project-status-toggle
class="hds-button hds-button--size-medium hds-button--color-secondary pill-button border-color-border-strong"
@hasChevron={{true}}
>
<Project::StatusIcon @status={{dd.selected}} />
<span class="ml-1 mr-0.5">
{{this.statusLabel}}
</span>
</dd.ToggleAction>
</:anchor>
<:item as |dd|>
<dd.Action data-test-status-action={{dd.value}}>
<X::DropdownList::CheckableItem
@isSelected={{dd.isSelected}}
@checkmarkPosition="trailing"
>
<:default>
<div class="flex items-center gap-2 pl-1.5">
<Project::StatusIcon @status={{dd.value}} />
<span>
{{dd.attrs.label}}
</span>
</div>
</:default>
</X::DropdownList::CheckableItem>
</dd.Action>
</:item>
</X::DropdownList>
<CopyURLButton
@isIconOnly={{true}}
@url={{this.url}}
class="hds-button hds-button--color-secondary pill-button h-9 w-9 justify-center border-color-border-strong p-0"
/>
</div>
</div>
</div>

<div class="flex h-9 gap-1.5">
<div class="flex gap-2.5">
<AnimatedContainer @motion={{this.motion}}>
<div class="pb-6">
<div class="relative z-20 max-w-3xl pb-5">
<AnimatedContainer @motion={{this.motion}}>

<span class="self-center text-color-foreground-faint">
Status:
</span>
{{! Title }}
<div class="mt-7 flex">
<EditableField
class="project-title text-display-600"
data-test-project-title
@value={{this.title}}
@tag="h1"
@placeholder="Add project title"
@buttonSize="medium"
@onSave={{this.saveTitle}}
@isReadOnly={{not this.projectIsActive}}
@isRequired={{true}}
@isSaving={{this.titleIsSaving}}
/>
</div>

<X::DropdownList
@items={{this.statuses}}
@placement="bottom"
@selected={{this.status}}
class="theme--neutral"
>
<:anchor as |dd|>
<dd.ToggleAction
data-test-project-status-toggle
class="hds-button hds-button--size-medium hds-button--color-secondary pill-button border-color-border-strong"
@hasChevron={{true}}
>
<Project::StatusIcon @status={{dd.selected}} />
<span class="ml-1 mr-0.5">
{{this.statusLabel}}
</span>
</dd.ToggleAction>
</:anchor>
<:item as |dd|>
<dd.Action
data-test-status-action={{dd.value}}
{{on "click" (fn this.changeStatus dd.value)}}
>
<X::DropdownList::CheckableItem
@isSelected={{dd.isSelected}}
@checkmarkPosition="trailing"
class=""
>
<:default>
<div class="flex items-center gap-2 pl-1.5">
<Project::StatusIcon @status={{dd.value}} />
<span>
{{dd.attrs.label}}
</span>
</div>
</:default>
</X::DropdownList::CheckableItem>
</dd.Action>
</:item>
</X::DropdownList>
</div>
{{#animated-if
(or this.description this.projectIsActive)
rules=this.descriptionTransitionRules
}}
{{! Description }}
<div class="flex">
<EditableField
class="project-description"
data-test-project-description
@value="{{this.description}}"
@onSave={{this.saveDescription}}
@isReadOnly={{not this.projectIsActive}}
@isSaving={{this.descriptionIsSaving}}
@placeholder="Add a description"
@buttonSize="medium"
/>
</div>
{{/animated-if}}
</AnimatedContainer>

<CopyURLButton
@isIconOnly={{true}}
@url={{this.url}}
class="hds-button hds-button--color-secondary pill-button w-9 justify-center border-color-border-strong p-0"
/>
</div>

</div>
</div>
<div class="relative z-20 max-w-3xl pb-5">
{{#if this.jiraIsEnabled}}
<AnimatedContainer
@motion={{this.motion}}
{{did-insert this.maybeLoadJiraInfo}}
>
{{! Jira }}
{{#animated-if this.jiraWidgetIsShown rules=this.jiraTransitionRules}}
<div class="mt-5 w-full">
<Project::JiraWidget
@issue={{this.jiraIssue}}
@onIssueRemove={{this.removeJiraIssue}}
@onIssueSelect={{this.addJiraIssue}}
@isLoading={{this.loadJiraIssue.isRunning}}
@isReadOnly={{not this.projectIsActive}}
/>
</div>
{{/animated-if}}
</AnimatedContainer>
{{/if}}

{{! Plus button }}
<RelatedResources
@modalHeaderTitle="Add project resource"
@modalInputPlaceholder="Search docs or paste a URL..."
@addResource={{this.addResource}}
>
<:header as |rr|>
{{#animated-if
this.projectIsActive
rules=this.plusButtonTransitionRules
initialInsertion=true
finalRemoval=true
}}
<Action
data-test-add-project-resource-button
{{on "click" rr.showModal}}
class="hds-button hds-button--color-primary add-project-resource-button pill-button pointer-events-auto absolute right-14 -bottom-10 z-10 grid h-20 w-20 place-items-center"
>
<FlightIcon @name="plus" @size="24" class="relative h-9 w-9" />
</Action>
{{/animated-if}}
</:header>
</RelatedResources>

{{! Title }}
<div class="mt-7 flex">
<EditableField
class="project-title text-display-600"
data-test-project-title
@value={{this.title}}
@tag="h1"
@placeholder="Add project title"
@buttonSize="medium"
@onSave={{this.saveTitle}}
@isReadOnly={{not this.projectIsActive}}
@isRequired={{true}}
@isSaving={{this.titleIsSaving}}
/>
</div>
{{#if (or this.projectIsActive this.description)}}
{{! Description }}
<div class="flex">
<EditableField
class="project-description"
data-test-project-description
@value="{{this.description}}"
@onSave={{this.saveDescription}}
@isReadOnly={{not this.projectIsActive}}
@isSaving={{this.descriptionIsSaving}}
@placeholder="Add a description"
@buttonSize="medium"
/>
</div>
{{/if}}
</AnimatedContainer>
</div>

{{#if this.jiraIsEnabled}}
<div {{did-insert this.maybeLoadJiraInfo}}>
{{#if this.jiraWidgetIsShown}}
{{! Jira }}
<div class="mt-5 flex w-full max-w-3xl">
<Project::JiraWidget
@issue={{this.jiraIssue}}
@onIssueRemove={{this.removeJiraIssue}}
@onIssueSelect={{this.addJiraIssue}}
@isLoading={{this.loadJiraIssue.isRunning}}
@isReadOnly={{not this.projectIsActive}}
/>
</div>
{{/if}}
</div>
{{/if}}

<div class="relative mt-6 border-t border-t-color-border-primary">

{{! Plus button }}
<RelatedResources
@items={{this.relatedResources}}
@modalHeaderTitle="Add project resource"
@modalInputPlaceholder="Search docs or paste a URL..."
@addResource={{this.addResource}}
>
<:header as |rr|>
<div class="sticky top-24 -mb-20 pr-14">
<div class="pointer-events-none -translate-y-1/2">
<Action
data-test-add-project-resource-button
{{on "click" rr.showModal}}
class="hds-button hds-button--color-primary add-project-resource-button pill-button pointer-events-auto ml-auto grid h-20 w-20 place-items-center"
>
<FlightIcon @name="plus" @size="24" class="h-9 w-9" />
</Action>
</div>
</div>
</:header>
</RelatedResources>

<div
class="relative border-t border-t-color-border-primary bg-color-page-primary"
>
{{! Resources }}
<div class="max-w-3xl">
{{#if (or this.hermesDocuments.length this.externalLinks.length)}}
Expand Down Expand Up @@ -167,7 +183,10 @@
)
}}
>
<Doc::TileMedium @doc={{document}} />
<Doc::TileMedium
@doc={{document}}
@avatarIsLoading={{this.getOwnerPhoto.isRunning}}
/>
</Project::Resource>
</li>
{{/each}}
Expand Down Expand Up @@ -236,6 +255,7 @@
data-test-empty-body
class="mt-7 flex h-48 flex-col items-start justify-center"
>
{{! TODO: this doesn't make sense for completed/archived projects }}
<div class="text-display-300 font-bold text-color-foreground-strong">
Nothing here yet
</div>
Expand Down
Loading