|
| 1 | +<script setup lang="ts"> |
| 2 | +import VueCommand, { createStdout } from "vue-command"; |
| 3 | +import "vue-command/dist/vue-command.css"; |
| 4 | +import { useMainStore } from '../store'; |
| 5 | +import LoginPanel from './LoginPanel.vue'; |
| 6 | +import DebugPanel from './DebugPanel.vue'; |
| 7 | +
|
| 8 | +const mainStore = useMainStore(); |
| 9 | +
|
| 10 | +const commands = { |
| 11 | + "help": () => createStdout("Available commands: hello, login, debug"), |
| 12 | + "login": () => { |
| 13 | + mainStore.toggleLogin(); |
| 14 | + return createStdout("Login interface activated."); |
| 15 | + }, |
| 16 | + "hello": () => createStdout("Hello world! #wip"), |
| 17 | + "debug": () => { |
| 18 | + mainStore.toggleDebugPanel(); |
| 19 | + return createStdout("Debug panel activated."); |
| 20 | + }, |
| 21 | +}; |
| 22 | +</script> |
| 23 | + |
1 | 24 | <template> |
2 | 25 | <div class="cli-container"> |
3 | | - <vue-command :commands="commands" :hide-buttons="true" :show-help="true" :cursor-position="0" :is-fullscreen="true"> |
| 26 | + <vue-command :commands="commands" :hide-buttons="true" :show-help="true" :cursor-position="0" :is-fullscreen="true"> |
4 | 27 | <template #title>Command Line Interface v0.1 -- type "help" for instructions</template> |
5 | 28 | <template #prompt> |
6 | 29 | <span class="prompt"> |
|
13 | 36 | <template #help-text>asdfasdf</template> |
14 | 37 | <template #invert>true</template> |
15 | 38 | <template #font></template> |
16 | | - |
17 | 39 | </vue-command> |
| 40 | + <LoginPanel v-if="mainStore.showLogin" /> |
| 41 | + <DebugPanel v-if="mainStore.showDebugPanel" /> |
18 | 42 | </div> |
19 | 43 | </template> |
20 | 44 |
|
21 | | -<script lang="ts"> |
22 | | -// https://github.com/ndabAP/vue-command |
23 | | -import VueCommand, { createStdout } from "vue-command"; |
24 | | -import "vue-command/dist/vue-command.css"; |
25 | | -
|
26 | | -export default { |
27 | | - components: { |
28 | | - VueCommand, |
29 | | - }, |
30 | | -
|
31 | | - data: () => ({ |
32 | | - commands: { |
33 | | - "help": () => createStdout("Available commands: hello, login"), |
34 | | - "login": () => createStdout("Login not available (coming soon!)"), |
35 | | - "hello": () => createStdout("Hello world! #wip"), |
36 | | - }, |
37 | | - }), |
38 | | -}; |
39 | | -</script> |
40 | | - |
41 | 45 | <style scoped> |
42 | 46 | .cli-container { |
43 | 47 | /* Adjust the border-radius as needed */ |
|
0 commit comments