Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: corruption loadout import/export #114

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

nmussy
Copy link
Contributor

@nmussy nmussy commented Jul 25, 2021

Minor refactor: move "Copy to clipboard" save export feature to a new copyToClipboard function

Fixes #113

@strentax
Copy link
Contributor

I looked at the suggestion in the issue and I'm a bit concerned about spacing. When you add all the cube types to the ascend history, there isn't much room for buttons on the right:

image

@nmussy
Copy link
Contributor Author

nmussy commented Jul 26, 2021

Oh, I didn't think of it. I might just make the whole corruption cell clickable instead, with a tooltip at the bottom. Thanks!

@nmussy nmussy marked this pull request as draft July 26, 2021 15:09
@@ -201,10 +201,15 @@ export const corruptionLoadoutTableCreate = () => {
}
if (i === 0) {
let cell = row.insertCell();
//empty
let btn = document.createElement("button");
Copy link
Member

Choose a reason for hiding this comment

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

const

let btn = document.createElement("button");
btn.className = "corrSave"
btn.textContent = "Import"
btn.onclick = () => corruptionLoadoutImportPrompt();
Copy link
Member

Choose a reason for hiding this comment

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

addEventListener


cell = row.insertCell();
let btn = document.createElement("button");
btn = document.createElement("button");
Copy link
Member

Choose a reason for hiding this comment

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

rename

Comment on lines +263 to +266
[
'Please enter comma-separated corruption values. Current loadout:',
player.prototypeCorruptions.join(','),
].join('\n')
Copy link
Member

Choose a reason for hiding this comment

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

just concat the strings

return Alert('Invalid format! Corruption loadouts should be 13 comma-separated numbers.');
}

player.prototypeCorruptions = importLoadout;
Copy link
Member

@KhafraDev KhafraDev Aug 9, 2021

Choose a reason for hiding this comment

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

what if one of these is NaN, negative, infinite, etc?


cell = row.insertCell();
let btn = document.createElement("button");
btn = document.createElement("button");
btn.className = "corrLoad"
btn.textContent = "Zero"
btn.onclick = () => corruptionLoadoutSaveLoad(false, i);
Copy link
Member

Choose a reason for hiding this comment

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

please addEventListener here too

player.prototypeCorruptions = importLoadout;
corruptionLoadoutTableUpdate();
corruptionStatsUpdate();
};
Copy link
Member

Choose a reason for hiding this comment

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

remove semicolon


export const copyToClipboard = async (text: string) => {
if ('clipboard' in navigator) {
await navigator.clipboard.writeText(text)
Copy link
Member

Choose a reason for hiding this comment

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

return void navigator.clipboard...

await navigator.clipboard.writeText(text)
.catch(e => console.error(e));

return;
Copy link
Member

Choose a reason for hiding this comment

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

axe this return

@@ -102,3 +102,27 @@ export const btoa = (s: string) => {
return null;
}
}

export const copyToClipboard = async (text: string) => {
Copy link
Member

Choose a reason for hiding this comment

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

: Promise

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.

Feature: Corruption loadout import/export
3 participants