-
Notifications
You must be signed in to change notification settings - Fork 65
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
Conversation
9d29b0d
to
a1a96b9
Compare
@@ -0,0 +1,11 @@ | |||
import { MouseEventHandler } from "react"; | |||
|
|||
export default (props: { onClick?: MouseEventHandler }): React.ReactElement => ( |
There was a problem hiding this comment.
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 => ( |
There was a problem hiding this comment.
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 => ( |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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"> |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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)
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 |
There was a problem hiding this comment.
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 ( |
There was a problem hiding this comment.
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>, |
There was a problem hiding this comment.
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.
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
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
Closing in favor of #652 |
Makes the editor a fixed size and popoutable.