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

create notification component #317

Closed
kfarr opened this issue Jul 14, 2023 · 9 comments
Closed

create notification component #317

kfarr opened this issue Jul 14, 2023 · 9 comments
Assignees

Comments

@kfarr
Copy link
Collaborator

kfarr commented Jul 14, 2023

this component enables other components and the 3dstreet editor to send messages to the user about different activities in the application such as save or load status

it is probably easiest to use an off-the-shelf solution, I have researched this one that seems to do the job and has a reasonable license: https://github.com/caroso1222/notyf/

This component could have some settings that reflect the notyf object such as position, duration, etc.

This component would expected to be loaded only once at the scene level. Other scenes would interact with this component by either setAttribute to set property values on the component, and/or by calling a method such as AFRAME.scenes[0].components['notification'].sendMessage('yo');

installation options

(A future version of this component could include notification for VR / immersive model, especially useful when modifying scenes in VR and wanting confirmation of save event.)

@Algorush
Copy link
Collaborator

This component would expected to be loaded only once at the scene level. Other scenes would interact with this component by either setAttribute to set property values on the component, and/or by calling a method such as AFRAME.scenes[0].components['notification'].sendMessage('yo');

Hi Kieran. Here you meant that other elements (not scenes?) can interact with the notifications component using setAttribute or sendMessage ?

@kfarr
Copy link
Collaborator Author

kfarr commented Jul 20, 2023

Yes this means to say that other entities, components, or js code from the editor may need to interact with this notification component

@Algorush
Copy link
Collaborator

What types of messages to make for notifications by default? It should be only one info type or more? There is success, error by default or could be customized types.

@kfarr
Copy link
Collaborator Author

kfarr commented Jul 21, 2023

I think for now success (green) and error (red) is ok. In my experience sometimes there is also warning (yellow) and information (blue) but I would vote to wait to do those until another time when it's actually needed.

@kfarr kfarr moved this from To Do to In progress in 3DStreet Dev Tracking Jul 22, 2023
@Algorush
Copy link
Collaborator

Yes this means to say that other entities, components, or js code from the editor may need to interact with this notification component

I did not understand a little how interaction should take place through setAttribute. I did it this way now:
AFRAME.scenes[0].setAttribute('notify','successMsg','hello')

@Algorush
Copy link
Collaborator

I noticed one peculiarity of using setAttribute. If it is called with the same data, then the update function of the component is not called. That is, the same message cannot be sent several times. It can be done using the component method

@Algorush
Copy link
Collaborator

PR: #319
Now we can call 2 types of messages - error and success. This can be done in two ways:
AFRAME.scenes[0].setAttribute('notify','successMsg','hello')
AFRAME.scenes[0].setAttribute('notify','errorMsg','error')
AFRAME.scenes[0].components.notify.successMsg('hello')
AFRAME.scenes[0].components.notify.errorMsg('error')

@kfarr
Copy link
Collaborator Author

kfarr commented Jul 26, 2023

@Algorush this is great! I just reviewed the PR with some requested updates

@kfarr kfarr moved this from In progress to For Review in 3DStreet Dev Tracking Jul 28, 2023
@kfarr
Copy link
Collaborator Author

kfarr commented Jul 28, 2023

closed with #319

@kfarr kfarr closed this as completed Jul 28, 2023
@github-project-automation github-project-automation bot moved this from For Review to Done in 3DStreet Dev Tracking Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

2 participants