Skip to content

Commit 0f007a5

Browse files
committed
refactor: Improve menu and ui
1 parent 219fb47 commit 0f007a5

File tree

9 files changed

+60
-36
lines changed

9 files changed

+60
-36
lines changed

runtime/assets/styles/index.scss

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020

2121
:root {
2222
--owd-font-family: ms-sans-serif, 'sans-serif';
23-
--p-font-size: 14px;
23+
--p-font-size: 0.9rem;
2424

2525
--owd-windov-nav-height: 26px;
26-
--owd-system-bar-height: 40px;
26+
--owd-system-bar-height: 38px;
2727

2828
--owd-border-color:
2929
rgb(var(--owd-theme-color-white)) var(--owd-border-width)
@@ -88,3 +88,17 @@
8888
inset 0 -2px 0 0 rgb(var(--owd-theme-color-grey)),
8989
inset 2px 0 0 0 rgb(var(--owd-theme-color-black));
9090
}
91+
92+
::selection {
93+
background: rgb(var(--owd-elevation-active-background));
94+
color: rgb(var(--owd-elevation-active-color));
95+
}
96+
97+
.owd-desktop {
98+
font-size: 0.9rem;
99+
line-height: 1rem;
100+
}
101+
102+
.text-sm {
103+
padding: 2px;
104+
}

runtime/assets/styles/partials/contextmenu.scss

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
--p-contextmenu-background: var(--p-surface-900);
33
--p-contextmenu-submenu-background: var(--p-contextmenu-background);
44
--p-contextmenu-shadow: var(--owd-border-color);
5-
--p-contextmenu-item-padding: 8px 8px;
5+
--p-contextmenu-item-padding: 6px 8px;
66
--p-contextmenu-submenu-label-padding: 4px 8px;
77
--p-contextmenu-submenu-label-font-weight: 600;
88
}
@@ -11,16 +11,19 @@
1111
font-family: var(--owd-font-family);
1212
font-size: var(--p-font-size);
1313
border-width: 2px;
14+
padding: var(--owd-border-width);
1415

15-
&-item-content {
16-
&:hover {
17-
background: rgb(var(--owd-elevation-active-background)) !important;
18-
color: rgb(var(--owd-elevation-active-color)) !important;
16+
&-item {
17+
&-content {
18+
&:hover {
19+
background: rgb(var(--owd-elevation-active-background)) !important;
20+
color: rgb(var(--owd-elevation-active-color)) !important;
21+
}
1922
}
2023
}
2124

2225
&-separator {
23-
margin: 2px;
26+
margin: 4px 2px;
2427
height: 2px;
2528
border-width: 1px;
2629
border-style: solid;

runtime/assets/styles/partials/input.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,6 @@
1818
border-width: 2px;
1919
border-style: solid;
2020
border-color: var(--p-inputtext-border-color);
21+
padding: 4px;
22+
font-size: var(--p-font-size);
2123
}

runtime/assets/styles/partials/menu.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
--p-menu-background: var(--p-surface-900);
33
--p-menubar-submenu-background: var(--p-menu-background);
44
--p-menu-shadow: var(--owd-border-color);
5-
--p-menu-item-padding: 8px 8px;
5+
--p-menu-item-padding: 6px 8px;
66
--p-menu-submenu-label-padding: 4px 8px;
77
--p-menu-submenu-label-font-weight: 600;
88

9-
--p-menubar-item-padding: 8px 8px;
9+
--p-menubar-item-padding: 6px 8px;
1010
--p-menubar-base-item-padding: 6px 12px;
1111
}
1212

@@ -37,7 +37,7 @@
3737
}
3838

