Before copying the code first you need to create a custom object "Project" (API name Project__c) and one checkbox field "Converted To Project" on 'Opportunity' object so that it mark the record which has been already converted to project.
In this example I have made a lightning component in which I have just initialize it and call the controller which then perform task through Apex function. We need to make 'Quick Action' button on Opportunity object. For that just go to Setup >> Object Manager >> Button, Links and Actions >> New Action >> Now choose the lightning component (the code is given below) and save.
Here you will also see the how "Toast Msg" works and also how we can hide Modal when we click on quick action button