Skip to content

Commit

Permalink
Fix: always, show location in top bar, make file picker work in vario…
Browse files Browse the repository at this point in the history
…us locations, file picker width too narrow
  • Loading branch information
AlexAndBear committed Nov 13, 2024
1 parent 17a1882 commit 16d4f46
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 38 deletions.
7 changes: 6 additions & 1 deletion packages/web-pkg/src/components/AppTemplates/AppWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,12 @@ export default defineComponent({
yield addMissingDriveAliasAndItem()
}
space.value = unref(unref(currentFileContext).space)
resource.value = yield getFileInfo(currentFileContext, { signal })
resource.value = yield getFileInfo(unref(currentFileContext), { signal })
//FIXME: As soon the backend exposes oc-remote-id via webdav, remove the assignment below
if (isShareSpaceResource(unref(space))) {
unref(resource).remoteItemId = unref(space).id
}
resourcesStore.initResourceList({ currentFolder: null, resources: [unref(resource)] })
selectedResources.value = [unref(resource)]
} catch (e) {
Expand Down
43 changes: 9 additions & 34 deletions packages/web-pkg/src/components/AppTopBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
id="app-top-bar-resource"
:is-thumbnail-displayed="false"
:is-extension-displayed="areFileExtensionsShown"
:path-prefix="pathPrefix"
:path-prefix="getPathPrefix(resource)"
:resource="resource"
:parent-folder-name="parentFolderName"
:parent-folder-name="getParentFolderName(resource)"
:parent-folder-link-icon-additional-attributes="
parentFolderLinkIconAdditionalAttributes
getParentFolderLinkIconAdditionalAttributes(resource)
"
:is-path-displayed="isPathDisplayed"
:is-path-displayed="true"
/>
</div>
<div class="oc-flex main-actions">
Expand Down Expand Up @@ -87,19 +87,18 @@
</template>

<script lang="ts">
import { computed, defineComponent, PropType, unref } from 'vue'
import { computed, defineComponent, PropType } from 'vue'
import ContextActionMenu, { MenuSection } from './ContextActions/ContextActionMenu.vue'
import { useGettext } from 'vue3-gettext'
import {
Action,
FileActionOptions,
useConfigStore,
useFolderLink,
useGetMatchingSpace,
useResourcesStore
} from '../composables'
import ResourceListItem from './FilesList/ResourceListItem.vue'
import { Resource, isPublicSpaceResource, isShareSpaceResource } from '@ownclouders/web-client'
import { Resource } from '@ownclouders/web-client'
import { Duration } from 'luxon'
export default defineComponent({
Expand Down Expand Up @@ -140,7 +139,6 @@ export default defineComponent({
emits: ['close'],
setup(props) {
const { $gettext, current: currentLanguage } = useGettext()
const { getMatchingSpace } = useGetMatchingSpace()
const resourcesStore = useResourcesStore()
const configStore = useConfigStore()
Expand All @@ -158,38 +156,15 @@ export default defineComponent({
return $gettext(`Autosave (every %{ duration })`, { duration: duration.toHuman() })
})
const { getParentFolderName, getParentFolderLinkIconAdditionalAttributes, getPathPrefix } =
useFolderLink()
const space = computed(() => getMatchingSpace(props.resource))
//FIXME: We currently have problems to display the parent folder name of a shared file, so we disabled it for now
const isPathDisplayed = computed(() => {
return !isShareSpaceResource(unref(space)) && !isPublicSpaceResource(unref(space))
})
const pathPrefix = computed(() => {
return props.resource ? getPathPrefix(props.resource) : null
})
const parentFolderName = computed(() => {
return props.resource ? getParentFolderName(props.resource) : null
})
const parentFolderLinkIconAdditionalAttributes = computed(() => {
return props.resource ? getParentFolderLinkIconAdditionalAttributes(props.resource) : null
})
console.log(props.resource.isShareRoot())
return {
pathPrefix,
isPathDisplayed,
contextMenuLabel,
closeButtonLabel,
parentFolderName,
parentFolderLinkIconAdditionalAttributes,
areFileExtensionsShown,
hasAutosave,
autoSaveTooltipText
autoSaveTooltipText,
...useFolderLink()
}
}
})
Expand Down
2 changes: 1 addition & 1 deletion packages/web-pkg/src/components/Modals/FilePickerModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export default defineComponent({
</script>

<style lang="scss">
.open-with-app-modal {
.oc-modal.open-with-app-modal {
max-width: 80vw;
border: none;
overflow: hidden;
Expand Down
2 changes: 1 addition & 1 deletion packages/web-pkg/src/components/Modals/SaveAsModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export default defineComponent({
</script>

<style lang="scss">
.save-as-modal {
.oc-modal.save-as-modal {
max-width: 80vw;
border: none;
overflow: hidden;
Expand Down
5 changes: 4 additions & 1 deletion packages/web-pkg/src/composables/folderLink/useFolderLink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ export const useFolderLink = (options: ResourceRouteResolverOptions = {}) => {
space,
path: dirname(resource.path)
})
if (isShareRoot(resource) || !parentFolderAccessible) {

//FIXME: As soon the backend exposes oc-share-root via webdav, only use isShareRoot fn
const shareRoot = isShareRoot(resource) || resource.id === space.id
if (shareRoot || !parentFolderAccessible) {
return $gettext('Shared with me')
}
const parentFolder = extractParentFolderName(resource)
Expand Down

0 comments on commit 16d4f46

Please sign in to comment.