Skip to content

Commit fcc1e07

Browse files
committed
wip: Updated text for demo
1 parent f034a3f commit fcc1e07

File tree

4 files changed

+33
-38
lines changed

4 files changed

+33
-38
lines changed

src/renderer/src/components/shared/DatasetTreeViewRenderer/index.jsx

+3-13
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const fileIconMap = {
3939
xml: <IconFileTypeXml size={FILE_ICON_SIZE} />,
4040
zip: <IconFileTypeZip size={FILE_ICON_SIZE} />,
4141
rar: <IconFileTypeZip size={FILE_ICON_SIZE} />,
42+
jp2: <IconPhoto size={FILE_ICON_SIZE} />,
4243
};
4344

4445
const getFileTypeIcon = (fileName) => {
@@ -48,8 +49,7 @@ const getFileTypeIcon = (fileName) => {
4849

4950
// FileItem component
5051
const FileItem = ({ name, content, onFileClick, getFileBackgroundColor }) => {
51-
const filesRelativePath = content.relativePath;
52-
const fileBackgroundColor = getFileBackgroundColor(filesRelativePath);
52+
const fileBackgroundColor = getFileBackgroundColor(content.relativePath);
5353
return (
5454
<div
5555
style={{
@@ -68,14 +68,7 @@ const FileItem = ({ name, content, onFileClick, getFileBackgroundColor }) => {
6868
};
6969

7070
// FolderItem component
71-
const FolderItem = ({
72-
name,
73-
content,
74-
onFolderClick,
75-
onFileClick,
76-
getFolderBackgroundColor,
77-
getFileBackgroundColor,
78-
}) => {
71+
const FolderItem = ({ name, content, onFolderClick, onFileClick, getFileBackgroundColor }) => {
7972
const [isOpen, setIsOpen] = useState(false);
8073
const { hovered, ref } = useHover();
8174

@@ -115,7 +108,6 @@ const FolderItem = ({
115108
content={content.folders[folderName]}
116109
onFolderClick={onFolderClick}
117110
onFileClick={onFileClick}
118-
getFolderBackgroundColor={getFolderBackgroundColor}
119111
getFileBackgroundColor={getFileBackgroundColor}
120112
/>
121113
))}
@@ -138,7 +130,6 @@ const DatasetTreeView = ({
138130
datasetStructure,
139131
onFolderClick,
140132
onFileClick,
141-
getFolderBackgroundColor,
142133
getFileBackgroundColor,
143134
}) =>
144135
!datasetStructure?.folders && !datasetStructure?.files ? null : (
@@ -159,7 +150,6 @@ const DatasetTreeView = ({
159150
content={datasetStructure.folders[folderName]}
160151
onFolderClick={onFolderClick}
161152
onFileClick={onFileClick}
162-
getFolderBackgroundColor={getFolderBackgroundColor}
163153
getFileBackgroundColor={getFileBackgroundColor}
164154
/>
165155
))}

src/renderer/src/components/shared/manifest/ManifestEntitySelector.jsx

+11-16
Original file line numberDiff line numberDiff line change
@@ -34,31 +34,27 @@ const ManifestEntitySelector = () => {
3434
toggleRelativeFilePathForManifestEntity(entityType, activeEntity, fileContents.relativePath);
3535
};
3636

37-
const getFolderBackgroundColor = (folderRelativePath) => {
38-
const folderIsSelected = getEntityForRelativePath(folderRelativePath);
39-
return folderIsSelected ? "blue" : "white";
40-
};
41-
4237
const getFileBackgroundColor = (fileRelativePath) => {
43-
if (fileRelativePath === "primary/sub-1/code_description.xlsx") {
44-
console.log("Active entity:", activeEntity);
38+
const filesEntity = getEntityForRelativePath(fileRelativePath);
39+
if (!filesEntity) {
40+
return null;
4541
}
46-
const fileIsSelected = getEntityForRelativePath(fileRelativePath);
47-
if (fileIsSelected) {
48-
console.log("File is selected:", fileRelativePath);
42+
if (filesEntity === "sub-2") {
43+
console.log(fileRelativePath + " is sub-2");
4944
}
50-
return fileIsSelected ? "blue" : "white";
45+
46+
return filesEntity === activeEntity ? "var(--color-transparent-soda-green)" : "red";
5147
};
5248

5349
return (
5450
<FullWidthContainer>
5551
<Grid gutter="md">
5652
<Grid.Col span={4} style={{ position: "sticky", top: "20px" }}>
57-
<Paper shadow="lg" p="lg" radius="md" withBorder>
58-
<Text size="xl" weight={700} align="center" color="dark">
59-
Select Entity
53+
<Paper shadow="lg" p="sm" radius="md" withBorder>
54+
<Text size="xl" weight={700} align="center" c="dark">
55+
Subject list
6056
</Text>
61-
<Divider my="lg" />
57+
<Divider my="sm" />
6258
<Stack gap="xs">
6359
{entityList.map((entity) => (
6460
<Button
@@ -83,7 +79,6 @@ const ManifestEntitySelector = () => {
8379
datasetStructure={datasetStructureJSONObj}
8480
onFolderClick={handleFolderClick}
8581
onFileClick={handleFileClick}
86-
getFolderBackgroundColor={getFolderBackgroundColor}
8782
getFileBackgroundColor={getFileBackgroundColor}
8883
/>
8984
</Paper>

src/renderer/src/sections/guided_mode/guided_curate_dataset.html

+9-8
Original file line numberDiff line numberDiff line change
@@ -2634,25 +2634,26 @@ <h2 class="text-sub-step-title">Preview/Edit manifest files</h2>
26342634
id="guided-manifest-subject-entity-selector-tab"
26352635
class="guided--page"
26362636
data-component-type="guided-mode-page"
2637-
data-page-header="Denote subject folders"
2637+
data-page-header="Indicate subject folders/files"
26382638
data-page-name="Manifest subject selection"
26392639
></div>-->
26402640

26412641
<div
26422642
class="guided--page"
26432643
id="guided-manifest-subject-entity-selector-tab"
2644-
data-page-name="Denote subject folders"
2644+
data-page-name="Map Folders/Files to Subjects"
26452645
>
26462646
<div class="guided--section">
2647-
<h1 class="text-sub-step-title">Manifest files</h1>
2647+
<h1 class="text-sub-step-title">Map Folders/Files to Subjects</h1>
26482648
<p class="help-text">
2649-
The SPARC guidelines require all datasets to include metadata files called manifest
2650-
files. One manifest file must be included in each high level folder. Manifest files
2651-
are intended to contain information about all of the data files in its high level
2652-
folder.
2649+
The SPARC guidelines require all folders and files related to subjects to be mapped to
2650+
their respective subjects in the manifest file.
2651+
</p>
2652+
<p class="help-text">
2653+
To map folders and files to subjects in the interface below, first select a subject
2654+
from the list, then choose the folders and files associated with that subject.
26532655
</p>
26542656
</div>
2655-
26562657
<div data-component-type="manifest-entity-selector" class="guided--section"></div>
26572658
</div>
26582659
<div

src/renderer/src/stores/slices/manifestEntitySelectorSlice.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -127,5 +127,14 @@ export const getEntityForRelativePath = (relativePath) => {
127127
const manifestEntityObj = useGlobalStore((state) => state.manifestEntityObj);
128128
const entityType = useGlobalStore((state) => state.entityType);
129129
const activeEntity = useGlobalStore((state) => state.activeEntity);
130-
return manifestEntityObj?.[entityType]?.[activeEntity]?.includes(relativePath);
130+
131+
if (!entityType || !activeEntity) {
132+
return null;
133+
}
134+
135+
if (manifestEntityObj?.[entityType]?.[activeEntity]?.includes(relativePath)) {
136+
return activeEntity;
137+
} else {
138+
return null;
139+
}
131140
};

0 commit comments

Comments
 (0)