{
+ $refs.drop_area.style.visibility = 'hidden'
+ if (event.dataTransfer && event.dataTransfer.files && fileAllowed) {
+ $emit('change', event.dataTransfer.files)
+ }
+ }
+ "
+ @dragenter.prevent="allowDrag"
+ @dragover.prevent="allowDrag"
+ @dragleave.prevent="$refs.drop_area.style.visibility = 'hidden'"
+ />
+
+
+
+
diff --git a/lib/components/base/FileInput.vue b/lib/components/base/FileInput.vue
new file mode 100644
index 000000000..9bc463b70
--- /dev/null
+++ b/lib/components/base/FileInput.vue
@@ -0,0 +1,96 @@
+
+
+
+
+
+
+
diff --git a/lib/components/index.js b/lib/components/index.js
index 53d75e4ed..f3d9214a9 100644
--- a/lib/components/index.js
+++ b/lib/components/index.js
@@ -11,8 +11,11 @@ export { default as TextLogo } from './brand/TextLogo.vue'
export { default as Pagination } from './base/Pagination.vue'
export { default as ProjectCard } from './base/ProjectCard.vue'
export { default as EnvironmentIndicator } from './base/EnvironmentIndicator.vue'
+export { default as FileInput } from './base/FileInput.vue'
+export { default as DropArea } from './base/DropArea.vue'
export { default as Categories } from './search/Categories.vue'
+export { default as SearchFilter } from './search/SearchFilter.vue'
export { default as NavItem } from './nav/NavItem.vue'
export { default as NavRow } from './nav/NavRow.vue'
diff --git a/lib/components/search/Categories.vue b/lib/components/search/Categories.vue
index 676b92494..267e37720 100644
--- a/lib/components/search/Categories.vue
+++ b/lib/components/search/Categories.vue
@@ -39,7 +39,7 @@ export default {
flex-wrap: wrap;
gap: var(--gap-sm);
- span ::v-deep {
+ :deep(span) {
display: flex;
flex-direction: row;
color: var(--color-icon);
diff --git a/lib/components/search/SearchFilter.vue b/lib/components/search/SearchFilter.vue
new file mode 100644
index 000000000..5627d5393
--- /dev/null
+++ b/lib/components/search/SearchFilter.vue
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
{{ displayName }}
+
+
+
+
+
+
+
diff --git a/lib/components/utils.js b/lib/components/utils.js
index 03112ddf3..25c0c7ee5 100644
--- a/lib/components/utils.js
+++ b/lib/components/utils.js
@@ -189,3 +189,34 @@ export function cycleValue(value, values) {
const index = values.indexOf(value) + 1
return values[index % values.length]
}
+
+export const fileIsValid = (file, validationOptions) => {
+ const { maxSize, alertOnInvalid } = validationOptions
+ if (maxSize !== null && maxSize !== undefined && file.size > maxSize) {
+ if (alertOnInvalid) {
+ alert(`File ${file.name} is too big! Must be less than ${formatBytes(maxSize)}`)
+ }
+ return false
+ }
+
+ return true
+}
+
+export const acceptFileFromProjectType = (projectType) => {
+ switch (projectType) {
+ case 'mod':
+ return '.jar,.zip,.litemod,application/java-archive,application/x-java-archive,application/zip'
+ case 'plugin':
+ return '.jar,.zip,application/java-archive,application/x-java-archive,application/zip'
+ case 'resourcepack':
+ return '.zip,application/zip'
+ case 'shader':
+ return '.zip,application/zip'
+ case 'datapack':
+ return '.zip,application/zip'
+ case 'modpack':
+ return '.mrpack,application/x-modrinth-modpack+zip,application/zip'
+ default:
+ return '*'
+ }
+}