Changeset 35899


Ignore:
Timestamp:
2022-01-07T14:51:11+13:00 (2 years ago)
Author:
cstephen
Message:

Allow uploaded files to be removed before transcribing

Location:
main/trunk/model-interfaces-dev/atea/korero-maori-asr/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/model-interfaces-dev/atea/korero-maori-asr/src/components/AudioUpload.vue

    r35898 r35899  
    5656            this.$refs.audioFileInput.click();
    5757        },
     58        /**
     59         * Invoked when a drop event occurs on the file upload panel.
     60         * @param {DragEvent} ev The drop event.
     61         */
    5862        onFilesDropped(ev) {
    5963            ev.preventDefault();
     
    7276                this.files.push(ev.dataTransfer.files);
    7377            }
     78        },
     79        /**
     80         * Invoked when the user clicks a button to remove a file.
     81         * @param {MouseEvent} ev The mouse event.
     82         * @param {Number} index The index of the file to remove.
     83         */
     84        onFileRemove(ev, index) {
     85            ev.cancelBubble = true;
     86            this.files.splice(index, 1);
    7487        },
    7588        onFilesChanged() {
     
    171184            <div class="text-input-sl" style="cursor: pointer;"
    172185                @click="openFilePicker" @drop="onFilesDropped" @dragover="$event.preventDefault()">
    173                 <span class="text-placeholder material-icons" v-if="!anyFiles">&#xe226;</span> <!-- attach_file -->
     186                <span class="text-placeholder material-icons">&#xe226;</span> <!-- attach_file -->
    174187                <span class="text-placeholder" v-if="!anyFiles">{{ translations.get("AudioUpload_SelectFileText") }}</span>
    175                 <span v-if="anyFiles">{{ getFileNameList }}</span>
     188
     189                <div class="uploaded-file-listing" v-for="(file, index) in files" :key="file.name">
     190                    <span>{{ file.name }}</span>
     191                    <button type="button" @click="onFileRemove($event, index)" class="btn-pin">
     192                        <span class="material-icons mdi-s">close</span>
     193                    </button>
     194                </div>
    176195            </div>
    177196
     
    204223</template>
    205224
    206 <!-- Add "scoped" attribute to limit CSS to this component only -->
    207225<style scoped lang="scss">
    208226.audio-file-picker {
     
    220238}
    221239
     240.uploaded-file-listing {
     241    display: flex;
     242    align-items: center;
     243
     244    padding: 3px;
     245    gap: 5px;
     246
     247    border: 1px solid var(--bg-color);
     248    border-radius: 3px;
     249    border-left: 4px solid var(--bg-color);
     250    background: rgba(var(--bg-color-raw), 0.1);
     251
     252    margin-right: 0.5em;
     253    &:last-child {
     254        margin-right: 0;
     255    }
     256}
     257
    222258.input-bar {
    223259    display: grid;
  • main/trunk/model-interfaces-dev/atea/korero-maori-asr/src/styles/_material.scss

    r35731 r35899  
    131131    border-radius: 50%;
    132132    padding: 0.3em;
     133}
     134
     135.btn-pin {
     136    appearance: none;
     137    display: flex;
     138    align-items: center;
     139    justify-content: center;
     140
     141    margin: 0;
     142    padding: 2px;
     143    background: none;
     144    border: none;
     145    border-radius: 50%;
     146
     147    &:hover {
     148        background-color: rgba(30, 30, 30, 0.15);
     149    }
    133150}
    134151
Note: See TracChangeset for help on using the changeset viewer.