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

DYN-7034: Change default behavior pattern #22

Merged
merged 1 commit into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dynamods/dynamo-home",
"version": "1.0.13",
Copy link
Contributor

@reddyashish reddyashish May 29, 2024

Choose a reason for hiding this comment

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

why are we changing the version here? the version on apphome repo is still 1.0.13?

Copy link
Contributor

Choose a reason for hiding this comment

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

oh sorry i thought this was on dynamorepo.

"version": "1.0.14",
"description": "Dynamo Home",
"author": "Autodesk Inc.",
"main": "index.js",
Expand Down
8 changes: 4 additions & 4 deletions src/components/Samples/SamplesGrid.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import React from "react";
import { SamplesGridItem } from "./SamplesGridItem";
import styles from './SamplesGrid.module.css';

const renderSample = (sample, key) => {
const renderSample = (sample, keyPrefix) => {
if (sample.Children && sample.Children.length > 0) {
// Separate the children into leaf nodes and nested nodes
const leafNodes = sample.Children.filter(child => !child.Children || child.Children.length === 0);
const nestedNodes = sample.Children.filter(child => child.Children && child.Children.length > 0);

return (
<div key={key} className={styles["sample-container"]}>
<div key={keyPrefix} className={styles["sample-container"]}>
<div className='drop-shadow-2xl'>
<p className='title-paragraph'>{sample.FileName}</p>
</div>
Expand All @@ -24,9 +24,9 @@ const renderSample = (sample, key) => {
} else {
// Render a SamplesGridItem for leaf nodes
return (
<div className={styles["sample-container"]}>
<div key={keyPrefix} className={styles["sample-container"]}>
<div className={styles["graphs-grid"]}>
<SamplesGridItem key={key} FileName={sample.FileName} FilePath={sample.FilePath} />
<SamplesGridItem key={keyPrefix} FileName={sample.FileName} FilePath={sample.FilePath} />
</div>
</div>
);
Expand Down
9 changes: 2 additions & 7 deletions src/components/Sidebar/CustomDropDown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,16 @@ export const CustomDropdown = ({ id, selectedValue, options, onSelect, placehold

/** Peforms the selected action type when used as a Drop-down */
const handleOptionSelect = (option) => {
onSelect(option.label);
setIsOpen(false);
setLastSelected(option);
if (onSelectionChange) {
onSelectionChange(option.value);
}
};

/** Peforms the selected action type when used as a Button */
const handleDefaultAction = () => {
if (lastSelected) {
onSelect(lastSelected.label);
if (onSelectionChange) {
onSelectionChange(lastSelected.value);
}
if (onSelectionChange) {
onSelectionChange(lastSelected.value);
}
};

Expand Down
7 changes: 0 additions & 7 deletions src/components/Sidebar/Sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ import styles from './Sidebar.module.css';

export function Sidebar({ onItemSelect, selectedSidebarItem })
{
const [selectedFile, setSelectedFile] = useState('');
const [selectedNew, setSelectedNew] = useState('');

const isSelected = (item) => selectedSidebarItem === item;

/**Trigger the backend command based on the drop-down value */
Expand All @@ -27,8 +24,6 @@ export function Sidebar({ onItemSelect, selectedSidebarItem })
{/* Files Dropdown */}
<CustomDropdown
id="openDropdown"
selectedValue={selectedFile}
onSelect={setSelectedFile}
placeholder={<FormattedMessage id="button.title.text.open" />}
onSelectionChange={setSelectedValue}
options={[
Expand All @@ -41,8 +36,6 @@ export function Sidebar({ onItemSelect, selectedSidebarItem })
{/* New Dropdown */}
<CustomDropdown
id="newDropdown"
selectedValue={selectedNew}
onSelect={setSelectedNew}
placeholder={<FormattedMessage id="button.title.text.new" />}
onSelectionChange={setSelectedValue}
options={[
Expand Down
Loading