Skip to content

Commit

Permalink
fix: Sorting and version numbers for mirabuf files
Browse files Browse the repository at this point in the history
  • Loading branch information
HunterBarclay committed Dec 19, 2024
1 parent e9613b5 commit 0d3606c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions fission/src/ui/panels/mirabuf/ImportMirabufPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ const ImportMirabufPanel: React.FC<PanelPropsImpl> = ({ panelId }) => {
// Generate Item cards for cached robots.
const cachedRobotElements = useMemo(
() =>
cachedRobots.map(info =>
cachedRobots.sort((a, b) => a.name?.localeCompare(b.name ?? "") ?? -1).map(info =>
ItemCard({
name: info.name || info.cacheKey || "Unnamed Robot",
id: info.id,
Expand All @@ -279,7 +279,7 @@ const ImportMirabufPanel: React.FC<PanelPropsImpl> = ({ panelId }) => {
// Generate Item cards for cached fields.
const cachedFieldElements = useMemo(
() =>
cachedFields.map(info =>
cachedFields.sort((a, b) => a.name?.localeCompare(b.name ?? "") ?? -1).map(info =>
ItemCard({
name: info.name || info.cacheKey || "Unnamed Field",
id: info.id,
Expand All @@ -304,7 +304,7 @@ const ImportMirabufPanel: React.FC<PanelPropsImpl> = ({ panelId }) => {
const remoteRobots = manifest?.robots.filter(
path => !cachedRobots.some(info => info.cacheKey.includes(path.src))
)
return remoteRobots?.map(path =>
return remoteRobots?.sort((a, b) => a.displayName.localeCompare(b.displayName)).map(path =>
ItemCard({
name: path.displayName,
id: path.src,
Expand All @@ -322,7 +322,7 @@ const ImportMirabufPanel: React.FC<PanelPropsImpl> = ({ panelId }) => {
const remoteFields = manifest?.fields.filter(
path => !cachedFields.some(info => info.cacheKey.includes(path.src))
)
return remoteFields?.map(path =>
return remoteFields?.sort((a, b) => a.displayName.localeCompare(b.displayName)).map(path =>
ItemCard({
name: path.displayName,
id: path.src,
Expand All @@ -338,9 +338,9 @@ const ImportMirabufPanel: React.FC<PanelPropsImpl> = ({ panelId }) => {
// Generate Item cards for APS robots and fields.
const hubElements = useMemo(
() =>
files?.map(file =>
files?.sort((a, b) => a.attributes.displayName!.localeCompare(b.attributes.displayName!)).map(file =>
ItemCard({
name: file.attributes.displayName!,
name: `${file.attributes.displayName!.replace(".mira", "")}${file.attributes.versionNumber != undefined ? ` (v${file.attributes.versionNumber})` : ''}`,
id: file.id,
primaryButtonNode: SynthesisIcons.DownloadLarge,
primaryOnClick: () => {
Expand Down

0 comments on commit 0d3606c

Please sign in to comment.