From 9d4304a33274e1d9893ea3d00adcd410754eba28 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sun, 18 Oct 2026 18:27:05 -0400 Subject: [PATCH] chore: Remove unused code (#14133) * chore: Remove unused code * Restore DiscordClient --- app/actions/definitions/navigation.tsx | 10 ---- app/styles/animations.ts | 24 -------- app/types.ts | 18 ------ server/editor/index.ts | 5 -- shared/editor/queries/table.ts | 66 ---------------------- shared/editor/types/index.ts | 2 - shared/i18n/locales/en_US/translation.json | 2 +- shared/utils/color.ts | 23 -------- shared/utils/indexCharacters.ts | 2 - 9 files changed, 1 insertion(+), 151 deletions(-) delete mode 100644 shared/utils/indexCharacters.ts diff --git a/app/actions/definitions/navigation.tsx b/app/actions/definitions/navigation.tsx index 7e9d291f6e..1f24fe9198 100644 --- a/app/actions/definitions/navigation.tsx +++ b/app/actions/definitions/navigation.tsx @@ -10,7 +10,6 @@ import { LogoutIcon, ProfileIcon, BrowserIcon, - ShapesIcon, DraftsIcon, BugIcon, ImportIcon, @@ -140,15 +139,6 @@ export const navigateToProfileSettings = createInternalLinkAction({ to: settingsPath(), }); -export const navigateToTemplateSettings = createInternalLinkAction({ - name: ({ t }) => t("Templates"), - analyticsName: "Navigate to template settings", - section: NavigationSection, - iconInContextMenu: false, - icon: , - to: settingsPath("templates"), -}); - export const navigateToNotificationSettings = createInternalLinkAction({ name: ({ t, isMenu }) => isMenu ? t("Notification settings") : t("Notifications"), diff --git a/app/styles/animations.ts b/app/styles/animations.ts index fc0a5603a0..88e123bd73 100644 --- a/app/styles/animations.ts +++ b/app/styles/animations.ts @@ -10,12 +10,6 @@ export const fadeOut = keyframes` to { opacity: 0; } `; -export const fadeOutCursor = keyframes` - 0% { opacity: 1; } - 90% { opacity: 1; } - 100% { opacity: 0; } -`; - export const fadeAndScaleIn = keyframes` from { opacity: 0; @@ -76,18 +70,6 @@ export const fadeOutAndSlideRight = keyframes` } `; -export const mobileContextMenu = keyframes` - from { - opacity: 0; - transform: scale(.98) translateY(10vh); - } - - to { - opacity: 1; - transform: scale(1) translateY(0px); - } -`; - export const bounceIn = keyframes` from, 20%, @@ -162,12 +144,6 @@ export const pulse = keyframes` 100% { transform: scale(1); } `; -export const bigPulse = keyframes` - 0% { transform: scale(1); } - 50% { transform: scale(1.2); } - 100% { transform: scale(1); } -`; - /** * The duration of the sidebar appearing animation in ms */ diff --git a/app/types.ts b/app/types.ts index bf09a9853c..48911a384a 100644 --- a/app/types.ts +++ b/app/types.ts @@ -10,11 +10,7 @@ import type RootStore from "~/stores/RootStore"; import type { SidebarContextType } from "./components/Sidebar/components/SidebarContext"; import type Model from "./models/base/Model"; import type Document from "./models/Document"; -import type FileOperation from "./models/FileOperation"; -import type Pin from "./models/Pin"; -import type Star from "./models/Star"; import type User from "./models/User"; -import type UserMembership from "./models/UserMembership"; import type Policy from "./models/Policy"; export type PartialExcept = Partial> & @@ -225,10 +221,6 @@ export type CommandBarAction = { parent?: string; }; -export type LocationWithState = Location & { - state: Record; -}; - export type FetchOptions = { prefetch?: boolean; revisionId?: string; @@ -287,16 +279,6 @@ export type WebsocketCommentReactionEvent = { user: User; }; -export type WebsocketEvent = - | PartialExcept - | PartialExcept - | PartialExcept - | PartialExcept - | WebsocketCollectionUpdateIndexEvent - | WebsocketEntityDeletedEvent - | WebsocketEntitiesEvent - | WebsocketCommentReactionEvent; - type CursorPosition = { type: { client: number; diff --git a/server/editor/index.ts b/server/editor/index.ts index 57a1f9d721..88803a7db9 100644 --- a/server/editor/index.ts +++ b/server/editor/index.ts @@ -62,11 +62,6 @@ for (const extension of basicExtensionManager.extensions) { extension.bindEditor(stubEditor(basicSchema)); } -export const basicParser = basicExtensionManager.parser({ - schema: basicSchema, - plugins: basicExtensionManager.rulePlugins, -}); - const commentExtensions = [...basicExtensions, CodeBlock, CodeFence, Mention]; export const commentExtensionManager = new ExtensionManager(commentExtensions); diff --git a/shared/editor/queries/table.ts b/shared/editor/queries/table.ts index 1ac13693fb..d8812c1a5b 100644 --- a/shared/editor/queries/table.ts +++ b/shared/editor/queries/table.ts @@ -73,41 +73,6 @@ export function getRowIndex(state: EditorState): number | undefined { return undefined; } -/** - * Get the actual row index in the table map for a given visual row index - * when merged cells are present. - * - * @param visualRowIndex The visual row index (0-based) - * @param state The editor state - * @returns The actual row index in the table map, or -1 if not found - */ -export function getRowIndexInMap( - visualRowIndex: number, - state: EditorState -): number { - if (!isInTable(state)) { - return -1; - } - const rect = selectedRect(state); - const cells = getCellsInColumn(0)(state); - - if (visualRowIndex >= 0 && visualRowIndex < cells.length) { - const cellPos = cells[visualRowIndex] - rect.tableStart; - - // Find the row index in the table map for this cell position - for (let row = 0; row < rect.map.height; row++) { - const rowStart = row * rect.map.width; - for (let col = 0; col < rect.map.width; col++) { - if (rect.map.map[rowStart + col] === cellPos) { - return row; - } - } - } - } - - return -1; -} - /** * Get the actual row positions in the table map, accounting for merged cells. * @@ -142,37 +107,6 @@ export function getRowsInTable(state: EditorState): number[] { return rows; } -/** - * Get the actual column positions in the table map, accounting for merged cells. - * - * @param state The editor state - * @returns Array of cell positions representing the first unique cell in each column - */ -export function getColumnsInTable(state: EditorState): number[] { - if (!isInTable(state)) { - return []; - } - - const rect = selectedRect(state); - const columns: number[] = []; - const seenCells = new Set(); - - for (let col = 0; col < rect.map.width; col++) { - // Find the topmost cell in this column - for (let row = 0; row < rect.map.height; row++) { - const cellPos = - rect.tableStart + rect.map.map[row * rect.map.width + col]; - if (!seenCells.has(cellPos)) { - columns.push(cellPos); - seenCells.add(cellPos); - break; // Only add the first unique cell per column - } - } - } - - return columns; -} - export function getCellsInColumn(index: number) { return (state: EditorState): number[] => { if (!isInTable(state)) { diff --git a/shared/editor/types/index.ts b/shared/editor/types/index.ts index b0cc7e221d..f2a1da722f 100644 --- a/shared/editor/types/index.ts +++ b/shared/editor/types/index.ts @@ -11,8 +11,6 @@ export type NodeWithPos = { node: ProsemirrorNode; }; -export type PlainTextSerializer = (node: ProsemirrorNode) => string; - /** The severity of a notice surfaced to the user from the editor. */ export type EditorNoticeType = "info" | "success" | "warning" | "error"; diff --git a/shared/i18n/locales/en_US/translation.json b/shared/i18n/locales/en_US/translation.json index c152c38d27..7c5f6df2df 100644 --- a/shared/i18n/locales/en_US/translation.json +++ b/shared/i18n/locales/en_US/translation.json @@ -180,7 +180,6 @@ "Settings": "Settings", "Import docs": "Import docs", "Profile": "Profile", - "Templates": "Templates", "Notification settings": "Notification settings", "Notifications": "Notifications", "Preferences": "Preferences", @@ -755,6 +754,7 @@ "Last seen": "Last seen", "{{ time }} local time": "{{ time }} local time", "Your import completed": "Your import completed", + "Templates": "Templates", "View comment thread": "View comment thread", "Previous match": "Previous match", "Next match": "Next match", diff --git a/shared/utils/color.ts b/shared/utils/color.ts index d34f067c32..5e3d0e8696 100644 --- a/shared/utils/color.ts +++ b/shared/utils/color.ts @@ -29,29 +29,6 @@ export const stringToColor = (input: string) => { return palette[inputAsNumber % palette.length]; }; -/** - * Converts a color to string of RGB values separated by commas - * - * @param color - A color string - * @returns A string of RGB values separated by commas - */ -export const toRGB = (color: string) => - Object.values(parseToRgb(color)).join(", "); - -/** - * Returns the text color that contrasts the given background color - * - * @param background - A color string - * @returns A color string - */ -export const getTextColor = (background: string) => { - const r = parseInt(background.substring(1, 3), 16); - const g = parseInt(background.substring(3, 5), 16); - const b = parseInt(background.substring(5, 7), 16); - const yiq = (r * 299 + g * 587 + b * 114) / 1000; - return yiq >= 128 ? "black" : "white"; -}; - /** * Returns the color when it is visible against the theme background, otherwise * the fallback. Very dark colors are not visible in the dark theme and very diff --git a/shared/utils/indexCharacters.ts b/shared/utils/indexCharacters.ts deleted file mode 100644 index 6a897e2a5e..0000000000 --- a/shared/utils/indexCharacters.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const validateIndexCharacters = (index: string) => - new RegExp("^[\x20-\x7E]+$").test(index);