refactor(views/board): unnecessary imports

This commit is contained in:
Elian Doran 2025-07-25 11:31:57 +03:00
parent bb660d15b2
commit 06d98f6fcf
No known key found for this signature in database
2 changed files with 12 additions and 13 deletions

View File

@ -1,4 +1,4 @@
import { BoardDragHandler, DragContext } from "./drag_handler"; import { BoardDragHandler } from "./drag_handler";
import BoardApi from "./api"; import BoardApi from "./api";
import appContext from "../../../components/app_context"; import appContext from "../../../components/app_context";
import FNote from "../../../entities/fnote"; import FNote from "../../../entities/fnote";
@ -135,7 +135,7 @@ export class DifferentialBoardRenderer {
private updateColumns(oldState: BoardState, newState: BoardState): void { private updateColumns(oldState: BoardState, newState: BoardState): void {
// Check if column order has changed // Check if column order has changed
const orderChanged = !this.arraysEqual(oldState.columnOrder, newState.columnOrder); const orderChanged = !this.arraysEqual(oldState.columnOrder, newState.columnOrder);
if (orderChanged) { if (orderChanged) {
// If order changed, we need to reorder the columns in the DOM // If order changed, we need to reorder the columns in the DOM
this.reorderColumns(newState.columnOrder); this.reorderColumns(newState.columnOrder);
@ -177,7 +177,7 @@ export class DifferentialBoardRenderer {
// Get all existing column elements // Get all existing column elements
const $columns = this.$container.find('.board-column'); const $columns = this.$container.find('.board-column');
const $addColumnButton = this.$container.find('.board-add-column'); const $addColumnButton = this.$container.find('.board-add-column');
// Create a map of column elements by their data-column attribute // Create a map of column elements by their data-column attribute
const columnElements = new Map<string, JQuery<HTMLElement>>(); const columnElements = new Map<string, JQuery<HTMLElement>>();
$columns.each((_, el) => { $columns.each((_, el) => {
@ -190,7 +190,7 @@ export class DifferentialBoardRenderer {
// Remove all columns from DOM (but keep references) // Remove all columns from DOM (but keep references)
$columns.detach(); $columns.detach();
// Re-insert columns in the new order // Re-insert columns in the new order
let $insertAfter: JQuery<HTMLElement> | null = null; let $insertAfter: JQuery<HTMLElement> | null = null;
for (const columnValue of newOrder) { for (const columnValue of newOrder) {
@ -205,7 +205,7 @@ export class DifferentialBoardRenderer {
$insertAfter = $columnEl; $insertAfter = $columnEl;
} }
} }
// Ensure add column button is at the end // Ensure add column button is at the end
if ($addColumnButton.length) { if ($addColumnButton.length) {
this.$container.append($addColumnButton); this.$container.append($addColumnButton);
@ -294,7 +294,7 @@ export class DifferentialBoardRenderer {
// Create header with drag handle // Create header with drag handle
const $titleEl = $("<h3>").attr("data-column-value", column); const $titleEl = $("<h3>").attr("data-column-value", column);
// Create drag handle // Create drag handle
const $dragHandle = $("<span>") const $dragHandle = $("<span>")
.addClass("column-drag-handle icon bx bx-menu") .addClass("column-drag-handle icon bx bx-menu")
@ -302,7 +302,7 @@ export class DifferentialBoardRenderer {
// Create title text // Create title text
const $titleText = $("<span>").text(column); const $titleText = $("<span>").text(column);
// Create title content container // Create title content container
const $titleContent = $("<div>") const $titleContent = $("<div>")
.addClass("column-title-content") .addClass("column-title-content")

View File

@ -1,8 +1,7 @@
import { setupHorizontalScrollViaWheel } from "../../widget_utils"; import { setupHorizontalScrollViaWheel } from "../../widget_utils";
import ViewMode, { ViewModeArgs } from "../view_mode"; import ViewMode, { ViewModeArgs } from "../view_mode";
import attributeService from "../../../services/attributes";
import noteCreateService from "../../../services/note_create"; import noteCreateService from "../../../services/note_create";
import appContext, { EventData } from "../../../components/app_context"; import { EventData } from "../../../components/app_context";
import { BoardData } from "./config"; import { BoardData } from "./config";
import SpacedUpdate from "../../../services/spaced_update"; import SpacedUpdate from "../../../services/spaced_update";
import { setupContextMenu } from "./context_menu"; import { setupContextMenu } from "./context_menu";
@ -388,11 +387,11 @@ export default class BoardView extends ViewMode<BoardData> {
// Also handle clicks on the h3 element itself (but not on the drag handle) // Also handle clicks on the h3 element itself (but not on the drag handle)
this.$container.on('click', 'h3[data-column-value]', (e) => { this.$container.on('click', 'h3[data-column-value]', (e) => {
// Only proceed if the click wasn't on the drag handle or edit icon // Only proceed if the click wasn't on the drag handle or edit icon
if (!$(e.target).hasClass('column-drag-handle') && if (!$(e.target).hasClass('column-drag-handle') &&
!$(e.target).hasClass('edit-icon') && !$(e.target).hasClass('edit-icon') &&
!$(e.target).hasClass('bx-menu') && !$(e.target).hasClass('bx-menu') &&
!$(e.target).hasClass('bx-edit-alt')) { !$(e.target).hasClass('bx-edit-alt')) {
e.stopPropagation(); e.stopPropagation();
const $titleEl = $(e.currentTarget); const $titleEl = $(e.currentTarget);
const columnValue = $titleEl.attr('data-column-value'); const columnValue = $titleEl.attr('data-column-value');
@ -416,7 +415,7 @@ export default class BoardView extends ViewMode<BoardData> {
.attr("title", "Drag to reorder column"); .attr("title", "Drag to reorder column");
const $titleText = $("<span>").text(title); const $titleText = $("<span>").text(title);
const $titleContent = $("<div>") const $titleContent = $("<div>")
.addClass("column-title-content") .addClass("column-title-content")
.append($dragHandle, $titleText); .append($dragHandle, $titleText);