Skip to content

Commit

Permalink
xml file custom handling
Browse files Browse the repository at this point in the history
- custom rendering of the 'Auther' field notifying the file is of old (XML) type for recent files
  • Loading branch information
dnenov committed Feb 27, 2024
1 parent f843b83 commit c9f5cd6
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/assets/home.js

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

20 changes: 20 additions & 0 deletions src/components/Common/CustomIcons.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,23 @@ export const ListViewIcon = () => (
/>
</svg>
);

export const QuestionMarkIcon = () => (
<div style={{ verticalAlign: "center", marginLeft: "5px", marginTop: "4px", marginRight: "5px" }}>
<svg
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M8.00008 15.3337C12.0502 15.3337 15.3334 12.0504 15.3334 8.00033C15.3334 3.95024 12.0502 0.666992 8.00008 0.666992C3.94999 0.666992 0.666748 3.95024 0.666748 8.00033C0.666748 12.0504 3.94999 15.3337 8.00008 15.3337ZM8.00008 5.33366C7.15681 5.33366 6.66675 5.89343 6.66675 6.36396C6.66675 6.73215 6.36827 7.03063 6.00008 7.03063C5.63189 7.03063 5.33342 6.73215 5.33342 6.36396C5.33342 4.96007 6.63422 4.00033 8.00008 4.00033C9.36594 4.00033 10.6667 4.96007 10.6667 6.36396C10.6667 7.16403 10.2248 7.76798 9.61551 8.11926C9.32651 8.2859 9.0747 8.46968 8.90124 8.66562C8.73248 8.85625 8.66675 9.02371 8.66675 9.18214V9.33366C8.66675 9.70185 8.36827 10.0003 8.00008 10.0003C7.63189 10.0003 7.33342 9.70185 7.33342 9.33366V9.18214C7.33342 8.6042 7.58993 8.13536 7.9029 7.78182C8.21117 7.43361 8.60058 7.16537 8.94951 6.96418C9.21746 6.80968 9.33342 6.61013 9.33342 6.36396C9.33342 5.89343 8.84336 5.33366 8.00008 5.33366ZM9.00008 11.667C9.00008 12.2193 8.55237 12.667 8.00008 12.667C7.4478 12.667 7.00008 12.2193 7.00008 11.667C7.00008 11.1147 7.4478 10.667 8.00008 10.667C8.55237 10.667 9.00008 11.1147 9.00008 11.667Z"
fill="#999999"
/>
</svg>
</div>
);

29 changes: 29 additions & 0 deletions src/components/Recent/CustomAuthorCellRenderer.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React from "react";
import { FormattedMessage, useIntl } from 'react-intl';
import { Tooltip } from '../Common/Tooltip.jsx';
import { QuestionMarkIcon } from '../Common/CustomIcons.jsx';
import styles from './CustomCellRenderer.module.css';


/**
* Exports a custom cell renderer for the author cell.
* @param value - the name of the graph
* @param row - the data associate with this row containing all the information for the graph
*/
export const CustomAuthorCellRenderer = ({ value, row }) => {
const intl = useIntl();
const author = value;
const isOldFormat = author === intl.formatMessage({ id: 'recent.item.old.format' });

console.log(author);
console.log(isOldFormat);
return (
<div className={styles["title-cell"]}>
<p>{author}</p>
{isOldFormat &&
<Tooltip content={<FormattedMessage id="recent.item.old.format.tooltip" />}>
<QuestionMarkIcon />
</Tooltip>}
</div>
);
};
2 changes: 2 additions & 0 deletions src/components/Recent/PageRecent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useState, useEffect } from 'react';
import { GraphGridItem } from './GraphGridItem.jsx';
import { CustomNameCellRenderer } from './CustomNameCellRenderer.jsx';
import { CustomLocationCellRenderer } from './CustomLocationCellRenderer.jsx';
import { CustomAuthorCellRenderer } from "./CustomAuthorCellRenderer.jsx";
import { GraphTable } from './GraphTable.jsx';
import { GridViewIcon, ListViewIcon } from '../Common/CustomIcons.jsx';
import { openFile } from '../../functions/utility.js';
Expand Down Expand Up @@ -60,6 +61,7 @@ export function RecentPage ({ setIsDisabled }){
Header: 'Author',
accessor: 'Author',
resizable: true,
Cell: CustomAuthorCellRenderer,
},
{
Header: 'Date Modified',
Expand Down
4 changes: 3 additions & 1 deletion src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@
"learning.title.text.guides": "Interactive Guides",
"learning.title.text.videos": "Video Tutorials",
"samples.showsamples.text": "Show Samples in Folder",
"main.page.loading.text": "Loading"
"main.page.loading.text": "Loading",
"recent.item.old.format": "Dynamo 1.0 file format",
"recent.item.old.format.tooltip": "Author and thumbnail not available for files saved in Dynamo 1.0 format"
}

0 comments on commit c9f5cd6

Please sign in to comment.