Merge each person's states in react-slate - reactjs

I am building a doc editor like google doc using react-slate for the frontend and express for the backend. It works well when one person types in the editor but I faced one problem when some people typed in one editor. When two people or some people type the content in one editor, we should merge all the states and show the acceptable result to all people.
How to implement the functionality? on the frontend or backend side?

Related

Web Apps - How to Dynamically Present Announcements

I am developing a web app that has a page that displays updates and announcements. I am not familiar with how other websites accomplish this. Do people store their announcements/updates in a database and just update their database whenever they have a new announcement?
What are the standard methods that people use to accomplish something like this at scale?
Basically what you want is a backend that runs a websocket port for clients to bind to. So a client would send his request to post an announcement, this could be via the web socket or any other API( REST, SOAP, GraphQL).
The server can then save the announcements in its Database or/and push update to all the clients attached that an announcement was added through the websocket port. Then the client can handle the response from the server according to its logic.
To fetch announcements for clients which were not connected at the time of announcement via websocket, you can just reply with all the announcements made after a client disconnected.
There are a lot of possible solution, all with different degree of difficulty and flexibility:
1. Hardcode everything in your HTML page
It's the easier solution in the short term, but it would become harder and harder as the projects grows. I would not suggest doing this even for smaller projects.
2. Save the list on a committed data source
For example, create a JSON file in your project with the following structure:
[
{
"type": "announcement",
"date": "2020-08-18",
"title": "New announcement!",
"content": "Bla bla bla...",
},
{
"type": "update",
"date": "2020-08-18",
"title": "Version 2.1.0",
"content": "Here is the changelog: ...",
},
]
Then your webapp can load this file and render it accordingly. This approach has some advantages:
You don't need to rewrite all the boilerplate html everytime
The changes on the update page are committed, so they are easier to review or cancel
However, you still need to insert html in your content field and that could be problematic to do by hand everytime (especially if you need to add images, tables or more complex elements). Also, the changes are in the codebase, so they can not be delegated to a not-technical person (such as the marketing manager).
Also, it is not very efficient to load and parse a json file everytime. You can add some caching, but it's still not as performant as a database
3. Save the list manually in the database
This solution is very similar to number (2). It provides some performance improvement, but most of the other disadvantages remains valid.
4. Use a database and implement a GUI for creating/editing/publishing announcements
The ideal solution is to use a database, while also implementing in the backend a restricted area where it is possible to manage the announcements using a WYSIWYG editor.
Advantages:
Maximum flexibility and it does not require writing the HTML by hand everytime
Anyone can write and publish the announcement, it does not have to be a developer
Disadvantages:
You need to develop the whole editing/publishing system
I don't know whats your programming language or technologies you're using. But, I guess you want a realtime updates and announcement. I'm suggesting you to use realtime databases like FCM to handle it:
https://firebase.google.com/docs/cloud-messaging/concept-options?hl=id
In this example, it using NodeJS:
https://thecodebarbarian.com/sending-web-push-notifications-from-node-js.html
It depends upon how you want to handle it.
Some use this technique of storing in a database and updating it.
Another approach is that you can simply use a web crawler to import the announcement/notices if you are taking references from another websites and you won't need to create a database too. But, your website will be little bit slow but will save the memory for database.
The standard method for putting text onto webpages without hardcoding it is using a content management system or CMS. This can be big and complex, or simple and lightweight.
The approach I've seen work best is to use a "headless CMS", which gives non-technical people a UI to enter the content, and an API which allows your application to grab that content (e.g. as JSON), and render it in whichever framework you're using. This works for "Announcements", or other text content like FAQs, terms & conditions etc.
Another approach is to use a "static site generator" which takes text in a specific format and spits it out as HTML. You could use this to build a pipeline to take "announcements" written in markdown and committed to Git, which are converted by the static site generator into an HTML snippet, which you then render using your NodeJS application.
As stated before, a CMS (content management system) is probably the way to go. If you haven't decided on how to build your web app, I would strongly advise you to use a web framework.
If you are in search of a good solution I would recommend Django and Django CMS.
Both are well documented, open-source and can scale as needed.
Django:
https://docs.djangoproject.com/en/3.1/contents/
Django CMS:
http://docs.django-cms.org/en/latest/

