Tweak styling and layout
This commit is contained in:
parent
8f5d5ce3e2
commit
d011580074
@ -13,7 +13,7 @@ body {
|
|||||||
color: var(--fg-color);
|
color: var(--fg-color);
|
||||||
font-size: 12pt;
|
font-size: 12pt;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
padding: 0.5em;
|
padding: 0 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
button {
|
button {
|
||||||
|
|||||||
@ -30,9 +30,9 @@ pre {
|
|||||||
padding: 0.5em 1em 10em;
|
padding: 0.5em 1em 10em;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
overflow: scroll;
|
overflow: scroll;
|
||||||
min-height: 10rem;
|
min-height: 20rem;
|
||||||
height: 20rem;
|
height: 40rem;
|
||||||
max-height: 20rem;
|
max-height: 40rem;
|
||||||
background: rgba(255, 255, 255, 0.15);
|
background: rgba(255, 255, 255, 0.15);
|
||||||
color: #c0c0c0;
|
color: #c0c0c0;
|
||||||
border: 1px solid rgba(255, 255, 255, 0.3);
|
border: 1px solid rgba(255, 255, 255, 0.3);
|
||||||
|
|||||||
@ -6,16 +6,21 @@ const emit = defineEmits<{
|
|||||||
progress: [read: number, total: number]
|
progress: [read: number, total: number]
|
||||||
success: [data: ArrayBuffer]
|
success: [data: ArrayBuffer]
|
||||||
error: [message: string]
|
error: [message: string]
|
||||||
|
unload: []
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const MAX_FILE_SIZE = 1440 * 1024
|
const MAX_FILE_SIZE = 1440 * 1024
|
||||||
|
|
||||||
const fileInput = useTemplateRef('file-input')
|
const fileInput = useTemplateRef('file-input')
|
||||||
|
|
||||||
async function onOpenClick() {
|
async function onLoadClick() {
|
||||||
fileInput.value?.click()
|
fileInput.value?.click()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onEjectClick() {
|
||||||
|
emit('unload')
|
||||||
|
}
|
||||||
|
|
||||||
async function onFileChange(event: Event) {
|
async function onFileChange(event: Event) {
|
||||||
const files = (event.target as HTMLInputElement).files
|
const files = (event.target as HTMLInputElement).files
|
||||||
if (!files?.length) {
|
if (!files?.length) {
|
||||||
@ -75,7 +80,8 @@ function readFile(file: File): Promise<ArrayBuffer> {
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<input id="disk-file" ref="file-input" type="file" @change="onFileChange" />
|
<input id="disk-file" ref="file-input" type="file" @change="onFileChange" />
|
||||||
<button type="button" @click="onOpenClick">Open a disk image...</button>
|
<button class="eject" type="button" @click="onEjectClick">Eject</button>
|
||||||
|
<button class="load" type="button" @click="onLoadClick">Load</button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -83,4 +89,27 @@ function readFile(file: File): Promise<ArrayBuffer> {
|
|||||||
input[type='file'] {
|
input[type='file'] {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
min-width: 100px;
|
||||||
|
width: 100px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
button.eject {
|
||||||
|
background-color: tomato;
|
||||||
|
}
|
||||||
|
|
||||||
|
button.load {
|
||||||
|
background-color: chartreuse;
|
||||||
|
}
|
||||||
|
|
||||||
|
div {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
background: #404040;
|
||||||
|
padding: 1em;
|
||||||
|
border: 3px solid gray;
|
||||||
|
gap: 1em;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -91,13 +91,12 @@ const hexDump = computed(() => {
|
|||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
pre {
|
pre {
|
||||||
width: fit-content;
|
|
||||||
padding: 0.5em 1em 10em;
|
padding: 0.5em 1em 10em;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
min-height: 10rem;
|
min-height: 20rem;
|
||||||
height: 20rem;
|
height: 40rem;
|
||||||
max-height: 20rem;
|
max-height: 40rem;
|
||||||
background: rgba(255, 255, 255, 0.15);
|
background: rgba(255, 255, 255, 0.15);
|
||||||
color: #c0c0c0;
|
color: #c0c0c0;
|
||||||
border: 1px solid rgba(255, 255, 255, 0.3);
|
border: 1px solid rgba(255, 255, 255, 0.3);
|
||||||
|
|||||||
@ -41,6 +41,14 @@ function onReadProgress(read: number, total: number) {
|
|||||||
diskReadBytes.value = read
|
diskReadBytes.value = read
|
||||||
diskTotalBytes.value = total
|
diskTotalBytes.value = total
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onUnload() {
|
||||||
|
diskData.value = new ArrayBuffer(0)
|
||||||
|
diskReadError.value = ''
|
||||||
|
diskReadyState.value = 'empty'
|
||||||
|
diskReadBytes.value = -1
|
||||||
|
diskTotalBytes.value = -1
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -60,6 +68,7 @@ function onReadProgress(read: number, total: number) {
|
|||||||
@progress="onReadProgress"
|
@progress="onReadProgress"
|
||||||
@start="onReadStart"
|
@start="onReadStart"
|
||||||
@success="onReadSuccess"
|
@success="onReadSuccess"
|
||||||
|
@unload="onUnload"
|
||||||
/>
|
/>
|
||||||
<div v-if="diskReadyState === 'read-started'">
|
<div v-if="diskReadyState === 'read-started'">
|
||||||
{{ diskName }} reading
|
{{ diskName }} reading
|
||||||
@ -75,14 +84,14 @@ function onReadProgress(read: number, total: number) {
|
|||||||
<div v-else>No disk loaded</div>
|
<div v-else>No disk loaded</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<section v-if="diskReadyState === 'read-success'">
|
|
||||||
<h2>Disk Hex Dump</h2>
|
|
||||||
<HexDump :buffer="diskData" />
|
|
||||||
</section>
|
|
||||||
<section v-if="diskReadyState === 'read-success'">
|
<section v-if="diskReadyState === 'read-success'">
|
||||||
<h2>Disk Info</h2>
|
<h2>Disk Info</h2>
|
||||||
<DiskInfo :data="diskData" />
|
<DiskInfo :data="diskData" />
|
||||||
</section>
|
</section>
|
||||||
|
<section v-if="diskReadyState === 'read-success'">
|
||||||
|
<h2>Disk Hex Dump</h2>
|
||||||
|
<HexDump :buffer="diskData" />
|
||||||
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user