Skip to content

Commit

Permalink
enhance(frontend): tweak drive file component
Browse files Browse the repository at this point in the history
  • Loading branch information
syuilo committed Nov 2, 2023
1 parent 5f88880 commit 7f5ad5b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
7 changes: 6 additions & 1 deletion packages/frontend/src/components/MkDrive.file.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import { i18n } from '@/i18n.js';
import { $i } from '@/account.js';
import { useRouter } from '@/router.js';
import { getDriveFileMenu } from '@/scripts/get-drive-file-menu.js';
import { deviceKind } from '@/scripts/device-kind.js';

const router = useRouter();

Expand Down Expand Up @@ -74,7 +75,11 @@ function onClick(ev: MouseEvent) {
if (props.selectMode) {
emit('chosen', props.file);
} else {
router.push(`/my/drive/file/${props.file.id}`);
if (deviceKind === 'desktop') {
router.push(`/my/drive/file/${props.file.id}`);
} else {
os.popupMenu(getDriveFileMenu(props.file, props.folder), (ev.currentTarget ?? ev.target ?? undefined) as HTMLElement | undefined);
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions packages/frontend/src/pages/drive.file.info.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ SPDX-License-Identifier: AGPL-3.0-only
<template #key>{{ i18n.ts._fileViewer.size }}</template>
<template #value>{{ bytes(file.size) }}</template>
</MkKeyValue>
<MkKeyValue :class="$style.fileMetaDataChildren" :copy="file.url">
<template #key>URL</template>
<template #value>{{ file.url }}</template>
</MkKeyValue>
</div>
</div>
<div v-else class="_fullinfo">
Expand Down
10 changes: 5 additions & 5 deletions packages/frontend/src/scripts/get-drive-file-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ export function getDriveFileMenu(file: Misskey.entities.DriveFile, folder?: Miss
const isImage = file.type.startsWith('image/');
let menu;
menu = [{
type: 'link',
to: `/my/drive/file/${file.id}`,
text: i18n.ts._fileViewer.title,
icon: 'ti ti-info-circle',
}, null, {
text: i18n.ts.rename,
icon: 'ti ti-forms',
action: () => rename(file),
Expand Down Expand Up @@ -113,11 +118,6 @@ export function getDriveFileMenu(file: Misskey.entities.DriveFile, folder?: Miss
text: i18n.ts.download,
icon: 'ti ti-download',
download: file.name,
}, null, {
type: 'link',
to: `/my/drive/file/${file.id}`,
text: i18n.ts._fileViewer.title,
icon: 'ti ti-file',
}, null, {
text: i18n.ts.delete,
icon: 'ti ti-trash',
Expand Down

0 comments on commit 7f5ad5b

Please sign in to comment.