diff --git a/resources/js/components/SMInput.vue b/resources/js/components/SMInput.vue
index b7a6f8c..9ffb8f3 100644
--- a/resources/js/components/SMInput.vue
+++ b/resources/js/components/SMInput.vue
@@ -9,24 +9,66 @@
-
-
-
+
+
+ {{ value }}
+
+
+
+
+
+ {{ value?.name ? value.name : value }}
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -37,7 +79,7 @@
@@ -326,6 +391,40 @@ const handleClear = () => {
cursor: not-allowed;
}
}
+
+ .static-input-control {
+ width: 100%;
+ padding: 22px 16px 8px 16px;
+ border: 1px solid var(--base-color-darker);
+ border-radius: 8px;
+ background-color: var(--base-color);
+ height: 52px;
+ }
+
+ .file-input-control {
+ opacity: 0;
+ width: 0.1px;
+ height: 0.1px;
+ position: absolute;
+ margin-left: -9999px;
+ }
+
+ .file-input-control-value {
+ width: 100%;
+ padding: 22px 16px 8px 16px;
+ border: 1px solid var(--base-color-darker);
+ border-radius: 8px 0 0 8px;
+ background-color: var(--base-color);
+ height: 52px;
+ }
+
+ .file-input-control-button {
+ border-width: 1px 1px 1px 0;
+ border-style: solid;
+ border-color: var(--base-color-darker);
+ border-radius: 0 8px 8px 0;
+ padding: 15px 30px;
+ }
}
}
diff --git a/resources/js/components/SMRow.vue b/resources/js/components/SMRow.vue
index 596d45b..24e5914 100644
--- a/resources/js/components/SMRow.vue
+++ b/resources/js/components/SMRow.vue
@@ -25,7 +25,7 @@ defineProps({
display: flex;
flex-direction: row;
margin: 8px auto;
- align-items: top;
+ align-items: flex-start;
width: 100%;
max-width: 1200px;
}
diff --git a/resources/js/helpers/api.types.ts b/resources/js/helpers/api.types.ts
index 484722c..8d8079b 100644
--- a/resources/js/helpers/api.types.ts
+++ b/resources/js/helpers/api.types.ts
@@ -30,12 +30,14 @@ export interface Media {
user_id: string;
title: string;
name: string;
- mime: string;
- permission: Array;
+ mime_type: string;
+ permission: string;
size: number;
status: string;
+ storage: string;
url: string;
description: string;
+ dimensions: string;
variants: { [key: string]: string };
created_at: string;
updated_at: string;
diff --git a/resources/js/helpers/url.ts b/resources/js/helpers/url.ts
index 6438edf..abc3bea 100644
--- a/resources/js/helpers/url.ts
+++ b/resources/js/helpers/url.ts
@@ -95,3 +95,12 @@ export const updateRouterParams = (router: Router, params: Params): void => {
router.push({ query });
};
+
+export const extractFileNameFromUrl = (url: string): string => {
+ const matches = url.match(/\/([^/]+\.[^/]+)$/);
+ if (!matches) {
+ return "";
+ }
+ const fileName = matches[1];
+ return fileName;
+};
diff --git a/resources/js/helpers/utils.ts b/resources/js/helpers/utils.ts
index 354c73b..0299441 100644
--- a/resources/js/helpers/utils.ts
+++ b/resources/js/helpers/utils.ts
@@ -1,3 +1,5 @@
+import { extractFileNameFromUrl } from "./url";
+
/**
* Tests if an object or string is empty.
*
@@ -55,7 +57,7 @@ export const getFileIconImagePath = (fileName: string): string => {
* @returns {string} The url to the file preview icon.
*/
export const getFilePreview = (url: string): string => {
- const ext = getFileExtension(fileName);
+ const ext = getFileExtension(extractFileNameFromUrl(url));
if (ext.length > 0) {
if (/(gif|jpe?g|png)/i.test(ext)) {
return `${url}?size=thumb`;
@@ -80,3 +82,19 @@ export const clamp = (n: number, min: number, max: number): number => {
if (n > max) return max;
return n;
};
+
+/**
+ * Generate a random element ID.
+ *
+ * @param {string} prefix Any prefix to add to the ID.
+ * @returns {string} A random string non-existent in the document.
+ */
+export const generateRandomElementId = (prefix: string = ""): string => {
+ let randomId = "";
+
+ do {
+ randomId = prefix + Math.random().toString(36).substring(2, 9);
+ } while (document.getElementById(randomId));
+
+ return randomId;
+};
diff --git a/resources/js/helpers/validate.ts b/resources/js/helpers/validate.ts
index ca3c177..73db3cb 100644
--- a/resources/js/helpers/validate.ts
+++ b/resources/js/helpers/validate.ts
@@ -2,7 +2,7 @@ import { bytesReadable } from "../helpers/types";
import { SMDate } from "./datetime";
export interface ValidationObject {
- validate: (value: string) => Promise;
+ validate: (value: any) => Promise;
}
export interface ValidationResult {
@@ -818,7 +818,7 @@ const defaultValidationFileSizeOptions: ValidationFileSizeOptions = {
};
/**
- * Validate field is in a valid Email format
+ * Validate file is equal or less than size.
*
* @param options options data
* @returns ValidationEmailObject
diff --git a/resources/js/views/dashboard/MediaEdit.vue b/resources/js/views/dashboard/MediaEdit.vue
index 9c52541..94e3605 100644
--- a/resources/js/views/dashboard/MediaEdit.vue
+++ b/resources/js/views/dashboard/MediaEdit.vue
@@ -1,115 +1,153 @@
-
-
- {{ page_title }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+