Looking for reactjs vscode crud example code

I would like to build a simple web app and learn reactjs at the same time, using vscode. The web app I'd like to build is very simple- just one form with multiple sections, and in each section multiple elements can be added. An example would be a section called 'People' and there is a form element for a person (first name, last name etc.). If I add that person, it appears in a list under 'People' and I can add another Person. Another section could be 'Cars', and I add a new car, etc. etc. For each new person or car I add, it gets stored in a database and I can edit/update.
I've never build a reactjs app before but I've built many angularjs apps- but it's been a while. I'm looking for an example or demo that uses reactjs to create a UI like this, and uses MySQL (or aurora) on the backend.
Ultimate goal is to get this app onto AWS. Maybe using Serverless and graphql (also tools I've never used before).
Can anyone point me to an example or tutorial that might be a good fit for what I'm trying to learn?
And if there's a better place to post this, please let me know.
Not exactly what you are looking for but these are links to some CRUD tutorials with react.
Simple CRUD App by Sophie
Step by Step React CRUD
Full-Stack React-Graphql CRUD APP

Creating a webpage with a unique URL using react/firebase?

I'm pretty new to react and building out a little prototype using Firebase as a backend. One of the primary functionalities involves a user writing a post in an editor, which is saved to firebase. On submit in the editor, I am trying to create a new standalone page for the post with the firebase uid as the ending part of the new unique URL.
The problem I'm having is figuring out a way to create the new page on submit. I haven't been able to find any documentation for a similar problem like this specific to react or firebase, and was just wondering on a high-level what a good approach to executing this might be? Thanks
The newly launched Firebase Hosting + Cloud Functions integration can help here. The first bullet point in the documentation looks like it describes your use case exactly.
You also mentioned React. There is a handy sample project showing how to implement an isomorphic React app with Firebase.

Add databound dropdown to Azure API App logic app shape

I have developed an azure API app that I am using in a logic app. For the purpose of this post, it doesn't matter what my app does.
In my logic app shape (Azure API App) I have managed to render a drop down list by making one of my API post params an ENUM. Then changing the swagger / swashbuckle configuration to render the definition differently.
This is a good start but I really need a data driven drop down that reads it's data from a constantly changing data source (blobs, documentDB for example but it doesn't matter).
I can't find any posts on this.
All help will be greatly appreciated
Great question - we have on our backlog to support what we call "Dynamic Swagger" that lets you do just this. I'm hoping it will be in production near the beginning of March. In the meantime you will need to just enter in the values of those fields manually.

How to interact Users(input form data) Using Salesforce Sites into the SalesForce Application(to Custom objects)

First of all I'm really sorry if i'm asking a Dumb Question. But unfortunately i can't find out a way to take inputs for my salesforce Application.
I am developing a simple CV Management app, but i can't figure out how to interact users(input data) to the App? I have created Candidate Custom object, and manually i can create the Candidates, but my requirement is to create records by Candidates themselves.
I followed SalesForce Tutorials and i found out a way to display data using VisualForce Custom Pages. But what i want to## Heading ## do is when i giving a link to the user, he can go to that link and there having form to fill with his personal data, and submit only. But i'm just confused how to user input data map with our Custom Candidate object fields.
when i'm searching i saw some FormAssembly and Custom VisualForce Pages. But Problem is I don't hope to use any 3rd party apps.
Tutorials says that;
In the past, to make Force.com data available to the general public, you had to set up a Web
server, create custom Web pages (JSP, PHP, or other), and use the API to integrate Force.com
apps with an external website. This is no longer the case, thanks to Sites!
Please if you can, help me Friends, Really Appreciate it & Thank you soo much..
You'll probably want to do something along these lines...
Create a Visualforce page with standard controller set to your custom object which is the "CV Entry" page (to send candidates to)
Create a Force.com site in your salesforce org to allow public or restricted access to the page
Setup page authentication/permissions as required

Resources