Skip to content

Commit

Permalink
Merge pull request #857 from trey-wallis/revert-856-show-as-disabled
Browse files Browse the repository at this point in the history
Revert "fix: add disabled background and tooltip when column frontmat…
  • Loading branch information
decaf-dev authored Nov 15, 2023
2 parents 6530379 + 28198b0 commit 7cdc42a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 33 deletions.
42 changes: 19 additions & 23 deletions src/react/loom-app/body-cell-container/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,6 @@ export default function BodyCellContainer({
columnType === CellType.TAG ||
columnType === CellType.MULTI_TAG ||
columnType === CellType.DATE;
const isDisabled = source !== null && frontmatterKey === null;
const isUneditable =
columnType === CellType.CHECKBOX ||
columnType === CellType.CREATION_TIME ||
columnType === CellType.LAST_EDITED_TIME ||
columnType === CellType.SOURCE ||
columnType === CellType.SOURCE_FILE;

const COMPONENT_ID = `body-cell-${cellId}`;
const menu = useMenu(COMPONENT_ID);
Expand Down Expand Up @@ -187,13 +180,13 @@ export default function BodyCellContainer({
}

function handleMenuTriggerEnterDown() {
if (isDisabled) return;
if (columnType === CellType.CHECKBOX) toggleCheckbox();
}

function handleMenuTriggerClick() {
if (isDisabled) return;
if (columnType === CellType.CHECKBOX) toggleCheckbox();
if (columnType === CellType.CHECKBOX) {
toggleCheckbox();
}
}

function handleExternalLinkToggle(value: boolean) {
Expand Down Expand Up @@ -307,32 +300,35 @@ export default function BodyCellContainer({
const overflowClass = useOverflow(shouldWrapOverflow, {
ellipsis: columnType === CellType.DATE,
});

className += " " + overflowClass;

if (isUneditable) {
className += " dataloom-cell--uneditable";
} else if (isDisabled) {
className += " dataloom-cell--disabled";
if (
columnType === CellType.LAST_EDITED_TIME ||
columnType === CellType.CREATION_TIME ||
columnType === CellType.SOURCE ||
columnType === CellType.SOURCE_FILE ||
(source && frontmatterKey === null)
) {
className += " dataloom-cell--body__container--default-cursor";
}

const cellTags = columnTags.filter((tag) => cellTagIds.includes(tag.id));

let shouldRunTrigger = true;
if (isUneditable || isDisabled) {
if (
columnType === CellType.CHECKBOX ||
columnType === CellType.CREATION_TIME ||
columnType === CellType.LAST_EDITED_TIME ||
columnType === CellType.SOURCE ||
columnType === CellType.SOURCE_FILE ||
(source && frontmatterKey === null)
) {
shouldRunTrigger = false;
}

let ariaLabel = "";
if (isDisabled) {
ariaLabel =
"This cell is disabled until you choose a frontmatter key for this column";
}

return (
<>
<MenuTrigger
ariaLabel={ariaLabel}
ref={menu.triggerRef}
variant="cell"
menuId={menu.id}
Expand Down
9 changes: 2 additions & 7 deletions src/react/loom-app/body-cell-container/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@
color: var(--text-normal); /* Stop dimming of text when mouse leaves embedded loom */
}

.dataloom-cell--uneditable {
cursor: default;
}

.dataloom-cell--disabled {
cursor: default;
background-color: var(--background-secondary);
.dataloom-cell--body__container--default-cursor {
cursor: default;
}
3 changes: 0 additions & 3 deletions src/react/shared/menu-trigger/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { useMenuOperations } from "../menu-provider/hooks";
import { LoomMenuLevel } from "../menu-provider/types";

interface Props {
ariaLabel?: string;
menuId: string;
level: LoomMenuLevel;
shouldRunTrigger?: boolean;
Expand All @@ -28,7 +27,6 @@ interface Props {
const MenuTrigger = React.forwardRef<HTMLDivElement, Props>(
(
{
ariaLabel,
menuId,
level,
variant,
Expand Down Expand Up @@ -111,7 +109,6 @@ const MenuTrigger = React.forwardRef<HTMLDivElement, Props>(
}
return (
<div
aria-label={ariaLabel}
data-menu-id={menuId}
tabIndex={0}
className={className}
Expand Down

0 comments on commit 7cdc42a

Please sign in to comment.