forked from didirus/AstralRinth
* chore: dedupe lockfile Signed-off-by: Evan Song <theevansong@gmail.com> * fix: incorrect spacing between editing and browsing state Signed-off-by: Evan Song <theevansong@gmail.com> * chore: improve files image viewer toolbar Signed-off-by: Evan Song <theevansong@gmail.com> * chore: image viewer cursor affordance Signed-off-by: Evan Song <theevansong@gmail.com> * chore: clean imports Signed-off-by: Evan Song <theevansong@gmail.com> * chore: add tooltips Signed-off-by: Evan Song <theevansong@gmail.com> * chore: use black background Signed-off-by: Evan Song <theevansong@gmail.com> * feat: show scale factor, handle large images, consolidate state Signed-off-by: Evan Song <theevansong@gmail.com> * chore: add types to fs operations Signed-off-by: Evan Song <theevansong@gmail.com> * feat: add date create sorting option Signed-off-by: Evan Song <theevansong@gmail.com> * fix: match name of folder creation modal Signed-off-by: Evan Song <theevansong@gmail.com> * fix: add it here too Signed-off-by: Evan Song <theevansong@gmail.com> * feat: add creation date to file item, file manager header Signed-off-by: Evan Song <theevansong@gmail.com> * chore: a11y Signed-off-by: Evan Song <theevansong@gmail.com> * fix: ensure move item modal always has leading slash Signed-off-by: Evan Song <theevansong@gmail.com> * fix: correct move input placeholder Signed-off-by: Evan Song <theevansong@gmail.com> * chore: correct design disparity Signed-off-by: Evan Song <theevansong@gmail.com> * chore: add better affordance on active file item state Signed-off-by: Evan Song <theevansong@gmail.com> * fix: correct instances where we dont sentence case Signed-off-by: Evan Song <theevansong@gmail.com> * chore: clean Signed-off-by: Evan Song <theevansong@gmail.com> * chore: notify that server restarted on saveandrestart Signed-off-by: Evan Song <theevansong@gmail.com> * fix: consolidate error state in file manager Signed-off-by: Evan Song <theevansong@gmail.com> * chore: adjust sizing Signed-off-by: Evan Song <theevansong@gmail.com> * feat: drag and drop file items to move them Signed-off-by: Evan Song <theevansong@gmail.com> * feat: enable ability to drag folders too Signed-off-by: Evan Song <theevansong@gmail.com> * feat: better file movement toasts Signed-off-by: Evan Song <theevansong@gmail.com> * just say u hate me Signed-off-by: Evan Song <theevansong@gmail.com> * feat: uploading indicator for file uploads Signed-off-by: Evan Song <theevansong@gmail.com> * chore: cleaner file item ghost when dragging Signed-off-by: Evan Song <theevansong@gmail.com> * fix: enforce max length and truncate on ghost Signed-off-by: Evan Song <theevansong@gmail.com> * chore: improve item rename toast Signed-off-by: Evan Song <theevansong@gmail.com> * chore: improve item create toast Signed-off-by: Evan Song <theevansong@gmail.com> * feat: undo and redo stack Signed-off-by: Evan Song <theevansong@gmail.com> * fix: confusing behavior where folders were not sorted alphabetically Signed-off-by: Evan Song <theevansong@gmail.com> * feat: find and replace in file editor Signed-off-by: Evan Song <theevansong@gmail.com> * feat: correctly set language mode of file editor Signed-off-by: Evan Song <theevansong@gmail.com> * chore: slop Signed-off-by: Evan Song <theevansong@gmail.com> * chore: actually handle case with multiple dots in file name before setting language Signed-off-by: Evan Song <theevansong@gmail.com> * fix: match move icons in file context/threedot Signed-off-by: Evan Song <theevansong@gmail.com> * feat: upload indicator Signed-off-by: Evan Song <theevansong@gmail.com> * chore: dedupe lockfile again Signed-off-by: Evan Song <theevansong@gmail.com> * lockfile Signed-off-by: Evan Song <theevansong@gmail.com> * fix: file undefinedness Signed-off-by: Evan Song <theevansong@gmail.com> * checkpoint Signed-off-by: Evan Song <theevansong@gmail.com> * checkpoint Signed-off-by: Evan Song <theevansong@gmail.com> * checkpoint Signed-off-by: Evan Song <theevansong@gmail.com> * remove shitty animation logic Signed-off-by: Evan Song <theevansong@gmail.com> * feat: file upload queuer Signed-off-by: Evan Song <theevansong@gmail.com> * chore: only allow editable files to have active affordance Signed-off-by: Evan Song <theevansong@gmail.com> * fix: properly throw pyrofetcherror when rename fails Signed-off-by: Evan Song <theevansong@gmail.com> * feat: cancel file uploads Signed-off-by: Evan Song <theevansong@gmail.com> * chore: clean Signed-off-by: Evan Song <theevansong@gmail.com> --------- Signed-off-by: Evan Song <theevansong@gmail.com>
107 lines
2.4 KiB
Vue
107 lines
2.4 KiB
Vue
<template>
|
|
<div
|
|
class="fixed"
|
|
:style="{
|
|
transform: `translateY(${isAtBottom ? '-100%' : '0'})`,
|
|
top: `${y}px`,
|
|
left: `${x}px`,
|
|
}"
|
|
>
|
|
<Transition>
|
|
<div
|
|
v-if="item"
|
|
id="item-context-menu"
|
|
ref="ctxRef"
|
|
:style="{
|
|
border: '1px solid var(--color-divider)',
|
|
borderRadius: 'var(--radius-lg)',
|
|
backgroundColor: 'var(--color-raised-bg)',
|
|
padding: 'var(--gap-sm)',
|
|
boxShadow: 'var(--shadow-floating)',
|
|
gap: 'var(--gap-xs)',
|
|
width: 'max-content',
|
|
}"
|
|
class="flex h-fit w-fit select-none flex-col"
|
|
>
|
|
<button
|
|
class="btn btn-transparent flex !w-full items-center"
|
|
@click="$emit('rename', item)"
|
|
>
|
|
<EditIcon class="h-5 w-5" />
|
|
Rename
|
|
</button>
|
|
<button class="btn btn-transparent flex !w-full items-center" @click="$emit('move', item)">
|
|
<RightArrowIcon />
|
|
Move
|
|
</button>
|
|
<button
|
|
v-if="item.type !== 'directory'"
|
|
class="btn btn-transparent flex !w-full items-center"
|
|
@click="$emit('download', item)"
|
|
>
|
|
<DownloadIcon class="h-5 w-5" />
|
|
Download
|
|
</button>
|
|
<button
|
|
class="btn btn-transparent btn-red flex !w-full items-center"
|
|
@click="$emit('delete', item)"
|
|
>
|
|
<TrashIcon class="h-5 w-5" />
|
|
Delete
|
|
</button>
|
|
</div>
|
|
</Transition>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { EditIcon, DownloadIcon, TrashIcon, RightArrowIcon } from "@modrinth/assets";
|
|
|
|
interface FileItem {
|
|
type: string;
|
|
name: string;
|
|
[key: string]: any;
|
|
}
|
|
|
|
defineProps<{
|
|
item: FileItem | null;
|
|
x: number;
|
|
y: number;
|
|
isAtBottom: boolean;
|
|
}>();
|
|
|
|
const ctxRef = ref<HTMLElement | null>(null);
|
|
|
|
defineEmits<{
|
|
(e: "rename", item: FileItem): void;
|
|
(e: "move", item: FileItem): void;
|
|
(e: "download", item: FileItem): void;
|
|
(e: "delete", item: FileItem): void;
|
|
}>();
|
|
|
|
defineExpose({
|
|
ctxRef,
|
|
});
|
|
</script>
|
|
|
|
<style scoped>
|
|
#item-context-menu {
|
|
transition:
|
|
transform 0.1s ease,
|
|
opacity 0.1s ease;
|
|
transform-origin: top left;
|
|
}
|
|
|
|
#item-context-menu.v-enter-active,
|
|
#item-context-menu.v-leave-active {
|
|
transform: scale(1);
|
|
opacity: 1;
|
|
}
|
|
|
|
#item-context-menu.v-enter-from,
|
|
#item-context-menu.v-leave-to {
|
|
transform: scale(0.5);
|
|
opacity: 0;
|
|
}
|
|
</style>
|