| 1 | <script lang="ts"> |
| 2 | import { openFolderDialog } from "./File"; |
| 3 | import { DocumentBlank, Folder, RecentlyViewed, Settings } from "carbon-icons-svelte"; |
| 4 | import { addEditorTab, addTab } from "./EditorTabList.svelte"; |
| 5 | import settings from "./Settings.svelte"; |
| 6 | import { getVersion } from '@tauri-apps/api/app'; |
| 7 | import { onMount } from "svelte"; |
| 8 | import RecentFolders from "./utility/RecentFolders.svelte"; |
| 9 | |
| 10 | export let hidden = true; |
| 11 | |
| 12 | let appVersion = ""; |
| 13 | let showRecentFolders = false; |
| 14 | |
| 15 | onMount(async () => { |
| 16 | appVersion = await getVersion(); |
| 17 | }) |
| 18 | |
| 19 | function toggleRecentFolders() { |
| 20 | console.log("toggleRecentFolders"); |
| 21 | showRecentFolders = !showRecentFolders; |
| 22 | } |
| 23 | </script> |
| 24 | |
| 25 | <div class="container" class:hidden> |
| 26 | <div class="content"> |
| 27 | <div class="logo"></div> |
| 28 | |
| 29 | <h1>Svara</h1> |
| 30 | |
| 31 | <div class="quick-actions"> |
| 32 | <button on:click={() => addEditorTab()} ><DocumentBlank /> New file</button> |
| 33 | <button on:click={openFolderDialog} ><Folder /> Open Folder</button> |
| 34 | <button on:click={toggleRecentFolders} ><RecentlyViewed /> Recent...</button> |
| 35 | {#if showRecentFolders} |
| 36 | <RecentFolders on:close={toggleRecentFolders} /> |
| 37 | {/if} |
| 38 | <button on:click={() => addTab("Settings", "Settings", new settings({target: document.getElementById("tabview")}))}><Settings /> Settings</button> |
| 39 | </div> |
| 40 | </div> |
| 41 | |
| 42 | <div class="version">v{appVersion}-alpha</div> |
| 43 | </div> |
| 44 | |
| 45 | <style lang="scss"> |
| 46 | .hidden { |
| 47 | display: none !important; |
| 48 | } |
| 49 | |
| 50 | .container { |
| 51 | display: grid; |
| 52 | grid-template-areas: |
| 53 | ". header ." |
| 54 | ". footer ."; |
| 55 | grid-template-columns: 1fr 6fr 1fr; |
| 56 | grid-template-rows: minmax(min-content, auto) min-content; |
| 57 | height: 100%; |
| 58 | width: 100%; |
| 59 | } |
| 60 | |
| 61 | .content { |
| 62 | grid-area: header; |
| 63 | display: flex; |
| 64 | flex-direction: column; |
| 65 | align-items: center; |
| 66 | justify-content: center; |
| 67 | } |
| 68 | |
| 69 | .logo { |
| 70 | width: 200px; |
| 71 | height: 200px; |
| 72 | background-image: url('assets/images/Icon.png'); |
| 73 | background-size: contain; |
| 74 | background-repeat: no-repeat; |
| 75 | background-position: center; |
| 76 | } |
| 77 | |
| 78 | h1 { |
| 79 | font-size: 2.5rem; |
| 80 | margin-bottom: 3rem; |
| 81 | } |
| 82 | |
| 83 | .quick-actions { |
| 84 | width: 130px; |
| 85 | display: flex; |
| 86 | flex-direction: column; |
| 87 | gap: 0.1rem; |
| 88 | } |
| 89 | |
| 90 | button { |
| 91 | color: white; |
| 92 | display: flex; |
| 93 | align-items: center; |
| 94 | justify-content: flex-start; |
| 95 | width: 100%; |
| 96 | text-align: left; |
| 97 | padding: 0.5rem; |
| 98 | background: none; |
| 99 | border: none; |
| 100 | cursor: pointer; |
| 101 | transition: color 0.3s ease; |
| 102 | } |
| 103 | |
| 104 | button:hover { |
| 105 | color: #006FF2; |
| 106 | } |
| 107 | |
| 108 | button:focus { |
| 109 | border: none; |
| 110 | outline: none; |
| 111 | } |
| 112 | |
| 113 | button :global(svg) { |
| 114 | margin-right: 0.5rem; |
| 115 | fill: white; |
| 116 | transition: fill 0.3s ease; |
| 117 | } |
| 118 | |
| 119 | button:hover :global(svg) { |
| 120 | fill: #006FF2; |
| 121 | } |
| 122 | |
| 123 | .version { |
| 124 | color: rgba(255, 255, 255, 0.5); |
| 125 | grid-area: footer; |
| 126 | text-align: center; |
| 127 | margin-bottom: 0.5rem; |
| 128 | } |
| 129 | </style> |