Fix stuff
This commit is contained in:
parent
e5aba2fdec
commit
183507524b
@ -8,7 +8,7 @@ export const useLayoutStore = defineStore("layout", {
|
|||||||
loading: boolean;
|
loading: boolean;
|
||||||
show: string | null | boolean;
|
show: string | null | boolean;
|
||||||
showConfirm: any;
|
showConfirm: any;
|
||||||
showAction: boolean | null;
|
showAction: PopupAction | null;
|
||||||
showShell: boolean | null;
|
showShell: boolean | null;
|
||||||
} => ({
|
} => ({
|
||||||
loading: false,
|
loading: false,
|
||||||
@ -25,7 +25,7 @@ export const useLayoutStore = defineStore("layout", {
|
|||||||
toggleShell() {
|
toggleShell() {
|
||||||
this.showShell = !this.showShell;
|
this.showShell = !this.showShell;
|
||||||
},
|
},
|
||||||
showHover(value: LayoutValue | string) {
|
showHover(value: PopupProps | string) {
|
||||||
if (typeof value !== "object") {
|
if (typeof value !== "object") {
|
||||||
this.show = value;
|
this.show = value;
|
||||||
return;
|
return;
|
||||||
|
|||||||
4
frontend/src/types/common.d.ts
vendored
4
frontend/src/types/common.d.ts
vendored
@ -1,4 +0,0 @@
|
|||||||
interface Sorting {
|
|
||||||
by: string;
|
|
||||||
asc: boolean;
|
|
||||||
}
|
|
||||||
6
frontend/src/types/file.d.ts
vendored
6
frontend/src/types/file.d.ts
vendored
@ -23,8 +23,10 @@ interface Resource extends ResourceBase {
|
|||||||
content?: string;
|
content?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
// interface ResourceItem extends ResourceBase {
|
interface ResourceItem extends ResourceBase {
|
||||||
// }
|
index?: number;
|
||||||
|
subtitles?: string[];
|
||||||
|
}
|
||||||
|
|
||||||
type ResourceType =
|
type ResourceType =
|
||||||
| "video"
|
| "video"
|
||||||
|
|||||||
5
frontend/src/types/global.d.ts
vendored
5
frontend/src/types/global.d.ts
vendored
@ -5,4 +5,9 @@ declare global {
|
|||||||
FileBrowser: any;
|
FileBrowser: any;
|
||||||
grecaptcha: any;
|
grecaptcha: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface HTMLElement {
|
||||||
|
// TODO: no idea what the exact type is
|
||||||
|
__vue__: any;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
6
frontend/src/types/layout.d.ts
vendored
6
frontend/src/types/layout.d.ts
vendored
@ -1,5 +1,7 @@
|
|||||||
interface LayoutValue {
|
interface PopupProps {
|
||||||
prompt: string;
|
prompt: string;
|
||||||
confirm: any;
|
confirm: any;
|
||||||
action?: boolean;
|
action?: PopupAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type PopupAction = (e: Event) => void;
|
||||||
|
|||||||
2
frontend/src/types/settings.d.ts
vendored
2
frontend/src/types/settings.d.ts
vendored
@ -13,7 +13,7 @@ interface ISettings {
|
|||||||
interface SettingsDefaults {
|
interface SettingsDefaults {
|
||||||
scope: string;
|
scope: string;
|
||||||
locale: string;
|
locale: string;
|
||||||
viewMode: string;
|
viewMode: ViewModeType;
|
||||||
singleClick: boolean;
|
singleClick: boolean;
|
||||||
sorting: Sorting;
|
sorting: Sorting;
|
||||||
perm: Permissions;
|
perm: Permissions;
|
||||||
|
|||||||
4
frontend/src/types/upload.d.ts
vendored
4
frontend/src/types/upload.d.ts
vendored
@ -19,10 +19,10 @@ interface UploadItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface UploadEntry {
|
interface UploadEntry {
|
||||||
fullPath: string;
|
|
||||||
isDir: boolean;
|
|
||||||
name: string;
|
name: string;
|
||||||
size: number;
|
size: number;
|
||||||
|
isDir: boolean;
|
||||||
|
fullPath?: string;
|
||||||
file?: File;
|
file?: File;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
11
frontend/src/types/user.d.ts
vendored
11
frontend/src/types/user.d.ts
vendored
@ -11,13 +11,12 @@ interface IUser {
|
|||||||
hideDotfiles: boolean;
|
hideDotfiles: boolean;
|
||||||
singleClick: boolean;
|
singleClick: boolean;
|
||||||
dateFormat: boolean;
|
dateFormat: boolean;
|
||||||
viewMode: "list" | "mosaic" | "mosaic gallery";
|
viewMode: ViewModeType;
|
||||||
sorting?: {
|
sorting?: Sorting;
|
||||||
by: string,
|
|
||||||
asc: boolean
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ViewModeType = "list" | "mosaic" | "mosaic gallery";
|
||||||
|
|
||||||
interface IUserForm {
|
interface IUserForm {
|
||||||
id?: number;
|
id?: number;
|
||||||
username?: string;
|
username?: string;
|
||||||
@ -48,7 +47,7 @@ interface Permissions {
|
|||||||
upload: boolean;
|
upload: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface UserSorting {
|
interface Sorting {
|
||||||
by: string;
|
by: string;
|
||||||
asc: boolean;
|
asc: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,10 @@
|
|||||||
import { useUploadStore } from "@/stores/upload";
|
import { useUploadStore } from "@/stores/upload";
|
||||||
import url from "@/utils/url";
|
import url from "@/utils/url";
|
||||||
|
|
||||||
export function checkConflict(files: UploadList, dest: Resource[]): boolean {
|
export function checkConflict(
|
||||||
|
files: UploadList,
|
||||||
|
dest: ResourceItem[]
|
||||||
|
): boolean {
|
||||||
if (typeof dest === "undefined" || dest === null) {
|
if (typeof dest === "undefined" || dest === null) {
|
||||||
dest = [];
|
dest = [];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -303,6 +303,7 @@ import {
|
|||||||
} from "vue";
|
} from "vue";
|
||||||
import { useRoute } from "vue-router";
|
import { useRoute } from "vue-router";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
|
import { storeToRefs } from "pinia";
|
||||||
|
|
||||||
const showLimit = ref<number>(50);
|
const showLimit = ref<number>(50);
|
||||||
const columnWidth = ref<number>(280);
|
const columnWidth = ref<number>(280);
|
||||||
@ -317,6 +318,8 @@ const authStore = useAuthStore();
|
|||||||
const fileStore = useFileStore();
|
const fileStore = useFileStore();
|
||||||
const layoutStore = useLayoutStore();
|
const layoutStore = useLayoutStore();
|
||||||
|
|
||||||
|
const { req } = storeToRefs(fileStore);
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
@ -428,9 +431,7 @@ const isMobile = computed(() => {
|
|||||||
return width.value <= 736;
|
return width.value <= 736;
|
||||||
});
|
});
|
||||||
|
|
||||||
// @ts-ignore
|
watch(req, () => {
|
||||||
// TODO
|
|
||||||
watch(fileStore.req, () => {
|
|
||||||
// Reset the show value
|
// Reset the show value
|
||||||
showLimit.value = 50;
|
showLimit.value = 50;
|
||||||
|
|
||||||
@ -725,7 +726,6 @@ const drop = async (event: DragEvent) => {
|
|||||||
) {
|
) {
|
||||||
// Get url from ListingItem instance
|
// Get url from ListingItem instance
|
||||||
// TODO: Don't know what is happening here
|
// TODO: Don't know what is happening here
|
||||||
// @ts-ignore
|
|
||||||
path = el.__vue__.url;
|
path = el.__vue__.url;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -740,8 +740,6 @@ const drop = async (event: DragEvent) => {
|
|||||||
if (conflict) {
|
if (conflict) {
|
||||||
layoutStore.showHover({
|
layoutStore.showHover({
|
||||||
prompt: "replace",
|
prompt: "replace",
|
||||||
// TODO: don't know yet
|
|
||||||
// @ts-ignore
|
|
||||||
action: (event: Event) => {
|
action: (event: Event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
layoutStore.closeHovers();
|
layoutStore.closeHovers();
|
||||||
@ -766,53 +764,50 @@ const uploadInput = (event: Event) => {
|
|||||||
let files = (event.currentTarget as HTMLInputElement)?.files;
|
let files = (event.currentTarget as HTMLInputElement)?.files;
|
||||||
if (files === null) return;
|
if (files === null) return;
|
||||||
|
|
||||||
let folder_upload =
|
let folder_upload = !files[0].webkitRelativePath;
|
||||||
files[0].webkitRelativePath !== undefined &&
|
|
||||||
files[0].webkitRelativePath !== "";
|
|
||||||
|
|
||||||
if (folder_upload) {
|
const uploadFiles: UploadList = [];
|
||||||
for (let i = 0; i < files.length; i++) {
|
for (let i = 0; i < files.length; i++) {
|
||||||
let file = files[i];
|
const file = files[i];
|
||||||
// @ts-ignore
|
const fullPath = folder_upload ? file.webkitRelativePath : undefined;
|
||||||
files[i].fullPath = file.webkitRelativePath;
|
uploadFiles.push({
|
||||||
}
|
file,
|
||||||
|
name: file.name,
|
||||||
|
size: file.size,
|
||||||
|
isDir: false,
|
||||||
|
fullPath,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let path = route.path.endsWith("/") ? route.path : route.path + "/";
|
let path = route.path.endsWith("/") ? route.path : route.path + "/";
|
||||||
// @ts-ignore
|
let conflict = upload.checkConflict(uploadFiles, fileStore.req!.items);
|
||||||
let conflict = upload.checkConflict(files, fileStore.req.items);
|
|
||||||
|
|
||||||
if (conflict) {
|
if (conflict) {
|
||||||
layoutStore.showHover({
|
layoutStore.showHover({
|
||||||
prompt: "replace",
|
prompt: "replace",
|
||||||
// @ts-ignore
|
|
||||||
action: (event: Event) => {
|
action: (event: Event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
layoutStore.closeHovers();
|
layoutStore.closeHovers();
|
||||||
// @ts-ignore
|
upload.handleFiles(uploadFiles, path, false);
|
||||||
upload.handleFiles(files, path, false);
|
|
||||||
},
|
},
|
||||||
confirm: (event: Event) => {
|
confirm: (event: Event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
layoutStore.closeHovers();
|
layoutStore.closeHovers();
|
||||||
// @ts-ignore
|
upload.handleFiles(uploadFiles, path, true);
|
||||||
upload.handleFiles(files, path, true);
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ts-ignore
|
upload.handleFiles(uploadFiles, path);
|
||||||
upload.handleFiles(files, path);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const resetOpacity = () => {
|
const resetOpacity = () => {
|
||||||
let items = document.getElementsByClassName("item");
|
let items = document.getElementsByClassName("item");
|
||||||
|
|
||||||
// @ts-ignore
|
Array.from(items).forEach((file: Element) => {
|
||||||
Array.from(items).forEach((file: HTMLElement) => {
|
(file as HTMLElement).style.opacity = "1";
|
||||||
file.style.opacity = "1";
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -164,7 +164,7 @@ const mediaTypes: ResourceType[] = ["image", "video", "audio", "blob"];
|
|||||||
|
|
||||||
const previousLink = ref<string>("");
|
const previousLink = ref<string>("");
|
||||||
const nextLink = ref<string>("");
|
const nextLink = ref<string>("");
|
||||||
const listing = ref<null | Resource[]>(null);
|
const listing = ref<ResourceItem[] | null>(null);
|
||||||
const name = ref<string>("");
|
const name = ref<string>("");
|
||||||
const fullSize = ref<boolean>(false);
|
const fullSize = ref<boolean>(false);
|
||||||
const showNav = ref<boolean>(true);
|
const showNav = ref<boolean>(true);
|
||||||
@ -318,7 +318,7 @@ const updatePreview = async () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const prefetchUrl = (item: Resource) => {
|
const prefetchUrl = (item: ResourceItem) => {
|
||||||
if (item.type !== "image") {
|
if (item.type !== "image") {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user