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

latest working component <NotificationTray /> #22

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
Binary file added .DS_Store
Binary file not shown.
18 changes: 14 additions & 4 deletions addon/components/layout/header.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<LinkToExternal @route="console" class="logo navbar-logo mr-4">
<LogoIcon @brand={{@brand}} @size="8" />
</LinkToExternal>
{{#unless (media 'isMobile')}}
{{#unless (media "isMobile")}}
<div role="menu" class="next-catalog-menu-items flex mr-4">
{{#each @menuItems as |menuItem|}}
<LinkToExternal @route={{menuItem.route}} class="next-view-header-item {{menuItem.class}}" role="menuitem">
<LinkToExternal @route={{menuItem.route}} class="next-view-header-item truncate {{menuItem.class}}" role="menuitem">
<div class="w-6">
<FaIcon @icon={{menuItem.icon}} @size="sm" />
</div>
Expand All @@ -15,7 +15,7 @@
</div>
</LinkToExternal>
{{/each}}
<LinkToExternal @route="console.extensions" class="next-view-header-item" role="menuitem">
<LinkToExternal @route="console.extensions" class="next-view-header-item truncate" role="menuitem">
<div class="w-6">
<FaIcon @icon="shapes" @size="sm" />
</div>
Expand All @@ -33,6 +33,9 @@
<Layout::Header::LoadingIndicator />
<div id="view-header-actions"></div>
<div class="flex items-center justify-between">
<div class="flex-1 flex items-center pr-1">
<NotificationTray @registerAPI={{@registerNotificationTrayApi}} @onClickNotification={{@onClickNotification}} />
</div>
<div class="flex-1 flex items-center pr-1">
<Layout::Header::Dropdown @items={{this.organizationNavigationItems}} @onAction={{@onAction}} class="flex-shrink-0" @triggerClass="flex-shrink-0" as |dd|>
<div class="next-org-button-trigger flex-shrink-0 {{if dd.isOpen 'is-open'}}">
Expand All @@ -46,7 +49,14 @@
<div class="flex-1 flex items-center justify-end">
<Layout::Header::Dropdown @items={{this.userNavigationItems}} @onAction={{@onAction}} class="flex-shrink-0" @triggerClass="flex-shrink-0" as |dd|>
<div class="next-user-button-trigger flex-shrink-0 {{if dd.isOpen 'is-open'}}">
<Image class="rounded-full h-5 w-5 shadow-sm flex-shrink-0" height="20" width="20" src={{@user.avatar_url}} @fallbackSrc="https://s3.ap-southeast-1.amazonaws.com/flb-assets/static/no-avatar.png" alt={{@user.name}} />
<Image
class="rounded-full h-5 w-5 shadow-sm flex-shrink-0"
height="20"
width="20"
src={{@user.avatar_url}}
@fallbackSrc="https://s3.ap-southeast-1.amazonaws.com/flb-assets/static/no-avatar.png"
alt={{@user.name}}
/>
</div>
</Layout::Header::Dropdown>
</div>
Expand Down
63 changes: 58 additions & 5 deletions addon/components/model-select.hbs
Original file line number Diff line number Diff line change
@@ -1,9 +1,62 @@
<div class="fleetbase-model-select fleetbase-power-select ember-model-select">
<PowerSelect @afterOptionsComponent={{@afterOptionsComponent}} @allowClear={{@allowClear}} @animationEnabled={{@animationEnabled}} @ariaDescribedBy={{@ariaDescribedBy}} @ariaInvalid={{@ariaInvalid}} @ariaLabel={{@ariaLabel}} @ariaLabelledBy={{@ariaLabelledBy}} @beforeOptionsComponent={{@beforeOptionsComponent}} @buildSelection={{@buildSelection}} @calculatePosition={{@calculatePosition}} @closeOnSelect={{@closeOnSelect}} @defaultHighlighted={{@defaultHighlighted}} @destination={{@destination}} @disabled={{@disabled}} @dropdownClass={{or @dropdownClass "ember-model-select__dropdown"}} @extra={{@extra}} @groupComponent={{@groupComponent}} @highlightOnHover={{@highlightOnHover}} @horizontalPosition={{@horizontalPosition}} @initiallyOpened={{@initiallyOpened}} @loadingMessage={{@loadingMessage}} @eventType={{@eventType}} @matcher={{@matcher}} @matchTriggerWidth={{@matchTriggerWidth}} @noMatchesMessage={{@noMatchesMessage}} @onBlur={{@onBlur}} @onChange={{this.change}} @onClose={{this.onClose}} @onFocus={{@onFocus}} @onInput={{this.onInput}} @onKeydown={{@onKeydown}} @onOpen={{this.onOpen}} @options={{this._options}} @optionsComponent={{component
this.optionsComponent
infiniteScroll=this.infiniteScroll
infiniteModel=this.model
withCreate=this.withCreate}} @placeholder={{@placeholder}} @placeholderComponent={{@placeholderComponent}} @preventScroll={{@preventScroll}} @renderInPlace={{@renderInPlace}} @scrollTo={{@scrollTo}} @search={{perform this.searchModels}} @searchEnabled={{get-default-value @searchEnabled true}} @searchField={{@searchField}} @searchMessage={{@searchMessage}} @searchPlaceholder={{@searchPlaceholder}} @selected={{this.selectedModel}} @selectedItemComponent={{@selectedItemComponent}} @tabindex={{@tabindex}} @triggerClass={{@triggerClass}} @triggerComponent={{@triggerComponent}} @triggerId={{@triggerId}} @triggerRole={{@triggerRole}} @typeAheadMatcher={{@typeAheadMatcher}} @verticalPosition={{@verticalPosition}} @withCreate={{@withCreate}} ...attributes as |model|>
<PowerSelect
@afterOptionsComponent={{@afterOptionsComponent}}
@allowClear={{@allowClear}}
@animationEnabled={{@animationEnabled}}
@ariaDescribedBy={{@ariaDescribedBy}}
@ariaInvalid={{@ariaInvalid}}
@ariaLabel={{@ariaLabel}}
@ariaLabelledBy={{@ariaLabelledBy}}
@beforeOptionsComponent={{@beforeOptionsComponent}}
@buildSelection={{@buildSelection}}
@calculatePosition={{@calculatePosition}}
@closeOnSelect={{@closeOnSelect}}
@defaultHighlighted={{@defaultHighlighted}}
@destination={{@destination}}
@disabled={{@disabled}}
@dropdownClass={{or @dropdownClass "ember-model-select__dropdown"}}
@extra={{@extra}}
@groupComponent={{@groupComponent}}
@highlightOnHover={{@highlightOnHover}}
@horizontalPosition={{@horizontalPosition}}
@initiallyOpened={{@initiallyOpened}}
@loadingMessage={{@loadingMessage}}
@eventType={{@eventType}}
@matcher={{@matcher}}
@matchTriggerWidth={{@matchTriggerWidth}}
@noMatchesMessage={{@noMatchesMessage}}
@onBlur={{@onBlur}}
@onChange={{this.change}}
@onClose={{this.onClose}}
@onFocus={{@onFocus}}
@onInput={{this.onInput}}
@onKeydown={{@onKeydown}}
@onOpen={{this.onOpen}}
@options={{this._options}}
@optionsComponent={{component this.optionsComponent infiniteScroll=this.infiniteScroll infiniteModel=this.model withCreate=this.withCreate}}
@placeholder={{@placeholder}}
@placeholderComponent={{@placeholderComponent}}
@preventScroll={{@preventScroll}}
@renderInPlace={{@renderInPlace}}
@scrollTo={{@scrollTo}}
@search={{perform this.searchModels}}
@searchEnabled={{get-default-value @searchEnabled true}}
@searchField={{@searchField}}
@searchMessage={{@searchMessage}}
@searchPlaceholder={{@searchPlaceholder}}
@selected={{this.selectedModel}}
@selectedItemComponent={{@selectedItemComponent}}
@tabindex={{@tabindex}}
@triggerClass={{@triggerClass}}
@triggerComponent={{@triggerComponent}}
@triggerId={{@triggerId}}
@triggerRole={{@triggerRole}}
@typeAheadMatcher={{@typeAheadMatcher}}
@verticalPosition={{@verticalPosition}}
@withCreate={{@withCreate}}
...attributes
as |model|
>
{{#if (has-block)}}
{{yield model}}
{{else}}
Expand Down
35 changes: 35 additions & 0 deletions addon/components/notification-tray.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<BasicDropdown @renderInPlace={{true}} @registerAPI={{this.registerAPI}} class="notification-tray next-user-button" ...attributes as |dd|>
<dd.Trigger class="next-org-button-trigger flex-shrink-0">
<FaIcon @icon="inbox" />
{{#if this.notifications.length}}
<div class="notification-tray-unread-notifications-badge">{{this.notifications.length}}</div>
{{/if}}
</dd.Trigger>
<dd.Content class="notification-tray-panel-container">
<div class="notification-tray-panel">
<div>
<div class="px-4 py-2 border-b border-gray-200 dark:border-gray-700 flex flex-row space-x-4">
<h1 class="text-black dark:text-gray-100 text-sm font-bold">{{pluralize this.notifications.length "Unread Notification"}}</h1>
</div>
<div class="h-48 overflow-y-scroll p-2">
{{#each this.notifications as |notification|}}
<a href="javascript:;" class="notification-item {{if notification._isRemoving 'opacity-50'}}" {{on "click" (fn this.onClickNotification notification)}}>
<h3 class="font-semibold text-small truncate">{{notification.data.subject}}</h3>
<p class="text-xs mb-1.5 truncate">{{notification.data.message}}</p>
<span class="text-xs">Received: {{notification.createdAgo}}</span>
</a>
{{else}}
<div class="flex flex-1 items-center justify-center w-full h-full">
<span class="text-base text-gray-800 dark:text-gray-300 italic">No unread notifications</span>
</div>
{{/each}}
</div>
</div>
<div class="px-2 py-1.5 border-t border-gray-200 dark:border-gray-700 flex flex-row space-x-4">
<LinkTo @route="console.notifications" class="notification-tray-view-all-link">
View all notifications
</LinkTo>
</div>
</div>
</dd.Content>
</BasicDropdown>
Loading