Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

chore: no underscored variable for naming collision (#708)

gbirman6d17ee702e13
diff --git a/js/app/packages/app/component/UnifiedListView.tsx b/js/app/packages/app/component/UnifiedListView.tsx
index 5bc96f4173..3d7cdb47e2 100644
--- a/js/app/packages/app/component/UnifiedListView.tsx
+++ b/js/app/packages/app/component/UnifiedListView.tsx
@@ -254,7 +254,7 @@ export function UnifiedListView(props: UnifiedListViewProps) {
if (view()?.hasUserInteractedEntity) {
const selectedEntityId = selectedEntity()?.id;
if (selectedEntityId) {
- if (localEntityListRef && localEntityListRef.isConnected) {
+ if (localEntityListRef?.isConnected) {
// focusing non-first entity causes issue where 100ms later, that focused entity loses focus and document.body is focused
// forcing refocus on that entity works for now
// read TODO inside function for more info
diff --git a/js/app/packages/block-canvas/component/nodes/DSSFile.tsx b/js/app/packages/block-canvas/component/nodes/DSSFile.tsx
index dd915c0b4e..7e3744e07d 100644
--- a/js/app/packages/block-canvas/component/nodes/DSSFile.tsx
+++ b/js/app/packages/block-canvas/component/nodes/DSSFile.tsx
@@ -113,32 +113,32 @@ export function File(props: { node: FileNode; mode: RenderMode }) {
});
createEffect(() => {
- const _item = item();
- if (_item.loading) {
+ const currentItem = item();
+ if (currentItem.loading) {
setError('LOADING');
return;
}
- if ((_item as PreviewItemNoAccess).access === 'no_access') {
+ if ((currentItem as PreviewItemNoAccess).access === 'no_access') {
setError('UNAUTHORIZED');
return;
}
- if (_item.access === 'does_not_exist') {
+ if (currentItem.access === 'does_not_exist') {
setError('MISSING');
return;
}
- if (_item.access === 'access') {
+ if (currentItem.access === 'access') {
setError();
- if (_item.type === 'document') {
- setFileName(_item.name);
- setFileType(_item.fileType);
- setBlockName(fileTypeToBlockName(_item.fileType!));
- } else if (_item.type === 'chat') {
- setFileName(_item.name);
+ if (currentItem.type === 'document') {
+ setFileName(currentItem.name);
+ setFileType(currentItem.fileType);
+ setBlockName(fileTypeToBlockName(currentItem.fileType!));
+ } else if (currentItem.type === 'chat') {
+ setFileName(currentItem.name);
setFileType('chat');
setBlockName('chat');
setError();
- } else if (_item.type === 'project') {
- setFileName(_item.name);
+ } else if (currentItem.type === 'project') {
+ setFileName(currentItem.name);
setFileType('project' as FileType);
setBlockName('project');
setError();
diff --git a/js/app/packages/block-channel/component/BaseInput.tsx b/js/app/packages/block-channel/component/BaseInput.tsx
index 6626d368fa..e6f58d858d 100644
--- a/js/app/packages/block-channel/component/BaseInput.tsx
+++ b/js/app/packages/block-channel/component/BaseInput.tsx
@@ -195,8 +195,8 @@ export function BaseInput(props: BaseInputProps) {
} = useChannelMarkdownArea();
createRenderEffect(() => {
- const _ref = ref();
- if (_ref) props.domRef?.(_ref);
+ const currentRef = ref();
+ if (currentRef) props.domRef?.(currentRef);
});
const allMentions: Accessor<SimpleMention[]> = () =>
diff --git a/js/app/packages/block-email/component/BaseInput.tsx b/js/app/packages/block-email/component/BaseInput.tsx
index 26fa4d72a6..4d58b5df2c 100644
--- a/js/app/packages/block-email/component/BaseInput.tsx
+++ b/js/app/packages/block-email/component/BaseInput.tsx
@@ -450,17 +450,17 @@ export function BaseInput(props: {
linkId = linksData.links[0].id;
}
- const _editor = editor();
+ const currentEditor = editor();
// We handle cleaning up the signature after we've sent the request because
// otherwise the `bodyMacro` signal would update after the clean up call and
// not contain the signature in the request data
const cleanupWatermark = $appendWatermarkNodeToLast(
- _editor,
+ currentEditor,
!hasPaidAccess() ? MACRO_EMAIL_SIGNATURE : undefined
);
- const prepared = prepareEmailBody(_editor, {
+ const prepared = prepareEmailBody(currentEditor, {
replyType: effectiveReplyType(),
replyingTo: props.replyingTo(),
});
diff --git a/js/app/packages/block-email/component/Compose.tsx b/js/app/packages/block-email/component/Compose.tsx
index 33fa2c7789..cd0b3bc4a2 100644
--- a/js/app/packages/block-email/component/Compose.tsx
+++ b/js/app/packages/block-email/component/Compose.tsx
@@ -135,7 +135,7 @@ export function EmailCompose() {
const onSubmit = (data: ComposeInputData) => {
setValidationError(null);
- const _link = link();
+ const currentLink = link();
if (!selectedRecipients().length) {
setValidationError(
@@ -161,7 +161,7 @@ export function EmailCompose() {
return;
}
- if (!_link) {
+ if (!currentLink) {
setValidationError(
new EmailComposeError('no_link', 'Unable to find linked email account')
);
@@ -170,7 +170,7 @@ export function EmailCompose() {
sendMutation.mutate({
message: {
- link_id: _link.id,
+ link_id: currentLink.id,
to: convertToContactInfoArray(selectedRecipients()),
cc:
ccRecipients().length > 0
diff --git a/js/app/packages/block-email/component/ComposeEmailInput.tsx b/js/app/packages/block-email/component/ComposeEmailInput.tsx
index 5d912ab061..18cde8d997 100644
--- a/js/app/packages/block-email/component/ComposeEmailInput.tsx
+++ b/js/app/packages/block-email/component/ComposeEmailInput.tsx
@@ -123,17 +123,17 @@ export function ComposeEmailInput(props: ComposeEmailInputProps) {
let composeContainerRef: HTMLDivElement | undefined;
async function handleSend() {
- const _editor = editor();
+ const currentEditor = editor();
// We handle cleaning up the signature after we've sent the request because
// otherwise the `bodyMacro` signal would update after the clean up call and
// not contain the signature in the request data
const cleanupWatermark = $appendWatermarkNodeToLast(
- _editor,
+ currentEditor,
!hasPaidAccess() ? MACRO_EMAIL_SIGNATURE : undefined
);
- const prepared = prepareEmailBody(_editor, undefined);
+ const prepared = prepareEmailBody(currentEditor, undefined);
if (!prepared) return;
const bodyMacro = content();
diff --git a/js/app/packages/block-md/component/FormatTools.tsx b/js/app/packages/block-md/component/FormatTools.tsx
index 5d802c6478..7add45e83c 100644
--- a/js/app/packages/block-md/component/FormatTools.tsx
+++ b/js/app/packages/block-md/component/FormatTools.tsx
@@ -328,22 +328,22 @@ export function FormatTools(props: { withinPopup?: boolean }) {
const cleanups: Array<() => void> = [];
function handleLink() {
- const _editor = editor();
- if (_editor === undefined) return;
+ const currentEditor = editor();
+ if (currentEditor === undefined) return;
if (selection()?.hasLinks) {
- _editor.dispatchCommand(UNLINK_COMMAND, undefined);
+ currentEditor.dispatchCommand(UNLINK_COMMAND, undefined);
setTimeout(() => {
- _editor.focus();
+ currentEditor.focus();
});
return;
}
- _editor.dispatchCommand(TRY_INSERT_LINK_COMMAND, undefined);
+ currentEditor.dispatchCommand(TRY_INSERT_LINK_COMMAND, undefined);
}
function handleInsertEquation() {
- const _editor = editor();
- if (_editor === undefined) return;
- _editor.dispatchCommand(TRY_INSERT_EQUATION_COMMAND, undefined);
+ const currentEditor = editor();
+ if (currentEditor === undefined) return;
+ currentEditor.dispatchCommand(TRY_INSERT_EQUATION_COMMAND, undefined);
}
createEffect(() => {
diff --git a/js/app/packages/block-md/component/MarkdownPopup.tsx b/js/app/packages/block-md/component/MarkdownPopup.tsx
index 44ac25e8e5..370a868faf 100644
--- a/js/app/packages/block-md/component/MarkdownPopup.tsx
+++ b/js/app/packages/block-md/component/MarkdownPopup.tsx
@@ -596,8 +596,8 @@ export function MarkdownPopup(props: {
const anchorRefPosition = () => {
const sel = selection();
if (!showPopup()) return { left: 0, top: 0, width: 0, height: 0 };
- const _blockRect = blockRect();
- if (!_blockRect) return { left: 0, top: 0, width: 0, height: 0 };
+ const currentBlockRect = blockRect();
+ if (!currentBlockRect) return { left: 0, top: 0, width: 0, height: 0 };
// if their is a highlight location then we have a rewrite in progress
// and should pin to that.
@@ -605,7 +605,7 @@ export function MarkdownPopup(props: {
const hlRect = highlightRect();
if (hlLocation && hlRect) {
return {
- left: hlRect.left - _blockRect.left,
+ left: hlRect.left - currentBlockRect.left,
top: hlRect.top - contentTopOffset() + untrack(scrollYOffset),
width: hlRect.width,
height: hlRect.height,
@@ -614,7 +614,7 @@ export function MarkdownPopup(props: {
if (!sel) return { left: 0, top: 0, width: 0, height: 0 };
return {
- left: sel.rect.left - _blockRect.left,
+ left: sel.rect.left - currentBlockRect.left,
top: sel.rect.top - contentTopOffset() + untrack(scrollYOffset),
width: sel.rect.width,
height: sel.rect.height,
diff --git a/js/app/packages/block-md/component/TableInsert.tsx b/js/app/packages/block-md/component/TableInsert.tsx
index 5a1a5ae862..5d0e42120a 100644
--- a/js/app/packages/block-md/component/TableInsert.tsx
+++ b/js/app/packages/block-md/component/TableInsert.tsx
@@ -115,11 +115,11 @@ export function TableInsert(
const handleInsertTable = createCallback((rows: number, cols: number) => {
if (rows <= 0 || cols <= 0) return;
- const _cols = Math.min(cols, MAX_NUMBER_OF_COLS);
- const _rows = Math.min(rows, MAX_NUMBER_OF_ROWS);
+ const clampedCols = Math.min(cols, MAX_NUMBER_OF_COLS);
+ const clampedRows = Math.min(rows, MAX_NUMBER_OF_ROWS);
editor()?.dispatchCommand(INSERT_TABLE_COMMAND, {
- columns: `${_cols}`,
- rows: `${_rows}`,
+ columns: `${clampedCols}`,
+ rows: `${clampedRows}`,
includeHeaders: false,
});
setRows(undefined);
diff --git a/js/app/packages/block-md/component/TitleEditor.tsx b/js/app/packages/block-md/component/TitleEditor.tsx
index e7bce80d90..6b7de157a4 100644
--- a/js/app/packages/block-md/component/TitleEditor.tsx
+++ b/js/app/packages/block-md/component/TitleEditor.tsx
@@ -223,11 +223,11 @@ export function TitleEditor(props: { autoFocusOnMount?: boolean } = {}) {
createEffect(() => {
const docName = mdDocumentName();
- const _state = untrack(state);
+ const currentState = untrack(state);
if (
dataReady() &&
docName !== undefined &&
- docName !== _state.trim() &&
+ docName !== currentState.trim() &&
!selfChangedTitle
) {
forceSetTextContent(editor, docName);
@@ -237,12 +237,12 @@ export function TitleEditor(props: { autoFocusOnMount?: boolean } = {}) {
createEffect(() => {
if (emojiMenuOperations.isOpen()) return;
- const _state = state();
+ const currentState = state();
if (!untrack(initialized)) {
setInitialized(true);
return;
}
- if (_state.trim() !== untrack(mdDocumentName)) {
+ if (currentState.trim() !== untrack(mdDocumentName)) {
selfChangedTitle = true;
debouncedRename();
}
diff --git a/js/app/packages/block-pdf/util/pdfjsUtils.ts b/js/app/packages/block-pdf/util/pdfjsUtils.ts
index e4096bcb48..3217f720c3 100644
--- a/js/app/packages/block-pdf/util/pdfjsUtils.ts
+++ b/js/app/packages/block-pdf/util/pdfjsUtils.ts
@@ -232,8 +232,8 @@ function rangeToString(range: Range): string {
else return contents.textContent ?? '';
}
-function textNodeRects(_range: Range) {
- const range = _range.cloneRange();
+function textNodeRects(inputRange: Range) {
+ const range = inputRange.cloneRange();
const iter = document.createNodeIterator(
range.commonAncestorContainer,
NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT,
diff --git a/js/app/packages/core/component/ForwardToChannel.tsx b/js/app/packages/core/component/ForwardToChannel.tsx
index 80546373d7..5097da8c7e 100644
--- a/js/app/packages/core/component/ForwardToChannel.tsx
+++ b/js/app/packages/core/component/ForwardToChannel.tsx
@@ -95,9 +95,10 @@ export function ForwardToChannel(props: ForwardToChannelProps) {
createSignal<boolean>(true);
const canSendAsGroup = createMemo(() => {
- const _selectedOptions = selectedOptions();
- if (!_selectedOptions || _selectedOptions.length <= 1) return false;
- for (const selectedOption of _selectedOptions) {
+ const currentSelectedOptions = selectedOptions();
+ if (!currentSelectedOptions || currentSelectedOptions.length <= 1)
+ return false;
+ for (const selectedOption of currentSelectedOptions) {
if (selectedOption.kind === 'channel') {
return false;
}
diff --git a/js/app/packages/core/component/LexicalMarkdown/component/core/StaticMarkdown.tsx b/js/app/packages/core/component/LexicalMarkdown/component/core/StaticMarkdown.tsx
index 0a8c5e5468..71d2f043c4 100644
--- a/js/app/packages/core/component/LexicalMarkdown/component/core/StaticMarkdown.tsx
+++ b/js/app/packages/core/component/LexicalMarkdown/component/core/StaticMarkdown.tsx
@@ -366,8 +366,8 @@ const ListItem: RenderableElement<ListItemNode> = {
const checked = props.node.__checked;
// Get the parent list node
- const _children = props.node.getChildren();
- const nested = _children.some((child) => child.__type === 'list');
+ const children = props.node.getChildren();
+ const nested = children.some((child) => child.__type === 'list');
// Build class names
const classes = [
diff --git a/js/app/packages/core/component/LexicalMarkdown/component/decorator/HorizontalRule.tsx b/js/app/packages/core/component/LexicalMarkdown/component/decorator/HorizontalRule.tsx
index 0042af1dfe..cc45e1ef6a 100644
--- a/js/app/packages/core/component/LexicalMarkdown/component/decorator/HorizontalRule.tsx
+++ b/js/app/packages/core/component/LexicalMarkdown/component/decorator/HorizontalRule.tsx
@@ -25,10 +25,10 @@ export function HorizontalRule(props: HorizontalRuleDecoratorProps) {
};
const clickRuleHandler = () => {
- const _editor = editor();
- if (_editor === undefined) return;
+ const currentEditor = editor();
+ if (currentEditor === undefined) return;
if (isSelectedAsNode()) return;
- _editor.update(() => {
+ currentEditor.update(() => {
const sel = $createNodeSelection();
sel.add(props.key);
$setSelection(sel);
@@ -36,9 +36,9 @@ export function HorizontalRule(props: HorizontalRuleDecoratorProps) {
};
const deleteRule = () => {
- const _editor = editor();
- if (_editor === undefined) return;
- _editor.update(() => {
+ const currentEditor = editor();
+ if (currentEditor === undefined) return;
+ currentEditor.update(() => {
let node = $getNodeByKey(props.key);
if (!node) return;
const nextSibling = node.getNextSibling();
diff --git a/js/app/packages/core/component/LexicalMarkdown/component/decorator/MarkdownImage.tsx b/js/app/packages/core/component/LexicalMarkdown/component/decorator/MarkdownImage.tsx
index 7e040ee7bf..c616fc4c1b 100644
--- a/js/app/packages/core/component/LexicalMarkdown/component/decorator/MarkdownImage.tsx
+++ b/js/app/packages/core/component/LexicalMarkdown/component/decorator/MarkdownImage.tsx
@@ -119,11 +119,11 @@ export function MarkdownImage(props: ImageDecoratorProps) {
};
const clickImageHandler = () => {
- const _editor = editor();
- if (_editor === undefined) return;
- if (!_editor.isEditable()) return;
+ const currentEditor = editor();
+ if (currentEditor === undefined) return;
+ if (!currentEditor.isEditable()) return;
if (isSelectedAsNode()) return;
- _editor.update(() => {
+ currentEditor.update(() => {
const sel = $createNodeSelection();
sel.add(props.key);
$setSelection(sel);
@@ -131,9 +131,9 @@ export function MarkdownImage(props: ImageDecoratorProps) {
};
const deleteImage = () => {
- const _editor = editor();
- if (_editor === undefined) return;
- _editor.update(() => {
+ const currentEditor = editor();
+ if (currentEditor === undefined) return;
+ currentEditor.update(() => {
let node = $getNodeByKey(props.key);
if (!node) return;
const nextSibling = node.getNextSibling();
diff --git a/js/app/packages/core/component/LexicalMarkdown/component/decorator/MarkdownVideo.tsx b/js/app/packages/core/component/LexicalMarkdown/component/decorator/MarkdownVideo.tsx
index bf1dcb073c..abd221d5e4 100644
--- a/js/app/packages/core/component/LexicalMarkdown/component/decorator/MarkdownVideo.tsx
+++ b/js/app/packages/core/component/LexicalMarkdown/component/decorator/MarkdownVideo.tsx
@@ -119,11 +119,11 @@ export function MarkdownVideo(props: VideoDecoratorProps) {
};
const clickVideoHandler = () => {
- const _editor = editor();
- if (_editor === undefined) return;
- if (!_editor.isEditable()) return;
+ const currentEditor = editor();
+ if (currentEditor === undefined) return;
+ if (!currentEditor.isEditable()) return;
if (isSelectedAsNode()) return;
- _editor.update(() => {
+ currentEditor.update(() => {
const sel = $createNodeSelection();
sel.add(props.key);
$setSelection(sel);
@@ -131,9 +131,9 @@ export function MarkdownVideo(props: VideoDecoratorProps) {
};
const deleteVideo = () => {
- const _editor = editor();
- if (_editor === undefined) return;
- _editor.update(() => {
+ const currentEditor = editor();
+ if (currentEditor === undefined) return;
+ currentEditor.update(() => {
let node = $getNodeByKey(props.key);
if (!node) return;
const nextSibling = node.getNextSibling();
diff --git a/js/app/packages/core/component/LexicalMarkdown/component/menu/TableActionMenu.tsx b/js/app/packages/core/component/LexicalMarkdown/component/menu/TableActionMenu.tsx
index bfea2be24d..a48b0310da 100644
--- a/js/app/packages/core/component/LexicalMarkdown/component/menu/TableActionMenu.tsx
+++ b/js/app/packages/core/component/LexicalMarkdown/component/menu/TableActionMenu.tsx
@@ -154,8 +154,10 @@ function ActionMenu({
});
const initialBackgroundColor = () => {
- const _editor = editor();
- return !_editor ? '' : currentCellBackgroundColor(_editor) || '';
+ const currentEditor = editor();
+ return !currentEditor
+ ? ''
+ : currentCellBackgroundColor(currentEditor) || '';
};
const [_backgroundColor, _setBackgroundColor] = createBlockSignal<string>(
@@ -183,18 +185,18 @@ function ActionMenu({
// Action Functions
const clearTableSelection = createCallback(() => {
- const _editor = editor();
- if (!_editor) return;
+ const currentEditor = editor();
+ if (!currentEditor) return;
- const _tableCellNode = nodeByKey(_editor, tableCellNodeKey());
- if (!_tableCellNode || !$isTableCellNode(_tableCellNode)) return;
+ const tableCellNode = nodeByKey(currentEditor, tableCellNodeKey());
+ if (!tableCellNode || !$isTableCellNode(tableCellNode)) return;
- _editor.update(() => {
- if (_tableCellNode.isAttached()) {
- const tableNode = $getTableNodeFromLexicalNodeOrThrow(_tableCellNode);
+ currentEditor.update(() => {
+ if (tableCellNode.isAttached()) {
+ const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);
const tableElement = getTableElement(
tableNode,
- _editor.getElementByKey(tableNode.getKey())
+ currentEditor.getElementByKey(tableNode.getKey())
);
if (!tableElement) return;
@@ -205,7 +207,7 @@ function ActionMenu({
}
tableNode.markDirty();
- setTableCellNodeKey(_tableCellNode.getLatest().getKey());
+ setTableCellNodeKey(tableCellNode.getLatest().getKey());
}
$setSelection(null);
@@ -330,14 +332,14 @@ function ActionMenu({
});
const deleteTableAtSelection = createCallback(() => {
- const _editor = editor();
- if (!_editor) return;
+ const currentEditor = editor();
+ if (!currentEditor) return;
- const _tableCellNode = nodeByKey(_editor, tableCellNodeKey());
- if (!_tableCellNode) return;
+ const tableCellNode = nodeByKey(currentEditor, tableCellNodeKey());
+ if (!tableCellNode) return;
- _editor.update(() => {
- const tableNode = $getTableNodeFromLexicalNodeOrThrow(_tableCellNode);
+ currentEditor.update(() => {
+ const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);
tableNode.remove();
clearTableSelection();
});
diff --git a/js/app/packages/core/component/LexicalMarkdown/component/misc/TableCellResizer.tsx b/js/app/packages/core/component/LexicalMarkdown/component/misc/TableCellResizer.tsx
index 4502849b3a..8c0117d7a5 100644
--- a/js/app/packages/core/component/LexicalMarkdown/component/misc/TableCellResizer.tsx
+++ b/js/app/packages/core/component/LexicalMarkdown/component/misc/TableCellResizer.tsx
@@ -84,14 +84,16 @@ export function TableCellResizer() {
// Update handlers
const updateRowHeight = createCallback((heightChange: number) => {
- const _activeCell = activeCell();
- if (!_activeCell) {
+ const currentActiveCell = activeCell();
+ if (!currentActiveCell) {
throw new Error('TableCellResizer: Expected active cell.');
}
editor()?.update(
() => {
- const tableCellNode = $getNearestNodeFromDOMNode(_activeCell.elem);
+ const tableCellNode = $getNearestNodeFromDOMNode(
+ currentActiveCell.elem
+ );
if (!$isTableCellNode(tableCellNode)) {
throw new Error('TableCellResizer: Table cell node not found.');
}
@@ -134,14 +136,16 @@ export function TableCellResizer() {
});
const updateColumnWidth = createCallback((widthChange: number) => {
- const _activeCell = activeCell();
- if (!_activeCell) {
+ const currentActiveCell = activeCell();
+ if (!currentActiveCell) {
throw new Error('TableCellResizer: Expected active cell.');
}
editor()?.update(
() => {
- const tableCellNode = $getNearestNodeFromDOMNode(_activeCell.elem);
+ const tableCellNode = $getNearestNodeFromDOMNode(
+ currentActiveCell.elem
+ );
if (!$isTableCellNode(tableCellNode)) {
throw new Error('TableCellResizer: Table cell node not found.');
}
@@ -180,14 +184,14 @@ export function TableCellResizer() {
event.preventDefault();
event.stopPropagation();
- const _activeCell = activeCell();
- if (!_activeCell) {
+ const currentActiveCell = activeCell();
+ if (!currentActiveCell) {
throw new Error('TableCellResizer: Expected active cell.');
}
if (pointerStartPosRef) {
const { x, y } = pointerStartPosRef;
- if (!_activeCell) {
+ if (!currentActiveCell) {
return;
}
@@ -214,8 +218,8 @@ export function TableCellResizer() {
event.preventDefault();
event.stopPropagation();
- const _activeCell = activeCell();
- if (!_activeCell) {
+ const currentActiveCell = activeCell();
+ if (!currentActiveCell) {
throw new Error('TableCellResizer: Expected active cell.');
}
@@ -319,15 +323,15 @@ export function TableCellResizer() {
// UI related
const getResizers = createMemo(() => {
- const _activeCell = activeCell();
+ const currentActiveCell = activeCell();
editorWidth(); // Make this memo reactive on editor width change.
const rootEl = editor()?.getRootElement();
// let rootRect = rootEl ? containedClientRect(rootEl!) : null;
// let containerRect = rootEl ? getContainerRect(rootEl) : null;
let rootRect = rootEl ? rootEl.getBoundingClientRect() : null;
- if (_activeCell) {
- // const cellRect = containedClientRect(_activeCell.elem);
- const cellRect = _activeCell.elem.getBoundingClientRect();
+ if (currentActiveCell) {
+ // const cellRect = containedClientRect(currentActiveCell.elem);
+ const cellRect = currentActiveCell.elem.getBoundingClientRect();
const zoneWidth = 5; // Pixel width of the zone where you can drag the edge
const styles: Record<string, JSX.CSSProperties> = {
@@ -352,35 +356,35 @@ export function TableCellResizer() {
};
const tableRect = tableRectRef;
- const _draggingDirection = draggingDirection();
- const _pointerCurrentPos = pointerCurrentPos();
+ const currentDraggingDirection = draggingDirection();
+ const currentPointerPos = pointerCurrentPos();
- if (_draggingDirection && _pointerCurrentPos && tableRect) {
+ if (currentDraggingDirection && currentPointerPos && tableRect) {
const compensatedMousePos = {
- x: _pointerCurrentPos.x,
- y: _pointerCurrentPos.y,
+ x: currentPointerPos.x,
+ y: currentPointerPos.y,
};
- if (isHeightChanging(_draggingDirection)) {
- styles[_draggingDirection].left = `${tableRect.left}px`;
- styles[_draggingDirection].top = `${compensatedMousePos.y}px`;
- styles[_draggingDirection].height = '3px';
- styles[_draggingDirection].width = `${tableRect.width}px`;
+ if (isHeightChanging(currentDraggingDirection)) {
+ styles[currentDraggingDirection].left = `${tableRect.left}px`;
+ styles[currentDraggingDirection].top = `${compensatedMousePos.y}px`;
+ styles[currentDraggingDirection].height = '3px';
+ styles[currentDraggingDirection].width = `${tableRect.width}px`;
// Do not let the resizer go outside of the root element;
if (rootRect) {
- styles[_draggingDirection].left =
+ styles[currentDraggingDirection].left =
`${Math.max(rootRect.left, tableRect.left)}px`;
- styles[_draggingDirection].width =
+ styles[currentDraggingDirection].width =
`${Math.min(rootRect.width, tableRect.width)}px`;
}
} else {
- styles[_draggingDirection].top = `${tableRect.top}px`;
- styles[_draggingDirection].left = `${compensatedMousePos.x}px`;
- styles[_draggingDirection].width = '3px';
- styles[_draggingDirection].height = `${tableRect.height}px`;
+ styles[currentDraggingDirection].top = `${tableRect.top}px`;
+ styles[currentDraggingDirection].left = `${compensatedMousePos.x}px`;
+ styles[currentDraggingDirection].width = '3px';
+ styles[currentDraggingDirection].height = `${tableRect.height}px`;
}
- styles[_draggingDirection]['background-color'] =
+ styles[currentDraggingDirection]['background-color'] =
'var(--color-accent-bg)';
}
diff --git a/js/app/packages/core/component/LexicalMarkdown/plugins/tables/tableActionMenuPlugin.ts b/js/app/packages/core/component/LexicalMarkdown/plugins/tables/tableActionMenuPlugin.ts
index 1f0cacffd7..a8bf7b9979 100644
--- a/js/app/packages/core/component/LexicalMarkdown/plugins/tables/tableActionMenuPlugin.ts
+++ b/js/app/packages/core/component/LexicalMarkdown/plugins/tables/tableActionMenuPlugin.ts
@@ -161,11 +161,11 @@ function registerTableActionMenuPlugin(
}
const enabled = !tableObserver || !tableObserver.isSelecting;
- const _anchorElem = props.anchorElem();
+ const anchorElem = props.anchorElem();
if (
enabled &&
- _anchorElem &&
+ anchorElem &&
tableCellParentNodeDOM &&
tableCellNodeFromSelection
) {
@@ -182,7 +182,7 @@ function registerTableActionMenuPlugin(
// Calculate position
const tableCellRect = tableCellParentNodeDOM.getBoundingClientRect();
- const anchorRect = _anchorElem.getBoundingClientRect();
+ const anchorRect = anchorElem.getBoundingClientRect();
const top = tableCellRect.top - anchorRect.top;
const left = tableCellRect.right - anchorRect.left;
const offsetX = -35;
diff --git a/js/app/packages/core/component/Modal.tsx b/js/app/packages/core/component/Modal.tsx
index c12f8ae954..0fcd78788c 100644
--- a/js/app/packages/core/component/Modal.tsx
+++ b/js/app/packages/core/component/Modal.tsx
@@ -63,10 +63,10 @@ export function Content(props: ComponentProps<typeof Dialog.Content<'div'>>) {
});
const positionStyle = createMemo(() => {
- const _rect = rect();
- if (_rect) {
- const centerX = _rect.left + _rect.width / 2;
- const centerY = _rect.top + _rect.height / 2;
+ const currentRect = rect();
+ if (currentRect) {
+ const centerX = currentRect.left + currentRect.width / 2;
+ const centerY = currentRect.top + currentRect.height / 2;
return {
position: 'absolute',
diff --git a/js/app/packages/core/component/RecipientSelector.tsx b/js/app/packages/core/component/RecipientSelector.tsx
index ab59c56422..1a0e1cb739 100644
--- a/js/app/packages/core/component/RecipientSelector.tsx
+++ b/js/app/packages/core/component/RecipientSelector.tsx
@@ -581,11 +581,11 @@ export function RecipientSelector<K extends CombinedRecipientKind>(
createSignal<VirtualizerHandle | null>(null);
setScrollToItem(() => (key: string) => {
- const _handle = handle();
- if (_handle) {
+ const virtualizerHandle = handle();
+ if (virtualizerHandle) {
const ndx = arr.findIndex((item) => item.key === key);
if (ndx > -1) {
- _handle.scrollToIndex(ndx, { align: 'nearest' });
+ virtualizerHandle.scrollToIndex(ndx, { align: 'nearest' });
}
}
});
diff --git a/js/app/packages/lexical-core/transformers/mentions.ts b/js/app/packages/lexical-core/transformers/mentions.ts
index b9eeaa7511..243dcd9de4 100644
--- a/js/app/packages/lexical-core/transformers/mentions.ts
+++ b/js/app/packages/lexical-core/transformers/mentions.ts
@@ -226,8 +226,8 @@ export const I_DOCUMENT_MENTION: TextMatchTransformer = {
// External Document Mentions
-function cleanHostname(_hostname: string): string {
- const hostname = _hostname.replace('www.', '').toLowerCase();
+function cleanHostname(rawHostname: string): string {
+ const hostname = rawHostname.replace('www.', '').toLowerCase();
if (hostname === 'localhost') {
return 'dev.macro.com';
}
diff --git a/js/app/packages/macro-entity/src/source/email.ts b/js/app/packages/macro-entity/src/source/email.ts
index c125c29186..7cfa94ad93 100644
--- a/js/app/packages/macro-entity/src/source/email.ts
+++ b/js/app/packages/macro-entity/src/source/email.ts
@@ -57,28 +57,28 @@ export function createEmailSource(
disabled?: Accessor<boolean>;
}
): EmailSource {
- const [_store, setStore] = singletonEmailStore;
+ const [store, setStore] = singletonEmailStore;
const [sortedView, setSortedView] = createStore<EmailBySortedView>({});
const [queryParams, setQueryParams] =
createStore<FetchPaginatedEmailsParams>(initialQueryParams);
- const _query =
+ const query =
maybeQuery ??
createEmailsInfiniteQuery(() => ({ ...queryParams }), {
disabled: options?.disabled,
});
- const emails = createMemo(() => Object.values(_store));
+ const emails = createMemo(() => Object.values(store));
const getByParams = (params: EmailQueryParams) => {
const viewKey = getViewKey(params);
const emailIds = trackStore(sortedView[viewKey]) ?? [];
// Map IDs to actual email entities from the store
- return emailIds.map((id) => _store[id]).filter((email) => !!email);
+ return emailIds.map((id) => store[id]).filter((email) => !!email);
};
- const isLoading = () => _query.isLoading;
+ const isLoading = () => query.isLoading;
/** Reconcile new emails into the store and update view */
const reconcileEmails = (emails: EmailEntity[], viewKey: string) =>
@@ -97,22 +97,22 @@ export function createEmailSource(
// TODO: if something needs emails it needs to be using search query
const canBackgroundFetch = createDeferred(
- () => false && _query.isSuccess && _query.hasNextPage && !_query.isFetching
+ () => false && query.isSuccess && query.hasNextPage && !query.isFetching
);
createEffect(() => {
// don't background fetch for all view, there are too many emails to fetch
if (queryParams.view === 'all') return;
- if (canBackgroundFetch()) _query.fetchNextPage();
+ if (canBackgroundFetch()) query.fetchNextPage();
});
createEffect(() => {
- if (_query.isSuccess) reconcileEmails(_query.data, getViewKey(queryParams));
+ if (query.isSuccess) reconcileEmails(query.data, getViewKey(queryParams));
});
const archiveEmail = async (id: string, value: boolean) => {
// Optimistically update
- const previousValue = _store[id]?.done;
+ const previousValue = store[id]?.done;
setStore(id, 'done', value);
try {
@@ -130,7 +130,7 @@ export function createEmailSource(
const markAsRead = async (id: string) => {
// Optimistically update
- const previousValue = _store[id]?.isRead;
+ const previousValue = store[id]?.isRead;
setStore(id, 'isRead', true);
try {
@@ -147,12 +147,12 @@ export function createEmailSource(
};
const refetch = async () => {
- await _query.refetch();
+ await query.refetch();
};
return {
- _store,
- _query,
+ _store: store,
+ _query: query,
emails,
isLoading,
setQueryParams,
diff --git a/js/app/packages/service-clients/service-storage/client.ts b/js/app/packages/service-clients/service-storage/client.ts
index 02c330ab6f..42309f0faf 100644
--- a/js/app/packages/service-clients/service-storage/client.ts
+++ b/js/app/packages/service-clients/service-storage/client.ts
@@ -130,7 +130,7 @@ type SuccessResponse = { data: Success };
export type ItemType = CloudStorageItemType | 'channel' | 'email';
-const _itemTypeSet = new Set([
+const itemTypeSet = new Set([
'document',
'channel',
'email',
@@ -139,7 +139,7 @@ const _itemTypeSet = new Set([
]);
export function isItemType(str: string): str is ItemType {
- return _itemTypeSet.has(str);
+ return itemTypeSet.has(str);
}
const mapMetadataDocumentName = (