From 86e292bfee2c43ee7ab4b5e08b75a1a2fc96cc75 Mon Sep 17 00:00:00 2001 From: Baptiste Leproux Date: Wed, 19 Nov 2025 21:41:18 +0100 Subject: [PATCH 1/3] feat(actions): use ellipsis in toolbar + add gh repo --- .../content/ContentEditorConflict.vue | 5 +- .../shared/item/ItemActionsDropdown.vue | 24 +++- .../shared/item/ItemActionsToolbar.vue | 123 ++++-------------- src/app/src/locales/en.json | 3 +- src/app/src/locales/fr.json | 3 +- src/app/src/types/git.ts | 3 +- src/app/src/utils/providers/github.ts | 9 +- src/app/src/utils/providers/gitlab.ts | 9 +- src/app/src/utils/providers/null.ts | 2 +- 9 files changed, 66 insertions(+), 115 deletions(-) diff --git a/src/app/src/components/content/ContentEditorConflict.vue b/src/app/src/components/content/ContentEditorConflict.vue index 57e05a9..ee4dc77 100644 --- a/src/app/src/components/content/ContentEditorConflict.vue +++ b/src/app/src/components/content/ContentEditorConflict.vue @@ -3,8 +3,7 @@ import { ref, computed, type PropType } from 'vue' import type { ContentConflict, DraftItem } from '../../types' import { useMonacoDiff } from '../../composables/useMonacoDiff' import { useStudio } from '../../composables/useStudio' -import { ContentFileExtension } from '../../types' -import { joinURL } from 'ufo' +import { ContentFileExtension, StudioFeature } from '../../types' const props = defineProps({ draftItem: { @@ -19,7 +18,7 @@ const diffEditorRef = ref() const conflict = computed(() => props.draftItem.conflict!) const repositoryInfo = computed(() => gitProvider.api.getRepositoryInfo()) -const fileRemoteUrl = computed(() => joinURL(gitProvider.api.getContentRootDirUrl(), props.draftItem.fsPath)) +const fileRemoteUrl = computed(() => gitProvider.api.getFileUrl(StudioFeature.Content, props.draftItem.fsPath)) const language = computed(() => { switch (props.draftItem.fsPath.split('.').pop()) { diff --git a/src/app/src/components/shared/item/ItemActionsDropdown.vue b/src/app/src/components/shared/item/ItemActionsDropdown.vue index 9165ca1..4d30ad5 100644 --- a/src/app/src/components/shared/item/ItemActionsDropdown.vue +++ b/src/app/src/components/shared/item/ItemActionsDropdown.vue @@ -15,6 +15,10 @@ const props = defineProps({ type: Object as PropType, required: true, }, + extraActions: { + type: Array as PropType, + default: () => [], + }, }) const isOpen = ref(false) @@ -44,11 +48,11 @@ const getPendingActionLabel = (action: StudioAction | null) return t('studio.actions.confirmAction', { action: t(`studio.actions.verbs.${verb}`, verb) }) } -const actions = computed(() => { +const actions = computed(() => { const hasPendingAction = pendingAction.value !== null const hasLoadingAction = loadingAction.value !== null - return computeItemActions(context.itemActions.value, props.item, context.currentFeature.value).map((action) => { + const itemActions = computeItemActions(context.itemActions.value, props.item, context.currentFeature.value).map((action) => { const isOneStepAction = oneStepActions.includes(action.id) const isPending = pendingAction.value?.id === action.id const isLoading = loadingAction.value?.id === action.id @@ -79,11 +83,16 @@ const actions = computed(() => { // For two-step actions, execute it without confirmation if (!isOneStepAction) { + // Navigate into folder before adding form creation if (props.item.type === 'directory' && [StudioItemActionId.CreateDocument, StudioItemActionId.CreateDocumentFolder, StudioItemActionId.CreateMediaFolder].includes(action.id)) { - // Navigate into folder before adding form creation context.activeTree.value.selectItemByFsPath(props.item.fsPath) } + // Navigate to parent folder if needed before renaming + if (action.id === StudioItemActionId.RenameItem && context.activeTree.value.currentItem.value.fsPath === props.item.fsPath) { + context.activeTree.value.selectParentByFsPath(props.item.fsPath) + } + action.handler!(props.item) return } @@ -108,6 +117,15 @@ const actions = computed(() => { }, } }) + + // Return groups: main actions and extra actions + const groups: DropdownMenuItem[][] = [itemActions] + + if (props.extraActions.length > 0) { + groups.push(props.extraActions) + } + + return groups }) const pendingActionLabel = computed(() => getPendingActionLabel(pendingAction.value)) diff --git a/src/app/src/components/shared/item/ItemActionsToolbar.vue b/src/app/src/components/shared/item/ItemActionsToolbar.vue index 6e94838..4868d5f 100644 --- a/src/app/src/components/shared/item/ItemActionsToolbar.vue +++ b/src/app/src/components/shared/item/ItemActionsToolbar.vue @@ -1,13 +1,13 @@