ember-cli-flash icon indicating copy to clipboard operation
ember-cli-flash copied to clipboard

Order of appearance, or rather, the oldest in the place of the new and old ones dying before no moving all the others.

Open ghost opened this issue 9 years ago • 2 comments

My notifications are to the top.

Now, with the same priority, new notifications appear under the old ones.

1 2 3 4

Why?

I wish that the new notifications appeared "above" the other old and older notifications moved down by one step. So when they die they do not move all the others.

4 3 2 1

I'm wrong, or there isn't an option like that?

Thanks in advance.

ghost avatar Oct 11 '16 21:10 ghost

Hi @johnunclesam! I think this more a product of the each loop showing the array of flash objects. In your component (where you are most likely injecting the flash message service), you can create a new, reversed array based on the queue:

flashMessages: Ember.inject.service(),

reversedQueue: Ember.computed('flashMessages.queue', function() {
  return this.get('flashMessages.queue').reverseObjects();
})

Then in your template, you can update it to:

{{#each reversedQueue as |flash|}}
  {{#flash-message flash=flash as |component flash|}}
     ... etc.
  {{/flash-message}}
{{/each}}

Now it should be based on the reverse of the queue array and you should get the order you want.

sbatson5 avatar Oct 29 '16 18:10 sbatson5

I face the same issue than @johnunclesam .

The problem with your proposed solution @sbatson5 is that it will move the message with the top priority below the lowest priority whereas the expected behavior (IMO) would be a 2 dimensional sort.

First by priority, then for messages with the same one, sort from the newest to the oldest.

The reversed queue would be sufficient if the priority parameter is not used though.

panthony avatar Nov 16 '16 16:11 panthony