Skip to content

Commit 5e15e45

Browse files
committed
Open stats in the same tab
1 parent 09370c8 commit 5e15e45

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/assets/css/dashboard.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,10 @@ label {
281281
display: table-cell;
282282
cursor: pointer;
283283
}
284+
.settings-tab label[name='tabName']:hover {
285+
background-color: #cccccc !important;
286+
border-radius: 10px;
287+
}
284288
.settings-tab [type='radio'] {
285289
display: none;
286290
}

src/utils/open-page.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,18 @@ export async function openPage(tab: SettingsTab, domain?: string) {
2121
const url = Browser.runtime.getURL(
2222
`src/dashboard.html${tabName != '' ? `?tab=${tabName}` : ''}${getDomain()}`,
2323
);
24-
await Browser.tabs.create({
25-
url: url,
24+
const currentPage = await Browser.tabs.query({
2625
active: true,
26+
lastFocusedWindow: true,
2727
});
28+
if (currentPage[0].url?.startsWith(`chrome-extension://${__APP_ID__}/src/dashboard.html`))
29+
await Browser.tabs.update({
30+
url: url,
31+
active: true,
32+
});
33+
else
34+
await Browser.tabs.create({
35+
url: url,
36+
active: true,
37+
});
2838
}

0 commit comments

Comments
 (0)