-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Refactor store selectors to only update on specific state updates
- Loading branch information
1 parent
89c8f7a
commit 5edc38d
Showing
6 changed files
with
108 additions
and
6 deletions.
There are no files selected for viewing
76 changes: 76 additions & 0 deletions
76
src/renderer/src/components/pages/EntitySelector/index.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import GuidedModePage from "../../containers/GuidedModePage"; | ||
import GuidedModeSection from "../../containers/GuidedModeSection"; | ||
import DropDownNote from "../../utils/ui/DropDownNote"; | ||
import { TextInput, Textarea, Text } from "@mantine/core"; | ||
import ExternalLink from "../../buttons/ExternalLink"; | ||
import useGlobalStore from "../../../stores/globalStore"; | ||
import { | ||
setGuidedDatasetName, | ||
setGuidedDatasetSubtitle, | ||
} from "../../../stores/slices/guidedModeSlice"; | ||
|
||
const NameAndSubtitlePage = () => { | ||
const { guidedDatasetName, guidedDatasetSubtitle } = useGlobalStore((state) => ({ | ||
guidedDatasetName: state.guidedDatasetName, | ||
guidedDatasetSubtitle: state.guidedDatasetSubtitle, | ||
})); | ||
return ( | ||
<GuidedModePage pageHeader="Dataset name and subtitle"> | ||
<GuidedModeSection> | ||
<TextInput | ||
label="Dataset Name:" | ||
placeholder="Enter dataset name" | ||
value={guidedDatasetName} | ||
onChange={(event) => setGuidedDatasetName(event.target.value)} | ||
/> | ||
<DropDownNote | ||
dropDownIcon="info" | ||
dropDownButtonText="What is the dataset name used for?" | ||
dropDownNote={ | ||
<Text> | ||
This field will be displayed in public as the title of the dataset once it is | ||
published on the | ||
<ExternalLink | ||
href="https://sparc.science/" | ||
buttonText="SPARC Data Portal" | ||
buttonType="anchor" | ||
/> | ||
. Please make sure that your dataset name is unique and relatively informative. | ||
</Text> | ||
} | ||
/> | ||
</GuidedModeSection> | ||
<GuidedModeSection> | ||
<Textarea | ||
label="Dataset Subtitle:" | ||
placeholder="Enter dataset subtitle" | ||
autosize | ||
minRows={5} | ||
value={guidedDatasetSubtitle} | ||
onChange={(event) => setGuidedDatasetSubtitle(event.target.value)} | ||
maxLength={255} | ||
/> | ||
<Text align="right" style={{ marginTop: "-35px", zIndex: "10", marginRight: "10px" }}> | ||
{255 - guidedDatasetSubtitle.length} characters remaining | ||
</Text> | ||
<DropDownNote | ||
dropDownIcon="info" | ||
dropDownButtonText="What is the dataset subtitle used for?" | ||
dropDownNote={ | ||
<Text> | ||
This field will become the short description visible immediately under the title of | ||
your dataset once it is published on the | ||
<ExternalLink | ||
href="https://sparc.science/" | ||
buttonText="SPARC Data Portal" | ||
buttonType="anchor" | ||
/> | ||
</Text> | ||
} | ||
/> | ||
</GuidedModeSection> | ||
</GuidedModePage> | ||
); | ||
}; | ||
|
||
export default NameAndSubtitlePage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters