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

QuickCSS improvements #557

Closed
wants to merge 31 commits into from
Closed

QuickCSS improvements #557

wants to merge 31 commits into from

Conversation

12944qwerty
Copy link
Member

@12944qwerty 12944qwerty commented Sep 20, 2023

Makes the editor a fixed size and popoutable.

@12944qwerty 12944qwerty marked this pull request as ready for review September 21, 2023 20:04
@@ -0,0 +1,11 @@
import { MouseEventHandler } from "react";

export default (props: { onClick?: MouseEventHandler }): React.ReactElement => (
Copy link
Member

Choose a reason for hiding this comment

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

There is a component (StayOnTopButton, id 631443) with the icon and all the functionality already done.

@@ -0,0 +1,11 @@
import { MouseEventHandler } from "react";

export default (props: { onClick?: MouseEventHandler }): React.ReactElement => (
Copy link
Member

Choose a reason for hiding this comment

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

Do not use onClick on svg's. Instead use this icon wrapped in a Clickable component.

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentColor">
import { MouseEventHandler } from "react";

export default (props: { onClick?: MouseEventHandler }): React.ReactElement => (
Copy link
Member

Choose a reason for hiding this comment

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

Same here, use Clickable.


{!props.popout && props.isPopoutOpen ? (
<ButtonItem
button="Close Popout"
Copy link
Member

Choose a reason for hiding this comment

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

i18n. You can use POPOUT_RETURN.

openPopout(
"DISCORD_REPLUGGED_QUICKCSS",
() => (
<DnDProvider windowKey="DISCORD_REPLUGGED_QUICKCSS">
Copy link
Member

Choose a reason for hiding this comment

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

Pass a title prop to set the window title, or else it will be undefined.

};

// eslint-disable-next-line @typescript-eslint/non-nullable-type-assertion-style
const DnDProvider = webpack.getBySource(
Copy link
Member

Choose a reason for hiding this comment

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

To be precise, do not confuse the two components, which are different (DragAndDropProvider vs PopoutWindow)

Suggested change
const DnDProvider = webpack.getBySource(
const PopoutWindow = webpack.getBySource(

const PopoutModule = await webpack.waitForModule(
webpack.filters.bySource('type:"POPOUT_WINDOW_OPEN"'),
);
// eslint-disable-next-line @typescript-eslint/non-nullable-type-assertion-style
Copy link
Member

Choose a reason for hiding this comment

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

All these comments to disable the rules are useless. Instead use the ! assertion, or even better check later if it's undefined or not.

webpack.filters.bySource('type:"POPOUT_WINDOW_OPEN"'),
);
// eslint-disable-next-line @typescript-eslint/non-nullable-type-assertion-style
const openPopout = webpack.getFunctionBySource(PopoutModule, "POPOUT_WINDOW_OPEN") as (
Copy link
Member

@FedeIlLeone FedeIlLeone Sep 22, 2023

Choose a reason for hiding this comment

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

Type generics are a thing with these webpack functions. Use them.

// eslint-disable-next-line @typescript-eslint/non-nullable-type-assertion-style
const openPopout = webpack.getFunctionBySource(PopoutModule, "POPOUT_WINDOW_OPEN") as (
key: string,
render: ReactComponent<unknown>,
Copy link
Member

@FedeIlLeone FedeIlLeone Sep 22, 2023

Choose a reason for hiding this comment

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

I completely deleted the ReactComponent type quite some time ago for obvious reasons. You could pass any prop without type checking. Instead, create a new type for the component with the correct and typed props.

@FedeIlLeone FedeIlLeone changed the title Quickcss improvements QuickCSS improvements Sep 22, 2023
@FedeIlLeone FedeIlLeone added enhancement New feature or request semver: minor Requires a minor semver version bump labels Sep 22, 2023
@asportnoy asportnoy added this to the v4.7.0 milestone Sep 27, 2023
@asportnoy asportnoy changed the base branch from main to v4.8.0 October 12, 2023 01:38
@asportnoy asportnoy modified the milestones: v4.7.0, v4.8.0 Oct 12, 2023
@FedeIlLeone FedeIlLeone removed this from the v4.8.0 milestone Jul 13, 2024
@12944qwerty 12944qwerty changed the base branch from v4.8.0 to main October 22, 2024 13:19
weblate and others added 8 commits October 22, 2024 09:19
Co-authored-by: Marius <weilandmarius@gmail.com>
Co-authored-by: Weblate <noreply@weblate.org>
Translate-URL: https://i18n.replugged.dev/projects/replugged/replugged/
Translate-URL: https://i18n.replugged.dev/projects/replugged/replugged/de/
Translation: Replugged/Replugged
Co-authored-by: La prière <lapriere@duck.com>
Co-authored-by: SKEIDs <11477e@gmail.com>
Co-authored-by: Weblate <noreply@weblate.org>
Translate-URL: https://i18n.replugged.dev/projects/replugged/replugged/ja/
Translation: Replugged/Replugged
Co-authored-by: La prière <lapriere@duck.com>
Co-authored-by: Sebastián <wqb7wgxke@mozmail.com>
Translate-URL: https://i18n.replugged.dev/projects/replugged/replugged/es/
Translate-URL: https://i18n.replugged.dev/projects/replugged/replugged/ja/
Translation: Replugged/Replugged
Co-authored-by: Olaf Harlender <olafharlender@gmail.com>
Co-authored-by: Teltta <tteltta@gmail.com>
Translate-URL: https://i18n.replugged.dev/projects/replugged/replugged/fi/
Translate-URL: https://i18n.replugged.dev/projects/replugged/replugged/pl/
Translation: Replugged/Replugged
Co-authored-by: TCr3 <tcreeper.earth@gmail.com>
Translate-URL: https://i18n.replugged.dev/projects/replugged/replugged/tr/
Translation: Replugged/Replugged
Co-authored-by: Teltta <tteltta@gmail.com>
Translate-URL: https://i18n.replugged.dev/projects/replugged/replugged/fi/
Translation: Replugged/Replugged
Co-authored-by: Teltta <tteltta@gmail.com>
Co-authored-by: dolphin-cat <vncrealvnc@gmail.com>
Translate-URL: https://i18n.replugged.dev/projects/replugged/replugged/el/
Translate-URL: https://i18n.replugged.dev/projects/replugged/replugged/fi/
Translation: Replugged/Replugged
weblate and others added 14 commits October 22, 2024 09:19
Co-authored-by: dolphin-cat <vncrealvnc@gmail.com>
Translate-URL: https://i18n.replugged.dev/projects/replugged/replugged/el/
Translation: Replugged/Replugged
* Limit chars after decimal point in ignition logs

* Improved plugin logs
Co-authored-by: Lyssieth <lys@lys.ee>
Translate-URL: https://i18n.replugged.dev/projects/replugged/replugged/et/
Translation: Replugged/Replugged
Co-authored-by: Lyssieth <lys@lys.ee>
Co-authored-by: dolphin-cat <vncrealvnc@gmail.com>
Translate-URL: https://i18n.replugged.dev/projects/replugged/replugged/el/
Translate-URL: https://i18n.replugged.dev/projects/replugged/replugged/et/
Translation: Replugged/Replugged
Co-authored-by: Olaf Harlender <olafharlender@gmail.com>
Co-authored-by: dolphin-cat <vncrealvnc@gmail.com>
Translate-URL: https://i18n.replugged.dev/projects/replugged/replugged/el/
Translate-URL: https://i18n.replugged.dev/projects/replugged/replugged/pl/
Translation: Replugged/Replugged
* Package updates

* Lemme have my safe optional chaining

* Missed one

* Update src/renderer/coremods/settings/pages/QuickCSS.tsx

Co-authored-by: Federico Di Leo <38290480+FedeIlLeone@users.noreply.github.com>

* Less ignores

---------

Co-authored-by: Federico Di Leo <38290480+FedeIlLeone@users.noreply.github.com>
* Fix component selector

* Handle components failing to import
@12944qwerty 12944qwerty mentioned this pull request Oct 26, 2024
3 tasks
@12944qwerty
Copy link
Member Author

Closing in favor of #652

@FedeIlLeone FedeIlLeone deleted the quickcss-improvements branch October 26, 2024 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request semver: minor Requires a minor semver version bump
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants