Skip to content
This repository has been archived by the owner on Sep 25, 2024. It is now read-only.

Commit

Permalink
Merge pull request #80 from MichaelYuhe/fix/type-check
Browse files Browse the repository at this point in the history
feat: add type check
  • Loading branch information
MichaelYuhe authored Dec 15, 2023
2 parents 4dab99e + 7c2ff3c commit ad7026b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ jobs:
- name: Lint
run: nr style

- name: Type check
run: nr typecheck

- name: Build
run: nr build

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"prepare": "husky install",
"dev": "vite build --watch",
"build": "vite build",
"typecheck": "tsc --noEmit",
"style": "prettier --check \"src/**/*.{ts,tsx}\"",
"style:fix": "prettier --write \"src/**/*.{ts,tsx}\""
},
Expand Down
6 changes: 3 additions & 3 deletions src/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ chrome.storage.local.get("types", (result) => {

const windowGroupMaps: { [key: number]: Map<string, number> } = {};

chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
chrome.runtime.onMessage.addListener((message) => {
chrome.storage.local.get("types", (resultStorage) => {
if (resultStorage.types) {
types = resultStorage.types;
Expand Down Expand Up @@ -159,7 +159,7 @@ async function handleNewTab(tab: chrome.tabs.Tab) {
}

async function handleTabUpdate(
tabId: number,
_tabId: number,
changeInfo: chrome.tabs.TabChangeInfo,
tab: chrome.tabs.Tab
) {
Expand All @@ -185,7 +185,7 @@ async function handleTabUpdate(

chrome.tabs.onCreated.addListener(handleNewTab);
chrome.tabs.onUpdated.addListener(handleTabUpdate);
chrome.tabs.onDetached.addListener((tabId, detachInfo) => {
chrome.tabs.onDetached.addListener((_tabId, detachInfo) => {
const windowId = detachInfo.oldWindowId;
if (
windowGroupMaps.hasOwnProperty(windowId) &&
Expand Down
10 changes: 5 additions & 5 deletions src/popup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const Popup = () => {
};

const enableAutoPosition = () => {
setIsAutoPosition((isAutoGroupPosition) => {
setIsAutoPosition(() => {
setStorage("isAutoPosition", !isAutoPosition);
return !isAutoPosition;
});
Expand Down Expand Up @@ -140,8 +140,8 @@ const Popup = () => {

<button
disabled={!newType}
className="rounded-md w-fit bg-primary/lg px-2.5 py-1.5 text-sm font-semibold
text-white shadow-sm hover:bg-primary focus-visible:outline focus-visible:outline-2
className="rounded-md w-fit bg-primary/lg px-2.5 py-1.5 text-sm font-semibold
text-white shadow-sm hover:bg-primary focus-visible:outline focus-visible:outline-2
focus-visible:outline-offset-2 disabled:bg-primary/sm"
>
Add
Expand Down Expand Up @@ -178,7 +178,7 @@ const Popup = () => {
<div className="flex items-center gap-x-4">
<button
disabled={!openAIKey || !types || !types.length}
className="inline-flex items-center rounded-md bg-primary/lg px-2.5 py-1.5 text-sm font-semibold
className="inline-flex items-center rounded-md bg-primary/lg px-2.5 py-1.5 text-sm font-semibold
text-white shadow-sm hover:bg-primary focus-visible:outline cursor-pointer
focus-visible:outline-2 focus-visible:outline-offset-2"
onClick={getAllTabsInfo}
Expand All @@ -188,7 +188,7 @@ const Popup = () => {
</button>

<button
className="inline-flex items-center rounded-md bg-primary/lg px-2.5 py-1.5 text-sm font-semibold
className="inline-flex items-center rounded-md bg-primary/lg px-2.5 py-1.5 text-sm font-semibold
text-white shadow-sm hover:bg-primary focus-visible:outline cursor-pointer
focus-visible:outline-2 focus-visible:outline-offset-2"
onClick={ungroup}
Expand Down

0 comments on commit ad7026b

Please sign in to comment.