| 
									
										
										
										
											2021-11-14 15:13:40 +02:00
										 |  |  | <script> | 
					
						
							| 
									
										
										
										
											2021-11-16 22:09:01 +02:00
										 |  |  | import BottomBorder from "./BottomBorder.svelte"; | 
					
						
							| 
									
										
										
										
											2021-11-21 00:12:24 +02:00
										 |  |  | import CreateAccount from "./CreateAccount.svelte"; | 
					
						
							| 
									
										
										
										
											2021-11-16 22:09:01 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-14 17:35:37 +02:00
										 |  |  | import Login from "./Login.svelte"; | 
					
						
							|  |  |  | import MainPage from "./MainPage.svelte"; | 
					
						
							| 
									
										
										
										
											2021-11-16 22:09:01 +02:00
										 |  |  | import TopBorder from "./TopBorder.svelte"; | 
					
						
							| 
									
										
										
										
											2021-11-14 15:13:40 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-20 17:42:59 +02:00
										 |  |  | 	let loggedin = true; | 
					
						
							| 
									
										
										
										
											2021-11-14 17:35:37 +02:00
										 |  |  | 	function toggleLoggedIn() { | 
					
						
							|  |  |  | 		loggedin = !loggedin; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2021-11-21 00:12:24 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	let isCreatingAccount = false; | 
					
						
							|  |  |  | 	let isCheckingNotifications = false; | 
					
						
							|  |  |  | 	let isSendingMoney = false; | 
					
						
							|  |  |  | 	let sendingAccount = ""; | 
					
						
							|  |  |  | 	let notifications = []; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	function onCreatePopup(event) { | 
					
						
							|  |  |  | 		const eventType = event.detail.type; | 
					
						
							|  |  |  | 		switch (eventType) { | 
					
						
							|  |  |  | 			case "new_account": | 
					
						
							|  |  |  | 				isCreatingAccount = true; | 
					
						
							|  |  |  | 			break; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			case "create_acc_success": | 
					
						
							|  |  |  | 				isCreatingAccount = false; | 
					
						
							|  |  |  | 			break; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			case "create_acc_cancelled": | 
					
						
							|  |  |  | 				isCreatingAccount = false; | 
					
						
							|  |  |  | 			break; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			case "create_acc_failed": | 
					
						
							|  |  |  | 				isCreatingAccount = false; | 
					
						
							|  |  |  | 				alert(`Account creation failed! Reason: ${event.detail.reason}`); | 
					
						
							|  |  |  | 			break; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			case "send_money": | 
					
						
							|  |  |  | 				sendingAccount = event.detail.iban; | 
					
						
							|  |  |  | 				isSendingMoney = true; | 
					
						
							|  |  |  | 			break; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			case "send_money_cancelled": | 
					
						
							|  |  |  | 				isSendingMoney = false; | 
					
						
							|  |  |  | 			break; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			case "send_money_failed": | 
					
						
							|  |  |  | 				isSendingMoney = false; | 
					
						
							|  |  |  | 				alert(`Sending money failed! Reason: ${event.detail.reason}`); | 
					
						
							|  |  |  | 			break; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			case "check_notifications": | 
					
						
							|  |  |  | 				notifications = event.detail.notifications; | 
					
						
							|  |  |  | 				isCheckingNotifications = true; | 
					
						
							|  |  |  | 			break; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			case "check_notifications_cancelled": | 
					
						
							|  |  |  | 				isCheckingNotifications = false; | 
					
						
							|  |  |  | 			break; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			default: | 
					
						
							|  |  |  | 				alert(`Unhandled createPopup event: ${eventType}`); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2021-11-14 15:13:40 +02:00
										 |  |  | </script> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-20 17:42:59 +02:00
										 |  |  | <main class="flex flex-col items-stretch bg-banner bg-cover bg-center bg-fixed h-screen font-sans"> | 
					
						
							| 
									
										
										
										
											2021-11-21 00:12:24 +02:00
										 |  |  | 	{#if isCreatingAccount} | 
					
						
							|  |  |  | 		<CreateAccount> </CreateAccount> | 
					
						
							|  |  |  | 	{:else if  isCheckingNotifications} | 
					
						
							|  |  |  | 		 <!-- else if content here --> | 
					
						
							|  |  |  | 	{:else if  isSendingMoney} | 
					
						
							|  |  |  | 		 <!-- else if content here --> | 
					
						
							|  |  |  | 	{/if} | 
					
						
							| 
									
										
										
										
											2021-11-16 23:30:26 +02:00
										 |  |  | 	<TopBorder class="flex-shrink"></TopBorder> | 
					
						
							| 
									
										
										
										
											2021-11-20 17:42:59 +02:00
										 |  |  | 	<div class="flex-grow max-h-full overflow-hidden"> | 
					
						
							| 
									
										
										
										
											2021-11-16 23:30:26 +02:00
										 |  |  | 		{#if loggedin} | 
					
						
							| 
									
										
										
										
											2021-11-21 00:12:24 +02:00
										 |  |  | 			<MainPage on:logOut={toggleLoggedIn} on:createPopup={onCreatePopup}></MainPage> | 
					
						
							| 
									
										
										
										
											2021-11-16 23:30:26 +02:00
										 |  |  | 		{:else} | 
					
						
							|  |  |  | 			<Login on:loginSuccess={toggleLoggedIn}></Login> | 
					
						
							|  |  |  | 		{/if} | 
					
						
							|  |  |  | 	</div> | 
					
						
							| 
									
										
										
										
											2021-11-20 17:42:59 +02:00
										 |  |  | 	<BottomBorder class="flex-none"></BottomBorder> | 
					
						
							| 
									
										
										
										
											2021-11-14 15:13:40 +02:00
										 |  |  | </main> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-16 22:09:01 +02:00
										 |  |  | <svelte:head> | 
					
						
							|  |  |  | 	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" > | 
					
						
							|  |  |  | </svelte:head> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-14 15:13:40 +02:00
										 |  |  | <style global lang="postcss"> | 
					
						
							| 
									
										
										
										
											2021-11-14 19:07:05 +02:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	@import url('https://fonts.googleapis.com/css2?family=Geo&family=Roboto&family=Rochester&display=swap'); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-14 15:13:40 +02:00
										 |  |  | 	@tailwind base; | 
					
						
							|  |  |  | 	@tailwind components; | 
					
						
							|  |  |  | 	@tailwind utilities; | 
					
						
							|  |  |  | </style> |