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

WIP: Product Area screen #276

Closed
wants to merge 66 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
3909f6d
Product area template prototype
jeffdaley Jul 28, 2023
bd5e9f4
Merge branch 'main' into jeffdaley/products-route
jeffdaley Aug 9, 2023
9622a1e
Merge branch 'main' into jeffdaley/products-route
jeffdaley Aug 10, 2023
8602498
Merge branch 'main' into jeffdaley/products-route
jeffdaley Aug 10, 2023
37afc22
Merge branch 'main' into jeffdaley/products-route
jeffdaley Aug 17, 2023
cbe7389
ProductAvatar
jeffdaley Sep 27, 2023
9ad5125
Convert ProductBadgeLink to `gts`
jeffdaley Sep 27, 2023
2995aad
Merge branch 'main' into jeffdaley/product-avatar
jeffdaley Sep 29, 2023
476ef18
Merge branch 'main' into jeffdaley/project-badge-link
jeffdaley Oct 5, 2023
63987dd
Merge branch 'main' into jeffdaley/product-avatar
jeffdaley Oct 5, 2023
1b06441
LetterCount and ProductAbbreviations
jeffdaley Oct 5, 2023
2e94850
Merge branch 'jeffdaley/project-badge-link' into jeffdaley/product-av…
jeffdaley Oct 5, 2023
a534cee
Default size
jeffdaley Oct 6, 2023
78536fe
Merge branch 'main' into jeffdaley/product-avatar
jeffdaley Oct 6, 2023
4e570fa
Improve fallback styling
jeffdaley Oct 6, 2023
2b18780
Hide avatar in row
jeffdaley Oct 6, 2023
e00676b
Update "New" button
jeffdaley Oct 6, 2023
3835b10
Thumbnail cleanup
jeffdaley Oct 9, 2023
fd1123b
Add ToggleSelect component
jeffdaley Oct 9, 2023
0ccfd1c
Remove unused change
jeffdaley Oct 9, 2023
b10492d
Update tests and test selectors
jeffdaley Oct 9, 2023
176d5f4
Update test, increase dropdown height
jeffdaley Oct 9, 2023
1b107fa
Remove comment
jeffdaley Oct 9, 2023
7f4facc
Merge branch 'jeffdaley/toggle-select' into jeffdaley/product-avatar
jeffdaley Oct 9, 2023
3f596c3
Tweak offset
jeffdaley Oct 9, 2023
82c511b
Improved class tagging and styles
jeffdaley Oct 9, 2023
38692fb
Improved DocForm
jeffdaley Oct 9, 2023
7e44e8c
ProductSelect states and styles
jeffdaley Oct 9, 2023
9c1e615
Remove unused components
jeffdaley Oct 10, 2023
7d75b84
Merge branch 'jeffdaley/new-button' into jeffdaley/product-avatar
jeffdaley Oct 10, 2023
39bebd8
Tweak padding
jeffdaley Oct 10, 2023
7cb1684
Realign form
jeffdaley Oct 10, 2023
af43ea1
Revise table and search results
jeffdaley Oct 10, 2023
7ed84ce
Tweak results, rename table component
jeffdaley Oct 10, 2023
4043070
More test updates
jeffdaley Oct 10, 2023
7ef2588
Move `getAbbreviation` to service
jeffdaley Oct 10, 2023
eb86c7a
Merge branch 'main' into jeffdaley/product-avatar
jeffdaley Oct 10, 2023
138a69d
Fix merge diffs
jeffdaley Oct 10, 2023
628d10f
Choose a template updates
jeffdaley Oct 11, 2023
0353361
Spacing tweaks
jeffdaley Oct 11, 2023
607801c
Update and test doc template screen
jeffdaley Oct 11, 2023
5405049
Add helper test
jeffdaley Oct 11, 2023
fd218b5
Merge branch 'jeffdaley/update-template-screen' into jeffdaley/produc…
jeffdaley Oct 11, 2023
972557e
Fix `link` arg bug
jeffdaley Oct 11, 2023
f20f9b4
WIP rounded avatars
jeffdaley Oct 13, 2023
3c24cb2
Merge branch 'main' into jeffdaley/product-avatar
jeffdaley Oct 13, 2023
26806be
Clean up avatar API
jeffdaley Oct 16, 2023
610a807
Add avatar to Subscriptions screen
jeffdaley Oct 16, 2023
f4720bf
Update subscription-list-item.hbs
jeffdaley Oct 16, 2023
4114a9c
Add random colors
jeffdaley Oct 16, 2023
ea305d6
Update document-template-list.hbs
jeffdaley Oct 16, 2023
b05fa03
Tweak avatar size
jeffdaley Oct 19, 2023
87cf404
Merge branch 'main' into jeffdaley/products-route
jeffdaley Oct 20, 2023
94736f2
Post-merge layout fixes
jeffdaley Oct 20, 2023
ee350c3
Merge branch 'main' into jeffdaley/product-avatar
jeffdaley Oct 20, 2023
b5f87ec
Merge branch 'jeffdaley/product-avatar' into jeffdaley/products-route
jeffdaley Oct 20, 2023
e38d0e7
Post-merge style tweaks
jeffdaley Oct 20, 2023
442c416
Switch from `isLarge` to `size`
jeffdaley Oct 20, 2023
5d529a0
Merge branch 'jeffdaley/thumbnail' into jeffdaley/products-route
jeffdaley Oct 20, 2023
89abd8a
Medium-sized docThumbnail with obsolete styles
jeffdaley Oct 20, 2023
5071235
Style tweaks
jeffdaley Oct 20, 2023
70a85c6
Merge branch 'main' into jeffdaley/products-route
jeffdaley Oct 20, 2023
2163122
Fix merge errors
jeffdaley Oct 20, 2023
02656ef
Clean up header markup
jeffdaley Oct 21, 2023
790c951
Improve styles under weird conditions
jeffdaley Oct 23, 2023
a3b781d
Rearrange type
jeffdaley Oct 23, 2023
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
3 changes: 1 addition & 2 deletions web/app/components/dashboard/docs-awaiting-review.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
<Hds::BadgeCount
data-test-docs-awaiting-review-count
@text="{{@docs.length}}"
@type="inverted"
class="mx-0.5 !bg-color-foreground-critical md:mx-1.5"
class="mx-0.5 md:mx-1.5"
/>
document{{if (gt @docs.length 1) "s"}}
awaiting your review:
Expand Down
29 changes: 15 additions & 14 deletions web/app/components/dashboard/docs-awaiting-review/doc.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@
>
<div class="w-full">
<div
class="relative flex w-full flex-wrap items-center gap-2.5 md:flex-nowrap"
class="relative flex w-full flex-wrap items-center gap-3.5 md:flex-nowrap"
>

