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

MISC: Convert Literature entries and helper functions to TSX #1854

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

NagaOuroboros
Copy link

Following the conclusion of discussion on the Discord, I have brought the Literature-related files in-line with the recommendations made so that, going forward, contribution and maintenance of Literature files should be both easier and more flexible.

Literatures.ts -> Literatures.tsx

  • Reformatted every Literature entry's text property to hold a JSX Element.
  • Miscellaneous edits to entries to use JSX features and fix parsing errors so the final output is unchanged.
  • Replaced single quotes within the entries with double quotes, since the text property is no longer comprised of string literals.

LiteratureHelpers.ts -> LiteratureHelpers.tsx

  • Updated showLiterature() to pass a JSX Element to dialogueBoxCreate() instead of a string.

Literature.ts

  • Changed the LiteratureConstructorParams interface's text field from type string to type JSX.Element.
  • Changed the Literature class's text field from type string to type JSX.Element.

<br />
{litObj.text}
</>
);
dialogBoxCreate(txt, true);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
dialogBoxCreate(txt, true);
dialogBoxCreate(txt);

The second parameter should not be used. We only use it in 2 cases:

  • Literature. We concatenate strings to create an HTML string, so we need HTML support in dialogBoxCreate.
  • ns.alert. Legacy support.

Literature content is a React element now, so there is no need to call dialogBoxCreate with html=true.

Copy link
Author

Choose a reason for hiding this comment

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

Done!

I only left it in due to my own uncertainty over what it controlled, and didn't try removing it, as it didn't produce any erroneous output. Thanks for the pointer!

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.

2 participants