3939
&-separator {
40-
margin: 2px -2px;
40+
margin: 4px -2px;
4141
height: 2px;
4242
border-width: 1px;
4343
border-style: solid;

runtime/components/FileSystem/FileSystemFile.vue

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<script setup lang="ts">
22
import { fs } from '@zenfs/core'
33
import { ref, onMounted } from 'vue'
4-
import { isImageFile } from '@owdproject/module-fs/runtime/utils/utilFileSystemImage'
54
import FileSystemFileContextMenu from './FileSystemFileContextMenu.vue'
65
import FileSystemFileIcon from './FileSystemFileIcon.vue'
76
@@ -11,12 +10,12 @@ const props = defineProps<{
1110
layout: string
1211
selected?: boolean
1312
cutted?: boolean
13+
window: IWindowController
1414
}>()
1515
1616
const emit = defineEmits([
1717
'openDirectory',
1818
'openFile',
19-
'delete',
2019
'rename',
2120
])
2221
@@ -26,7 +25,7 @@ const isDirectory = ref<boolean>(false)
2625
const isFile = ref<boolean>()
2726
const fileContent = ref<string | null>(null)
2827
29-
const contextMenuRef = ref() // riferimento al menu interno
28+
const contextMenuRef = ref()
3029
3130
async function fetchStatsAndContent(currentPath: string) {
3231
fs.stat(currentPath, (err, stats) => {
@@ -63,9 +62,9 @@ async function fetchStatsAndContent(currentPath: string) {
6362
6463
function onFileOpen() {
6564
if (isDirectory.value) {
66-
emit('openDirectory', props.fileName)
65+
props.window.fsExplorer.openDirectory(props.fileName)
6766
} else {
68-
emit('openFile', props.fileName)
67+
props.window.fsExplorer.openFile(props.fileName)
6968
}
7069
}
7170
@@ -139,14 +138,14 @@ const classes = computed(() => {
139138
<span
140139
v-if="!isRenaming"
141140
@dblclick.stop="renameStart"
142-
class="text-sm text-gray-800 truncate"
141+
class="text-sm truncate"
143142
v-text="fileName"
144143
/>
145144

146145
<input
147146
v-else
148147
v-model="editableName"
149-
class="text-sm text-gray-800 truncate border border-gray-300 rounded-sm px-1"
148+
class="text-sm truncate border border-gray-300 rounded-sm px-1"
150149
@blur="renameCommit"
151150
@keyup.enter="renameCommit"
152151
@keyup.esc="renameCancel"
@@ -159,10 +158,9 @@ const classes = computed(() => {
159158
<FileSystemFileContextMenu
160159
ref="contextMenuRef"
161160
:file-name="fileName"
162-
:base-path="basePath"
161+
:window="window"
163162
@open="onFileOpen"
164163
@rename="renameStart"
165-
@delete="$emit('delete', fileName)"
166164
/>
167165

168166
</div>
@@ -180,6 +178,8 @@ const classes = computed(() => {
180178
input {
181179
border: 0;
182180
text-align: center;
181+
background: rgb(var(--owd-elevation-active-background));
182+
color: rgb(var(--owd-elevation-active-color)) !important;
183183
}
184184
}
185185
@@ -195,14 +195,17 @@ const classes = computed(() => {
195195
196196
&--selected {
197197
.owd-file__name {
198+
background: rgb(var(--owd-elevation-active-background));
199+
color: rgb(var(--owd-elevation-active-color)) !important;
200+
198201
&:after {
199202
position: absolute;
200203
top: 0;
201204
left: 0;
202205
right: 0;
203206
bottom: 0;
204207
content: '';
205-
border: 1px dotted black;
208+
border: 1px dotted rgb(var(--owd-theme-color-white));
206209
}
207210
}
208211
}

runtime/components/FileSystem/FileSystemFileContextMenu.vue

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ const { t } = useI18n()
66
77
const props = defineProps<{
88
fileName: string
9-
basePath: string
9+
window: IWindowController
1010
}>()
1111
12-
const emit = defineEmits(['open', 'delete', 'rename'])
12+
const emit = defineEmits(['open', 'rename'])
1313
1414
const menu = ref<Menu | null>(null)
1515
const items = ref<MenuItem[]>([
@@ -29,27 +29,29 @@ const items = ref<MenuItem[]>([
2929
{
3030
label: t('fs.contextMenu.cut'),
3131
command: () => {
32-
window.alert('To be implemented')
32+
props.window.fsExplorer.selectFiles([
33+
props.fileName,
34+
])
35+
props.window.fsExplorer.cutSelectedFiles()
3336
},
3437
},
3538
{
3639
label: t('fs.contextMenu.copy'),
3740
command: () => {
38-
window.alert('To be implemented')
39-
},
40-
},
41-
{ separator: true },
42-
{
43-
label: t('fs.contextMenu.delete'),
44-
command: () => {
45-
emit('delete', props.fileName)
41+
props.window.fsExplorer.selectFiles([
42+
props.fileName,
43+
])
44+
props.window.fsExplorer.copySelectedFiles()
4645
},
4746
},
4847
{ separator: true },
4948
{
5049
label: t('fs.contextMenu.delete'),
5150
command: () => {
52-
emit('delete', props.fileName)
51+
props.window.fsExplorer.selectFiles([
52+
`${props.window.fsExplorer.basePath.value}/${props.fileName}`,
53+
])
54+
props.window.fsExplorer.fsController.deleteSelectedFiles()
5355
},
5456
},
5557
{

runtime/components/Window/Directory/WindowDirectoryAddress.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ watch(() => props.address, (address) => {
2121
<div class="flex-col w-full">
2222
<InputText
2323
v-model="addressInput" style="width: inherit"
24+
spellcheck="false"
2425
@keydown.enter="$emit('update:modelValue', addressInput)"
2526
/>
2627
</div>

runtime/components/Window/Directory/WindowDirectoryToolbar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ defineEmits(['back', 'forward', 'up', 'cut', 'copy', 'paste', 'undo', 'delete',
112112
vertical-align: top;
113113
min-width: 50px;
114114
height: 50px;
115-
margin-bottom: 5px;
115+
margin-bottom: 4px;
116116
filter: grayscale(1);
117117
118118
&-image {

runtime/components/Window/WindowDirectory.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ props.window.fsExplorer.initialize()
7777
:layout="fsExplorer.layout.value"
7878
:selected="fsExplorer.selectedFiles.value.includes(`${fsExplorer.basePath.value}/${fileName}`)"
7979
:cutted="fsExplorer.fsClipboard.clipboardFiles.value.includes(`${fsExplorer.basePath.value}/${fileName}`) && fsExplorer.fsClipboard.clipboardType.value === 'cut'"
80-
@openDirectory="window.fsExplorer.openDirectory"
81-
@openFile="fsExplorer.openFile"
80+
:window="window"
8281
/>
8382
</SelectableArea>
8483
<iframe

0 commit comments

Comments
 (0)