Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Feature: Attribute Select #443

Merged
merged 19 commits into from
Sep 15, 2023
Merged

Add Feature: Attribute Select #443

merged 19 commits into from
Sep 15, 2023

Conversation

mdroidian
Copy link
Collaborator

@mdroidian mdroidian commented Sep 7, 2023

https://www.loom.com/share/b7648ed545ff42b4bff6aacc42461ee2

before this PR:

  • move selections to options tree for future proofing

probably also

  • refresh <Tab> on delete
  • refresh attribute observer on add/delete instead of keyboard shortcut

Would be nice

  • remove value from autocomplete after after add
  • controlled tabs
    • focus on added attribute
    • focus on block to add options

Future Additions

  • multiple values
    • requires multiple adjustments
      • dialog
        • select box probably
      • what values are supported
        • [[``]]
        • #
        • plain text
        • block references?
        • commas?
  • options
    • via UID
      • Status
    • via smartblock
      • <%CHILDREN:Status%>
      • <%QUERYBUILDER:someQuery,{text}%>
  • choose default icon
  • choose icon per attribute
  • inline dropdown instead of popup dialog
  • clicking the chevron-down should just display the blueprintjs Select without a button or "overlay"
  • after initial Add an Attribute is clicked, menu should be already open and displayed

@mdroidian mdroidian marked this pull request as ready for review September 7, 2023 02:51
Comment on lines 239 to 275
const ConfigPage = ({}: {}): React.ReactElement => {
const titleRef = useRef<HTMLDivElement>(null);
return (
<Card style={{ color: "#202B33" }} className={"roamjs-config-panel"}>
<div
style={{ display: "flex", justifyContent: "space-between" }}
ref={titleRef}
tabIndex={-1}
>
<h4 style={{ padding: 4 }}>Attribute Select Configuration</h4>
</div>
<AttributeConfigPanel />
</Card>
);
};
const renderConfigPage = ({
h,
pageUid,
}: {
h: HTMLHeadingElement;
pageUid: string;
}) => {
const uid = pageUid;
const attribute = `data-roamjs-${uid}`;
const containerParent = h.parentElement?.parentElement;
if (containerParent && !containerParent.hasAttribute(attribute)) {
containerParent.setAttribute(attribute, "true");
const parent = document.createElement("div");
const configPageId = "attribute-select";
parent.id = `${configPageId}-config`;
containerParent.insertBefore(
parent,
h.parentElement?.nextElementSibling || null
);
ReactDOM.render(<ConfigPage />, parent);
}
};
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pulled this out because

  • I was having issue with duplicate blocks being created
  • had to CSS hide multiple tabs

Turns out the multiple blocks issue was solved elsewhere, so I could go back to using roamjs createConfigObserver

src/features/attributeSelect.tsx Outdated Show resolved Hide resolved
src/features/attributeSelect.tsx Outdated Show resolved Hide resolved
src/features/attributeSelect.tsx Show resolved Hide resolved
src/features/attributeSelect.tsx Outdated Show resolved Hide resolved
src/features/attributeSelect.tsx Outdated Show resolved Hide resolved
src/features/attributeSelect.tsx Outdated Show resolved Hide resolved
src/features/attributeSelect.tsx Show resolved Hide resolved
src/index.ts Outdated Show resolved Hide resolved
@mdroidian
Copy link
Collaborator Author

tagging @dvargas92495 just for visibility

Here's a video with some of the changes since the first video

WorkBench.-.Attribute.Select.-.14.September.2023.mp4

@mdroidian mdroidian merged commit 1f95f39 into main Sep 15, 2023
1 check passed
@mdroidian mdroidian deleted the attribute-select branch September 15, 2023 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants