Skip to content

Commit

Permalink
0.9.4
Browse files Browse the repository at this point in the history
  • Loading branch information
yofukashino committed Jun 7, 2023
1 parent 9a39259 commit 068a6f4
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 48 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"discordID": "1025214794766221384",
"github": "Tharki-God"
},
"version": "0.9.3",
"version": "0.9.4",
"updater": {
"type": "store",
"id": "dev.tharki.Address"
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "address",
"version": "0.9.3",
"version": "0.9.4",
"description": "Get an option to copy the current web address by right clicking on the home button.",
"engines": {
"node": ">=14.0.0"
Expand Down Expand Up @@ -30,7 +30,7 @@
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-react": "^7.31.10",
"prettier": "^2.8.1",
"replugged": "^4.3.0",
"replugged": "^4.3.1",
"typescript": "^4.8.4"
}
}
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/Components/MenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const AddressMenuItem = (
label: "Copy Address",
id: "copy-address",
icon: () => Icons.glob("20", "20"),
children: [],
action: () => {
try {
const Address = SettingValues.get("normalizeAddress", defaultSettings.normalizeAddress)
Expand Down
19 changes: 6 additions & 13 deletions src/lib/HomeButtonContextMenuApi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { common, components } from "replugged";
import * as Types from "../types";
const { contextMenu: ContextMenuApi } = common;
const {
ContextMenu: { ContextMenu, MenuItem },
ContextMenu: { ContextMenu },
} = components;
class HomeButtonContextMenuApi {
items: Map<string, Types.ReactElement>;
Expand All @@ -16,25 +16,18 @@ class HomeButtonContextMenuApi {
removeItem(id: string) {
this.items.delete(id);
}
openContextMenu(event: Types.UIEvent) {
openContextMenu(event: Types.MouseEvent) {
const HomeButtonContextMenuItems = this.items.size
? Array.from(this.items.values())
.filter(Boolean)
.sort((a, b) => a?.props?.label?.localeCompare(b?.props?.label))
: [
<MenuItem
{...{
label: "♫ ⊂(。◕‿‿◕。⊂) ♪",
id: "no-items",
}}
/>,
];
const HomeButtonContextMenu = (props: Types.ExtendedContextMenuArgs) => (
: [];
const HomeButtonContextMenu = (props) => (
<ContextMenu {...{ ...props, navId: "tharki" }}>{...HomeButtonContextMenuItems}</ContextMenu>
);
ContextMenuApi.open(event, ((e: Types.ContextMenuArgs) => (
ContextMenuApi.open(event, (e) => (
<HomeButtonContextMenu {...Object.assign({}, e, { onClose: ContextMenuApi.close })} />
)) as unknown as Types.ContextMenu);
));
}
}

Expand Down
30 changes: 2 additions & 28 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,12 @@
import { types as DefaultTypes } from "replugged";
export { types as DefaultTypes } from "replugged";
export { ReactElement, ComponentClass, UIEvent } from "react";
import { ReactElement, UIEvent } from "react";
export { ReactElement, ComponentClass, MouseEvent } from "react";
import { ReactElement } from "react";
declare global {
interface Window {
HomeButtonContextMenuApi: HomeButtonContextMenuApi;
}
}
export interface ContextMenuArgs {
className: string;
config: { context: string };
context: string;
onHeightUpdate: DefaultTypes.AnyFunction;
position: null | number;
target: HTMLElement;
theme: string;
}
export interface ExtendedContextMenuArgs extends ContextMenuArgs {
onClose: DefaultTypes.AnyFunction;
}
export interface ContextMenu {
close: DefaultTypes.AnyFunction;
open: (
event: UIEvent,
render?: ContextMenu,
options?: { enableSpellCheck?: boolean },
renderLazy?: Promise<ContextMenu>,
) => void;
openLazy: (
event: UIEvent,
renderLazy?: Promise<ContextMenu>,
options?: { enableSpellCheck?: boolean },
) => void;
}
export interface HomeButtonContextMenuApi {
items?: Map<string, ReactElement>;
constructor?: DefaultTypes.AnyFunction;
Expand Down

0 comments on commit 068a6f4

Please # to comment.