connected/disconnected toasts
This commit is contained in:
		
							parent
							
								
									9955ddf08e
								
							
						
					
					
						commit
						277fe2ae02
					
				@ -28,7 +28,11 @@ $(document).ready(function () {
 | 
				
			|||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    socket.on("connect", function(socket) {
 | 
					    socket.on("connect", function(socket) {
 | 
				
			||||||
        console.log("Connected");
 | 
					        $("#connectedtoast").toast("show")
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    socket.on("disconnect", function(socket) {
 | 
				
			||||||
 | 
					        $("#disconnectedtoast").toast("show")
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
     socket.on("new_tick", function(data) {
 | 
					     socket.on("new_tick", function(data) {
 | 
				
			||||||
 | 
				
			|||||||
@ -15,111 +15,122 @@
 | 
				
			|||||||
<title>Hello world!</title>
 | 
					<title>Hello world!</title>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<body class="h-100 d-flex flex-column">
 | 
					<body class="h-100 d-flex flex-column">
 | 
				
			||||||
    <main class="container my-2 border h-100">
 | 
					<main class="container my-2 border h-100">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <div class="row row-cols-auto justify-content-center my-2" id="statistics">
 | 
					    <div class="row row-cols-auto justify-content-center my-2" id="statistics">
 | 
				
			||||||
            <div class="card bg-light mx-auto" style="max-width: 25rem;">
 | 
					        <div class="card bg-light mx-auto" style="max-width: 25rem;">
 | 
				
			||||||
                <div class="row g-0">
 | 
					            <div class="row g-0">
 | 
				
			||||||
                    <div class="col-md-7 my-2">
 | 
					                <div class="col-md-7 my-2">
 | 
				
			||||||
                        <h3 class="my-auto border-end text-center">Current price:</h3>
 | 
					                    <h3 class="my-auto border-end text-center">Current price:</h3>
 | 
				
			||||||
                    </div>
 | 
					 | 
				
			||||||
                    <div class="col-md-5">
 | 
					 | 
				
			||||||
                        <div class="card-body">
 | 
					 | 
				
			||||||
                            <p class="card-text text-center text-decoration-underline">USD XXXX.XX</p>
 | 
					 | 
				
			||||||
                        </div>
 | 
					 | 
				
			||||||
                    </div>
 | 
					 | 
				
			||||||
                    <p class="card-text text-center border-top my-auto">
 | 
					 | 
				
			||||||
                        <small class="text-muted">Last updated 3 mins ago</small>
 | 
					 | 
				
			||||||
                    </p>
 | 
					 | 
				
			||||||
                </div>
 | 
					                </div>
 | 
				
			||||||
            </div>
 | 
					                <div class="col-md-5">
 | 
				
			||||||
        </div>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        <div class="row border-top my-2">
 | 
					 | 
				
			||||||
            <div class="col">
 | 
					 | 
				
			||||||
                <div class="card my-2">
 | 
					 | 
				
			||||||
                    <div class="card-header text-center">
 | 
					 | 
				
			||||||
                        <h3>Open positions:</h3>
 | 
					 | 
				
			||||||
                    </div>
 | 
					 | 
				
			||||||
                    <div class="card-body">
 | 
					                    <div class="card-body">
 | 
				
			||||||
                        <table class="table table-striped table-hover table-sm align-middle">
 | 
					                        <p class="card-text text-center text-decoration-underline">USD XXXX.XX</p>
 | 
				
			||||||
                            <thead>
 | 
					 | 
				
			||||||
                                <tr>
 | 
					 | 
				
			||||||
                                    <th>ID</th>
 | 
					 | 
				
			||||||
                                    <th>Date</th>
 | 
					 | 
				
			||||||
                                    <th>Amount</th>
 | 
					 | 
				
			||||||
                                    <th>P/L</th>
 | 
					 | 
				
			||||||
                                    <th>Actions</th>
 | 
					 | 
				
			||||||
                                </tr>
 | 
					 | 
				
			||||||
                            </thead>
 | 
					 | 
				
			||||||
                            <tbody>
 | 
					 | 
				
			||||||
                                <tr>
 | 
					 | 
				
			||||||
                                    <th>1</th>
 | 
					 | 
				
			||||||
                                    <th>01/01/2020</th>
 | 
					 | 
				
			||||||
                                    <th>BTC +1.0000</th>
 | 
					 | 
				
			||||||
                                    <th>1.00 %</th>
 | 
					 | 
				
			||||||
                                    <th>
 | 
					 | 
				
			||||||
                                        <button id="button" type="button" class="btn btn-danger btn-sm">Close</button>
 | 
					 | 
				
			||||||
                                    </th>
 | 
					 | 
				
			||||||
                                </tr>
 | 
					 | 
				
			||||||
                            </tbody>
 | 
					 | 
				
			||||||
                        </table>
 | 
					 | 
				
			||||||
                    </div>
 | 
					                    </div>
 | 
				
			||||||
                </div>
 | 
					                </div>
 | 
				
			||||||
 | 
					                <p class="card-text text-center border-top my-auto">
 | 
				
			||||||
 | 
					                    <small class="text-muted">Last updated 3 mins ago</small>
 | 
				
			||||||
 | 
					                </p>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
 | 
					        </div>
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            <div class="col">
 | 
					    <div class="row border-top my-2">
 | 
				
			||||||
                <div class="card my-2">
 | 
					        <div class="col">
 | 
				
			||||||
                    <div class="card-header text-center">
 | 
					            <div class="card my-2">
 | 
				
			||||||
                        <h3>Open orders:</h3>
 | 
					                <div class="card-header text-center">
 | 
				
			||||||
                    </div>
 | 
					                    <h3>Open positions:</h3>
 | 
				
			||||||
                    <div class="card-body">
 | 
					                </div>
 | 
				
			||||||
                        <table class="table table-striped table-hover table-sm align-middle">
 | 
					                <div class="card-body">
 | 
				
			||||||
                            <thead>
 | 
					                    <table class="table table-striped table-hover table-sm align-middle">
 | 
				
			||||||
                                <tr>
 | 
					                        <thead>
 | 
				
			||||||
                                    <th>ID</th>
 | 
					                        <tr>
 | 
				
			||||||
                                    <th>Date</th>
 | 
					                            <th>ID</th>
 | 
				
			||||||
                                    <th>Amount</th>
 | 
					                            <th>Date</th>
 | 
				
			||||||
                                    <th>P/L</th>
 | 
					                            <th>Amount</th>
 | 
				
			||||||
                                </tr>
 | 
					                            <th>P/L</th>
 | 
				
			||||||
                            </thead>
 | 
					                            <th>Actions</th>
 | 
				
			||||||
                            <tbody>
 | 
					                        </tr>
 | 
				
			||||||
                                <tr>
 | 
					                        </thead>
 | 
				
			||||||
                                    <th>1</th>
 | 
					                        <tbody>
 | 
				
			||||||
                                    <th>01/01/2020</th>
 | 
					                        <tr>
 | 
				
			||||||
                                    <th>BTC +1.0000</th>
 | 
					                            <th>1</th>
 | 
				
			||||||
                                    <th>1.00 %</th>
 | 
					                            <th>01/01/2020</th>
 | 
				
			||||||
                                </tr>
 | 
					                            <th>BTC +1.0000</th>
 | 
				
			||||||
                            </tbody>
 | 
					                            <th>1.00 %</th>
 | 
				
			||||||
                        </table>
 | 
					                            <th>
 | 
				
			||||||
                    </div>
 | 
					                                <button id="button" type="button" class="btn btn-danger btn-sm">Close</button>
 | 
				
			||||||
 | 
					                            </th>
 | 
				
			||||||
 | 
					                        </tr>
 | 
				
			||||||
 | 
					                        </tbody>
 | 
				
			||||||
 | 
					                    </table>
 | 
				
			||||||
                </div>
 | 
					                </div>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <div class="row align-content-center">
 | 
					        <div class="col">
 | 
				
			||||||
            <div class="col">
 | 
					            <div class="card my-2">
 | 
				
			||||||
                <div class="my-auto" id="price_chart">
 | 
					                <div class="card-header text-center">
 | 
				
			||||||
                    <!-- Price chart is inserted here by rustico.js -->
 | 
					                    <h3>Open orders:</h3>
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
 | 
					                <div class="card-body">
 | 
				
			||||||
 | 
					                    <table class="table table-striped table-hover table-sm align-middle">
 | 
				
			||||||
 | 
					                        <thead>
 | 
				
			||||||
 | 
					                        <tr>
 | 
				
			||||||
 | 
					                            <th>ID</th>
 | 
				
			||||||
 | 
					                            <th>Date</th>
 | 
				
			||||||
 | 
					                            <th>Amount</th>
 | 
				
			||||||
 | 
					                            <th>P/L</th>
 | 
				
			||||||
 | 
					                        </tr>
 | 
				
			||||||
 | 
					                        </thead>
 | 
				
			||||||
 | 
					                        <tbody>
 | 
				
			||||||
 | 
					                        <tr>
 | 
				
			||||||
 | 
					                            <th>1</th>
 | 
				
			||||||
 | 
					                            <th>01/01/2020</th>
 | 
				
			||||||
 | 
					                            <th>BTC +1.0000</th>
 | 
				
			||||||
 | 
					                            <th>1.00 %</th>
 | 
				
			||||||
 | 
					                        </tr>
 | 
				
			||||||
 | 
					                        </tbody>
 | 
				
			||||||
 | 
					                    </table>
 | 
				
			||||||
                </div>
 | 
					                </div>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
    </main>
 | 
					    </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <div class="toast">
 | 
					    <div class="row align-content-center">
 | 
				
			||||||
 | 
					        <div class="col">
 | 
				
			||||||
 | 
					            <div class="my-auto" id="price_chart">
 | 
				
			||||||
 | 
					                <!-- Price chart is inserted here by rustico.js -->
 | 
				
			||||||
 | 
					            </div>
 | 
				
			||||||
 | 
					        </div>
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
 | 
					</main>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<div class="toast-container hide">
 | 
				
			||||||
 | 
					    <div class="toast mx-2 my-2 bg-success hide" id="connectedtoast" role="alert" aria-live="assertive" aria-atomic="true">
 | 
				
			||||||
        <div class="toast-header">
 | 
					        <div class="toast-header">
 | 
				
			||||||
          Toast Header
 | 
					            <strong class="me-auto">Connected!</strong>
 | 
				
			||||||
        </div>
 | 
					            <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>    </div>
 | 
				
			||||||
        <div class="toast-body">
 | 
					<!--        <div class="toast-body bg-light">-->
 | 
				
			||||||
          Some text inside the toast body
 | 
					<!--            You are connected to the server.-->
 | 
				
			||||||
        </div>
 | 
					<!--        </div>-->
 | 
				
			||||||
      </div>
 | 
					    </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <footer class="footer mt-auto py-3 bg-light border-top">
 | 
					    <div class="toast mx-2 my-2 bg-danger hide" id="disconnectedtoast" role="alert" aria-live="assertive" aria-atomic="true">
 | 
				
			||||||
        <div class="container text-center">
 | 
					        <div class="toast-header">
 | 
				
			||||||
            <span class="text-muted">Made with love by the Pepe</span>
 | 
					            <strong class="me-auto">Disconnected!</strong>
 | 
				
			||||||
        </div>
 | 
					            <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>    </div>
 | 
				
			||||||
    </footer>
 | 
					<!--        <div class="toast-body bg-light">-->
 | 
				
			||||||
 | 
					<!--            You got disconnected from the server.-->
 | 
				
			||||||
 | 
					<!--        </div>-->
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
 | 
					</div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<footer class="footer mt-auto py-3 bg-light border-top">
 | 
				
			||||||
 | 
					    <div class="container text-center">
 | 
				
			||||||
 | 
					        <span class="text-muted">Made with ❤️ by the Pepe</span>
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
 | 
					</footer>
 | 
				
			||||||
</body>
 | 
					</body>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
</html>
 | 
					</html>
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user