From 5c0076b9b2130aebdc5c19af798a53f03b240461 Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Fri, 6 Mar 2026 16:51:47 +0100 Subject: [PATCH] refactor: clean up whitespace and formatting in multiple components --- .../components/Contents/Contents.tsx | 2 +- .../components/Contents/StructureView.tsx | 4 +-- .../components/Modals/MoveFileDialog.tsx | 10 +++---- src/listeners/dashboard/PagesListener.ts | 27 +++++++++++++------ 4 files changed, 26 insertions(+), 17 deletions(-) diff --git a/src/dashboardWebView/components/Contents/Contents.tsx b/src/dashboardWebView/components/Contents/Contents.tsx index a3f5d309..7f26e375 100644 --- a/src/dashboardWebView/components/Contents/Contents.tsx +++ b/src/dashboardWebView/components/Contents/Contents.tsx @@ -66,7 +66,7 @@ export const Contents: React.FunctionComponent = ({ if (pageItem) { setPage(pageItem); - + if (selectedItemAction.action === 'delete') { setShowDeletionAlert(true); } else if (selectedItemAction.action === 'move') { diff --git a/src/dashboardWebView/components/Contents/StructureView.tsx b/src/dashboardWebView/components/Contents/StructureView.tsx index e23d5810..5b4e70b0 100644 --- a/src/dashboardWebView/components/Contents/StructureView.tsx +++ b/src/dashboardWebView/components/Contents/StructureView.tsx @@ -297,13 +297,13 @@ export const StructureView: React.FunctionComponent = ({ onClick={handleCreateContent} disabled={!settings?.initialized} className="inline-flex items-center px-3 py-1 border border-transparent text-xs leading-4 font-medium focus:outline-none rounded text-[var(--vscode-button-foreground)] bg-[var(--frontmatter-button-background)] hover:bg-[var(--vscode-button-hoverBackground)] disabled:opacity-50" - title={selectedFolder + title={selectedFolder ? l10n.t(LocalizationKey.dashboardHeaderHeaderCreateContent) + ` in ${selectedFolder}` : l10n.t(LocalizationKey.dashboardHeaderHeaderCreateContent)} > - {selectedFolder + {selectedFolder ? `${l10n.t(LocalizationKey.dashboardHeaderHeaderCreateContent)} here` : l10n.t(LocalizationKey.dashboardHeaderHeaderCreateContent)} diff --git a/src/dashboardWebView/components/Modals/MoveFileDialog.tsx b/src/dashboardWebView/components/Modals/MoveFileDialog.tsx index 883f40e8..d40006fd 100644 --- a/src/dashboardWebView/components/Modals/MoveFileDialog.tsx +++ b/src/dashboardWebView/components/Modals/MoveFileDialog.tsx @@ -86,9 +86,8 @@ export const MoveFileDialog: React.FunctionComponent = ({ return (
setSelectedFolder(node.path)} > @@ -101,9 +100,8 @@ export const MoveFileDialog: React.FunctionComponent = ({ className="mr-1" > )} diff --git a/src/listeners/dashboard/PagesListener.ts b/src/listeners/dashboard/PagesListener.ts index 77f4c587..16ca16a6 100644 --- a/src/listeners/dashboard/PagesListener.ts +++ b/src/listeners/dashboard/PagesListener.ts @@ -12,7 +12,14 @@ import { import { DashboardCommand } from '../../dashboardWebView/DashboardCommand'; import { DashboardMessage } from '../../dashboardWebView/DashboardMessage'; import { Page } from '../../dashboardWebView/models'; -import { ArticleHelper, Extension, Logger, parseWinPath, Settings, ContentType } from '../../helpers'; +import { + ArticleHelper, + Extension, + Logger, + parseWinPath, + Settings, + ContentType +} from '../../helpers'; import { BaseListener } from './BaseListener'; import { DataListener } from '../panel'; import Fuse from 'fuse.js'; @@ -385,7 +392,7 @@ export class PagesListener extends BaseListener { const article = await ArticleHelper.getFrontMatterByPath(filePath); if (article) { const contentType = await ArticleHelper.getContentType(article); - + if (contentType.pageBundle) { // Move the entire folder const sourceFolder = parseWinPath(filePath).substring( @@ -437,7 +444,7 @@ export class PagesListener extends BaseListener { } const { folderPath } = payload; - + // Get all content folders let folders = await Folders.get(); folders = folders.filter((f) => !f.disableCreation); @@ -460,8 +467,10 @@ export class PagesListener extends BaseListener { } const absoluteFolderPath = Folders.getFolderPath(Uri.file(folder.path)); - const relativeFolderPath = parseWinPath(absoluteFolderPath).replace(parseWinPath(wsFolder.fsPath), '').replace(/^\/+|\/+$/g, ''); - + const relativeFolderPath = parseWinPath(absoluteFolderPath) + .replace(parseWinPath(wsFolder.fsPath), '') + .replace(/^\/+|\/+$/g, ''); + // Check if the folderPath starts with this content folder if (folderPath === relativeFolderPath || folderPath.startsWith(relativeFolderPath + '/')) { targetFolder = folder; @@ -489,7 +498,7 @@ export class PagesListener extends BaseListener { // Get the folder path let absoluteFolderPath = Folders.getFolderPath(Uri.file(targetFolder.path)); - + // Add the subfolder if any if (subPath) { absoluteFolderPath = join(absoluteFolderPath, subPath); @@ -497,13 +506,15 @@ export class PagesListener extends BaseListener { // Check if templates are enabled const templatesEnabled = Settings.get('dashboardState.contents.templatesEnabled'); - + if (templatesEnabled) { // Use the template creation flow await Template.create(absoluteFolderPath); } else { // Use the content type creation flow - const selectedContentType = await Questions.SelectContentType(targetFolder.contentTypes || []); + const selectedContentType = await Questions.SelectContentType( + targetFolder.contentTypes || [] + ); if (!selectedContentType) { return; }