{{! Avatar }}
<Person::Avatar
data-test-doc-awaiting-review-owner-avatar
@email={{or (get @doc.owners 0) "Unknown"}}
@imgURL={{get @doc.ownerPhotos 0}}
@size="medium"
class="shrink-0"
/>
<div class="relative flex items-center gap-0.5">
{{! Avatars }}
<Product::Avatar @product={{@doc.product}} @size="medium" />
<Person::Avatar
data-test-doc-awaiting-review-owner-avatar
@email={{or (get @doc.owners 0) "Unknown"}}
@imgURL={{get @doc.ownerPhotos 0}}
@size="medium"
/>
</div>

<div class="block w-full overflow-hidden">

Expand Down Expand Up @@ -54,10 +55,10 @@
<div
class="absolute top-[3px] left-9 flex shrink-0 items-center space-x-1 md:relative md:top-0 md:left-0"
>
<Hds::Badge
data-test-doc-awaiting-review-product-badge
@icon={{or (get-product-id @doc.product) "folder"}}
@text={{or @doc.product "Unknown"}}
<Doc::State
data-test-doc-awaiting-review-status
@state={{lowercase @doc.status}}
@hideProgress={{true}}
/>
<Hds::Badge
data-test-doc-awaiting-review-doctype-badge
Expand Down
12 changes: 6 additions & 6 deletions web/app/components/doc/folder-affordance.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@
data-test-doc-thumbnail-folder-affordance
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox={{if this.sizeIsLarge "0 0 97 145" "0 0 43 63"}}
viewBox={{if this.sizeIsSmall "0 0 43 63" "0 0 97 145"}}
class="folder-affordance"
>
<path
fill="url(#doc-thumbnail-folder-gradient)"
stroke="currentColor"
fill-rule="evenodd"
d={{if
this.sizeIsLarge
"M6 0a6 6 0 0 0-6 6v41.04a6 6 0 0 0 2.659 4.983l8.29 5.558v80.729a6 6 0 0 0 6 6H97V0H6Z"
this.sizeIsSmall
"M3 0a3 3 0 0 0-3 3v18.407a3 3 0 0 0 .91 2.152l2.18 2.117v33.746a3 3 0 0 0 3 3H43V0H3Z"
"M6 0a6 6 0 0 0-6 6v41.04a6 6 0 0 0 2.659 4.983l8.29 5.558v80.729a6 6 0 0 0 6 6H97V0H6Z"
}}
clip-rule="evenodd"
></path>
<defs>
<linearGradient
id="doc-thumbnail-folder-gradient"
x1={{if this.sizeIsLarge "8.176" "4.746"}}
x2={{if this.sizeIsLarge "8.176" "4.746"}}
x1={{if this.sizeIsSmall "4.746" "8.176"}}
x2={{if this.sizeIsSmall "4.746" "8.176"}}
y1="0"
y2={{if this.sizeIsLarge "43.965" "19.018"}}
y2={{if this.sizeIsSmall "19.018" "43.965"}}
gradientUnits="userSpaceOnUse"
>
<stop stop-color="var(--token-color-palette-neutral-50)"></stop>
Expand Down
11 changes: 10 additions & 1 deletion web/app/components/doc/folder-affordance.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
import Component from "@glimmer/component";
import { DocThumbnailSize } from "hermes/components/doc/thumbnail";

