Skip to content

Commit e12e514

Browse files
committed
feat: add popout window
1 parent 1493a88 commit e12e514

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

locales/en/messages.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,9 @@
269269
"optionValue_popout": {
270270
"message": "Popout"
271271
},
272+
"optionValue_popoutWindow": {
273+
"message": "Popout"
274+
},
272275
"optionValue_schedule": {
273276
"message": "Schedule"
274277
},

src/browser/components/ProfileBadge.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
import { IconHeart, IconInfoCircle, IconPower, IconSettings } from "@tabler/icons-react";
1+
import {
2+
IconExternalLink,
3+
IconHeart,
4+
IconInfoCircle,
5+
IconPower,
6+
IconSettings,
7+
} from "@tabler/icons-react";
28
import { useState } from "react";
39
import tw, { styled } from "twin.macro";
410

@@ -29,12 +35,20 @@ function ProfileBadge(props: ProfileBadgeProps) {
2935
<DropdownMenu
3036
placement="right-end"
3137
items={[
38+
{
39+
type: "normal",
40+
title: t("optionValue_popoutWindow"),
41+
icon: <IconExternalLink size="1.25rem" />,
42+
onClick() {
43+
open("popup.html?popout=true", "_blank", "width=440,height=639");
44+
},
45+
},
3246
{
3347
type: "normal",
3448
title: t("optionValue_settings"),
3549
icon: <IconSettings size="1.25rem" />,
3650
onClick() {
37-
open(browser.runtime.getURL("settings.html"), "_blank");
51+
open("settings.html", "_blank");
3852
},
3953
},
4054
{

src/browser/views/popup/Root.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { css, Global } from "@emotion/react";
22
import { IconBrandTwitch } from "@tabler/icons-react";
33
import { useMemo } from "react";
44
import { isRouteErrorResponse, Outlet, useRouteError } from "react-router";
5+
import { useSearchParam } from "react-use";
56
import tw, { styled } from "twin.macro";
67

78
import { sendRuntimeMessage, t } from "~/common/helpers";
@@ -63,14 +64,16 @@ export function ChildComponent() {
6364
}
6465

6566
export function Component() {
67+
const popout = useSearchParam("popout");
68+
6669
return (
6770
<HistoryProvider>
6871
<SearchProvider>
6972
<Global
7073
styles={css`
7174
#app-root {
72-
height: 600px;
73-
width: 420px;
75+
height: ${popout ? "100vh" : "600px"};
76+
width: ${popout ? "100vw" : "420px"};
7477
}
7578
`}
7679
/>

0 commit comments

Comments
 (0)