Skip to content

Conversation

@khaosdoctor
Copy link

@khaosdoctor khaosdoctor commented Jul 13, 2025

This fixes #788 and it's a long requested feature. The ability to export SLEF builds in addition to the common internal Coriolis format.

SS:
image

Copilot AI review requested due to automatic review settings July 13, 2025 00:34

This comment was marked as outdated.

}

_copySLEF() {
navigator.clipboard.writeText(this.state.exportSLEF)
Copy link
Author

Choose a reason for hiding this comment

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

This button won't be shown if the browser doesn't support the clipboard object. In this case the text will automatically be selected

Copy link
Author

Choose a reason for hiding this comment

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

Added the copy icon

Copy link
Author

Choose a reason for hiding this comment

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

Removed consoles

Copy link
Author

Choose a reason for hiding this comment

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

Typo

group.push({
m: null,
incCost: true,
slotIndex: slotCounter.get(currentSlotType).length,
Copy link
Author

Choose a reason for hiding this comment

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

This adds the slotIndex so we can better control the name of it without needing a state to start the index over

Copy link
Author

Choose a reason for hiding this comment

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

For example, Utility Mounts are a special case of Hardpoints that have maxClass as 0. To export as a journal we need to put TinyHardpoint1 in the field name, but if the utility mount is the 6th index from the hardpoints, we need to first reset the index

incCost: true,
maxClass: slot,
// Add helper if it's a hardpoint
...(slotType === 'hardpoints' ? {isUtilityMount: isUtility} : {}),
Copy link
Author

Choose a reason for hiding this comment

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

This is for future proofing, just in case someone else needs to check if it's a utility mount

Comment on lines +38 to +39
FSD: "FrameShiftDrive",
Thrusters: "MainEngines",
Copy link
Author

Choose a reason for hiding this comment

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

For some reason I found both of these in the official journals, so I added them here to cover all the bases

Comment on lines +58 to +59
...ship.hardpoints.reduce(hardpointsToSLEF, []),
...ship.internal.reduce(optionalInternalToSLEF, []),
Copy link
Author

Choose a reason for hiding this comment

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

These could be maps, but they'd add the undefined values (which would be removed by the stringify) so, reduce already filters those out

@khaosdoctor khaosdoctor requested a review from Copilot July 14, 2025 15:38
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for exporting ship builds in the SLEF format alongside the existing Coriolis format.

  • Introduces toSLEF and helper functions to convert internal build data into SLEF JSON.
  • Extends the export modal to show, select, and copy the SLEF output, including new CSS, icon, and translations.
  • Updates mappings and ship/slot logic to track slot indices and map names correctly for SLEF; includes a fixture for SLEF export tests.

Reviewed Changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/less/modal.less Styles for JSON inputs and .slefbox layout
src/app/utils/SLEF.js toSLEF conversion and helpers for SLEF export
src/app/utils/CompanionApiUtils.js Mappings for bulkheads and core internals used by SLEF
src/app/shipyard/Ship.js Track slotIndex and utility mounts for export
src/app/shipyard/ModuleUtils.js Import formatting cleanup
src/app/shipyard/Constants.js Added RatingToNumber for rating conversion
src/app/pages/OutfittingPage.jsx Pass ship prop to ModalExport for SLEF generation
src/app/components/SvgIcons.jsx New Copy icon for clipboard action
src/app/components/ModalExport.jsx Render SLEF textarea, copy button, and CSS class update
src/app/i18n/*.json Add "copy" translation key in all locales
tests/fixtures/valid_exported_slef.json SLEF export fixture for testing
Comments suppressed due to low confidence (2)

src/app/utils/SLEF.js:1

  • Consider adding unit tests for toSLEF to verify mapping logic, slot ordering, and behavior when inputs are missing or invalid.
import {

src/less/modal.less:115

  • Missing semicolon after width: 100%. Add ; to prevent CSS parsing errors.
    width: 100%

@alex-williams
Copy link
Collaborator

Thanks for this, I haven't had a chance to look yet, although I have been trying. I will take a proper look as soon as I can.

@alex-williams alex-williams linked an issue Jul 15, 2025 that may be closed by this pull request
@khaosdoctor
Copy link
Author

No worries! I haven't added tests to it yet, if you prefer I can add it here or in another PR because I'll also be off for a few days :)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@khaosdoctor
Copy link
Author

Howdy! Any updates on this?

@alex-williams
Copy link
Collaborator

Howdy! Any updates on this?

Hi, apologies, I've been working on a long planned feature release all week, so I've unfortunately changed a LOT to do with the core code and haven't yet pushed it back to this repo to look at how that changes the PR. I will be doing soon.

@khaosdoctor
Copy link
Author

I see, do you think this is going to conflict? If you need an help on that I'm willing to help maintaining here too :)

@alex-williams
Copy link
Collaborator

I see, do you think this is going to conflict? If you need an help on that I'm willing to help maintaining here too :)

Always good to have additional help maintaining this stuff, although I do need to have a think about how we do that. Coriolis is deployed from my fork of the EDCD repo, as that's where I have all of my github runners configured and no one else has control of them. There is a live branch which is the code found on coriolis.io and a beta branch, which has the code found on beta.coriolis.io, forking from either of those branches isn't ideal, as those branches contain workflow scripts, which I don't want to push up to the EDCD upstream repo, so right now, because I'm mid-feature release, it's just a bit awkward trying to merge PR's in where the base for those PR's is either develop, or main, in the EDCD repo. Once this code gets pushed back to EDCD:coriolis on the develop branch, I can look at this PR and the others sat waiting for attention too, but they're definitely going to require a bit of a rework, yours especially, as I notice you've done slot indexing in the PR and I've done slot indexing in my current feature release as well. I did use your indexing code as the base for that, but had to go a step further and make changes to make it work with imports properly... I'll come back to you in hopefully a few days, when I've pushed this code back to develop, but currently the release isn't finished.

@khaosdoctor
Copy link
Author

I see, do you think this is going to conflict? If you need an help on that I'm willing to help maintaining here too :)

Always good to have additional help maintaining this stuff, although I do need to have a think about how we do that. Coriolis is deployed from my fork of the EDCD repo, as that's where I have all of my github runners configured and no one else has control of them. There is a live branch which is the code found on coriolis.io and a beta branch, which has the code found on beta.coriolis.io, forking from either of those branches isn't ideal, as those branches contain workflow scripts, which I don't want to push up to the EDCD upstream repo, so right now, because I'm mid-feature release, it's just a bit awkward trying to merge PR's in where the base for those PR's is either develop, or main, in the EDCD repo. Once this code gets pushed back to EDCD:coriolis on the develop branch, I can look at this PR and the others sat waiting for attention too, but they're definitely going to require a bit of a rework, yours especially, as I notice you've done slot indexing in the PR and I've done slot indexing in my current feature release as well. I did use your indexing code as the base for that, but had to go a step further and make changes to make it work with imports properly... I'll come back to you in hopefully a few days, when I've pushed this code back to develop, but currently the release isn't finished.

That makes a LOT of sense because I was looking for the commit that added the PCMII and couldn't find it xD all good on my side, I'll wait for your merge then, please lmk when it's landed in main so I can update the stuff for the SLEF builds, then I'll start tackling all the other issues too :)

I have some ideas for enhancements that I wanted to apply in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Export SLEF support

2 participants