Comments (10)
I modified my solidjs/tailwind example to add MicButton, ChatButton, ChatPanel components that I extracted and simplified from my project for one of my sponsor.
live: https://naf-nametag-solidjs.glitch.me
code: https://github.com/networked-aframe/naf-nametag-solidjs
As a proof of concept, with the same code, I created web components from the solidjs components via solid-element without shadow dom so using my tailwind classes shared for all web components, and a separate ui-components bundle.
The code to add a mic button and chat in your own project with naf web components is looking currently like this
https://github.com/networked-aframe/naf-nametag-solidjs/blob/5aba4448dd71838cc1998727f785d6ab3a2711da/public/ui-components.html#L76-L100
<script src="/dist/ui-components.js"></script>
<style>
/* You can override colors with css properties used by the ui components, see colors.css for the full list */
:root {
--panel-bg: #171717; /* bg-neutral-800 */
--panel-text: #e2e8f0; /* text-slate-200 */
--btn-primary-bg: #0f766e; /* bg-teal-700 */
--btn-primary-bg-hover: #115e59; /* bg-teal-800 */
--btn-primary-text: #e2e8f0; /* text-slate-200 */
--btn-border-radius: 0.5rem;
}
</style>
<!--
You can change the bar position with one of the following classes
naf-top-bar-left naf-top-bar-center naf-top-bar-right
naf-bottom-bar-left naf-bottom-bar-center naf-bottom-bar-right
-->
<div class="naf-bottom-bar-center">
<!-- This needs to be after the a-scene so the player element can be found. -->
<naf-username-input entity="#player" enable-color-picker="true"></naf-username-input>
<naf-mic-button></naf-mic-button>
<!-- When you add the naf-chat-button, don't forget to add the naf-chat-panel outside the bar as well -->
<naf-chat-button></naf-chat-button>
</div>
<naf-chat-panel></naf-chat-panel>
You can test it live here: https://naf-nametag-solidjs.glitch.me/ui-components.html
Is this an interesting approach? Would you use something like that in your naf projects?
Please give me some feedback if I should continue on this and create a separate library, mainly create a participants listing with mute indication, unread chat messages, user join/left notifications, translation.
from networked-aframe.
If you want to try it in your project, you can use the following build
<script src="https://cdn.jsdelivr.net/gh/networked-aframe/naf-nametag-solidjs@4a374ca/public/dist/ui-components.js"></script>
You still need to define your player-info component with username and color and the associated networked entities, see the example.
from networked-aframe.
You can sponsor $100 to vincentfretin fully or partially to work on this feature. Find other work you can sponsor at https://github.com/c-frame/sponsorship
from networked-aframe.
In case this wasn't clear, you won't need to know solidjs or tailwindcss to use those web components in your projects. That would only be a script tag to add like any other aframe component.
I'll start working on the users listing web component and later the chat web component if I reach 10 persons donating $10 monthly. Once I reach this goal, I'll know for sure there is an interest for this.
Here are some screenshots of the implemented chat (you can also see it live in the kitchen experience I shared above):
from networked-aframe.
I would love to see if who is there as well.
from networked-aframe.
@ahmed-frq Your chat could be a good candidate for a first naf web component to be easily reusable in the other examples. I found https://kinsta.com/blog/web-components/ to be simple as an introduction. If you're interested in continuing to contribute, you can look at it after #439 is merged and do a refactoring so it could look like that:
<head>
<script src="/js/naf-chat.js"></script>
</head>
<body>
<naf-chat id="chat" style="position: absolute; top: 0; left: 0" name="anonymous"></naf-chat>
<input type="text" id="username" />
<script>
document.addEventListener('DOMContentLoaded', () => {
const chat = document.querySelector('#chat');
const username = document.querySelector('#username');
username.value = 'user-' + Math.round(Math.random() * 10000);
username.addEventListener('input', () = > {
chat.setAttribute('name', username.value)
});
});
</script>
</body>
from networked-aframe.
i'll definetly check this out, give me some time
from networked-aframe.
I see the usage of those web components mainly for persons that don't write javascript at all, or persons that don't want to introduce a build step to their existing experience.
Also those web components may still be used together with your current developed ui in basic html/css/js, solidjs or vue (maybe not with current stable version of react I heard it doesn't support integrating web components). I probably need a way to access or set the state used in the different components like username and color though methods on a specific web component. If you have any feedback of the design, that will be appreciated.
from networked-aframe.
Related Issues (20)
- Be in networked aframe but not be there? HOT 4
- didn't manage to get hand tracking working HOT 5
- User in new position with each refresh?
- Add ability to add networked entity to non-networked parent HOT 7
- Share Screen Issue HOT 1
- stuck with npm i on a RPi Zero HOT 5
- Write a "how it works" documentation HOT 12
- Not a issue but really need some help. Trying to add pre-text pharses above the character. HOT 1
- networked-video-source should respect the video aspect ratio HOT 1
- [networked-audio-zone] Private audio zone HOT 1
- https for audio? HOT 1
- Audio chat example low volume? HOT 10
- Deactivate synchronization for child nodes? HOT 9
- Deletion of a component in the NAF schema is not replicated HOT 2
- Updated state not being replicated to new joiners to a scene HOT 2
- Fix networked-video-source has a bad color space with a-frame v1.5.0
- networked-hand-controls issues with aframe-v1.5.0 HOT 2
- Alternative using binary instead of json for updates HOT 3
- Networked fullbody tracking HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from networked-aframe.