* Projects page * Continue work on bulk edit * editLinks is now bulkEdit * Bulk Edit Links completed * Edit URL clear fields. * Create project button + other bulk buttons. * Pagination (w/o reactivity.) * Apply suggestions from code review Co-authored-by: triphora <emmaffle@modrinth.com> * Sorting fixed, broken page count though? * Only make editable projects selectable + remove delete button * Shorthand * Start using computed * Fix pagination * Add Pagination Switching * Final Style Changes * Cleanup * Action Affects dropdown * Switch to checkbox swizzle * Projects dashboard, the most hellish thing I have ever worked on * Rewrite project dashboard without tables * why's that there * Fix mod message icon * New project settings page * Remove extra slash * Bulk project route and improve styling of links UI * Remove beta label from Monetization * Relevant page links in project settings * Don't vertically center header rows * Improve error messages, add remove project icon button, add saving feedback, begin project checklist, fix license settings * Remove contextual link from project settings, disable WIP checklist * Fix bulk edit * Project checklist, add featured gallery image to project pages, fix random bugs * Remove old check * Remove icon border on grid mode and hide project status card when unnecessary * Fix build * Make checklist progress smaller and add collapsing * Remove uneven gap on nav cards * Improve wrapping of checklist * Replace project settings header link with status * Fix bugs + status stuff * Fix warns + compile error * Update wording * Hide environment type nag for project types without it * Make member dropdown match Co-authored-by: mineblock11 <93472213+mineblock11@users.noreply.github.com> Co-authored-by: triphora <emmaffle@modrinth.com> Co-authored-by: Jai A <jaiagr+gpg@pm.me> Co-authored-by: Geometrically <18202329+Geometrically@users.noreply.github.com>
112 lines
2.0 KiB
Vue
112 lines
2.0 KiB
Vue
<template>
|
|
<label
|
|
:class="{ 'long-style': longStyle }"
|
|
@drop.prevent="handleDrop"
|
|
@dragover.prevent
|
|
>
|
|
<slot></slot>
|
|
{{ prompt }}
|
|
<input
|
|
type="file"
|
|
:multiple="multiple"
|
|
:accept="accept"
|
|
@change="handleChange"
|
|
/>
|
|
</label>
|
|
</template>
|
|
|
|
<script>
|
|
import { fileIsValid } from '~/plugins/fileUtils'
|
|
|
|
export default {
|
|
name: 'FileInput',
|
|
components: {},
|
|
props: {
|
|
prompt: {
|
|
type: String,
|
|
default: 'Select file',
|
|
},
|
|
multiple: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
accept: {
|
|
type: String,
|
|
default: null,
|
|
},
|
|
/**
|
|
* The max file size in bytes
|
|
*/
|
|
maxSize: {
|
|
type: Number,
|
|
default: null,
|
|
},
|
|
showIcon: {
|
|
type: Boolean,
|
|
default: true,
|
|
},
|
|
shouldAlwaysReset: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
longStyle: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
},
|
|
data() {
|
|
return {
|
|
files: [],
|
|
}
|
|
},
|
|
methods: {
|
|
addFiles(files, shouldNotReset) {
|
|
if (!shouldNotReset || this.shouldAlwaysReset) this.files = files
|
|
|
|
const validationOptions = { maxSize: this.maxSize, alertOnInvalid: true }
|
|
this.files = [...this.files].filter((file) =>
|
|
fileIsValid(file, validationOptions)
|
|
)
|
|
|
|
if (this.files.length > 0) {
|
|
this.$emit('change', this.files)
|
|
}
|
|
},
|
|
handleDrop(e) {
|
|
this.addFiles(e.dataTransfer.files)
|
|
},
|
|
handleChange(e) {
|
|
this.addFiles(e.target.files)
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
label {
|
|
flex-direction: unset;
|
|
max-height: unset;
|
|
|
|
svg {
|
|
height: 1rem;
|
|
}
|
|
|
|
input {
|
|
display: none;
|
|
}
|
|
|
|
&.long-style {
|
|
display: flex;
|
|
padding: 1.5rem 2rem;
|
|
justify-content: center;
|
|
align-items: center;
|
|
grid-gap: 0.5rem;
|
|
background-color: var(--color-button-bg);
|
|
border-radius: var(--size-rounded-sm);
|
|
border: dashed 0.3rem var(--color-text);
|
|
cursor: pointer;
|
|
color: var(--color-text-dark);
|
|
}
|
|
}
|
|
</style>
|