refactor: clean up whitespace and formatting in multiple components

This commit is contained in:
Elio Struyf
2026-03-06 16:51:47 +01:00
parent 7ea0fbad05
commit 5c0076b9b2
4 changed files with 26 additions and 17 deletions
@@ -66,7 +66,7 @@ export const Contents: React.FunctionComponent<IContentsProps> = ({
if (pageItem) {
setPage(pageItem);
if (selectedItemAction.action === 'delete') {
setShowDeletionAlert(true);
} else if (selectedItemAction.action === 'move') {
@@ -297,13 +297,13 @@ export const StructureView: React.FunctionComponent<IStructureViewProps> = ({
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)}
>
<PlusIcon className="w-4 h-4 mr-1" />
<span>
{selectedFolder
{selectedFolder
? `${l10n.t(LocalizationKey.dashboardHeaderHeaderCreateContent)} here`
: l10n.t(LocalizationKey.dashboardHeaderHeaderCreateContent)}
</span>
@@ -86,9 +86,8 @@ export const MoveFileDialog: React.FunctionComponent<IMoveFileDialogProps> = ({
return (
<div key={node.path}>
<div
className={`flex items-center py-1 px-2 cursor-pointer hover:bg-[var(--vscode-list-hoverBackground)] rounded ${
isSelected ? 'bg-[var(--vscode-list-activeSelectionBackground)]' : ''
}`}
className={`flex items-center py-1 px-2 cursor-pointer hover:bg-[var(--vscode-list-hoverBackground)] rounded ${isSelected ? 'bg-[var(--vscode-list-activeSelectionBackground)]' : ''
}`}
style={{ paddingLeft: `${paddingLeft}px` }}
onClick={() => setSelectedFolder(node.path)}
>
@@ -101,9 +100,8 @@ export const MoveFileDialog: React.FunctionComponent<IMoveFileDialogProps> = ({
className="mr-1"
>
<ChevronRightIcon
className={`w-3 h-3 transform transition-transform ${
isExpanded ? 'rotate-90' : ''
}`}
className={`w-3 h-3 transform transition-transform ${isExpanded ? 'rotate-90' : ''
}`}
/>
</button>
)}
+19 -8
View File
@@ -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;
}