interface DocFolderAffordanceSignature {
Args: {
size?: "large";
size?: `${DocThumbnailSize}`;
};
}

export default class DocFolderAffordance extends Component<DocFolderAffordanceSignature> {
protected get sizeIsSmall(): boolean {
return this.args.size === "small" || !this.args.size;
}

protected get sizeIsMedium(): boolean {
return this.args.size === "medium";
}

protected get sizeIsLarge(): boolean {
return this.args.size === "large";
}
Expand Down
75 changes: 56 additions & 19 deletions web/app/components/doc/row.hbs
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
<Hds::Table::Tr class="row-results__table__row">
<Hds::Table::Td class="name">
<tr class="group">
<td class="name">
<LinkTo
@route="authenticated.document"
@model="{{@docID}}"
@query={{hash draft=@isDraft}}
class="flex items-start space-x-4"
class="flex items-start gap-3.5"
>
<Doc::Thumbnail @status={{@status}} @product={{@productArea}} />
<div>
{{!
We create a click area that extends beyond the edges of its container.
This makes the entire row clickable without having to wrap itself in a link,
and lets us nest interactive elements (e.g., ProductBadgeLink) in a way that improves the mouse experience without sacrificing accessibility.
}}
<div
aria-hidden="true"
class="absolute top-0 -left-4 -right-4 -bottom-px -z-10 rounded-md group-hover:bg-color-surface-faint"
></div>

<Product::Avatar
@product={{@productArea}}
@fallbackIcon="file-text"
@size="small"
/>
<div class="relative">
<h4
class="hds-typography-body-200 hds-font-weight-semibold hds-foreground-strong"
>{{@title}}</h4>
Expand All @@ -18,17 +32,40 @@
{{/if}}
</div>
</LinkTo>
</Hds::Table::Td>
<Hds::Table::Td class="type">
{{@docType}}
</Hds::Table::Td>
<Hds::Table::Td class="status">
<Doc::State @state={{@status}} @hideProgress={{true}} /></Hds::Table::Td>
<Hds::Table::Td class="product">
<ProductBadgeLink @productArea={{@productArea}} />
</Hds::Table::Td>
<Hds::Table::Td class="owner">
<Person @ignoreUnknown={{true}} @imgURL={{@avatar}} @email={{@owner}} />
</Hds::Table::Td>
<Hds::Table::Td class="created">{{@createdDate}}</Hds::Table::Td>
</Hds::Table::Tr>
</td>
<td class="type">
<LinkTo
@route={{this.currentRoute}}
@query={{hash docType=(array @docType)}}
class="relative"
>
{{@docType}}
</LinkTo>
</td>
<td class="status">
<LinkTo
@route={{this.currentRoute}}
@query={{hash status=(array @status)}}
class="relative"
>
<Doc::State @state={{@status}} @hideProgress={{true}} />
</LinkTo>
</td>
<td class="product">
<Product::Link @avatarIsHidden={{true}} @product={{@productArea}} />
</td>
<td class="owner">
<LinkTo
@route={{this.currentRoute}}
@query={{hash owners=(array @owner)}}
class="relative"
>
<Person @ignoreUnknown={{true}} @imgURL={{@avatar}} @email={{@owner}} />
</LinkTo>
</td>
<td class="created">
<div class="relative">
{{@createdDate}}
</div>
</td>
</tr>
10 changes: 9 additions & 1 deletion web/app/components/doc/row.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import RouterService from "@ember/routing/router-service";
import { inject as service } from "@ember/service";
import Component from "@glimmer/component";

interface DocRowComponentSignature {
Expand All @@ -17,7 +19,13 @@ interface DocRowComponentSignature {
};
}

export default class DocRowComponent extends Component<DocRowComponentSignature> {}
export default class DocRowComponent extends Component<DocRowComponentSignature> {
@service declare router: RouterService;

protected get currentRoute() {
return this.router.currentRouteName;
}
}

declare module "@glint/environment-ember-loose/registry" {
export default interface Registry {
Expand Down
3 changes: 2 additions & 1 deletion web/app/components/doc/state.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{#unless @hideProgress}}
<ol
class="doc-state doc-state--{{this.dasherizedName}}
grid grid-cols-3 w-full items-center list-none gap-0.5"
grid w-full list-none grid-cols-3 items-center gap-0.5"
>
<li class="progress-bar"></li>
<li class="progress-bar"></li>
Expand All @@ -13,4 +13,5 @@
@text={{this.state.label}}
@color={{this.state.color}}
class="whitespace-nowrap"
...attributes
/>
1 change: 1 addition & 0 deletions web/app/components/doc/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { dasherize } from "@ember/string";
import Component from "@glimmer/component";

interface DocStateComponentSignature {
Element: HTMLDivElement;
Args: {
state?: string;
hideProgress?: boolean;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<div class="row-results">
{{#if @docs}}
<Hds::Table @isStriped={{false}} class="row-results__table">
<:head as |H|>
<H.Tr>
<H.Th class="name">Name</H.Th>
<H.Th class="type">Type</H.Th>
<H.Th class="status">Status</H.Th>
<H.Th class="product">Product/Area</H.Th>
<H.Th class="owner">Owner</H.Th>
<H.Th class="created">
<table class="hds-table">
<thead>
<tr>
<th class="name">Name</th>
<th class="type">Type</th>
<th class="status">Status</th>
<th class="product">Product/Area</th>
<th class="owner">Owner</th>
<th class="created">
<Table::SortableHeader
@changeSort={{@changeSort}}
@currentSort={{@currentSort}}
Expand All @@ -22,10 +22,10 @@
>
Created
</Table::SortableHeader>
</H.Th>
</H.Tr>
</:head>
<:body>
</th>
</tr>
</thead>
<tbody>
{{#each @docs as |doc|}}
<Doc::Row
@avatar="{{get doc.ownerPhotos 0}}"
Expand All @@ -40,8 +40,9 @@
@isDraft={{@isDraft}}
/>
{{/each}}
</:body>
</Hds::Table>
</tbody>
</table>

{{#if this.paginationIsShown}}
<Pagination @nbPages={{@nbPages}} @currentPage={{@currentPage}} />
{{/if}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Component from "@glimmer/component";
import { HermesDocument } from "hermes/types/document";
import { SortAttribute, SortDirection } from "./table/sortable-header";
import { SortAttribute, SortDirection } from "../table/sortable-header";

interface RowResultsComponentSignature {
interface DocTableComponentSignature {
Args: {
docs: HermesDocument[];
isDraft?: boolean;
Expand All @@ -13,14 +13,14 @@ interface RowResultsComponentSignature {
sortDirection: SortDirection;
};
}
export default class RowResultsComponent extends Component<RowResultsComponentSignature> {
export default class DocTableComponent extends Component<DocTableComponentSignature> {
protected get paginationIsShown() {
return this.args.nbPages && this.args.currentPage !== undefined;
}
}

declare module "@glint/environment-ember-loose/registry" {
export default interface Registry {
RowResults: typeof RowResultsComponent;
"Doc::Table": typeof DocTableComponent;
}
}
15 changes: 9 additions & 6 deletions web/app/components/doc/thumbnail.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
data-test-doc-thumbnail
class="doc-thumbnail
{{if this.sizeIsLarge 'large'}}
{{if this.sizeIsMedium 'medium'}}
{{if this.isObsolete 'obsolete'}}
rounded bg-color-palette-neutral-100"
...attributes
Expand All @@ -24,12 +25,14 @@
</div>
{{/if}}

{{#if this.productShortName}}
<div
data-test-doc-thumbnail-product-badge
class="product-badge {{this.productShortName}}"
>
<FlightIcon @size="16" @name={{this.productShortName}} />
{{#if this.badgeIsShown}}
<div class="absolute left-0 bottom-0">
<Product::Avatar
data-test-doc-thumbnail-product-badge
@product={{@product}}
@size={{this.productAvatarSize}}
@isGrayedOut={{this.isObsolete}}
/>
</div>
{{/if}}
</div>
Expand Down
Loading